:root {
    --paper: #efe6d2;
    --paper-soft: #f5eedc;
    --ink: #1f1a14;
    --ink-soft: #6b6358;
    --ink-faint: #b5ac9b;
    --brand-red: #c6411f;
    --rule: #1f1a14;
    --max-width: 440px;
}

@media (min-width: 768px) {
    :root {
        --max-width: 560px;
    }
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    background: var(--paper);
    color: var(--ink);
    font-family: "Fraunces", Georgia, serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    min-height: 100vh;
    display: flex;
    justify-content: center;
}

@media (min-width: 768px) {
    body {
        padding: 0;
        background:
            linear-gradient(
                to right,
                transparent calc(50% - var(--max-width) / 2 - 1px),
                var(--ink-faint) calc(50% - var(--max-width) / 2 - 1px),
                var(--ink-faint) calc(50% - var(--max-width) / 2),
                transparent calc(50% - var(--max-width) / 2),
                transparent calc(50% + var(--max-width) / 2),
                var(--ink-faint) calc(50% + var(--max-width) / 2),
                var(--ink-faint) calc(50% + var(--max-width) / 2 + 1px),
                transparent calc(50% + var(--max-width) / 2 + 1px)
            ),
            var(--paper);
    }
}

.page {
    width: 100%;
    max-width: var(--max-width);
    padding: 0 0 60px;
}

.content {
    padding: 0 20px;
}

.top-strip {
    display: grid;
    grid-template-columns: 1.5fr repeat(5, 1fr);
    border-top: 1px solid var(--ink);
    border-bottom: 1px solid var(--ink);
    background: var(--paper);
}

.strip-cell {
    text-align: center;
    padding: 10px 4px;
    border-right: 1px solid var(--ink-faint);
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 76px;
    justify-content: center;
    align-items: center;
}

.strip-cell:last-child {
    border-right: none;
}

.logo-cell {
    padding: 8px 6px;
}

.logo-icon {
    display: block;
    width: 64px;
    height: auto;
}

.wordmark-row {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 8px 12px 0 0;
    background: var(--paper);
}

.wordmark-anchor {
    flex: 0 0 auto;
    width: calc((100% / 6.5) * 1.5);
    text-align: center;
    padding: 0;
}

.wordmark-anchor .wordmark {
    font-family: "Big Shoulders Display", sans-serif;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink);
    display: block;
}

.wordmark-anchor .motto {
    font-family: "Big Shoulders Display", sans-serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ink-soft);
    display: block;
    text-align: center;
    margin-top: 2px;
}

.day-cell {
    cursor: pointer;
    background: transparent;
    border: none;
    border-right: 1px solid var(--ink-faint);
    font-family: inherit;
    color: inherit;
}

.day-cell:last-of-type {
    border-right: none;
}

.day-cell .day-name {
    font-family: "Big Shoulders Display", sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--ink);
}

.day-cell .practice-name {
    font-family: "Fraunces", serif;
    font-size: 10px;
    line-height: 1.15;
    color: var(--ink);
    font-weight: 500;
    padding: 0 2px;
}

.day-cell.selected {
    background: var(--ink);
}

.day-cell.selected .day-name,
.day-cell.selected .practice-name {
    color: var(--paper);
}

.day-cell.future:not(.selected) .day-name,
.day-cell.future:not(.selected) .practice-name {
    color: var(--ink-faint);
}

.strip-spacer {
    height: 0px;
}

.practice {
    padding: 8px 0 0;
}

.practice-image {
    width: 100%;
    max-width: 340px;
    height: auto;
    /* Every poster and placeholder is 928x1152. The element ships without a
       src, so there is nothing for the browser to measure — this holds the
       space at the right shape and stops the page reflowing when the image
       finally arrives. */
    aspect-ratio: 928 / 1152;
    background: var(--paper-soft);
    display: block;
    margin: 0 auto 16px;
    /* Hidden until app.js has a decoded image to show. The first picture the
       page paints is then the right one, arriving rather than replacing. */
    opacity: 0;
    transition: opacity 260ms ease-out;
    box-shadow:
        0 1px 0 var(--ink-faint),
        0 12px 24px rgba(31, 26, 20, 0.08);
}

.practice-image.loaded {
    opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
    .practice-image {
        transition: none;
    }
}

.practice-subtitle {
    font-family: "Fraunces", serif;
    font-style: italic;
    font-size: 17px;
    line-height: 1.35;
    color: var(--ink);
    text-align: center;
    max-width: 320px;
    margin: 0 auto 16px;
}

.practice.upcoming .practice-body,
.practice.upcoming .success-beat,
.practice.upcoming .anti-pattern {
    display: none;
}

.practice-body {
    font-family: "Fraunces", serif;
    font-size: 15px;
    line-height: 1.55;
    color: var(--ink);
    margin-bottom: 24px;
    text-align: justify;
    text-align-last: left;
    hyphens: auto;
    -webkit-hyphens: auto;
}

.practice-body p {
    margin-bottom: 14px;
}

.practice-aside {
    border-top: 1px solid var(--ink-faint);
    padding-top: 18px;
    margin-bottom: 24px;
}

.practice-aside h3 {
    font-family: "Big Shoulders Display", sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin-bottom: 8px;
}

.practice-aside p {
    font-family: "Fraunces", serif;
    font-size: 14.5px;
    line-height: 1.5;
    color: var(--ink);
    text-align: justify;
    text-align-last: left;
    hyphens: auto;
    -webkit-hyphens: auto;
}

.upload {
    border-top: 1px solid var(--ink);
    border-bottom: 1px solid var(--ink);
    padding: 28px 0;
    margin: 24px 0;
    text-align: center;
}

.upload-prompt {
    font-family: "Fraunces", serif;
    font-size: 15.5px;
    line-height: 1.45;
    color: var(--ink);
    margin: 0 auto 20px;
    max-width: 290px;
}

.upload-button {
    display: inline-block;
    font-family: "Fraunces", serif;
    font-style: italic;
    font-size: 18px;
    font-weight: 500;
    letter-spacing: 0.01em;
    color: var(--paper);
    background: var(--ink);
    padding: 14px 28px;
    border: none;
    cursor: pointer;
    transition: background 120ms ease;
}

.upload-button:hover {
    background: #000;
}

.upload-hint {
    font-family: "Fraunces", serif;
    font-size: 12px;
    font-style: italic;
    color: var(--ink-faint);
    line-height: 1.4;
}

.upload-hint.above {
    margin: 0 0 16px;
}

.upload-hint.below {
    margin: 12px 0 0;
}

.poll-options {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Buttons (pre-vote) and result rows (post-vote) share the same box so the
 * layout doesn't shift when the section flips. */
.poll-option,
.poll-result {
    display: block;
    width: 100%;
    box-sizing: border-box;
    font-family: "Fraunces", serif;
    font-size: 15px;
    line-height: 1.4;
    color: var(--ink);
    background: var(--paper-soft);
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    text-align: left;
}

.poll-option {
    cursor: pointer;
    transition: background 120ms ease;
}

.poll-option:hover {
    background: #e8dfca;
}

.poll-results {
    display: none;
    flex-direction: column;
    gap: 6px;
}

.poll-section.voted .poll-options {
    display: none;
}

.poll-section.voted .poll-results {
    display: flex;
}

.poll-result {
    position: relative;
    overflow: hidden;
}

.poll-result-fill {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 0;
    background: #d4c9b0;
}

.poll-result-label {
    position: relative;
    z-index: 1;
}

.poll-result-pct {
    position: relative;
    z-index: 1;
    float: right;
    font-family: "Big Shoulders Display", sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--ink-soft);
}

.poll-votes {
    font-family: "Fraunces", serif;
    font-size: 13px;
    font-style: italic;
    color: var(--ink-faint);
    margin-top: 12px;
}

.section-rule {
    border: none;
    border-top: 1px solid var(--ink);
    margin: 24px 0;
}

.rationale {
    padding: 16px 0 24px;
}

.rationale h2 {
    font-family: "Big Shoulders Display", sans-serif;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--ink);
    margin-bottom: 14px;
}

.rationale p {
    font-family: "Fraunces", serif;
    font-size: 14.5px;
    line-height: 1.55;
    color: var(--ink);
    margin-bottom: 14px;
    text-align: justify;
    text-align-last: left;
    hyphens: auto;
    -webkit-hyphens: auto;
}

.rationale .signoff {
    font-style: italic;
    color: var(--ink-soft);
    margin-top: 18px;
    text-align: left;
}

.cal-subscribe {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 10px;
}

.cal-url {
    flex: 1;
    font-family: "Big Shoulders Display", sans-serif;
    font-size: 11px;
    letter-spacing: 0.05em;
    color: var(--ink-soft);
    background: var(--paper-soft);
    padding: 8px 10px;
    border-radius: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cal-copy {
    flex: 0 0 auto;
    font-family: "Big Shoulders Display", sans-serif;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--paper);
    background: var(--ink);
    border: none;
    border-radius: 4px;
    padding: 8px 14px;
    cursor: pointer;
    transition: background 120ms ease;
}

.cal-copy:hover {
    background: #000;
}

.footer {
    border-top: 1px solid var(--ink-faint);
    padding: 18px 20px 0;
    text-align: center;
    font-family: "Big Shoulders Display", sans-serif;
    font-size: 10px;
    font-weight: 400;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/><feColorMatrix values='0 0 0 0 0.12  0 0 0 0 0.10  0 0 0 0 0.08  0 0 0 0.06 0'/></filter><rect width='200' height='200' filter='url(%23n)'/></svg>");
    background-size: 200px 200px;
    opacity: 0.5;
    mix-blend-mode: multiply;
    z-index: 999;
}
