/* ==========================================================================
   KEKSI/KIEKSI v2 — dictionary → desk → the Kieksi Classic.
   Mode classes set by JS:
     html.js       JS is running
     html.crt      wide viewport + motion OK → pinned CRT services + cookie flight
   Base (no .crt) is the linear fallback: the Mac chrome collapses via
   display:contents and the service windows become flow cards.
   ========================================================================== */

/* ---------- tokens ---------- */
:root {
    --paper: #EFEEE8;
    --paper-warm: #FDFBF5;
    --ink: #191920;
    --cobalt: #2B3FDE;
    --marker: #FFD84A;
    --annot: #77777F;

    --mat: #2F4F44;
    --mat-line: rgba(214, 238, 228, 0.14);
    --mat-line-minor: rgba(214, 238, 228, 0.075);
    --mat-text: rgba(214, 238, 228, 0.55);
    --mat-text-dim: rgba(214, 238, 228, 0.38);
    --sticky: #FFE86B;
    --tape: rgba(244, 232, 184, 0.75);
    --pencil: #3E4048;
    --pencil-soft: #5C5F68;
    --redpen: #D6472E;
    --rule-blue: rgba(76, 118, 182, 0.28);
    --shadow-soft: 0 1px 2px rgba(10, 20, 16, 0.18), 0 10px 24px rgba(10, 20, 16, 0.22);
    --shadow-lift: 0 2px 4px rgba(10, 20, 16, 0.2), 0 18px 40px rgba(10, 20, 16, 0.3);

    --mac-case: #D8D3C4;
    --mac-case-deep: #BEB9A8;
    --mac-screen: #C9D1C4;
    --mac-ink: #1C201C;
    --mac-paper: #F1F2EC;

    --font-display: 'Archivo', 'Helvetica Neue', sans-serif;
    --font-body: 'Newsreader', Georgia, serif;
    --font-hand: 'Caveat', cursive;
    --font-mono: 'JetBrains Mono', 'SF Mono', monospace;
    --font-pixel: 'Silkscreen', monospace;

    --col: 1080px;
    --pad: clamp(20px, 5vw, 48px);
    --strip-gap: clamp(6rem, 18vh, 11rem);

    --p: 0;              /* act I zoom progress (linear) */
    --pe: 0;             /* act I zoom progress (eased, for transforms) */
    --scale-drop: 0.62;
    --macw: min(48vw, 92vh, 700px);
}

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

html { overflow-x: clip; }

body {
    background-color: var(--mat);
    background-image:
        repeating-linear-gradient(0deg, var(--mat-line) 0 1px, transparent 1px 200px),
        repeating-linear-gradient(90deg, var(--mat-line) 0 1px, transparent 1px 200px),
        repeating-linear-gradient(0deg, var(--mat-line-minor) 0 1px, transparent 1px 40px),
        repeating-linear-gradient(90deg, var(--mat-line-minor) 0 1px, transparent 1px 40px);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 1.125rem;
    line-height: 1.55;
    overflow-x: clip;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

::selection { background: var(--cobalt); color: var(--paper); }
a { color: inherit; }
img { max-width: 100%; display: block; }

:focus-visible {
    outline: 3px solid var(--marker);
    outline-offset: 4px;
    border-radius: 2px;
}
.sheet :focus-visible { outline-color: var(--cobalt); outline-width: 2px; }

h1, h2, h3 { text-wrap: balance; }

.annot {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    font-weight: 400;
    letter-spacing: 0.01em;
    color: var(--annot);
}

.hand {
    font-family: var(--font-hand);
    font-weight: 600;
    font-size: 26px;
    line-height: 1.18;
    color: var(--pencil);
}

.typed-label {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.14em;
    color: var(--pencil-soft);
}

/* ==========================================================================
   ACT I · dictionary sheet
   ========================================================================== */

.dict-track { height: 300vh; position: relative; z-index: 2; }

.dict-stage {
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100svh;
    overflow: clip;
    display: grid;
    place-items: center;
}

.mat-layer {
    position: absolute;
    inset: 0;
    background-color: var(--mat);
    background-image:
        repeating-linear-gradient(0deg, var(--mat-line) 0 1px, transparent 1px 200px),
        repeating-linear-gradient(90deg, var(--mat-line) 0 1px, transparent 1px 200px),
        repeating-linear-gradient(0deg, var(--mat-line-minor) 0 1px, transparent 1px 40px),
        repeating-linear-gradient(90deg, var(--mat-line-minor) 0 1px, transparent 1px 40px);
    opacity: min(1, calc(var(--p) * 1.7));
}

.sheet {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 96px var(--pad) 64px;
    background: var(--paper);
    transform: scale(calc(1 - var(--pe) * var(--scale-drop)))
               rotate(calc(var(--pe) * -2deg));
    border-radius: calc(var(--pe) * 10px);
    box-shadow:
        0 2px 4px rgb(10 20 16 / calc(var(--p) * 0.22)),
        0 24px 64px rgb(10 20 16 / calc(var(--p) * 0.38));
    will-change: transform;
}

.sheet::before {
    content: "";
    position: absolute;
    top: -22px;
    left: 50%;
    width: 220px;
    height: 52px;
    transform: translateX(-50%) rotate(-1.5deg);
    background: var(--tape);
    box-shadow: 0 1px 3px rgba(10, 20, 16, 0.12);
    opacity: clamp(0, calc((var(--p) - 0.75) * 6), 1);
    pointer-events: none;
}

.nav {
    position: absolute;
    top: 0; left: 0; right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px var(--pad);
    opacity: calc(1 - var(--p) * 2.2);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--ink);
}

.brand-name {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.nav-hello {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-decoration: none;
    color: var(--ink);
    border-bottom: 1.5px solid var(--cobalt);
    padding-bottom: 2px;
    transition: color 0.25s ease;
}
.nav-hello:hover { color: var(--cobalt); }

.sheet-inner { max-width: 860px; width: 100%; }

.hero-annot { margin-bottom: clamp(1.25rem, 3.5vh, 2.5rem); }

.hero-word {
    display: flex;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 730;
    font-size: clamp(4rem, 16.5vw, 14rem);
    line-height: 0.95;
    letter-spacing: -0.035em;
    color: var(--ink);
    user-select: none;
}

.lt { display: inline-block; will-change: transform; }
.lt-ins { color: var(--cobalt); position: relative; }

/* anchor for the flying-cookie tittle (JS swaps i → ı and adds this) */
.tittle-anchor {
    position: absolute;
    top: 0.055em;
    left: 50%;
    transform: translateX(-50%);
    width: 0.16em;
    aspect-ratio: 1;
    pointer-events: none;
}

html.js .hero-word:not(.open) .lt-pre  { transform: translateX(calc(var(--iw, 0.29em) / 2)); }
html.js .hero-word:not(.open) .lt-post { transform: translateX(calc(var(--iw, 0.29em) / -2)); }
html.js .hero-word:not(.open) .lt-ins  { opacity: 0; transform: translateY(-0.85em) rotate(8deg); }

.hero-word .lt { transition: transform 0.68s cubic-bezier(0.34, 1.45, 0.64, 1); }
.hero-word .lt-ins {
    transition: transform 0.62s cubic-bezier(0.34, 1.45, 0.64, 1) 0.16s,
                opacity 0.28s ease 0.16s;
}

/* the three-column entry */
.defrow {
    display: grid;
    grid-template-columns: repeat(3, auto);
    justify-content: center;
    gap: clamp(1.5rem, 5vw, 4.5rem);
    margin-top: clamp(2rem, 6vh, 4rem);
}

.defcol {
    display: grid;
    gap: 0.35rem;
    text-align: left;
}

.defw {
    font-family: var(--font-body);
    font-weight: 600;
    font-style: italic;
    font-size: clamp(1.2rem, 2vw, 1.55rem);
    line-height: 1.1;
}

.defw-i { color: var(--cobalt); font-style: inherit; }

.defg { white-space: nowrap; }

/* act I fallbacks */
html:not(.js) .dict-track { height: auto; }
html:not(.js) .dict-stage { position: static; height: auto; min-height: 100vh; }
html:not(.js) .sheet { min-height: 100vh; height: auto; }
html:not(.js) .mat-layer,
html:not(.js) .sheet::before { display: none; }

@media (prefers-reduced-motion: reduce) {
    .dict-track { height: auto; }
    .dict-stage { position: static; height: auto; }
    .sheet {
        min-height: 100vh;
        height: auto;
        transform: none;
        border-radius: 0;
        box-shadow: none;
    }
    .sheet::before, .mat-layer { display: none; }
    .nav { opacity: 1; }
}

/* ==========================================================================
   ACT II · the desk
   ========================================================================== */

.desk {
    position: relative;
    z-index: 1;
    padding-top: clamp(4rem, 12vh, 8rem);
    overflow: visible;
}

.strip {
    position: relative;
    max-width: var(--col);
    margin: 0 auto;
    padding: var(--strip-gap) var(--pad) 0;
}

.artifact {
    background: var(--paper);
    border-radius: 3px;
    box-shadow: var(--shadow-soft);
    position: relative;
    rotate: calc(var(--r, 0) * 1deg);
}

/* --- typographic section titles, printed on the mat --- */
.desk-title { padding-top: var(--strip-gap); }

.intro-title { padding-top: 0; min-height: 32vh; }

.desk-h {
    font-family: var(--font-display);
    font-weight: 750;
    font-size: clamp(2.5rem, 5.2vw, 4.4rem);
    letter-spacing: -0.025em;
    line-height: 1.02;
    color: rgba(240, 246, 242, 0.96);
    margin-left: clamp(0px, 5vw, 80px);
    margin-bottom: 1.2rem;
}

.desk-lead {
    font-size: clamp(1.1rem, 1.55vw, 1.35rem);
    line-height: 1.6;
    color: rgba(222, 234, 228, 0.8);
    max-width: 46ch;
    margin-left: clamp(0px, 5vw, 80px);
}

/* ==========================================================================
   SERVICES · the Kieksi Classic
   ========================================================================== */

/* -- shared window styling (used in both CRT and flow modes) -- */
.mac-window, .mac-alert {
    background: var(--mac-paper);
    border: 2px solid var(--mac-ink);
    box-shadow: 2px 2px 0 var(--mac-ink);
}

.mac-titlebar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 22px;
    border-bottom: 2px solid var(--mac-ink);
    background: repeating-linear-gradient(0deg,
        transparent 0 2px, var(--mac-ink) 2px 3px, transparent 3px 5px);
    background-clip: content-box;
    padding: 3px 6px;
}

.mac-title {
    font-family: var(--font-pixel);
    font-size: 11px;
    line-height: 1;
    color: var(--mac-ink);
    background: var(--mac-paper);
    padding: 0 8px;
    white-space: nowrap;
}

.mac-closebox {
    position: absolute;
    left: 8px;
    top: 50%;
    translate: 0 -50%;
    width: 10px;
    height: 10px;
    border: 2px solid var(--mac-ink);
    background: var(--mac-paper);
}

.win-body { padding: 16px 16px 14px; }

.win-copy {
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.55;
    color: var(--mac-ink);
    margin-top: 12px;
}

.mac-btn {
    font-family: var(--font-pixel);
    font-size: 10px;
    color: var(--mac-ink);
    background: var(--mac-paper);
    border: 2px solid var(--mac-ink);
    border-radius: 8px;
    padding: 6px 14px 5px;
    cursor: pointer;
    box-shadow: 0 0 0 2px var(--mac-paper), 0 0 0 3.5px var(--mac-ink);
    margin: 4px;
}
.mac-btn:hover { background: var(--mac-ink); color: var(--mac-paper); }
.mac-btn:active { translate: 1px 1px; }

/* -- vignettes -- */
.vig-1 { width: 100%; height: auto; display: block; color: var(--mac-ink); }
.vig-1 .dr {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.vig-t {
    font-family: var(--font-pixel);
    font-size: 9px;
    fill: var(--mac-ink);
    opacity: 0;
    transition: opacity 0.4s ease 1.1s;
}

.vig-2 {
    position: relative;
    height: 74px;
    border: 1px dotted rgba(28, 32, 28, 0.35);
    overflow: hidden;
}
.v2-sel {
    position: absolute;
    top: 10px; left: 12px;
    width: 118px; height: 50px;
    border: 1.5px dashed var(--mac-ink);
    transform-origin: top left;
    transform: scale(0);
}
.v2-r1, .v2-r2, .v2-r3 {
    position: absolute;
    background: var(--mac-ink);
    opacity: 0;
}
.v2-r1 { top: 16px; left: 18px; width: 44px; height: 8px; }
.v2-r2 { top: 30px; left: 18px; width: 90px; height: 4px; }
.v2-r3 { top: 38px; left: 18px; width: 72px; height: 4px; }
.v2-cursor {
    position: absolute;
    top: 4px; left: 6px;
    width: 12px; height: 18px;
    fill: var(--mac-ink);
    stroke: var(--mac-paper);
    stroke-width: 0.8;
}

.vig-3 {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 22px 4px 14px;
}
.v3-label, .v3-done {
    font-family: var(--font-pixel);
    font-size: 9px;
    color: var(--mac-ink);
}
.v3-done { opacity: 0; }
.v3-bar {
    display: block;
    height: 14px;
    border: 2px solid var(--mac-ink);
    padding: 2px;
}
.v3-fill {
    display: block;
    height: 100%;
    width: 0%;
    background: repeating-linear-gradient(90deg,
        var(--mac-ink) 0 6px, transparent 6px 9px);
}

/* -- CRT-mode animations: triggered when a window gains .on -- */
html.crt .mac-window {
    opacity: 0;
    transform: scale(0.72);
    transition: opacity 0.22s steps(4), transform 0.22s steps(4);
    pointer-events: none;
}
html.crt .mac-window.on {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

html.crt .vig-1 .dr {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    transition: stroke-dashoffset 0.5s cubic-bezier(0.5, 0, 0.3, 1);
}
html.crt .vig-1 .dr:nth-of-type(2) { transition-delay: 0.35s; }
html.crt .vig-1 .dr:nth-of-type(3) { transition-delay: 0.5s; }
html.crt .vig-1 .dr:nth-of-type(4) { transition-delay: 0.6s; }
html.crt .vig-1 .dr:nth-of-type(5) { transition-delay: 0.95s; }
html.crt .vig-1 .dr:nth-of-type(6) { transition-delay: 1.05s; }
html.crt .vig-1 .dr:nth-of-type(7) { transition-delay: 1.15s; }
html.crt .win-1:not(.on) .vig-t { opacity: 0 !important; }
html.crt .win-1.on .vig-1 .dr { stroke-dashoffset: 0; }
html.crt .win-1.on .vig-t { opacity: 1; }

html.crt .win-2.on .v2-cursor { animation: v2cursor 1.5s steps(22) 0.15s both; }
html.crt .win-2.on .v2-sel { animation: v2sel 0.9s steps(12) 0.35s both; }
html.crt .win-2.on .v2-r1 { animation: v2pop 0.16s steps(2) 1.35s both; }
html.crt .win-2.on .v2-r2 { animation: v2pop 0.16s steps(2) 1.5s both; }
html.crt .win-2.on .v2-r3 { animation: v2pop 0.16s steps(2) 1.65s both; }

@keyframes v2cursor {
    from { transform: translate(0, 0); }
    to   { transform: translate(128px, 48px); }
}
@keyframes v2sel { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes v2pop { from { opacity: 0; } to { opacity: 1; } }

html.crt .win-3.on .v3-fill { animation: v3fill 1.5s steps(14) 0.2s both; }
html.crt .win-3.on .v3-label { animation: v3fade 0.2s 1.7s both; }
html.crt .win-3.on .v3-done { animation: v2pop 0.2s 1.75s both; }

@keyframes v3fill { from { width: 0%; } to { width: 100%; } }
@keyframes v3fade { from { opacity: 1; } to { opacity: 0.35; } }

/* -- the machine itself (CRT mode) -- */
.svc-track { position: relative; }
html.crt .svc-track { height: 560vh; }

html.crt .svc-stage {
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100svh;
    display: grid;
    place-items: center;
}

.mac-stage { position: relative; width: var(--macw); }

.mac {
    position: relative;
    background: linear-gradient(165deg, #E4DFD0 0%, var(--mac-case) 55%, var(--mac-case-deep) 100%);
    border-radius: 16px 16px 20px 20px;
    padding: 5.5% 5% 0;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.55),
        inset 0 -3px 6px rgba(60, 55, 40, 0.28),
        var(--shadow-lift);
    rotate: -1deg;
}

.mac-screen-recess {
    background: linear-gradient(180deg, #C4BFAE, #D2CDBC);
    border-radius: 12px;
    padding: 3.5%;
    box-shadow:
        inset 0 3px 9px rgba(60, 55, 40, 0.5),
        inset 0 -1px 1px rgba(255, 255, 255, 0.4);
}

.mac-crt-frame {
    background: #17191C;
    border-radius: 9px;
    padding: 3%;
}

.mac-screen {
    position: relative;
    background:
        radial-gradient(120% 120% at 50% 40%, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0) 55%),
        var(--mac-screen);
    border-radius: 7px;
    aspect-ratio: 3 / 2;
    box-shadow: inset 0 0 26px rgba(20, 30, 20, 0.35);
    overflow: hidden;
}

/* boot — every stage is scroll-driven via [data-boot] on .mac */
.crt-boot {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: #1A241E;
    z-index: 6;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s steps(3);
}
.mac[data-boot="off"] .crt-boot,
.mac[data-boot="face"] .crt-boot { opacity: 1; }

.boot-face {
    width: 17%;
    aspect-ratio: 1;
    color: #BFE8CC;
    opacity: 0;
    transition: opacity 0.12s steps(2);
}
.boot-face svg { width: 100%; height: 100%; display: block; }
.mac[data-boot="face"] .boot-face { opacity: 1; }

html:not(.crt) .crt-boot { display: none; }

/* boot payoff: the classic cursive greeting, written by hand */
.crt-hello {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: grid;
    place-items: center;
    background:
        radial-gradient(120% 120% at 50% 40%, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0) 55%),
        var(--mac-screen);
    transition: opacity 0.4s ease;
}

.hello-svg { width: 60%; overflow: visible; }

/* the greeting is written BY the scroll: --hp (0→1) scrubs the stroke */
.hello-path {
    fill: none;
    stroke: var(--mac-ink);
    stroke-width: 5.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 1;
    stroke-dashoffset: calc(1 - var(--hp, 0));
    transition: stroke-dashoffset 0.15s linear;
}

.hello-dot { fill: var(--mac-ink); opacity: 0; transition: opacity 0.15s ease; }
.mac.hello-done .hello-dot { opacity: 1; }

.mac[data-boot="working"] .crt-hello { opacity: 0; pointer-events: none; }

html:not(.crt) .crt-hello { display: none; }

/* desktop */
.crt-desktop { position: absolute; inset: 0; }

.mac-menubar {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 10px;
    background: var(--mac-paper);
    border-bottom: 2px solid var(--mac-ink);
    color: var(--mac-ink);
}
.menu-mark { flex: none; }
.menu-item, .menu-clock {
    font-family: var(--font-pixel);
    font-size: 8px;
    line-height: 1;
}
.menu-clock { margin-left: auto; }

/* windows tile like MacOS: cascade from top-left, every title bar readable */
html.crt .mac-window { position: absolute; }
html.crt .win-1 { top: 7%;  left: 3%;  width: 82%; z-index: 2; }
html.crt .win-2 { top: 15.5%; left: 8%; width: 82%; z-index: 3; }
html.crt .win-3 { top: 24%; left: 13%; width: 82%; z-index: 4; }

html.crt .vig-1 { max-width: 300px; margin: 0 auto; }

/* the Keksi alert arrives below the cascade, clear of every title bar */
.mac-alert {
    position: absolute;
    left: 53%;
    top: 66%;
    translate: -50% -50%;
    width: 62%;
    z-index: 7;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.2s steps(3), transform 0.2s steps(3);
    pointer-events: none;
}
.mac-alert.on { opacity: 1; transform: scale(1); pointer-events: auto; }
.mac-alert.dismissed { opacity: 0; pointer-events: none; }

.alert-body {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    align-items: center;
    padding: 14px 14px 4px;
}
.alert-crumbs { width: 44px; height: 44px; color: var(--mac-ink); }
.alert-crumbs svg { width: 100%; height: 100%; }
.alert-text {
    font-family: var(--font-mono);
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--mac-ink);
}
.alert-actions { display: flex; justify-content: flex-end; padding: 2px 12px 12px; }

html:not(.crt) .mac-alert { display: none; }

/* CRT overlay effects */
.crt-fx { position: absolute; inset: 0; pointer-events: none; z-index: 8; }
.crt-fx::before {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(0deg,
        rgba(20, 30, 20, 0.1) 0 1px, transparent 1px 3px);
}
.crt-fx::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(105% 105% at 50% 50%, transparent 62%, rgba(15, 25, 18, 0.32) 100%);
}
html:not(.crt) .crt-fx { display: none; }

@media (prefers-reduced-motion: no-preference) {
    html.crt .mac-screen { animation: crt-flicker 5.6s steps(60) infinite; }
    @keyframes crt-flicker {
        0%, 100% { filter: brightness(1); }
        7%  { filter: brightness(0.985); }
        8%  { filter: brightness(1.012); }
        36% { filter: brightness(0.99); }
        62% { filter: brightness(1.012); }
        63% { filter: brightness(0.988); }
    }
}

/* face below the screen: badge left, floppy slot right */
.mac-under {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 7% 3% 6.5%;
}

.mac-badge {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: rgba(60, 55, 45, 0.8);
}

.mac-label {
    font-family: var(--font-mono);
    font-size: 10.5px;
    letter-spacing: 0.14em;
    color: rgba(60, 55, 45, 0.75);
}

.mac-floppy {
    position: relative;
    margin-left: auto;
    width: 30%;
    height: 7px;
    background: rgba(45, 40, 32, 0.6);
    border-radius: 4px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.45), 0 1px 0 rgba(255, 255, 255, 0.4);
}

.mac-floppy::before {
    content: "";
    position: absolute;
    inset: -12px -16px;
    background: linear-gradient(180deg, rgba(60, 55, 40, 0.16), rgba(60, 55, 40, 0.05));
    border-radius: 8px;
    box-shadow: inset 0 1px 3px rgba(60, 55, 40, 0.3), 0 1px 0 rgba(255, 255, 255, 0.35);
    z-index: -1;
}

/* bottom band: seam, power LED, switch block */
.mac-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 -5%;
    padding: 4.5% 7% 5.5%;
    border-top: 2px solid rgba(60, 55, 40, 0.18);
}

.mac-led {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #7FD8A0;
    box-shadow: 0 0 6px rgba(127, 216, 160, 0.8);
    opacity: 1;
    transition: opacity 0.3s ease;
}
.mac[data-boot="off"] .mac-led { opacity: 0.18; }

.mac-bottom::after {
    content: "";
    width: 26px;
    height: 16px;
    background: #3B382F;
    border-radius: 3px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5), 0 1px 0 rgba(255, 255, 255, 0.35);
}

/* cookie dock: bottom-right corner of the SCREEN */
.cookie-dock {
    position: absolute;
    right: 3.2%;
    bottom: 4.5%;
    width: 9.5%;
    aspect-ratio: 1;
    pointer-events: none;
}

/* the docked cookie, drawn inside the CRT so scanlines sit on top of it */
.screen-cookie {
    position: absolute;
    right: 3.2%;
    bottom: 4.5%;
    width: 9.5%;
    aspect-ratio: 1;
    color: var(--mac-ink);
    z-index: 6;
    opacity: 0;
}
.screen-cookie.on { opacity: 1; }
.screen-cookie svg { width: 100%; height: 100%; display: block; }

.mac-crumbs {
    position: absolute;
    right: 2%;
    bottom: -26px;
    width: 90px;
    height: 26px;
    color: rgba(233, 240, 235, 0.75);
}
.mac-crumbs svg { width: 100%; height: 100%; }
html:not(.crt) .mac-crumbs { display: none; }

/* -- flow mode (no-JS / narrow / reduced motion): Mac collapses, windows stack -- */
html:not(.crt) .mac-stage { width: 100%; max-width: 560px; margin: 0 auto; }
html:not(.crt) .svc-track { padding: var(--strip-gap) var(--pad) 0; }
html:not(.crt) .mac,
html:not(.crt) .mac-screen-recess,
html:not(.crt) .mac-crt-frame,
html:not(.crt) .mac-screen,
html:not(.crt) .crt-desktop,
html:not(.crt) .svc-stage { display: contents; }
html:not(.crt) .mac-menubar,
html:not(.crt) .cookie-dock,
html:not(.crt) .screen-cookie,
html:not(.crt) .mac-under,
html:not(.crt) .mac-bottom { display: none; }
html:not(.crt) .mac-window {
    display: block;
    margin: 0 auto 2.75rem;
    max-width: 460px;
    rotate: -0.6deg;
}
html:not(.crt) .mac-window:nth-of-type(2) { rotate: 0.8deg; }
/* flow mode shows vignettes in their finished state */
html:not(.crt) .vig-t { opacity: 1; transition: none; }
html:not(.crt) .v2-sel { transform: scale(1); }
html:not(.crt) .v2-r1, html:not(.crt) .v2-r2, html:not(.crt) .v2-r3 { opacity: 1; }
html:not(.crt) .v2-cursor { transform: translate(128px, 48px); }
html:not(.crt) .v3-fill { width: 100%; }
html:not(.crt) .v3-label { opacity: 0.35; }
html:not(.crt) .v3-done { opacity: 1; }

/* ==========================================================================
   PROCESS SKETCH
   ========================================================================== */

.process-strip { max-width: 1180px; }

.graph-sheet {
    width: min(100%, 700px);
    margin-left: auto;
    margin-right: clamp(0px, 4vw, 60px);
    padding: 26px 28px 20px;
    background:
        repeating-linear-gradient(0deg, transparent 0 23px, rgba(76, 118, 182, 0.16) 23px 24px),
        repeating-linear-gradient(90deg, transparent 0 23px, rgba(76, 118, 182, 0.16) 23px 24px),
        var(--paper-warm);
}

.graph-sheet .typed-label { margin-bottom: 8px; }

.process-sticky {
    position: absolute;
    left: clamp(8px, 12vw, 190px);
    bottom: -30px;
    width: 205px;
}

.loop-svg { width: 100%; height: auto; display: block; }

.loop-ink path { fill: none; stroke: var(--pencil); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.loop-red path { fill: none; stroke: var(--redpen); stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; }
.loop-red-thin { stroke: var(--redpen); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.node-t { font-family: var(--font-display); font-weight: 600; font-size: 21px; fill: var(--ink); }
.node-c { font-family: var(--font-hand); font-weight: 600; font-size: 21px; fill: var(--pencil-soft); }
.node-red { font-family: var(--font-hand); font-weight: 700; font-size: 24px; fill: var(--redpen); }

html.js .loop-svg .dr {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    transition: stroke-dashoffset 0.9s cubic-bezier(0.5, 0, 0.3, 1);
}
html.js .loop-ink .dr:nth-of-type(2)  { transition-delay: 0.15s; }
html.js .loop-ink .dr:nth-of-type(3)  { transition-delay: 0.3s; }
html.js .loop-ink .dr:nth-of-type(4)  { transition-delay: 0.45s; }
html.js .loop-ink .dr:nth-of-type(5)  { transition-delay: 0.6s; }
html.js .loop-ink .dr:nth-of-type(6)  { transition-delay: 0.95s; }
html.js .loop-ink .dr:nth-of-type(7)  { transition-delay: 1.05s; }
html.js .loop-ink .dr:nth-of-type(8)  { transition-delay: 1.35s; }
html.js .loop-ink .dr:nth-of-type(9)  { transition-delay: 1.45s; }
html.js .loop-ink .dr:nth-of-type(10) { transition-delay: 1.75s; }
/* labels stay put; only the ink draws in */
html.js .drawn .dr { stroke-dashoffset: 0; }

@media (prefers-reduced-motion: reduce) {
    html.js .loop-svg .dr { stroke-dasharray: none; stroke-dashoffset: 0; transition: none; }
}

/* --- sticky notes --- */
.sticky {
    background: linear-gradient(180deg, #FFF08F 0%, var(--sticky) 60%);
    padding: 22px 20px 26px;
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(10, 20, 16, 0.14), 0 8px 18px rgba(10, 20, 16, 0.2);
}
.sticky::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    width: 26px;
    height: 26px;
    background: linear-gradient(315deg, var(--mat) 48%, rgba(10, 20, 16, 0.16) 50%, rgba(255, 244, 170, 0.9) 54%);
}
.sticky .hand { font-size: 25px; }

/* ==========================================================================
   CASE STUDIES
   ========================================================================== */

.case {
    position: relative;
    min-height: 92vh;
    display: grid;
    align-items: center;
    max-width: none;
    padding: 14vh 0;
}

.case-copy {
    max-width: 460px;
    padding: 0 var(--pad);
    position: relative;
    z-index: 2;
}
.case-copy-right { margin-left: clamp(48%, 52%, 56%); }
.case-copy-left { margin-left: clamp(24px, 10vw, 140px); }

.case-name {
    font-family: var(--font-display);
    font-weight: 750;
    font-size: clamp(2.4rem, 5.4vw, 4.4rem);
    letter-spacing: -0.025em;
    line-height: 1;
    color: rgba(240, 246, 242, 0.96);
    margin-bottom: 1.1rem;
}

.case-line {
    font-style: italic;
    font-size: clamp(1.15rem, 1.9vw, 1.5rem);
    line-height: 1.45;
    color: rgba(222, 234, 228, 0.85);
    margin-bottom: 0.9rem;
}

.case-meta { color: var(--mat-text); margin-bottom: 1.4rem; }

.chip-link {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 12.5px;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-decoration: none;
    border-radius: 999px;
    padding: 6px 15px;
    transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.chip-light {
    color: rgba(230, 240, 235, 0.92);
    border: 1.5px solid rgba(230, 240, 235, 0.5);
}
.chip-light:hover {
    background: var(--paper);
    border-color: var(--paper);
    color: var(--ink);
}

/* devices lying around, partially clipped at the viewport edge */
.case-device {
    position: absolute;
    z-index: 1;
    transform: perspective(900px) rotate(var(--rot, 0deg)) rotateX(var(--tx, 0deg)) rotateY(var(--ty, 0deg));
    transition: transform 0.3s ease-out;
}

.dev-left  { left: clamp(-60px, -2.5vw, -24px); top: 50%; translate: 0 -50%; }
.dev-right { right: clamp(-130px, -5.5vw, -50px); top: 48%; translate: 0 -50%; }
.dev-lying { right: clamp(-60px, -2.5vw, -24px); bottom: -10%; }

.device {
    width: clamp(240px, 22vw, 310px);
    background: #1B1C20;
    border-radius: 44px;
    padding: 13px;
    box-shadow: var(--shadow-lift);
}

.device-screen {
    position: relative;
    aspect-ratio: 1179 / 2552;
    border-radius: 32px;
    overflow: hidden;
    background: #08090B;
}

/* the screen wakes as the device scrolls into view */
.screen-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.9s ease 0.15s;
}
.device.awake .screen-img { opacity: 1; }
html:not(.js) .screen-img { opacity: 1; }

/* Heartforge's shot leaves the island cutout empty — supply the hardware */
.dyn-island {
    position: absolute;
    top: 1.4%;
    left: 50%;
    translate: -50%;
    width: 27%;
    aspect-ratio: 3.55;
    background: #060608;
    border-radius: 999px;
    z-index: 2;
}

/* Questweaver runs on an iPad — at true scale next to the phones */
.device-ipad {
    width: clamp(440px, 52vw, 800px);
    border-radius: 30px;
    padding: 15px;
}
.device-ipad .device-screen {
    aspect-ratio: 1979 / 1483;
    border-radius: 14px;
}

/* ==========================================================================
   DESK PROPS
   ========================================================================== */

.prop { position: absolute; pointer-events: none; }

.tape-scrap {
    width: 180px;
    height: 54px;
    background: var(--tape);
    box-shadow: 0 1px 3px rgba(10, 20, 16, 0.12);
}
.tape-b { top: 10%; left: clamp(-40px, -2vw, -10px); rotate: 76deg; }

.ruler {
    right: -38px;
    top: 44%;
    width: 112px;
    height: 620px;
    background:
        repeating-linear-gradient(0deg, rgba(35, 36, 42, 0.55) 0 2px, transparent 2px 8.3px) 0 8px / 22px calc(100% - 16px) no-repeat,
        repeating-linear-gradient(0deg, rgba(35, 36, 42, 0.7) 0 2.5px, transparent 2.5px 41.3px) 0 8px / 38px calc(100% - 16px) no-repeat,
        linear-gradient(90deg, #E7E2D2, #D9D4C3);
    border-radius: 5px;
    box-shadow: var(--shadow-soft);
    rotate: -2deg;
}

.coffee { left: clamp(0px, 3vw, 56px); top: 18%; width: 400px; }
.coffee svg { width: 100%; height: auto; display: block; }
.wisp {
    stroke: rgba(233, 240, 235, 0.55);
    stroke-width: 3;
    stroke-linecap: round;
    opacity: 0;
}
@media (prefers-reduced-motion: no-preference) {
    .wisp { animation: steam 4.8s ease-in-out infinite; }
    .wisp.w2 { animation-delay: 2.2s; }
    @keyframes steam {
        0%   { opacity: 0; transform: translateY(6px); }
        30%  { opacity: 1; }
        70%  { opacity: 0.2; }
        100% { opacity: 0; transform: translateY(-14px); }
    }
}

/* laid down under the closing line, like an underline */
.pencil {
    position: relative;
    margin: 16px auto -30px;
    width: 640px;
    max-width: 80vw;
    rotate: -3.5deg;
}

/* ==========================================================================
   CONTACT
   ========================================================================== */

.contact { text-align: center; padding-bottom: 0; }

.contact-line {
    font-family: var(--font-display);
    font-weight: 760;
    font-size: clamp(2.6rem, 8vw, 6.75rem);
    line-height: 1;
    letter-spacing: -0.03em;
    color: rgba(240, 246, 242, 0.96);
}

.contact-translation { margin-top: 1.3rem; color: var(--mat-text); }

.mail-chip {
    display: inline-block;
    margin-top: 3rem;
    padding: 22px 44px 20px;
    text-decoration: none;
    text-align: center;
    background: linear-gradient(170deg, #FFFEFA 0%, var(--paper) 85%);
    border-radius: 6px;
}
.mail-chip-kicker {
    display: block;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.22em;
    color: var(--redpen);
    margin-bottom: 6px;
}
.mail-chip-addr {
    display: block;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(20px, 2.6vw, 27px);
    letter-spacing: -0.01em;
    color: var(--ink);
}
.mail-chip:hover { box-shadow: var(--shadow-lift); }

/* the cookie, retired to pseudo-logo duty */
.contact-cookie {
    width: 40px;
    aspect-ratio: 1;
    margin: 4rem auto 0;
    color: rgba(236, 243, 239, 0.92);
}
.contact-cookie svg { width: 100%; height: 100%; display: block; }
html:not(.js) .contact-cookie { display: none; }

.footer {
    margin-top: var(--strip-gap);
    padding-bottom: 40px;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: var(--mat-text-dim);
}

/* ==========================================================================
   THE FLYING COOKIE
   ========================================================================== */

.cookie-fly {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 60;
    width: 34px;
    aspect-ratio: 1;
    pointer-events: none;
    color: var(--cobalt);
    opacity: 0;
    will-change: transform;
    transition: color 0.6s ease, opacity 0.4s ease;
}
.cookie-fly.show { opacity: 1; }
.cookie-fly.on-mat { color: #EDF3EF; }
.cookie-fly.inked { color: var(--mac-ink); }
.cookie-fly svg { width: 100%; height: 100%; display: block; }

/* it arrives as a real cookie, and digitizes on its way to the CRT */
.fly-emoji {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    line-height: 1;
    user-select: none;
}
.fly-px { position: absolute; inset: 0; }

html:not(.crt) .cookie-fly { display: none; }

/* when the flight is on, the ı carries no dot of its own */
html.crt .lt-ins { font-feature-settings: normal; }

/* ==========================================================================
   Reveals
   ========================================================================== */

@media (prefers-reduced-motion: no-preference) {
    @supports (animation-timeline: view()) {
        .rv {
            animation: settle-in both;
            animation-timeline: view();
            animation-range: entry 5% entry 50%;
        }
    }
    html.no-sda .rv {
        opacity: 0;
        transform: translateY(30px) rotate(1.5deg);
        transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
    }
    html.no-sda .rv.in-view { opacity: 1; transform: none; }

    @keyframes settle-in {
        from { opacity: 0; transform: translateY(30px) rotate(1.5deg); }
        to   { opacity: 1; transform: none; }
    }
}

/* case devices keep their tilt transform — exclude them from the .rv transform system */
.case-device.rv {
    animation: none;
    opacity: 1;
    transform: perspective(900px) rotate(var(--rot, 0deg)) rotateX(var(--tx, 0deg)) rotateY(var(--ty, 0deg));
    transition: transform 0.3s ease-out;
}
html.no-sda .case-device.rv { opacity: 1; transform: perspective(900px) rotate(var(--rot, 0deg)) rotateX(var(--tx, 0deg)) rotateY(var(--ty, 0deg)); }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    html.js .hero-word:not(.open) .lt-pre,
    html.js .hero-word:not(.open) .lt-post { transform: none; }
    html.js .hero-word:not(.open) .lt-ins  { opacity: 1; transform: none; }
    .hero-word .lt, .hero-word .lt-ins { transition: none; }
    .case-device { transition: none; }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 900px) {
    .defrow { grid-template-columns: 1fr; gap: 1.1rem; justify-items: center; }
    .defcol { text-align: center; }
    .case { min-height: auto; padding: 16vh 0 10vh; }
    .case-copy-right, .case-copy-left { margin: 0 auto; padding: 0 var(--pad); }
    .case-device { position: relative; margin: 0 0 3rem; }
    .dev-left  { left: -60px; top: auto; translate: none; }
    .dev-right { right: auto; left: 46%; top: auto; translate: none; }
    .dev-lying { right: -70px; left: auto; bottom: auto; margin-left: auto; }
    .device { width: min(66vw, 270px); }
    .device-ipad { width: min(94vw, 430px); }
    .ruler, .coffee { display: none; }
    .pencil { margin: 10px auto -18px; }
    .intro-card { margin-left: 0; }
    .graph-sheet { margin-right: auto; margin-left: auto; }
    .process-sticky { position: relative; left: auto; bottom: auto; margin: 1.5rem 0 0 auto; }
}

@media (max-width: 720px) {
    :root { --scale-drop: 0.5; }
    .footer { padding-bottom: 32px; }
}
