/* Site 4 · Galley — standalone stylesheet (does not load style.css).
   Heritage-editorial composition: cream paper, ink typography, crimson
   text accents, gold hairlines, a large warm black-and-white photographic
   plate, and a formal neural diagram engraved between name and statement. */

:root {
    --paper: #F6F1E7;
    --paper-deep: #EFE8D9;
    --ink: #1C1114;
    --ink-soft: rgba(28, 17, 20, 0.66);
    --ink-faint: rgba(28, 17, 20, 0.38);
    --hairline: rgba(28, 17, 20, 0.22);
    --crimson: #9E1B32;
    --crimson-bright: #C42C48;
    --gold: #A2823E;
    --gold-soft: rgba(162, 130, 62, 0.55);
    --ghost: rgba(28, 17, 20, 0.10);
    --serif: 'EB Garamond', 'Iowan Old Style', Georgia, serif;
    --text-serif: 'Newsreader', Georgia, serif;
    --mono: 'IBM Plex Mono', 'SFMono-Regular', Consolas, Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --paper: #191014;
        --paper-deep: #120B0E;
        --ink: #F1E8DB;
        --ink-soft: rgba(241, 232, 219, 0.66);
        --ink-faint: rgba(241, 232, 219, 0.4);
        --hairline: rgba(241, 232, 219, 0.24);
        --crimson: #D0435C;
        --crimson-bright: #E0546E;
        --gold: #C3A15C;
        --gold-soft: rgba(195, 161, 92, 0.55);
        --ghost: rgba(241, 232, 219, 0.11);
    }
}
/* Forced theme for testing: /site4?theme=dark|light (JS sets the attribute) */
:root[data-theme="dark"] {
    --paper: #191014;
    --paper-deep: #120B0E;
    --ink: #F1E8DB;
    --ink-soft: rgba(241, 232, 219, 0.66);
    --ink-faint: rgba(241, 232, 219, 0.4);
    --hairline: rgba(241, 232, 219, 0.24);
    --crimson: #D0435C;
    --crimson-bright: #E0546E;
    --gold: #C3A15C;
    --gold-soft: rgba(195, 161, 92, 0.55);
    --ghost: rgba(241, 232, 219, 0.11);
}
:root[data-theme="light"] {
    --paper: #F6F1E7;
    --paper-deep: #EFE8D9;
    --ink: #1C1114;
    --ink-soft: rgba(28, 17, 20, 0.66);
    --ink-faint: rgba(28, 17, 20, 0.38);
    --hairline: rgba(28, 17, 20, 0.22);
    --crimson: #9E1B32;
    --crimson-bright: #C42C48;
    --gold: #A2823E;
    --gold-soft: rgba(162, 130, 62, 0.55);
    --ghost: rgba(28, 17, 20, 0.10);
}

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

html, body { height: 100%; }

body {
    background: var(--paper);
    color: var(--ink);
    font-family: var(--text-serif);
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Paper grain */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 50;
    pointer-events: none;
    opacity: 0.05;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: inherit; }

/* ---------- Masthead ---------- */

.masthead {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px clamp(24px, 4.4vw, 64px) 14px;
    border-bottom: 1px solid var(--hairline);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--mono);
    font-weight: 500;
    font-size: 0.85rem;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--ink-soft);
    white-space: nowrap;
}

.brand-seal {
    width: 9px;
    height: 9px;
    background: var(--crimson);
    transform: rotate(45deg);
    flex: none;
}

.masthead-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    column-gap: clamp(14px, 1.8vw, 26px);
    row-gap: 4px;
}

.masthead-nav a {
    font-family: var(--mono);
    font-weight: 500;
    font-size: 0.85rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--ink-soft);
    padding-bottom: 2px;
    border-bottom: 1px solid transparent;
    transition: color 160ms ease, border-color 160ms ease;
}

.masthead-nav a:hover {
    color: var(--crimson);
    border-bottom-color: var(--crimson);
}

/* ---------- Sheet: split composition ---------- */

.sheet {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    padding: 0 clamp(24px, 4.4vw, 64px);
}

#inkCanvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

.columns {
    position: relative;
    z-index: 3;
    height: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1.16fr) minmax(0, 0.84fr);
    grid-template-rows: auto minmax(120px, 1fr) auto;
    grid-template-areas:
        "plate copy"
        "plate diagram"
        "plate proof";
    column-gap: clamp(32px, 4.5vw, 84px);
}

/* ---------- Copy (kicker · name · roles · actions) ---------- */

.feature-copy {
    grid-area: copy;
    padding-top: clamp(20px, 3.4vh, 44px);
    /* Title-page composition: the name block sits centered over the lattice. */
    text-align: center;
}

.kicker {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-family: var(--mono);
    font-size: 0.82rem;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--crimson);
    margin-bottom: clamp(12px, 1.8vh, 22px);
}

.kicker::before {
    content: '';
    width: 30px;
    height: 1px;
    background: var(--crimson);
}

.name {
    font-family: var(--serif);
    font-optical-sizing: auto;
    font-weight: 700;
    font-size: clamp(3.5rem, 6.5vw, 6.3rem);
    line-height: 1.0;
    letter-spacing: -0.005em;
    color: var(--ink);
    margin-bottom: clamp(14px, 2.4vh, 26px);
    text-wrap: balance;
}

.name-dot { color: var(--crimson); }

.role {
    font-family: var(--text-serif);
    font-size: clamp(1.04rem, 1.25vw, 1.2rem);
    line-height: 1.5;
    color: var(--ink-soft);
    max-width: 46ch;
    margin-left: auto;
    margin-right: auto;
    text-wrap: balance;
}

.role + .role { margin-top: 2px; }

.cta {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px 26px;
    margin-top: clamp(16px, 2.6vh, 30px);
}

.cta a {
    font-family: var(--mono);
    font-size: 0.82rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--crimson);
    padding: 7px 0 5px;
    border-bottom: 1px solid var(--crimson);
    transition: background 160ms ease, color 160ms ease, padding 160ms ease;
}

.cta a:hover {
    background: var(--crimson);
    color: var(--paper);
    padding: 7px 10px 5px;
}

/* ---------- Diagram box (the canvas draws the network here) ---------- */

.diagram {
    grid-area: diagram;
    min-height: 120px;
}

/* ---------- Plate ---------- */

.plate {
    grid-area: plate;
    align-self: center;
    justify-self: stretch;
    width: 100%;
    padding: clamp(8px, 1.4vh, 18px) 0;
}

.plate-frame {
    border: 1px solid var(--hairline);
    padding: clamp(8px, 0.9vw, 14px);
    background: var(--paper);
}

.plate-photo {
    position: relative;
    border: 1px solid var(--gold-soft);
}

.plate-photo picture {
    display: block;
}

/* The subject's color layer: pixel-aligned cutout over the monochrome plate.
   A radial mask grows from the sternum as the decoder reads — color ignites
   at the core and soaks outward through the silhouette. */
@property --bloom {
    syntax: '<percentage>';
    inherits: false;
    initial-value: 130%;
}

.plate-color {
    position: absolute;
    inset: 0;
    width: 100%;
    height: auto;
    pointer-events: none;
    opacity: 0.88;
    filter: saturate(0.85) sepia(0.08) contrast(1.16) brightness(1.03);
    -webkit-mask-image: radial-gradient(circle at 48% 34%, #000 calc(var(--bloom) - 16%), transparent var(--bloom));
    mask-image: radial-gradient(circle at 48% 34%, #000 calc(var(--bloom) - 16%), transparent var(--bloom));
}


.plate img {
    display: block;
    width: 100%;
    height: auto;
}

.plate figcaption {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    margin-top: 12px;
    text-align: center;
}

.cap-orn {
    width: 7px;
    height: 7px;
    background: var(--gold);
    transform: rotate(45deg);
    margin-bottom: 3px;
}

.cap-title {
    font-family: var(--mono);
    font-size: 0.74rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

.cap-sub {
    font-family: var(--text-serif);
    font-style: italic;
    font-size: 1.04rem;
    color: var(--ink-soft);
}

/* ---------- Proof (statement) ---------- */

.proof {
    grid-area: proof;
    padding-bottom: clamp(18px, 3vh, 36px);
}

.rule-row {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    border-top: 1px solid var(--hairline);
    padding-top: 10px;
    margin-bottom: clamp(10px, 1.6vh, 16px);
    font-family: var(--mono);
    font-size: 0.74rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

#tokenStatus { color: var(--crimson); }

.statement {
    font-family: var(--text-serif);
    font-style: italic;
    font-optical-sizing: auto;
    font-weight: 450;
    font-size: clamp(1.32rem, 1.76vw, 1.74rem);
    line-height: 1.48;
    color: var(--ink);
    text-wrap: pretty;
}

.statement .w {
    transition: color 700ms ease, text-shadow 700ms ease;
}

.statement .w.ghost {
    color: var(--ghost);
    transition: color 300ms ease;
}

.statement .w.just {
    color: var(--crimson-bright);
    transition: none;
}

.meta-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 4px 18px;
    margin-top: clamp(10px, 1.8vh, 18px);
    font-family: var(--mono);
    font-size: 0.74rem;
    letter-spacing: 0.06em;
    color: var(--ink-faint);
}

#seqStatus { color: var(--ink-soft); text-align: right; white-space: nowrap; margin-left: auto; }

.machine { white-space: nowrap; }

.machine a {
    color: var(--ink-faint);
    text-decoration: none;
    border-bottom: 1px solid var(--hairline);
}

.machine a:hover { color: var(--crimson); border-bottom-color: var(--crimson); }

/* ---------- Candidate annotation (follows the caret) ---------- */

.annotation {
    position: absolute;
    z-index: 4;
    display: none;
    flex-direction: column;
    gap: 2px;
    font-family: var(--mono);
    font-size: 0.76rem;
    letter-spacing: 0.04em;
    color: var(--ink-faint);
    background: color-mix(in srgb, var(--paper) 88%, transparent);
    padding: 6px 9px 7px;
    border-left: 1px solid var(--crimson);
    pointer-events: none;
    white-space: nowrap;
}

.annotation.on { display: flex; }

.ann-row { display: flex; justify-content: space-between; gap: 16px; }

.ann-row.is-lead { color: var(--crimson); font-weight: 500; }

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
    body { overflow-y: auto; }

    .masthead { flex-direction: column; align-items: flex-start; gap: 10px; }
    .masthead-nav { justify-content: flex-start; }

    .columns {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto minmax(140px, auto) auto;
        grid-template-areas:
            "copy"
            "plate"
            "diagram"
            "proof";
    }

    .plate {
        width: min(100%, 460px);
        justify-self: center;
        padding: 18px 0 6px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .statement .w, .statement .w.ghost, .statement .w.just { transition: none; }
}


