/* RavenRoom — off-white ground, white surfaces, black ink, one pure red.
 *
 * Light only, mobile-first. Red appears in exactly five places: the rule at the
 * top of the page, the submit button, the left bar on cards, the underline on a
 * chosen value, and link arrows. Everything else is black, grey, or hairline.
 * Squared corners throughout; no shadows, no gradients, no rounded pills.
 *
 * The two-tone rule: white floats on the off-white ground, and anything inset
 * inside a white surface returns to the ground colour. That gives the same
 * figure/ground separation the old white-page/grey-band alternation gave, but
 * warmer — and it does it with full-bleed bands rather than rounded cards,
 * which is the part of the reference we deliberately did not take. */

/* Libre Franklin — a Franklin Gothic revival, the American civic/signage
   lineage. Self-hosted so the strict default-src 'self' CSP stays intact; one
   variable file covers every weight the page uses. Regenerate with
   dev/fetch-fonts.mjs. */
@font-face {
    font-family: "Libre Franklin";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("fonts/librefranklin-var.woff2") format("woff2-variations");
}

:root {
    --font: "Libre Franklin", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --ink: #000000;
    --ink-2: #2a2724;
    /* Warmed to sit on the new ground, and darkened: #767676 measured 4.48:1 on
       white but only 4.04:1 on #f7f6f4, which fails. This is 4.78:1 on the
       ground and 5.31:1 on the white bands, so it passes on both surfaces. */
    --grey: #6e6b66;
    --line: #e3e0db;
    --mute: #b2aea8; /* disabled days and placeholders — inactive, so exempt */
    --ground: #f7f6f4; /* the page itself */
    --paper: #ffffff; /* what floats on it: rail, footer band, inset panels */
    --red: #ff0000;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    overflow-x: hidden; /* the footer band bleeds with vw units */
    border-top: 4px solid var(--red);
    background: var(--ground);
    color: var(--ink);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Column so the footer band can be pushed to the bottom of short pages. While
   the page was white on white an unfilled tail below the footer was invisible;
   against the ground colour it reads as the page stopping halfway. The 4px is
   the red rule on <body>, which would otherwise make this overflow by exactly
   that much. */
.page {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 4px);
    max-width: 1120px;
    margin: 0 auto;
    padding: 22px 20px 0;
}

/* Whichever body the page has, it takes the slack — the footer keeps its own
   56px gap rather than having it absorbed by an auto margin. */
.layout, .stage { flex: 1 0 auto; }

/* Before a day is chosen there is no rail, so the page is a single readable
   column rather than a half-empty grid. */
main { max-width: 44rem; }

/* ---- masthead ---------------------------------------------------------- */

.masthead {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 44px;
}

.mark { display: block; flex: none; }

.wordmark {
    font-size: 1.22rem;
    font-weight: 800;
    letter-spacing: -0.025em;
}

/* ---- type ------------------------------------------------------------- */

/* The one dominant element on the page. Everything else is deliberately
   quiet so this leads without competition. */
.display {
    margin: 0 0 18px;
    font-size: clamp(2.1rem, 7vw, 3.4rem);
    font-weight: 800;
    letter-spacing: -0.035em;
    line-height: 1.05;
    max-width: 15ch;
    text-wrap: balance; /* stops a single orphaned word on the last line */
}

.intro {
    margin: 0 0 40px;
    max-width: 46ch;
    color: var(--ink-2);
    font-size: 1.02rem;
}

.label {
    display: block; /* .label is used on <label> too, which is inline by default */
    margin: 0 0 9px;
    font-size: 0.67rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--grey);
}

.note {
    margin: 10px 0 0;
    font-size: 0.83rem;
    color: var(--grey);
}

a { color: var(--red); text-underline-offset: 2px; }

.arrow::after { content: " \2192"; }

/* ---- day strip --------------------------------------------------------- */

.day-strip {
    display: flex;
    gap: 0;
    /* overflow-x alone makes overflow-y compute to auto, which is what put a
       second scrollbar inside the strip. Both axes are stated explicitly. */
    overflow-x: auto;
    overflow-y: hidden;
    margin-bottom: 4px;
    scrollbar-width: none;
}

.day-strip::-webkit-scrollbar { display: none; }

.day {
    flex: none;
    padding: 4px 0 8px;
    margin-right: 26px;
    border: 0;
    border-bottom: 3px solid transparent;
    background: none;
    color: var(--ink);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.day .dow {
    display: block;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.13em;
    color: var(--grey);
}

.day .dom {
    display: block;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.day[aria-pressed="true"] { border-bottom-color: var(--red); }
.day[aria-pressed="true"] .dow { color: var(--ink); }
.day:disabled { cursor: not-allowed; }
.day:disabled .dom, .day:disabled .dow { color: var(--mute); }

.day .why {
    display: block;
    font-size: 0.58rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--mute);
}

/* ---- the request, written as a sentence -------------------------------- */

.sentence {
    margin: 30px 0 0;
    max-width: 56ch; /* Libre Franklin runs narrower than the old system stack */
    font-size: 1.28rem;
    line-height: 1.95;
    letter-spacing: -0.01em;
}

/* Keep a value and the word after it on one line, so a break never leaves a
   dropdown stranded at the start of a line. */
.clause { white-space: nowrap; }

.pick { position: relative; display: inline-block; }

.pick select {
    appearance: none;
    -webkit-appearance: none;
    margin: 0;
    padding: 0 13px 2px 1px; /* just enough for the caret — more reads as a gap before the comma */
    border: 0;
    border-bottom: 2px solid var(--red);
    border-radius: 0;
    background: transparent;
    color: var(--ink);
    font: inherit;
    /* `font: inherit` is a shorthand — it drags in the sentence's 1.95
       line-height and inflates the control's box to roughly twice its text,
       so the focus ring got drawn around a box that overlapped the next line.
       Anchor the box to the glyphs; the sentence keeps its own leading. */
    line-height: 1.2;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    vertical-align: baseline;
    cursor: pointer;
}

/* CSS triangle rather than a background image — keeps the strict CSP intact */
.pick::after {
    content: "";
    position: absolute;
    right: 1px;
    top: 50%;
    margin-top: -1px;
    pointer-events: none;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid var(--red);
}

/* ---- email + submit ---------------------------------------------------- */

.finish { margin-top: 40px; }

input[type="email"] {
    width: 100%;
    max-width: 24rem;
    padding: 7px 0 8px;
    border: 0;
    border-bottom: 2px solid var(--ink);
    border-radius: 0;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 1.05rem;
}

input[type="email"]::placeholder { color: var(--mute); }
input[type="email"]:focus { border-bottom-color: var(--red); }

.go {
    display: inline-block;
    margin-top: 22px;
    padding: 13px 24px;
    border: 0;
    border-radius: 0;
    background: var(--red);
    color: #fff;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.13em;
    cursor: pointer;
}

.go:disabled { background: #dcd9d4; color: #5f5c57; cursor: wait; }

/* ---- result ------------------------------------------------------------ */

/* Sits in the main column, so it is one of the things that floats. */
.result {
    margin-top: 26px;
    padding: 15px 16px 15px 17px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--red);
    background: var(--paper);
    max-width: 44ch;
    font-size: 0.95rem;
}

.result.warn { border-left-color: var(--grey); }

/* ---- availability rail ------------------------------------------------- */

/* A white band rather than another border — this is what gives the page two
   distinct zones instead of one continuous sheet. Bleeds to the viewport edges
   on mobile, where it stacks under the form as its own section. It is the
   reference's floating white card, expressed full-bleed instead of boxed. */
.rail {
    margin: 52px -20px 0;
    padding: 22px 20px 26px;
    background: var(--paper);
}

/* Already on white, so these take no fill of their own — a card inside a card
   is nesting the page does not need. The rule and the red bar do the dividing. */
.zone-card {
    border: 1px solid var(--line);
    border-left: 3px solid var(--red);
    padding: 15px 16px 13px 17px;
    margin-bottom: 10px;
}

.zone-card:last-child { margin-bottom: 0; }

.zone-label {
    margin: 0 0 2px;
    font-size: 0.63rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.13em;
    color: var(--grey);
}

.stat {
    display: flex;
    align-items: baseline;
    gap: 7px;
}

.stat-value {
    font-size: 2.3rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.045em;
    font-variant-numeric: tabular-nums;
}

.stat-unit { font-size: 0.85rem; color: var(--grey); }

.rooms { margin-top: 11px; }

.rooms > summary {
    list-style: none;
    cursor: pointer;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--red);
}

.rooms > summary::-webkit-details-marker { display: none; }
/* Points at where the content will appear, not at nothing */
.rooms > summary::after { content: " \2193"; }
.rooms[open] > summary::after { content: " \2191"; }

.room-list { list-style: none; margin: 9px 0 0; padding: 0; }

.room {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 5px 0;
    border-top: 1px solid var(--line);
    font-size: 0.9rem;
}

/* The name leads, the hours support it — otherwise every row reads at the
   same weight and nothing in the list is a starting point. */
.room-name { font-weight: 700; }
.room-when { color: var(--grey); font-size: 0.84rem; font-variant-numeric: tabular-nums; }

.empty {
    padding: 15px 16px;
    border: 1px solid var(--line);
    background: var(--ground);
    color: var(--grey);
    font-size: 0.92rem;
}

/* ---- standalone pages (confirm / cancel) -------------------------------- */

.stage { margin-top: 8px; max-width: 46ch; }

.stage-title {
    margin: 0 0 14px;
    font-size: clamp(1.8rem, 8vw, 2.7rem);
    font-weight: 800;
    letter-spacing: -0.035em;
    line-height: 1.05;
}

.stage-detail { margin: 0; color: var(--ink-2); }

.stage-summary {
    margin: 26px 0 0;
    padding: 15px 16px 15px 17px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--red);
    background: var(--paper);
    font-variant-numeric: tabular-nums;
}

.back {
    display: inline-block;
    margin-top: 32px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    text-decoration: none;
}

/* The privacy page is a longer read than the confirm/cancel stages, so it
   widens slightly and its paragraphs get spacing. The .label rule doubles as
   its section headings — same small-caps device the form already uses. */
.prose { max-width: 58ch; }
.prose p { margin: 0 0 15px; color: var(--ink-2); }
.prose .label { margin: 28px 0 8px; }
.prose .stage-title + p { margin-bottom: 22px; }

/* ---- footer ------------------------------------------------------------ */

/* Bleeds to the viewport edges so the page ends on a band rather than trailing
   off — the second half of the ground/white alternation. */
footer {
    margin: 56px calc(50% - 50vw) 0;
    padding: 26px calc(50vw - 50% + 20px) 34px;
    background: var(--paper);
    font-size: 0.84rem;
    color: var(--grey);
}

footer > * { max-width: 62ch; }
footer p { margin: 0 0 12px; }

/* Inset inside a white band, so it returns to the ground colour. */
.disclaimer {
    padding: 11px 14px 11px 15px;
    border-left: 3px solid var(--red);
    background: var(--ground);
    color: var(--ink-2);
}

/* ---- focus ------------------------------------------------------------- */

:focus-visible {
    outline: 2px solid var(--red);
    outline-offset: 2px;
}

/* Inline controls sit inside running text, so their ring has to hug them
   rather than reach into the lines above and below. */
.pick select:focus-visible { outline-offset: 1px; }

/* Give the native dropdown somewhere to open. It is drawn by the OS and always
   overlays the page, so the mitigation is clearance, not stacking order. */
.finish { scroll-margin-top: 96px; }

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}

/* ---- wide screens: asymmetric two-column, availability as a rail -------- */

@media (min-width: 860px) {
    .page { padding: 30px 40px 0; }
    .masthead { margin-bottom: 64px; }

    /* Two columns only once there is a rail to put in the second one —
       otherwise the page reserved an empty half and looked broken. */
    .layout.has-rail {
        display: grid;
        grid-template-columns: 1.7fr 1fr;
        gap: 0 68px;
        align-items: start;
    }

    .layout.has-rail main { max-width: none; }

    .layout.has-rail .rail {
        margin: 0;
        padding: 24px 22px 26px;
        position: sticky;
        top: 30px;
    }

    .display { margin-bottom: 22px; }
    .sentence { margin-top: 42px; }
}
