/* The hero (§8).
 *
 * Full bleed with a hairline lower edge, and unfiltered -- no scrim, no
 * duotone, no straw overlay. The height is clamped rather than driven by the
 * image's own aspect ratio, so a 4:3 painting crops to a band instead of
 * pushing everything below it off the first screen.
 *
 * The words sit on §8's opaque cream plate rather than on the paint. Cream
 * type straight on an unfiltered picture is only as readable as whatever the
 * crop happens to put behind it; a plate guarantees contrast on any image.
 *
 * Laid out as a grid rather than with absolute positioning so the plate can
 * hang over the photograph's lower edge -- bridging the picture and the page
 * -- without ever being taller than the band it sits on: the image spans the
 * first two rows, the plate the last two, and the third row is the overhang.
 * If the plate outgrows the band, the band's first row shrinks to nothing and
 * the page grows; nothing overlaps the header or clips.
 */
.hero-banner {
    --hero-overhang: var(--space-8);
    display: grid;
    grid-template-columns: 100%;
    grid-template-rows: 1fr auto var(--hero-overhang);
    margin-bottom: var(--space-7);
}

/* The ink background is what shows while the JPEG is still arriving; without
   it the band is an empty straw gap for a beat. The hairline is the image's
   own edge now, since the section runs on past it under the plate. */
.hero-banner img {
    grid-row: 1 / 3;
    grid-column: 1;
    display: block;
    width: 100%;
    height: clamp(440px, 74vh, 720px);
    object-fit: cover;
    /* The dahlias and the house, rather than the sky. */
    object-position: center 62%;
    background: var(--ink);
    border-bottom: 1px solid var(--rule);
}

.hero-banner-text {
    grid-row: 2 / 4;
    grid-column: 1;
    align-self: end;
}

/* §8's plate: opaque, 1px ink, anchored to an edge. */
.hero-plate {
    max-width: 38rem;
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: var(--radius-frame);
    padding: var(--space-6) var(--space-7) var(--space-6) var(--space-6);
}

/* On the plate, so ink -- the page's own colour, not the photograph's. This
   is the page's one MilesToGo line (§2). */
.hero-plate .display {
    color: var(--fg);
    margin: 0 0 var(--space-3);
}

.hero-pitch {
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: var(--size-h2);
    line-height: var(--leading-h2);
    color: var(--fg);
    margin: 0 0 var(--space-3);
}

.hero-lede {
    color: var(--fg-2);
    margin: 0;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--target-gap) var(--space-5);
    margin-top: var(--space-5);
}

.hero-rider-link {
    font-family: var(--font-ui);
    font-weight: 500;
    font-size: var(--size-ui);
}

/* Shared pieces ---------------------------------------------------------- */

/* The two headings that open a whole argument -- the comparison and the
   closing call -- take the h1 step of the scale. The h1 itself is the
   wordmark, so this is a size, not a level. */
.home-heading {
    font-size: var(--size-h1);
    line-height: var(--leading-h1);
    letter-spacing: -0.01em;
    margin: 0 0 var(--space-4);
}

/* For riders ------------------------------------------------------------- */

.home-events {
    scroll-margin-top: var(--space-5);
}

.home-events h2 {
    margin-top: 0;
}

.home-events .card-grid {
    margin: 0;
}

.home-events .card-actions {
    align-items: center;
    gap: var(--target-gap) var(--space-5);
}

.card-info-link {
    font-family: var(--font-ui);
    font-weight: 500;
    font-size: var(--size-ui);
}

/* Intro beside the cards on a wide screen: with one or two events, a card
   stretched across the whole 1052px column is a lot of cream around three
   lines of text. */
@media (min-width: 1024px) {
    .home-events {
        display: grid;
        grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
        gap: var(--space-8);
        align-items: start;
    }
}

/* For organizers: the comparison ---------------------------------------- *
 *
 * Built the way §6's schedule grid is built, so the two read as one family:
 * one 1px ink frame, solid rules down the columns, dotted rules across the
 * rows. The last column is the answer, and it is the only one in full ink.
 */
.home-compare {
    margin: var(--space-8) 0 var(--space-9);
}

.home-compare .lede {
    margin-bottom: var(--space-6);
}

.compare-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid var(--rule);
    border-radius: var(--radius-frame);
    background: var(--surface);
    overflow: hidden;
}

.compare-table th,
.compare-table td {
    text-align: left;
    vertical-align: top;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px dotted var(--rule-dotted);
}

.compare-table tbody tr:last-child > * {
    border-bottom: 0;
}

.compare-table th + :is(th, td) {
    border-left: 1px solid var(--rule-divide);
}

.compare-table thead th {
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: var(--size-meta);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--fg-2);
    background: var(--panel);
    border-bottom: 1px solid var(--rule);
}

/* The answer's own column head, in ink: the one place on the page the eye
   should land first in the table. */
.compare-table thead th.compare-ours {
    background: var(--ink);
    color: var(--cream);
    letter-spacing: normal;
    text-transform: none;
    font-size: var(--size-ui);
}

.compare-table tbody th {
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: var(--size-ui);
    line-height: var(--leading-ui);
    width: 24%;
}

.compare-table td {
    font-size: 15px;
    line-height: 1.5;
    color: var(--fg-2);
    width: 30%;
}

.compare-table td.compare-ours {
    color: var(--fg);
    width: auto;
}

/* What the site does -- one section each (§6's patterns) ----------------- *
 *
 * Each section shows the pattern rather than describing it. On a wide screen
 * the words and the specimen sit side by side and swap sides from one section
 * to the next, so the eye zig-zags down the page instead of reading three
 * identical stacks.
 *
 * These used to be divided by a 3px dotted rule, §3's separator for things of
 * the same kind. It came out when the specimens took a dotted bound: on this
 * page dotted-around now means one thing -- that is a picture. The space
 * between sections does the separating.
 */
.home-feature {
    padding: var(--space-8) 0;
}

.home-feature:first-child {
    padding-top: 0;
}

/* An h2 carries its own top margin for the case where a paragraph runs into
   it. Here it opens its column, level with the specimen beside it. */
.home-feature h2 {
    margin-top: 0;
}

.feature-points {
    list-style: none;
    padding: 0;
    margin: var(--space-5) 0 0;
    max-width: 60ch;
}

/* A short ledger: dotted between rows (§3), a small ink tick in front of each
   so the list reads as a list without a bullet's browser default. */
.feature-points li {
    position: relative;
    font-family: var(--font-ui);
    font-weight: 500;
    font-size: var(--size-ui);
    line-height: var(--leading-ui);
    padding: var(--space-3) 0 var(--space-3) var(--space-5);
    border-top: 1px dotted var(--rule-dotted);
}

.feature-points li:last-child {
    border-bottom: 1px dotted var(--rule-dotted);
}

.feature-points li::before {
    content: "";
    position: absolute;
    left: 2px;
    top: calc(var(--space-3) + 0.7em - 4px);
    width: 8px;
    height: 8px;
    border: 1px solid var(--rule);
    border-radius: var(--radius-pill);
    background: var(--ink);
}

@media (min-width: 1024px) {
    .home-feature {
        display: grid;
        grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
        gap: var(--space-8);
        align-items: center;
    }

    .home-feature:nth-of-type(even) {
        grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    }

    .home-feature:nth-of-type(even) .feature-text {
        order: 2;
    }

    .home-feature .feature-figure {
        margin: 0;
    }
}

/* The specimen plate ----------------------------------------------------- *
 *
 * A 2px dotted ink bound is §3's one exception to "dotted separates, never
 * surrounds", and this is what the exception is for: the frame says the thing
 * inside is a picture of the product rather than the product. Stakeholders
 * walked through the first draft of these sections and asked whether they
 * were looking at their own account, which is a fair reading -- an unframed
 * pledge card sitting on the page is a pledge card sitting on the page.
 *
 * §3 allows the dotted bound "as long as nothing inside it is further
 * divided", and the schedule grid plainly is. It is admitted here because the
 * grid carries its own 1px solid frame: the dotted border is a mount around a
 * self-bounded object, never the rule doing the dividing, which is the case
 * the exception is guarding against. A specimen that ever loses its own frame
 * has to be looked at again.
 *
 * Not `.panel .panel-dotted`, which carries this same border in base.css: a
 * panel also brings a cream ground, and cream behind the cream pledge panel
 * would put the same surface on both sides of that panel's rule. The plate
 * keeps the page's straw, which also keeps the caption's `--fg-2` at 5:1
 * instead of the 4.5 it drops to on any tint warm enough to read as a mount.
 *
 * Centred rather than flush left for the same reason as the frame: page
 * content starts at the measure's left edge, an exhibit sits in the middle of
 * its mount. `figure` also arrives with a browser default margin wide enough
 * to read as an indent, which it is not.
 */
.feature-figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: var(--space-6) 0 0;
    padding: var(--space-6);
    border: 2px dotted var(--rule);
    border-radius: var(--radius-frame);
}

.feature-figure figcaption {
    margin-top: var(--space-3);
    text-align: center;
}

/* The closing call ------------------------------------------------------- *
 *
 * `.panel-double` from base.css: §3's other bounding exception, a 2px double
 * rule around a whole panel with nothing inside it divided. It marks the end
 * of the page the way the vine marks the turn from riders to organizers.
 */
.home-cta {
    margin: var(--space-8) 0 0;
    padding: var(--space-8) var(--space-6);
    background: var(--surface);
    border-radius: var(--radius-frame);
    text-align: center;
}

.home-cta .lede {
    margin: 0 auto var(--space-5);
}

/* Schedule grid -- web (§6) ---------------------------------------------- *
 *
 * Days across, times down, one bounded frame. Solid rules divide the columns
 * and dotted rules separate the rows: §3's split, and here it also says which
 * direction is structure and which is just the next hour.
 *
 * §6 draws this at full width and gives the phone a different pattern
 * entirely -- day tabs, because "a grid is unreadable at 390pt". This page has
 * no room for a second pattern to make one point, so the grid scrolls sideways
 * inside its frame instead, which is what §7's platform table does. The
 * scroller is focusable because a region that scrolls and cannot be reached
 * from the keyboard is a region some readers cannot see the end of.
 */
.schedule-scroll {
    overflow-x: auto;
    border: 1px solid var(--rule);
    border-radius: var(--radius-frame);
    background: var(--surface);
    /* Bounded so the mount keeps a margin on both sides -- a specimen run out
       to the full 1052px column is a specimen pretending to be the page, which
       is the reading the plate exists to stop. Below 44rem it is `100%` and
       the scroller does its job. */
    width: min(100%, 44rem);
}

.schedule-preview {
    min-width: 30rem;
}

.sched-row {
    display: grid;
    grid-template-columns: 5.5rem repeat(3, 1fr);
    border-bottom: 1px dotted var(--rule-dotted);
}

.sched-row:last-child {
    border-bottom: 0;
}

.sched-head {
    background: var(--panel);
    border-bottom: 1px dotted var(--rule-dotted);
}

.sched-day {
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: var(--size-ui);
    padding: var(--space-3);
    border-left: 1px dotted var(--rule-dotted);
}

.sched-time {
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: var(--size-meta);
    line-height: var(--leading-ui);
    color: var(--fg-2);
    background: var(--panel);
    padding: var(--space-3);
}

.sched-cell {
    padding: var(--space-2);
    border-left: 1px solid var(--rule-divide);
    min-height: 4.5rem;
}

/* Tint inside, full-strength colour on the edge -- the pairing §1 uses
   everywhere a category has to read as a category without becoming a control. */
.sched-block {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: var(--space-2) 10px;
    border: 1px solid;
    border-radius: var(--radius-field);
}

.sched-title {
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: 14px;
    line-height: var(--leading-ui);
}

.sched-meta {
    font-size: var(--size-meta);
    line-height: var(--leading-ui);
    margin-top: 2px;
}

/* The three categories (§1). Ride is sage, which §6's grid now draws too --
   its specimen used to paint ride clay, carried over from the draft that had
   clay as the action colour, and it was corrected in the design project rather
   than worked around here. §5's session-row dots still carry the old palette;
   base.css settles those the same way at its own token block. */
.sched-block.is-ride,
.sched-swatch.is-ride {
    border-color: var(--ride);
    background: var(--sage-tint);
}

.sched-block.is-ride .sched-meta {
    color: var(--sage-deep);
}

.sched-block.is-learn,
.sched-swatch.is-learn {
    border-color: var(--learn);
    background: var(--teal-tint);
}

.sched-block.is-learn .sched-meta {
    color: var(--teal-deep);
}

.sched-block.is-gather,
.sched-swatch.is-gather {
    border-color: var(--gather);
    background: var(--brick-tint);
}

.sched-block.is-gather .sched-meta {
    color: var(--fg-2);
}

.sched-legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3) var(--space-5);
    list-style: none;
    padding: 0;
    margin: var(--space-3) 0 0;
    font-family: var(--font-ui);
    font-size: var(--size-meta);
    color: var(--fg-2);
}

.sched-legend li {
    display: flex;
    align-items: center;
    gap: 7px;
}

/* The block, shrunk -- so the key is the same object the grid is full of,
   rather than a dot that has to be mapped onto one. */
.sched-swatch {
    width: 14px;
    height: 14px;
    border: 1px solid;
    border-radius: var(--radius-frame);
    flex: none;
}

/* The pledge page's progress block (E12.1), at the width it runs there: a
   figure, a goal, a bar and a count stack in a narrow column, and stretching
   that across 1180px would make the bar a horizon line.
 *
 * `width`, not `max-width`. Centring the plate's contents made every specimen
 * a shrink-to-fit flex item, and this one's longest line is "9 donations", so
 * a cap of 20rem it never reached left a 112px card with a bar in it the size
 * of a dash. The two below take the same treatment for the same reason -- the
 * empty state only escapes it today because a sentence of Colin's happens to
 * be longer than its cap, which is not a thing to depend on. */
.pledge-preview {
    width: min(100%, 20rem);
    margin: 0;
}

.pledge-preview .progress-figure {
    margin: 0;
}

.pledge-preview .note {
    margin: 0;
}

/* The locked-window empty state (§5). Its own measure, for the same reason. */
.window-preview {
    width: min(100%, 34rem);
}

.window-preview p:last-child {
    margin-bottom: 0;
}


@media (max-width: 767px) {
    /* Shorter band on a phone. The plate is most of the first screen here, so
       the picture only has to say where we are; the plate starts a little way
       up it and runs on down the page. */
    .hero-banner {
        --hero-overhang: 0px;
        grid-template-rows: 1fr var(--space-7) auto;
        margin-bottom: var(--space-6);
    }

    .hero-banner img {
        height: clamp(220px, 36vh, 300px);
    }

    .hero-banner-text {
        grid-row: 2 / 4;
    }

    .hero-plate {
        padding: var(--space-5);
    }

    .hero-pitch {
        font-size: var(--size-h2);
    }

    /* Primary actions get the full row width (§4). */
    .hero-actions .button-primary,
    .home-cta .button-primary {
        width: 100%;
    }

    .home-heading {
        font-size: var(--size-h1);
    }

    /* The comparison stops being a table on a phone: three columns at 350px
       leave each one a word wide. Each row becomes a block -- the need as its
       heading, then the two answers, each labelled from the column head it has
       lost. The table's own head is kept for screen readers and hidden from
       sight, so the semantics stay a table whatever the layout does. */
    .compare-table,
    .compare-table tbody,
    .compare-table tr,
    .compare-table th,
    .compare-table td,
    .compare-table tbody th,
    .compare-table td.compare-ours {
        display: block;
        width: auto;
    }

    .compare-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }

    .compare-table tbody tr {
        padding: var(--space-4);
        border-bottom: 1px dotted var(--rule-dotted);
    }

    .compare-table tbody tr:last-child {
        border-bottom: 0;
    }

    .compare-table th,
    .compare-table td,
    .compare-table th + :is(th, td) {
        padding: 0;
        border: 0;
    }

    .compare-table tbody th {
        margin-bottom: var(--space-2);
    }

    .compare-table td + td {
        margin-top: var(--space-2);
    }

    .compare-table td::before {
        content: attr(data-label);
        display: block;
        font-family: var(--font-ui);
        font-weight: 600;
        font-size: 12px;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: var(--fg-2);
    }

    .home-feature {
        padding: var(--space-7) 0;
    }

    /* 32px of mount either side is a tenth of a 390px screen twice over, and
       what it takes comes off the specimen, which is the thing worth seeing. */
    .feature-figure {
        padding: var(--space-4);
    }

    .home-cta {
        padding: var(--space-7) var(--space-5);
    }

    /* The grid scrolls rather than shrinking: at 350px of column the three days
       would be under 100px each, and §6's whole objection to a grid on a phone
       is that it stops being readable. Scrolling costs the last day at a
       glance; shrinking costs the words.

       Narrower here than the numbers alone want, so that a slice of the third
       day stays on screen. A frame whose right edge lands exactly on a column
       boundary reads as a grid with two days in it, not as a grid that
       continues -- the sliver is the only thing saying to push it. */
    .schedule-preview {
        min-width: 27rem;
    }

    .sched-row {
        grid-template-columns: 4rem repeat(3, 1fr);
    }

    .sched-cell {
        min-height: 4rem;
    }
}
