/* site.css -- the site-level pages: home, About, privacy (Plan F, 2026-10-17).

   Tokens come from theme.css; this file only arranges them. The engraved chrome rules apply
   (engraved-style skill, section D6): plates are a 2px ink border + 3px gap + a #CFC5B4
   hairline, ink rules replace shadows, and the only offset block is the primary button's
   letterpress. No blur anywhere.

   The home page carries html.ev-home-a: its hero art is pinned behind a short scroll.
   (A restrained split-hero variant B was mocked up and dropped, 2026-10-17.)
   The tutorial pages do not load this file; their chrome is css/flow.css. */

/* ---- base ----------------------------------------------------------------------------- */

html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.6;
}
a { color: var(--annotation-link); }
a:hover { color: #1F4A87; }
h1, h2, h3, h4 { font-family: var(--font-heading); font-weight: 700; line-height: 1.15; margin: 0; }
img, svg { max-width: 100%; }
:focus-visible { outline: 2px solid var(--annotation-step); outline-offset: 3px; }

.wrap { max-width: 1160px; margin: 0 auto; padding: 0 32px; }

.skip { position: absolute; left: -999px; top: 8px; z-index: 10; background: var(--stage); padding: 8px 12px; }
.skip:focus { left: 8px; }

/* The engraved double rule: an ink line with a hairline beneath, used under the header and
   above the footer the way a plate's border sits inside its margin. */
.rule-double { border: 0; height: 5px; margin: 0;
    border-top: 2px solid var(--ink); border-bottom: 1px solid var(--plate-rule, #CFC5B4); }

/* ---- header ---------------------------------------------------------------------------- */

.site-header { position: relative; z-index: 3; background: var(--paper); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between;
    min-height: 64px; gap: 16px; }
.wordmark { display: inline-flex; align-items: center; gap: 10px; text-decoration: none;
    color: var(--ink); font-family: var(--font-heading); font-weight: 700; font-size: 24px;
    letter-spacing: 0.01em; }
.wordmark:hover { color: var(--ink); }
.wordmark svg { width: 26px; height: 26px; flex: none; }
.wordmark .tld { color: var(--ink-muted); font-weight: 600; }
.site-nav { display: flex; gap: 4px; }
.site-nav a { color: var(--ink-secondary); text-decoration: none; font-weight: 600; font-size: 15px;
    letter-spacing: 0.04em; text-transform: uppercase; padding: 10px 12px; border-radius: var(--radius-control);
    min-height: 44px; box-sizing: border-box; display: inline-flex; align-items: center; }
.site-nav a:hover { color: var(--ink); background: var(--panel); }
.site-nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--annotation-step); border-radius: 0; }

/* ---- buttons --------------------------------------------------------------------------- */

.btn { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 24px;
    border-radius: var(--radius-control); font-weight: 700; font-size: 17px; text-decoration: none;
    transition: background-color var(--motion-fast, 120ms) ease; }
.btn-primary { background: var(--btn-primary-bg); color: var(--btn-primary-text);
    box-shadow: var(--letterpress-offset, 2px) var(--letterpress-offset, 2px) 0 0 var(--ink); }
.btn-primary:hover { background: var(--btn-primary-bg-hover); color: var(--btn-primary-text); }
.btn-primary:active { transform: translate(2px, 2px); box-shadow: none; }
.btn-primary .btn-meta { font-weight: 600; opacity: 0.85; padding-left: 10px;
    border-left: 1px solid rgba(255, 255, 255, 0.4); }
.btn-ghost { background: var(--btn-ghost-bg); color: var(--ink); border: 1px solid var(--ink-muted); }
.btn-ghost:hover { background: var(--btn-ghost-bg-hover); color: var(--ink); }
.btn-row { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 28px; }

/* ---- plate ----------------------------------------------------------------------------- */

.plate { background: var(--stage); border: var(--plate-border-width, 2px) solid var(--ink);
    border-radius: var(--radius-block);
    box-shadow: inset 0 0 0 3px var(--stage), inset 0 0 0 4px var(--plate-rule, #CFC5B4); }

/* ---- hero ------------------------------------------------------------------------------ */

.kicker { font-size: 13px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
    color: #8A5800; margin: 0 0 14px; }   /* not --annotation-step: 4.41:1 at 13px fails AA */
.hero h1 { font-size: clamp(36px, 5.2vw, 60px); letter-spacing: -0.01em; }
.hero .lede { font-size: clamp(18px, 1.6vw, 21px); color: var(--ink-secondary); max-width: 34em;
    margin: 20px 0 0; }
.small-note { display: none; font-size: 14px; color: var(--ink-muted); margin: 14px 0 0; }

.hero-art { position: relative; }
.hero-art svg, .hero-art img { display: block; width: 100%; height: auto; }
.hero-skip { position: absolute; right: 12px; bottom: 12px; z-index: 2; font: inherit; font-size: 13px;
    font-weight: 600; color: var(--ink-secondary); background: rgba(243, 238, 230, 0.92);
    border: 1px solid var(--ink-muted); border-radius: var(--radius-control); padding: 6px 12px;
    cursor: pointer; display: none; }
html.ev-hero-anim .hero-skip { display: block; }
html.ev-hero-done .hero-skip { display: none; }

/* The hero art is pinned behind the opening screen; panels scroll over it.
   position:sticky, not background-attachment:fixed, which iOS ignores. */
.ev-home-a .stage { position: relative; }
.ev-home-a .pin { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden;
    z-index: 0; background: var(--paper); }
.ev-home-a .pin .hero-art { position: absolute; inset: 0; display: flex; align-items: center;
    justify-content: flex-end; }
.ev-home-a .pin .hero-art svg { width: auto; height: 100%; max-width: none; }
.ev-home-a .over { position: relative; z-index: 1; margin-top: -100vh; margin-top: -100svh; }
.ev-home-a .hero { position: relative; min-height: 100vh; min-height: 100svh; display: flex; align-items: center; }
.ev-home-a .hero .wrap { width: 100%; box-sizing: border-box; }
/* No plate round the copy: the pinned art carries a paper scrim on its left (hero motion). */
.ev-home-a .hero-text { max-width: 500px; }
.ev-home-a .why { margin-top: 0; }
.ev-home-a .scroll-cue { position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%);
    font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-muted); }

/* ---- sections -------------------------------------------------------------------------- */

.section { padding: 72px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 20px;
    flex-wrap: wrap; margin-bottom: 28px; }
.section-head h2 { font-size: clamp(28px, 3vw, 38px); }
.section-head p { margin: 0; color: var(--ink-muted); }
.panel-paper { background: var(--paper); }

/* ---- catalogue (generated by site-gen.py) ---------------------------------------------- */

.group { margin-top: 40px; }
.group:first-of-type { margin-top: 0; }
.group-title { display: flex; align-items: center; gap: 14px; font-family: var(--font-body);
    font-size: 13px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
    color: #8A5800; margin: 0 0 16px; }
.group-title::after { content: ""; flex: 1; border-top: 1px solid var(--plate-rule, #CFC5B4); }
/* auto-fit: a group of two fills the row instead of leaving an empty third column. */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px;
    list-style: none; margin: 0; padding: 0; }
.card { position: relative; display: flex; flex-direction: column; height: 100%; box-sizing: border-box;
    padding: 22px 22px 18px; transition: transform var(--motion-fast, 120ms) ease; }
.card:hover { transform: translate(-2px, -2px); box-shadow: inset 0 0 0 3px var(--stage),
    inset 0 0 0 4px var(--plate-rule, #CFC5B4), 3px 3px 0 0 var(--ink); }
.card:hover h4 a { color: #000; }
/* Engraved glyphs (48-unit art) fill their box; no disc behind them, the silhouette is the edge. */
.card-glyph { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px;
    margin-bottom: 14px; }
.card-glyph svg { display: block; width: 100%; height: 100%; }
.card h4 { font-size: 21px; }
.card h4 a { color: var(--ink); text-decoration: none; }
/* The whole card is the hit area of its title link. */
.card h4 a::after { content: ""; position: absolute; inset: 0; }
.card h4 a:focus-visible { outline: none; }
.card:focus-within { outline: 2px solid var(--annotation-step); outline-offset: 3px; }
.card p { margin: 8px 0 0; color: var(--ink-secondary); font-size: 16px; line-height: 1.5; }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: auto;
    padding-top: 16px; font-size: 14px; color: var(--ink-muted); }
.chip { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: 0.04em;
    padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.chip-beginner { background: var(--tint-green); color: var(--btn-primary-bg); }
.chip-intermediate { background: var(--tint-amber); color: #7A4E00; }
.chip-note { background: transparent; color: #8A3A1E; border: 1px solid #D7A88F; }

/* The featured card: first in "Start here", spans the row, lists its parts. */
.card-featured { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 0 22px;
    align-items: start; padding: 26px 28px 24px; }
.card-featured .card-glyph { width: 64px; height: 64px; margin: 0; }
.card-featured .card-glyph svg { width: 100%; height: 100%; }
.card-featured h4 { font-size: 26px; }
.card-featured .card-meta { margin-top: 12px; padding-top: 0; }
.cards-featured { grid-template-columns: minmax(0, 1fr); }
.parts { list-style: none; margin: 0; padding: 0; min-width: 260px; border-left: 1px solid var(--line);
    padding-left: 22px; position: relative; z-index: 1; }
.parts li + li { margin-top: 6px; }
.parts a { display: flex; justify-content: space-between; align-items: center; gap: 16px; text-decoration: none; min-height: 44px; box-sizing: border-box;
    color: var(--ink); font-weight: 600; padding: 6px 10px; border-radius: var(--radius-control); }
.parts a:hover { background: var(--panel); }
.parts .min { color: var(--ink-muted); font-weight: 400; white-space: nowrap; }

/* ---- why strip ------------------------------------------------------------------------- */

.why-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; }
.why-item h3 { font-size: 20px; margin: 12px 0 6px; }
.why-item p { margin: 0; color: var(--ink-secondary); }
.why-item svg { display: block; width: 48px; height: 48px; }
.mmt-line { margin: 44px 0 0; padding-top: 24px; border-top: 1px solid var(--plate-rule, #CFC5B4);
    color: var(--ink-secondary); }

/* ---- footer ---------------------------------------------------------------------------- */

.site-footer { position: relative; z-index: 2; background: var(--paper); padding: 0 0 40px;
    font-size: 15px; color: var(--ink-secondary); }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 18px 40px;
    align-items: center; padding-top: 28px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0 18px; }
.site-footer a { color: var(--ink-secondary); display: inline-block; padding: 10px 0; }
.site-footer .ev-mail a, .site-footer p a { display: inline-block; padding: 12px 0; }   /* 44px tap height */
.site-footer a:hover { color: var(--ink); }
/* The hero photo's licence credit: required, but quieter than the photo it credits. */
.site-footer .photo-credit { flex-basis: 100%; margin: 0; font-size: 13px; font-weight: 400; color: var(--ink-muted); }
.site-footer .photo-credit a { display: inline; padding: 0; color: inherit; }

/* ---- prose pages (About, privacy) ------------------------------------------------------ */

.prose { max-width: 720px; margin: 0 auto; padding: 56px 32px 72px; font-size: 18px; line-height: 1.65; }
.prose .two-col { columns: 2; column-gap: 40px; }
.prose .two-col li { break-inside: avoid; }
.prose h1 { font-size: clamp(32px, 4vw, 44px); margin-bottom: 20px; }
.prose h2 { font-size: 26px; margin: 44px 0 12px; }
.prose li + li { margin-top: 6px; }

/* ---- hero motion ----
   The hero art is inline SVG cut from the tutorial stage (hero-proto/tools/integrate.py)
   and driven by js/home_hero.js. The markup is the finished picture: without JS, with
   reduced motion, or if the script fails, everything below still shows the end state.
   html.ev-hero-anim (head gate) hides the finished layer .evC until the script fades it in
   over its own build layers (.evA fills under a sweep mask, .evB pen strokes); a 3.5 s
   watchdog shows it anyway if the script never takes over (html.ev-hero-live). */
.evHeroArt { --pen: 1; }
/* A: the owner's original waterwheel photo as a faint two-tone plate (ink on paper, darkest
   tone 20% of the way to ink) under the blueprint and the engraved loop. Toned, cropped and
   faded to paper on the copy side by docs/redesign/tools/hero/wash.py. "Wheel in action" by
   Edward Webb, CC BY 2.0 - credited in the footer. Local files only: no third-party request.
   No ?v= on these url()s: asset-version-check.py scans page tags only, and images cache for
   30 days, not a year. If the photo is re-toned, give the files a new name. */
.ev-home-a .pin .hero-art { background-color: var(--paper); background-repeat: no-repeat;
    background-size: cover; background-position: right center;
    background-image: url("../img/home/wheel-wash-1920.jpg");
    background-image: image-set(url("../img/home/wheel-wash-1920.webp") type("image/webp"),
        url("../img/home/wheel-wash-1920.jpg") type("image/jpeg")); }
.evGhostArt { opacity: 0.1; }               /* texture, not content: the ghost carries no text */
.ev-home-a .pin .hero-art svg { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; }
/* Paper scrim under the copy: the circuit runs on behind the text instead of stopping. */
.ev-home-a .pin .hero-art::after { content: ""; position: absolute; inset: 0; pointer-events: none;
    /* --ev-copy-r: the right edge of the 500px copy column inside the centred .wrap */
    --ev-copy-r: calc(max(0px, 50vw - 580px) + 32px + 500px);
    background: linear-gradient(90deg, rgba(243, 238, 230, 0.97) 0%,
        rgba(243, 238, 230, 0.95) var(--ev-copy-r),
        rgba(243, 238, 230, 0) calc(var(--ev-copy-r) + 56px)); }

html.ev-hero-anim .evC { opacity: 0; animation: ev-hero-watchdog 0s 3.5s forwards; }
html.ev-hero-anim.ev-hero-live .evC { animation: none; }
html.ev-hero-done .evC { opacity: 1 !important; }
@keyframes ev-hero-watchdog { to { opacity: 1; } }
.evA .t1, .evA .t2, .evA .t3, .evA .t4, .evA .tr { stroke: none !important; }
.evB * { fill: none !important; }
.evB .nd, .evB text { display: none !important; }
.evB .t1, .evB .t2, .evB .t3, .evB .t4, .evB .tr { stroke-dasharray: 1 1 !important; }
.evB .tr { visibility: hidden; }
.evB .t1 { stroke-dashoffset: var(--d1, 1) !important; visibility: var(--v1, hidden); }
.evB .t2 { stroke-dashoffset: var(--d2, 1) !important; visibility: var(--v2, hidden); }
.evB .t3 { stroke-dashoffset: var(--d3, 1) !important; visibility: var(--v3, hidden); }
.evB .t4 { stroke-dashoffset: var(--d4, 1) !important; visibility: var(--v4, hidden); }
.ev-home-a .over .hero .hero-skip { right: 24px; bottom: 20px; }
/* One small persistent control: "Skip intro" while it draws, "Replay" afterwards. */
.hero-skip { min-height: 44px; min-width: 44px; }
html.ev-hero-anim.ev-hero-done .hero-skip { display: block; }
/* A: the hero is exactly the first screen below the header (--ev-hdr is measured by
   js/home_hero.js), so the panels that slide over the pinned art start at the fold. Its
   foot fades to paper, so the art is never cut by a hard edge as #tutorials comes up, and
   the scroll cue sits on that paper rather than across the pipes. */
.ev-home-a .hero { min-height: calc(100vh - var(--ev-hdr, 69px)); min-height: calc(100svh - var(--ev-hdr, 69px)); }
.ev-home-a .hero-text { position: relative; z-index: 1; }   /* above the foot fade on short screens */
.ev-home-a .over .hero::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 150px;
    pointer-events: none; background: linear-gradient(180deg, rgba(243, 238, 230, 0), rgba(243, 238, 230, 0.85) 55%, var(--paper) 85%); }
.ev-home-a .scroll-cue { z-index: 1; bottom: 14px; padding: 4px 12px; border-radius: 999px;
    background: var(--paper); }

/* ---- tablet ---------------------------------------------------------------------------- */

@media (max-width: 900px) {
    .wrap { padding: 0 24px; }
    .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .cards.cards-featured { grid-template-columns: minmax(0, 1fr); }
    .card-featured { grid-template-columns: auto minmax(0, 1fr); }
    .parts { grid-column: 1 / -1; border-left: 0; padding-left: 0; margin-top: 18px;
        border-top: 1px solid var(--line); padding-top: 12px; min-width: 0; }
    .why-grid { grid-template-columns: minmax(0, 1fr); gap: 24px; }

    /* No pin below 900px; the art is a band at the top and the page scrolls normally. */
    .ev-home-a .pin { position: relative; height: auto; }
    /* hero motion: the band is its own composed crop (data-vb-narrow), about half the
       viewport tall, fading into the paper below rather than ending on a hard edge. */
    .ev-home-a .pin .hero-art { position: relative; display: block; aspect-ratio: 350 / 330;
        max-height: 45vh; max-height: 45svh; width: 100%; }
    .ev-home-a .pin .hero-art { background-position: center center;
        background-image: url("../img/home/wheel-wash-800.jpg");
        background-image: image-set(url("../img/home/wheel-wash-800.webp") type("image/webp"),
            url("../img/home/wheel-wash-800.jpg") type("image/jpeg")); }
    .ev-home-a .over .hero::before { display: none; }   /* the band has its own foot fade; this one would veil the copy */
    .ev-home-a .pin .hero-art::after { background: linear-gradient(180deg, rgba(243, 238, 230, 0) 82%,
        rgba(243, 238, 230, 1) 100%); }
    .ev-home-a .over { margin-top: 0; }
    .ev-home-a .hero { min-height: 0; display: block; padding: 8px 0 48px; }
    .ev-home-a .hero-text { max-width: 640px; padding: 20px 0 8px; }
    .ev-home-a .over .hero .hero-skip { top: -44px; bottom: auto; right: 16px; }
    .ev-home-a .scroll-cue { display: none; }
}

/* ---- phone ----------------------------------------------------------------------------- */

@media (max-width: 600px) {
    body { font-size: 16px; }
    .wrap { padding: 0 16px; }
    .site-header .wrap { min-height: 56px; }
    .wordmark { font-size: 21px; }
    .site-nav a { padding: 10px 8px; font-size: 14px; letter-spacing: 0.02em; }
    .kicker, .group-title { font-size: 14px; }
    .chip { font-size: 13px; }
    .prose .two-col { columns: 1; }
    .site-nav .nav-blog { display: none; }
    .section { padding: 48px 0; }
    .cards { grid-template-columns: minmax(0, 1fr); gap: 14px; }
    /* Glyph beside the title rather than above it: about a third less height per card. */
    .card { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 0 14px; padding: 18px 18px 16px; }
    .card .card-glyph { width: 40px; height: 40px; margin: 0; grid-row: span 3; }
    .card h4 { font-size: 19px; align-self: center; }
    .card p, .card .card-meta { grid-column: 2; }
    .card-meta { padding-top: 10px; }
    .card-featured { display: flex; padding: 22px 20px; }
    .card-featured .card-glyph { width: 48px; height: 48px; margin-bottom: 12px; }
    .card-featured .card-glyph svg { width: 100%; height: 100%; }
    .card-featured h4 { font-size: 23px; }
    .parts { margin-top: 16px; }
    .btn-row .btn { flex: 1 1 auto; justify-content: center; }
    .small-note { display: block; }
    .hero .lede { font-size: 16.5px; line-height: 1.5; margin-top: 14px; }   /* keeps Start above the fold on a 390x844 phone */
    .ev-home-a .hero-text { border: 0; box-shadow: none; padding: 20px 0 8px; background: transparent; }
    .ev-home-a .pin .hero-art { max-height: 40vh; max-height: 40svh; }   /* hero motion: h1 on the first screen */
    .prose { padding: 36px 16px 56px; }
}

@media (max-width: 360px) {
    .wordmark { font-size: 19px; gap: 6px; }
    .wordmark svg { width: 22px; height: 22px; }
    .site-nav a { padding: 10px 6px; letter-spacing: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .card, .btn { transition: none; }
    .card:hover { transform: none; }
}
