/* =========================================================
   LA MAISON · Design system
   0. Fonts  1. Tokens  2. Base  3. Typography  4. Signatures
   ========================================================= */

/* 0. FONTS: served by the house itself, not by Google.
   The three families are the same files Google serves - the Latin subset,
   which holds every letter French needs (é, è, à, ç, œ, «») - taken from
   Fontsource 5.3.0 and kept in assets/fonts with their licences (all three
   are under the SIL Open Font License, which allows exactly this, provided
   the licence travels with the files: OFL-*.txt beside them).

   Why: a page that fetches its fonts from Google tells Google about every
   visitor, waits on a second and third connection before the headline can
   be drawn, and cannot keep a strict security policy - `font-src 'self'`
   and `style-src 'self'` are only possible once nothing comes from outside.
   unicode-range is the subset's own: a character outside it (an arrow, a
   cross) is drawn by the system font, and the file is never fetched for it.
   font-display: swap - the text is readable at once in the fallback and
   changes face when the file lands; the headline's face is preloaded in
   each page's <head> so that change is rarely seen. */
@font-face {
  font-family: "Instrument Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/instrument-serif-400.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Instrument Serif";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/instrument-serif-400-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/inter-400.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../assets/fonts/inter-500.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../assets/fonts/inter-700.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/jetbrains-mono-400.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../assets/fonts/jetbrains-mono-500.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* 1. TOKENS: every colour, font and space lives here */
:root {
  /* The stage */
  --black:          #070A09;
  --surface:        #0C1210;
  --surface-raised: #111A17;

  /* Premium: depth, never small text */
  --racing-green:   #004225;
  --green-glow:     #0B5A3A;

  /* Signal: only what is alive or clickable */
  --cyan:           #33E1ED;

  /* Paper and ornament */
  --bone:           #E9E6DE;
  --bone-muted:     #9AA39E;
  --brass:          #B8955A;
  --brass-light:    #E2C58F;
  --brass-dark:     #6E5630;
  --brass-deep:     #33270F;
  --paper:          #F1EDE4;
  --paper-shade:    #D9D3C5;
  --ink:            #23241F;

  --line:           rgba(233, 230, 222, 0.12);

  /* Type */
  --font-display: "Instrument Serif", Georgia, serif;
  --font-body:    "Inter", system-ui, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, monospace;

  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   clamp(1.125rem, 1rem + 0.5vw, 1.375rem);
  --text-xl:   clamp(2rem, 1.5rem + 2vw, 3rem);
  --text-hero: clamp(3.1rem, min(0.9rem + 8.6vw, 13vh), 9rem);

  /* Space: one scale for the whole house */
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --space-5: 4rem;
  --space-6: 7rem;

  --container: 72rem;
  --radius: 2px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* Motion: three speeds, and a second curve for the pen */
  --quick: 0.25s;   /* it answers: hover, focus, a border waking up */
  --base:  0.45s;   /* it moves: a card lifting, a dialog arriving */
  --slow:  1.4s;    /* it performs: the scan, the ink, the drawing */

  /* --ease arrives: it eases out hard, which is right for a thing that
     appears. A drawn line does not appear - a hand draws it, and a hand
     starts and stops. Used only by strokes that draw themselves; give it the
     same value as --ease to put the whole house back on one curve. */
  --ease-pen: cubic-bezier(0.37, 0, 0.63, 1);

  /* A line that draws itself is a lit line: a tight bone core and a wide
     cool halo around it. One value, so every drawing in the house tunes
     from one place - raise the two alphas for more, drop them for less. */
  --lit-line:
    drop-shadow(0 0 1.5px rgb(233 230 222 / 0.55))
    drop-shadow(0 0 9px   rgb(51 225 237 / 0.2));
}

/* 2. BASE */
*, *::before, *::after { box-sizing: border-box; }

* { margin: 0; }

html {
  color-scheme: dark;
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  background: var(--black);
  color: var(--bone);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; height: auto; }

a { color: var(--cyan); text-underline-offset: 0.2em; }

::selection { background: var(--racing-green); color: var(--bone); }

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

.skip-link {
  position: absolute;
  left: var(--space-2);
  top: -100%;
  padding: var(--space-1) var(--space-2);
  background: var(--cyan);
  color: var(--black);
  z-index: 1000;
}
.skip-link:focus { top: var(--space-2); }

/* 3. TYPOGRAPHY */
h1, h2 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.01em;
}
h1 { font-size: var(--text-hero); }
h2 { font-size: var(--text-xl); }
h1 em { color: var(--brass); }

/* A room's emphasised word reads as the brightest word in its heading,
   not the dimmest: brass light, the same metal as the lit headline. */
h2 em { color: var(--brass-light); }

h3, h4 { font-weight: 500; line-height: 1.3; }

p { max-width: 65ch; }

.eyebrow, .room-number, .timeline-date, .modal-meta {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  letter-spacing: 0.04em;
  color: var(--bone-muted);
}

/* 4. SIGNATURES */

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

/* 4b. MOTION: how a drawing plays itself

   A drawing that draws itself is told WHEN to start by the page, and how
   fast to go by the clock. js/script.js watches for it arriving and writes
   two classes onto its <svg>; nothing else in the house touches them:

     .is-armed    the start state - strokes undrawn, lights off. Only a
                  script ever adds it, so a visitor with no JavaScript, or a
                  browser with no IntersectionObserver, is left with the
                  finished drawing rather than an empty frame.
     .is-drawing  it is on screen: play the beats. Taking the class off puts
                  the drawing back to its start state, and that is what lets
                  it draw itself again the next time it arrives.

   The beats are SECONDS FROM ARRIVAL, not positions in the page. The first
   version gave each drawing a view-timeline, which tied the stroke to the
   scroll: the reader who stopped to look at the car was the one left holding
   half a car. It also only ever ran in Chrome - Firefox and Safari were
   shown the finished drawing and never the drawing of it. Plain CSS
   animation runs everywhere.

   Two things to know when a new drawing joins:
     * a line that draws itself needs pathLength="1" on the path, so that one
       unit of dash is its whole length whatever the shape measures - and
       never on a dashed line. scripts/sheet.py is the only place that
       writes that attribute.
     * a part that already carries an animation needs it switched off while
       armed (`animation: none`), or that animation paints straight over the
       start state: an animated property beats a plain declaration however
       specific the declaration is. The Grounds' lit window is the one that
       does, because it breathes. */

@keyframes draw-line {
  from { stroke-dashoffset: 1; }
  to   { stroke-dashoffset: 0; }
}

@keyframes arrive {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* The glow is the last beat, and never one of the first.

   Which lines are lit is a rule rather than a list: the lit lines are
   exactly the lines that draw themselves - the ones carrying pathLength.
   The construction lines are cyan and dashed, and the fine detail is there
   to stay quiet; lighting either flattens the drawing into one bright mass.

   It comes up WITH that drawing's own light - the coupe's headlamp, the
   Grounds' window - so the whole sheet comes alive on one beat. That is
   also what keeps it cheap. A filter that changes while the dash is still
   moving re-rasterises every path on every frame: measured on the Grounds,
   where 32 lines draw at once, the glow carried through the stroke costs
   about 25ms a frame on a soft renderer, and waiting for the stroke to land
   costs 17ms. The drawing is static by the time the light reaches it. */
@keyframes lines-lit {
  from { filter: none; }
  to   { filter: var(--lit-line); }
}

/* 5. ROOMS: the blueprint every section follows */
.room {
  position: relative;
  max-width: var(--container);
  margin-inline: auto;
  /* More air above a room's heading than below its last piece, so a
     heading reads as the start of what follows rather than the end of what
     came before; and both scale with the screen's height, so a short
     laptop does not spend a third of every screen on the gaps. */
  padding:
    clamp(4.5rem, 10vh, var(--space-6)) var(--space-3)
    clamp(3rem, 6vh, 4.5rem);
}

/* The one guard against sideways scroll, for the whole house. The rooms'
   light runs to the screen's edges, and some drawings run past their room
   on purpose - the coupé's line, the pawn's lamp glow, the quill off the
   paper. They used to be clipped room by room, which also cut each room's
   light off at the column as a hard edge. Clipped here, at the screen's
   sides instead. clip, not hidden, so main never becomes a scroll box
   (and nothing sticky inside it stops sticking); hidden is the fallback
   for the few browsers without clip. */
main {
  overflow-x: hidden;
  overflow-x: clip;
}

/* The house's light. One field for the whole page, fixed to the screen
   rather than to any room, so it can never end at a room's edge: the brass
   lamp up and to the left, the racing green rising from the floor on the
   left and pooling on the right. It stays put while the rooms pass through
   it, the way a room's light stays put as you walk across it.

   Every glow fades on an eased curve, not a straight line. A straight fade
   to transparent stops at a point, and on black the eye finds that point
   as an edge; a curve that flattens out as it reaches zero leaves nothing
   to find. The stops are worked out once and written out here.

   On top of the field, only the two things that carry a light of their own
   get a glow of their own, small and held inside the column: the orrery's
   brass core and the lamp on the Study's letter. Each is placed in pixels
   from its room's top, so a block added above the object moves it: the
   letter's sits lower since "how I work" came before it. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 75vw 70vh at 0% 0%, rgb(226 197 143 / 0.085) 0%, rgb(226 197 143 / 0.073) 14%, rgb(226 197 143 / 0.056) 28%, rgb(226 197 143 / 0.038) 42%, rgb(226 197 143 / 0.023) 56%, rgb(226 197 143 / 0.011) 70%, rgb(226 197 143 / 0.003) 84%, rgb(226 197 143 / 0.000) 100%),
    radial-gradient(ellipse 85vw 75vh at 18% 100%, rgb(11 90 58 / 0.340) 0%, rgb(11 90 58 / 0.292) 14%, rgb(11 90 58 / 0.224) 28%, rgb(11 90 58 / 0.153) 42%, rgb(11 90 58 / 0.092) 56%, rgb(11 90 58 / 0.044) 70%, rgb(11 90 58 / 0.014) 84%, rgb(11 90 58 / 0.000) 100%),
    radial-gradient(ellipse 65vw 80vh at 100% 55%, rgb(0 66 37 / 0.300) 0%, rgb(0 66 37 / 0.258) 14%, rgb(0 66 37 / 0.198) 28%, rgb(0 66 37 / 0.135) 42%, rgb(0 66 37 / 0.081) 56%, rgb(0 66 37 / 0.039) 70%, rgb(0 66 37 / 0.012) 84%, rgb(0 66 37 / 0.000) 100%);
}

.library::before,
.study::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

.library::before {
  background:
    radial-gradient(ellipse 520px 380px at 36% 1650px, rgb(184 149 90 / 0.140) 0%, rgb(184 149 90 / 0.120) 14%, rgb(184 149 90 / 0.092) 28%, rgb(184 149 90 / 0.063) 42%, rgb(184 149 90 / 0.038) 56%, rgb(184 149 90 / 0.018) 70%, rgb(184 149 90 / 0.006) 84%, rgb(184 149 90 / 0.000) 100%);
}

.study::before {
  background:
    radial-gradient(ellipse 560px 420px at 30% 1010px, rgb(184 149 90 / 0.110) 0%, rgb(184 149 90 / 0.095) 14%, rgb(184 149 90 / 0.073) 28%, rgb(184 149 90 / 0.050) 42%, rgb(184 149 90 / 0.030) 56%, rgb(184 149 90 / 0.014) 70%, rgb(184 149 90 / 0.004) 84%, rgb(184 149 90 / 0.000) 100%);
}

.room-header { margin-bottom: var(--space-4); }

.room-number {
  color: var(--brass);
  margin-bottom: var(--space-1);
}

.room-header::after {
  content: "";
  display: block;
  width: 4rem;
  height: 6px;
  margin-top: var(--space-3);
  background:
    linear-gradient(var(--cyan), var(--cyan)) bottom / 100% 1px no-repeat,
    var(--racing-green);
}

/* 6. HEADER */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: rgb(7 10 9 / 0.8);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.logo {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--brass);
  text-decoration: none;
}

.site-header nav { margin-left: auto; }

.site-header ul {
  display: flex;
  gap: var(--space-3);
  list-style: none;
  padding: 0;
}

.site-header nav a {
  position: relative;
  color: var(--bone);
  text-decoration: none;
  font-size: var(--text-sm);
}

.nav-room {
  font-family: var(--font-mono);
  color: var(--bone-muted);
}

/* The racing stripe slides in under the link */
.site-header nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -8px;
  height: 3px;
  background:
    linear-gradient(var(--cyan), var(--cyan)) bottom / 100% 1px no-repeat,
    var(--racing-green);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--base) var(--ease);
}

.site-header nav a:hover::after,
.site-header nav a:focus-visible::after {
  transform: scaleX(1);
}

.lang-toggle,
.sound-toggle {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--bone);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.25rem 0.6rem;
  cursor: pointer;
}

.lang-toggle:hover,
.sound-toggle:hover { border-color: var(--brass); color: var(--brass); }

/* The voice's switch. A dot says what state it is in: hollow while it waits
   for the visitor's first gesture, filled cyan once it is live - cyan,
   because live is what cyan means here. Muted, the word is struck through. */
.sound-toggle::before {
  content: "";
  display: inline-block;
  width: 0.4em;
  height: 0.4em;
  margin-right: 0.45em;
  vertical-align: 0.12em;
  border: 1px solid var(--cyan);
  border-radius: 50%;
}

.sound-toggle[data-state="on"]::before { background: var(--cyan); }
.sound-toggle[data-state="off"]::before { display: none; }

.sound-toggle[data-state="off"] {
  color: var(--bone-muted);
  text-decoration: line-through;
  text-decoration-color: var(--brass);
}

.sound-toggle[hidden] { display: none; }

@media (scripting: none) {
  .sound-toggle { display: none; }
}

/* In the salon the switch is his headset: on, its brass lines light. */
[data-sound="on"] .vigil-brass {
  fill: var(--brass-light);
  filter: drop-shadow(0 0 3px rgb(226 197 143 / 0.9));
}

/* 7. BUTTONS */
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: 2rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  padding: 0.85rem 1.4rem;
  font-weight: 500;
  text-decoration: none;
  border-radius: var(--radius);
  transition:
    background-color var(--quick) var(--ease),
    border-color var(--quick) var(--ease),
    color var(--quick) var(--ease),
    box-shadow var(--quick) var(--ease);
}

/* The one thing on a screen you most want pressed is the brightest shape
   on it: lit brass, black words, and the cyan signal line underneath that
   says it is alive. Racing green against black was 1.71 : 1 - the button's
   words read, but its shape sank into the page. Brass light is 11.9 : 1. */
.btn-primary {
  background: var(--brass-light);
  color: var(--black);
  box-shadow:
    inset 0 -2px 0 var(--cyan),
    0 12px 32px -14px rgb(226 197 143 / 0.55);
}

.btn-primary:hover {
  background: var(--bone);
  box-shadow:
    inset 0 -2px 0 var(--cyan),
    0 14px 40px -12px rgb(226 197 143 / 0.7);
}

.btn-ghost {
  color: var(--bone);
  border: 1px solid rgb(233 230 222 / 0.28);
}

.btn-ghost:hover { border-color: var(--brass-light); color: var(--brass-light); }

/* 8. THE FOYER */
.foyer {
  position: relative;
  display: grid;
  gap: var(--space-5);
  align-items: center;
  min-height: calc(100svh - 4.5rem);
  padding-block: var(--space-4) var(--space-5);
}

/* The Foyer is the one room wider than the house's column: the headline
   needs the width to be big, and the first screen is where the house has
   to land. Every room after it returns to the column. */
.foyer { max-width: 86rem; }

@media (min-width: 900px) {
  .foyer { grid-template-columns: 1.4fr 1fr; }
}

/* Blueprint grid, fading out at the edges */
.foyer::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse at 40% 45%, #000 15%, transparent 70%);
  mask-image: radial-gradient(ellipse at 40% 45%, #000 15%, transparent 70%);
}

/* The Foyer's light, on top of the house's (section 5): the racing green
   gathers behind the words, and a little of the lamp's brass warms the
   wall behind the portrait. Both fade out well inside the Foyer, so it
   hands over to the next room without a line. */

.foyer::after {
  content: "";
  position: absolute;
  inset: 0 calc(50% - 50vw);
  z-index: -1;
  background:
    radial-gradient(ellipse 42% 48% at 24% 50%, rgb(11 90 58 / 0.420) 0%, rgb(11 90 58 / 0.361) 14%, rgb(11 90 58 / 0.277) 28%, rgb(11 90 58 / 0.189) 42%, rgb(11 90 58 / 0.113) 56%, rgb(11 90 58 / 0.055) 70%, rgb(11 90 58 / 0.017) 84%, rgb(11 90 58 / 0.000) 100%),
    radial-gradient(ellipse 26% 40% at 76% 52%, rgb(184 149 90 / 0.100) 0%, rgb(184 149 90 / 0.086) 14%, rgb(184 149 90 / 0.066) 28%, rgb(184 149 90 / 0.045) 42%, rgb(184 149 90 / 0.027) 56%, rgb(184 149 90 / 0.013) 70%, rgb(184 149 90 / 0.004) 84%, rgb(184 149 90 / 0.000) 100%);
}

.eyebrow { margin-bottom: var(--space-3); }

/* The house waking: three mono lines above the eyebrow, each one computed
   and so each one true - tonight's moon, the language and why it was chosen,
   and the house itself. js/script.js types them once per visit; on any later
   page of the visit, and for visitors who prefer stillness, they are simply
   there.

   The block holds the height of its three lines from the first paint, while
   it is still empty. The text column is centred in the room, so a block that
   arrived late would push the headline down as it came: reserving the space
   is what lets the typing never move anything. With no script there is
   nothing true to show, and the block is not in the page at all. */
.boot { margin-bottom: var(--space-2); }

@media (scripting: none) {
  .boot { display: none; }
}

.boot-line {
  max-width: none;
  min-height: 1.7em;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.7;
  letter-spacing: 0.06em;
  color: var(--bone-muted);
  white-space: pre;
  overflow: hidden;
  text-overflow: ellipsis;
}

.boot-prompt { color: var(--brass); visibility: hidden; }
.boot-line.is-on .boot-prompt { visibility: visible; }
.boot-value { color: var(--bone); }

/* The last line says the house is awake, which is to say live: cyan. */
.boot-line:last-child .boot-value { color: var(--cyan); }

.boot-cursor {
  display: inline-block;
  width: 0.55em;
  height: 1.05em;
  margin-left: 0.15em;
  vertical-align: -0.18em;
  background: var(--cyan);
  animation: boot-blink 1s steps(1, end) infinite;
}

/* Once the last line lands the cursor blinks a moment longer and goes: a
   cursor left blinking forever is motion beside the headline for nothing. */
.boot-cursor.is-done {
  animation:
    boot-blink 1s steps(1, end) infinite,
    boot-out 0.5s var(--ease) 1.4s forwards;
}

@keyframes boot-blink { 50% { opacity: 0; } }
@keyframes boot-out   { to { opacity: 0; visibility: hidden; } }

.foyer .lead {
  margin-top: var(--space-3);
  font-size: var(--text-lg);
  color: rgb(233 230 222 / 0.82);
}

/* Who, before what: the name a recruiter looks for first, then the role. */
.foyer-id {
  max-width: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 1rem;
}

.foyer-name {
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--bone);
}

.foyer-role {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
}

.foyer-role::before {
  content: "";
  width: 1.75rem;
  height: 1px;
  background: var(--brass);
}

/* On a phone the role takes its own line, and a rule leading nowhere would
   only push it into two. */
@media (max-width: 599px) {
  .foyer-role { font-size: 0.74rem; letter-spacing: 0.02em; }
  .foyer-role::before { display: none; }
}

/* Big, and set close: at this size the serif's own spacing reads loose. */
.foyer h1 {
  line-height: 0.98;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

/* The French says the same thing in about 40% more letters: set a size
   down so it takes the same room, not two more lines. */
:lang(fr) .foyer h1 { font-size: calc(var(--text-hero) * 0.8); }

/* The accent word is the brightest word on the screen. It starts as the
   brass every room uses; when the boot sequence says the house is awake,
   a cyan scan passes along it and leaves it lit. The scan is one gradient
   clipped to the letters - lit brass, a cyan band, plain brass - slid
   across the word, so the light follows the band. The padding gives the
   italic's overhang room inside the painted box, and the margin takes the
   same room back so nothing moves. */
.foyer h1 em {
  padding-inline: 0.06em 0.14em;
  margin-inline: -0.06em -0.14em;
  color: var(--brass);
  background-image: linear-gradient(100deg,
    var(--brass-light) 0 44%,
    var(--bone) 47.5%, var(--cyan) 49%, var(--bone) 50.5%,
    var(--brass) 54% 100%);
  background-size: 320% 100%;
  background-position: 100% 0;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  transition: filter 1.2s var(--ease) 0.4s;
}

.foyer.is-awake h1 em {
  background-position: 0 0;
  filter: drop-shadow(0 0 0.2em rgb(226 197 143 / 0.42));
}

/* With no script there is no boot to wait for: the word is simply lit. */
@media (scripting: none) {
  .foyer h1 em {
    background-position: 0 0;
    filter: drop-shadow(0 0 0.2em rgb(226 197 143 / 0.42));
  }
}

/* The CV, one move away, in the visitor's language. */
.hero-cv {
  align-self: center;
  padding: 0.85rem 0.25rem;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  letter-spacing: 0.06em;
  color: var(--cyan);
  text-decoration: none;
}

.hero-cv::before { content: "\2193\00a0" / ""; }
.hero-cv:hover span { text-decoration: underline; }

/* What I am open to, with the same live light the projects use. */
.foyer-status {
  max-width: none;
  margin-top: var(--space-3);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: rgb(233 230 222 / 0.82);
}

/* The entrance: once, on arrival. The name and the headline come first -
   the headline printed top to bottom as it settles, the way the boot lines
   above it print - then the reasons, then the doors. Clip and transform
   only on the headline, never opacity, so it counts as painted the moment
   it starts and the page's largest paint is not held back. */
@media (prefers-reduced-motion: no-preference) {
  .foyer-id,
  .foyer .lead,
  .hero-actions,
  .foyer-status {
    animation: hero-rise 0.9s var(--ease) both;
  }

  .foyer-id     { animation-delay: 0.05s; }
  .foyer .lead  { animation-delay: 0.45s; }
  .hero-actions { animation-delay: 0.6s; }
  .foyer-status { animation-delay: 0.75s; }

  .foyer h1 {
    animation: hero-print 1.15s var(--ease) 0.1s both;
  }

  .foyer.is-awake h1 em {
    animation: secure-scan 1.1s var(--ease-pen) both;
  }
}

@keyframes hero-rise {
  from { opacity: 0; transform: translateY(14px); }
}

@keyframes hero-print {
  from {
    transform: translateY(0.3em);
    clip-path: inset(0 -0.5em 100% -0.5em);
  }
  to {
    transform: none;
    clip-path: inset(-0.5em);
  }
}

@keyframes secure-scan {
  from { background-position: 100% 0; }
  to   { background-position: 0 0; }
}

/* The portrait: inverted, warmed, blended, revealed */
.portrait {
  position: relative;
  margin: 0;
  justify-self: center;
  max-width: 30rem;
}

/* The mount: warm paper, lit from above, double brass rule */
.portrait-frame {
  padding: var(--space-3);
  background: linear-gradient(to bottom, #F1EDE4, #D9D3C5);
  border: 1px solid var(--brass);
  outline: 1px solid var(--brass);
  outline-offset: 6px;
  /* lifted off the wall, catching the lamp on its upper left edge */
  box-shadow:
    0 30px 60px -20px rgb(0 0 0 / 0.8),
    -30px -30px 120px rgb(226 197 143 / 0.16),
    0 0 200px rgb(11 90 58 / 0.3);
}

.portrait-frame > img {
  mix-blend-mode: multiply;
  -webkit-mask-image: linear-gradient(to bottom, #000 40%, transparent 60%);
  mask-image: linear-gradient(to bottom, #000 40%, transparent 60%);
  -webkit-mask-size: 100% 300%;
  mask-size: 100% 300%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  animation: ink-reveal 1.8s var(--ease) 0.2s both;
}

@keyframes ink-reveal {
  from { -webkit-mask-position: 0 100%; mask-position: 0 100%; }
  to   { -webkit-mask-position: 0 0;    mask-position: 0 0; }
}

/* Two worlds: hover the portrait to scan into the negative */
.portrait-frame {
  position: relative;
  cursor: crosshair;
}

.portrait-scan {
  position: absolute;
  inset: 0;
  padding: var(--space-3);
  background: var(--black);
  clip-path: inset(0 0 100% 0);
  transition: clip-path var(--slow) var(--ease);
}

.portrait-scan img {
  filter: invert(1) sepia(0.15);
  mix-blend-mode: screen;
}

/* The scan line */
.portrait-frame::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan), 0 0 24px var(--cyan);
  opacity: 0;
  transition: top var(--slow) var(--ease), opacity var(--quick);
}

.portrait-frame:hover .portrait-scan { clip-path: inset(0); }

.portrait-frame:hover::after {
  top: calc(100% - 2px);
  opacity: 1;
}

.plaque {
  display: inline-grid;
  margin-top: var(--space-2);
  padding-top: var(--space-1);
  border-top: 1px solid var(--brass);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brass);
}

/* The plaque reads the scan */
.plaque {
  transition: border-color var(--base);
}

.plaque > span {
  grid-area: 1 / 1;
  transition: opacity var(--base);
}

.plaque-scan {
  opacity: 0;
  color: var(--cyan);
}

.portrait:has(.portrait-frame:hover) .plaque {
  border-color: var(--cyan);
}

.portrait:has(.portrait-frame:hover) .plaque-paper { opacity: 0; }

.portrait:has(.portrait-frame:hover) .plaque-scan { opacity: 1; }

.portrait:has(.portrait-frame:hover) .plaque > span {
  transition-delay: var(--base);
}

/* 9. THE GARAGE */

/* Utility: hidden visually, still read by screen readers */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.section-intro {
  color: var(--bone-muted);
  margin-bottom: var(--space-4);
}

.project-grid {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
}

.project-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-3) var(--space-3);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform var(--base) var(--ease), border-color var(--base) var(--ease);
}

/* Content sits above the light */
.project-card > * {
  position: relative;
  z-index: 1;
}

/* Racing stripe along the top of every bay */
.project-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background:
    linear-gradient(var(--cyan), var(--cyan)) bottom / 100% 1px no-repeat,
    var(--racing-green);
}

/* The garage light. JavaScript will make it follow the cursor */
.project-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(28rem circle at var(--x, 50%) var(--y, -10%), rgb(11 90 58 / 0.35), transparent 60%);
  opacity: 0;
  transition: opacity var(--base) var(--ease);
  pointer-events: none;
}

.project-card:hover {
  transform: translateY(-4px);
  border-color: rgb(184 149 90 / 0.45);
}

.project-card:hover::after { opacity: 1; }

.bay-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brass);
}

.project-card h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 2rem;
  line-height: 1.1;
}

.project-card--featured h3 {
  font-size: clamp(2.25rem, 1.5rem + 2vw, 3rem);
}

.project-card > p:not(.bay-label) { color: var(--bone-muted); }

/* The brass spec plate, with a screw in each corner */
.spec-plate {
  margin-top: var(--space-1);
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  border: 1px solid rgb(184 149 90 / 0.5);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 7px 7px, var(--brass) 1.5px, transparent 2px),
    radial-gradient(circle at calc(100% - 7px) 7px, var(--brass) 1.5px, transparent 2px),
    radial-gradient(circle at 7px calc(100% - 7px), var(--brass) 1.5px, transparent 2px),
    radial-gradient(circle at calc(100% - 7px) calc(100% - 7px), var(--brass) 1.5px, transparent 2px),
    linear-gradient(135deg, rgb(184 149 90 / 0.12), rgb(184 149 90 / 0.03));
}

/* Each row: label ........ value */
.spec-plate div {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  gap: 0.5rem;
}

.spec-plate div + div { margin-top: 0.3rem; }

.spec-plate dt {
  order: 1;
  color: var(--bone-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.spec-plate div::after {
  content: "";
  order: 2;
  border-bottom: 1px dotted rgb(184 149 90 / 0.5);
  transform: translateY(-0.25em);
}

.spec-plate dd {
  order: 3;
  color: var(--bone);
  text-align: right;
}

/* The status light */
.status-dot {
  position: relative;
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  margin-right: 0.5rem;
  border-radius: 50%;
  background: var(--cyan);
  vertical-align: middle;
}

.status-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: inherit;
  animation: status-pulse 2.4s var(--ease) infinite;
}

.status-dot--dev { background: var(--brass); }
.status-dot--dev::after { animation: none; }

@keyframes status-pulse {
  from { transform: scale(1); opacity: 0.7; }
  to   { transform: scale(3); opacity: 0; }
}

/* View details → */
.card-btn {
  margin-top: auto;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: var(--space-1) 0;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--cyan);
  background: none;
  border: none;
  cursor: pointer;
}

.card-btn::after {
  content: "→";
  transition: transform var(--quick) var(--ease);
}

.card-btn:hover::after,
.card-btn:focus-visible::after { transform: translateX(4px); }

/* The flagship gets a double bay on wide screens */
@media (min-width: 900px) {
  .project-card--featured {
    grid-column: span 2;
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    column-gap: var(--space-4);
    row-gap: var(--space-2);
    align-content: center;
  }

  .project-card--featured > :not(.spec-plate) { grid-column: 1; }

  .project-card--featured .spec-plate {
    grid-column: 2;
    grid-row: 1 / span 4;
    align-self: center;
    margin-top: 0;
  }
}

/* On a phone five cards one under another are five screens of scrolling
   before the Library - the same reason the Gallery's main wall becomes a
   strip there. So the bays become a row you swipe along, each card most of
   the screen's width and the next one showing at the edge, so it is plain
   there is more. */
@media (max-width: 40rem) {
  .project-grid {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 86%;
    margin-inline: calc(var(--space-2) * -1);
    padding: var(--space-1) var(--space-2) var(--space-3);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--space-2);
    scrollbar-width: none;
  }

  .project-card { scroll-snap-align: start; }
}

/* 9c. THE BAYS: roller doors over the showroom (built by js/script.js on a
   wide screen; a phone keeps the swipe strip, a page without a script the
   grid). The doors are drawn here, not in a picture: a shutter of slats
   rolls up over the bay, and inside is the car - the project's own screen,
   dimmed until its door is open. */
.bay-doors {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.bay-door {
  display: grid;
  gap: 0.55rem;
  padding: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  background: none;
  border: 0;
  cursor: pointer;
}

.bay-door:focus-visible { outline: 2px solid var(--cyan); outline-offset: 6px; }

/* the lintel: brass, with the bay's number and its light */
.bay-plate {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-bottom: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: var(--brass);
  border-bottom: 2px solid var(--brass-dark);
}

.bay-plate .status-dot { margin-right: 0; }

.bay-opening {
  position: relative;
  display: block;
  aspect-ratio: 16 / 11;
  overflow: hidden;
  background: #050706;
  border: 1px solid var(--line);
  border-top: 0;
}

/* inside: the project, lit from above, dim until the door is up */
.bay-inside {
  position: absolute;
  inset: 0;
  background-color: var(--surface);
  background-size: cover;
  background-position: top center;
  filter: brightness(0.5) saturate(0.7);
  transition: filter var(--slow) var(--ease);
}

.bay-inside::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 60% at 50% 0%, rgb(226 197 143 / 0.18), transparent 70%);
}

.bay-inside--plans {
  background:
    linear-gradient(rgb(51 225 237 / 0.08) 1px, transparent 1px) 0 0 / 14px 14px,
    linear-gradient(90deg, rgb(51 225 237 / 0.08) 1px, transparent 1px) 0 0 / 14px 14px,
    var(--surface);
}

/* the shutter: slats, a darker joint between each, a brass handle at its
   foot. 0.7s to roll fully up: a rhythm of character. */
.bay-shutter {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, transparent calc(100% - 5px), rgb(0 0 0 / 0.55)),
    repeating-linear-gradient(to bottom, #222a26 0 8px, #303a35 8px 9px, #151b18 9px 11px);
  transition: transform 0.7s var(--ease);
}

.bay-shutter::after {
  content: "";
  position: absolute;
  left: 42%;
  right: 42%;
  bottom: 9px;
  height: 3px;
  border-radius: 2px;
  background: var(--brass);
}

.bay-name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  line-height: 1.15;
  color: var(--bone-muted);
  transition: color var(--base) var(--ease);
}

/* under the pointer the door lifts a hand's breadth and its light gets out */
.bay-door:hover .bay-shutter,
.bay-door:focus-visible .bay-shutter { transform: translateY(-16%); }

.bay-door:hover .bay-inside { filter: brightness(0.7) saturate(0.85); }
.bay-door:hover .bay-name { color: var(--bone); }

/* chosen: rolled right up, the bay lit */
.bay-door[aria-selected="true"] .bay-shutter { transform: translateY(-100%); }
.bay-door[aria-selected="true"] .bay-inside { filter: none; }
.bay-door[aria-selected="true"] .bay-name { color: var(--bone); }
.bay-door[aria-selected="true"] .bay-plate { color: var(--brass-light); border-bottom-color: var(--brass); }

/* THE SHOWROOM: the open bay's card, full width - its screen large on the
   left and leaning to the pointer, its words and plate on the right. */
@media (min-width: 56.25rem) {
  .project-grid.is-garage { display: block; }

  .project-grid.is-garage > .project-card {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    column-gap: var(--space-5);
    row-gap: var(--space-2);
    align-content: center;
    min-height: 35rem;
    padding: var(--space-4);
    animation: bay-arrive 0.6s var(--ease) both;
  }

  .project-grid.is-garage > .project-card[hidden] { display: none; }
  .project-grid.is-garage > .project-card:hover { transform: none; }
  .project-grid.is-garage > .project-card > * { grid-column: 2; }

  .project-grid.is-garage > .project-card > .project-screen {
    position: relative;
    grid-column: 1;
    grid-row: 1 / span 7;
    align-self: center;
    margin: 0;
    border: 1px solid var(--line);
    box-shadow: 0 40px 80px -30px #000;
    transform: perspective(1400px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
    transition: transform 0.35s var(--ease);
  }

  /* the sheen on the glass, where the light catches it */
  .project-grid.is-garage .project-screen::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(36rem circle at var(--gx, 30%) var(--gy, 0%), rgb(255 255 255 / 0.07), transparent 45%);
    pointer-events: none;
  }

  .project-grid.is-garage .project-screen img,
  .project-grid.is-garage .project-card--featured .project-screen img { aspect-ratio: 16 / 10; filter: none; }

  .project-grid.is-garage > .project-card .spec-plate {
    grid-column: 2;
    grid-row: auto;
    align-self: start;
    margin-top: var(--space-2);
  }
}

@keyframes bay-arrive {
  from { opacity: 0; transform: translateY(18px); }
}

/* 9a. THE SCREENS: every bay shows the car it holds

   The work itself, at the top of its card, under a thin bar that names
   where it lives - a lit dot for a site that is open, a brass one for
   something still in the workshop or not yet public. A screen sits a
   little dimmed and desaturated, so five other people's palettes do not
   shout over the house's; the one you are looking at comes up to full.
   The screen runs to the card's edges, just under the racing stripe. */
.project-screen {
  margin: calc(4px - var(--space-4)) calc(-1 * var(--space-3)) var(--space-1);
  background: var(--black);
  border-bottom: 1px solid var(--line);
}

.screen-bar {
  max-width: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--bone-muted);
  background: #0A0F0D;
  border-bottom: 1px solid var(--line);
}

.screen-bar .status-dot {
  width: 0.4rem;
  height: 0.4rem;
  margin-right: 0;
}

.screen-bar .status-dot::after { animation: none; }

.project-screen img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top;
  filter: saturate(0.8) brightness(0.88);
  transition: filter var(--base) var(--ease);
}

.project-card:hover .project-screen img,
.project-card:focus-within .project-screen img { filter: none; }

/* Dokà has no interface yet, so its bay shows the plans: a blueprint grid
   and a wireframe in the house's dashed construction line. */
.screen-plans {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 10;
  background:
    linear-gradient(rgb(51 225 237 / 0.07) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, rgb(51 225 237 / 0.07) 1px, transparent 1px) 0 0 / 24px 24px,
    var(--surface);
}

.screen-plans::before,
.screen-plans::after {
  content: "";
  position: absolute;
  border: 1px dashed rgb(51 225 237 / 0.4);
}

.screen-plans::before { inset: 16% 12%; }
.screen-plans::after { inset: 16% 12% 70%; }

.plans-label {
  position: relative;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: var(--brass);
}

/* One line of proof under the description: what the thing does in the
   world, not what it is built with. */
.project-card > p.card-proof {
  position: relative;
  padding-left: 1.1rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.6;
  color: rgb(233 230 222 / 0.88);
}

.card-proof::before {
  content: "\25B8" / "";
  position: absolute;
  left: 0;
  color: var(--brass);
}

/* The flagship's screen runs across both its columns, like every other
   bay's; its words and its plate sit side by side beneath. */
@media (min-width: 900px) {
  .project-card--featured { align-content: start; }

  .project-card--featured > .project-screen {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  /* Twice the width of the other bays, so a wider frame: the same height
     of screen, not twice it. */
  .project-card--featured .project-screen img { aspect-ratio: 2 / 1; }

  .project-card--featured .spec-plate { grid-row: 2 / span 5; }
}

/* =========================================================
   Paste this into css/style.css at the END of section 9
   (THE GARAGE) - that is, immediately above the comment
   that opens section 10, SHOWROOM DIALOGS.
   ========================================================= */

/* 9b. THE COUPÉ: the ground arrives, becomes the car, and leaves again */

.coupe {
  display: block;
  width: 100%;
  max-width: 64rem;
  margin: var(--space-5) auto 0;
  overflow: visible;
}

/* The architect's line: bone on black, main edges firm, detail fine.
   Same vocabulary as .house-line / .house-fine in the Grounds. */
.coupe-line {
  fill: none;
  stroke: var(--bone);
  stroke-opacity: 0.85;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.coupe-under,
.coupe-tyre {
  fill: none;
  stroke: var(--bone);
  stroke-opacity: 0.7;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.coupe-glass {
  fill: none;
  stroke: var(--bone);
  stroke-opacity: 0.45;
  stroke-width: 1.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* The three strokes that draw themselves are the three that are lit. */
.coupe-line,
.coupe-under,
.coupe-tyre { filter: var(--lit-line); }

.coupe-fine {
  fill: none;
  stroke: var(--bone);
  stroke-opacity: 0.3;
  stroke-width: 0.9;
  stroke-linecap: round;
}

.coupe-guide {
  fill: none;
  stroke: var(--cyan);
  stroke-opacity: 0.5;
  stroke-width: 1;
  stroke-dasharray: 5 6;
  vector-effect: non-scaling-stroke;
}

/* The one brass detail. It says what the lit window says in the Grounds and
   what the cyan status dots say on the bays: someone is here, it is running. */
.coupe-lamp {
  fill: var(--brass);
  filter: drop-shadow(0 0 7px rgb(184 149 90 / 0.75));
}

/* What the lamp throws. Screen rather than normal, because light adds to
   what is behind it instead of covering it. */
.coupe-beam { mix-blend-mode: screen; }

.coupe-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.15em;
  fill: var(--bone-muted);
}

/* ---------------------------------------------------------------------------
   The drawing draws itself, in five beats, over 2.8s from the moment the car
   arrives on screen:

     0.00s   the setting out    construction lines fade up first
     0.35s   the wheels         on the axles that were just set out
     0.55s   the line           ground, car, ground - one continuous stroke
     1.20s   the body           the underside closes it
     1.85s   the detail         glass, shut lines, creases settle in
     2.20s   the light          the lamp comes on, it falls on the road, and
                                the drawn lines light with it

   They overlap on purpose: a draughtsman has started the next line before
   the last one lands. Section 4b has the two classes and why none of this
   follows the scroll any more.
   --------------------------------------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {

  /* Armed: a blank sheet. */
  .coupe.is-armed :is(.coupe-guide, .coupe-glass, .coupe-fine,
                      .coupe-lamp, .coupe-beam) { opacity: 0; }

  .coupe.is-armed :is(.coupe-tyre, .coupe-line, .coupe-under) {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
  }

  /* 1. setting out */
  .coupe.is-drawing .coupe-guide {
    animation: arrive 0.5s var(--ease) both;
  }

  /* 2. the wheels go on the axles that were just set out. A draughtsman
        drawing a car in elevation starts here, not with the roof - and
        doing it in that order means the drawing never passes through a
        stage where it is a closed silhouette with nothing under it. */
  .coupe.is-drawing .coupe-tyre {
    animation: draw-line 0.7s var(--ease-pen) 0.35s both,
               lines-lit 0.6s var(--ease) 2.2s both;
  }

  /* 3. the body is drawn around them. The long sweep gets --slow: it is the
        line the drawing is named for, and the only one worth watching. */
  .coupe.is-drawing .coupe-line {
    animation: draw-line var(--slow) var(--ease-pen) 0.55s both,
               lines-lit 0.6s var(--ease) 2.2s both;
  }

  .coupe.is-drawing .coupe-under {
    animation: draw-line 0.8s var(--ease-pen) 1.2s both,
               lines-lit 0.6s var(--ease) 2.2s both;
  }

  /* 4. the detail settles in */
  .coupe.is-drawing :is(.coupe-glass, .coupe-fine) {
    animation: arrive 0.6s var(--ease) 1.85s both;
  }

  /* 5. and a light comes on, falls on the road, and lights the lines that
        were drawn - the glow rides in on the same beat as the lamp */
  .coupe.is-drawing :is(.coupe-lamp, .coupe-beam) {
    animation: arrive 0.6s var(--ease) 2.2s both;
  }
}

/* On a phone the drawing scales to about a third, which would set the sheet
   annotations at under 3px. A label you cannot read is worse than no label,
   so small screens keep the lines and drop the lettering - and the drawing
   bleeds into the room's padding, which would otherwise spend a tenth of a
   small screen on margin it does not need. #projects is already clipped, so
   the bleed cannot turn into sideways scroll. */
@media (max-width: 640px) {
  .coupe-label { display: none; }

  .coupe {
    width: calc(100% + var(--space-2) * 2);
    margin-inline: calc(var(--space-2) * -1);
  }
}

/* 10. SHOWROOM DIALOGS */

/* The page behind stays still while a dialog is open */
html:has(dialog[open]) { overflow: hidden; }

.modal {
  width: calc(100% - 2rem);
  max-width: 44rem;
  max-height: 85svh;
  overflow: auto;
  margin: auto;
  padding: var(--space-5) var(--space-4) var(--space-4);
  background: var(--surface);
  color: var(--bone);
  border: 1px solid rgb(184 149 90 / 0.45);
  border-radius: var(--radius);
  box-shadow: 0 40px 80px -20px rgb(0 0 0 / 0.9);

  /* Entrance: rises and settles */
  opacity: 1;
  transform: none;
  transition:
    opacity var(--base) var(--ease),
    transform var(--base) var(--ease),
    overlay var(--base) allow-discrete,
    display var(--base) allow-discrete;
}

.modal:not([open]) {
  opacity: 0;
  transform: translateY(16px) scale(0.98);
}

@starting-style {
  .modal[open] {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
}

/* Racing stripe across the top */
.modal::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background:
    linear-gradient(var(--cyan), var(--cyan)) bottom / 100% 1px no-repeat,
    var(--racing-green);
}

.modal::backdrop {
  background: rgb(7 10 9 / 0.75);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.modal h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.25rem, 1.5rem + 2vw, 3rem);
  line-height: 1.1;
}

.modal-meta { margin: var(--space-1) 0 var(--space-4); }

.modal h4 {
  margin: var(--space-3) 0 var(--space-1);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brass);
}

.modal p { color: var(--bone-muted); }

.modal-note {
  margin-top: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

.modal .btn {
  margin: var(--space-4) var(--space-1) 0 0;
}

.modal-close {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
}

.modal-close button {
  width: 2.25rem;
  height: 2.25rem;
  color: var(--bone-muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
}

.modal-close button:hover {
  color: var(--brass);
  border-color: var(--brass);
}

/* 10b. THE CASE STUDIES: a project's pop-up tells its story the way a
   case study does. The work first and large - its screen, with the phone
   leaning on its corner, because most visitors here will meet the thing on
   a phone - then the story in four short parts (the problem, what was built,
   how it is kept safe, where it stands), then a strip of the other screens.
   Nothing on a screen is public that the client or the visitor in it would
   not want public: names, offers and venues are blurred at the source. */
.modal--case { max-width: 62rem; }

.case-hero {
  position: relative;
  margin: 0 0 var(--space-4);
  padding: 0 8% 7% 0;
}

.case-hero--plans { padding: 0; }

/* Dokà has no screen yet: its plans sit lower, so an empty grid does not
   take the room a screen would */
.case-hero--plans .case-desk .screen-plans { aspect-ratio: 16 / 6; }

.case-desk {
  margin: 0;
  border: 1px solid var(--line);
  box-shadow: 0 30px 60px -30px #000;
}

.case-desk img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top;
}

/* the phone: a black body with a thin brass edge, standing on the corner */
.case-phone {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 23%;
  margin: 0;
  padding: 4px;
  background: #050706;
  border: 1px solid rgb(184 149 90 / 0.5);
  border-radius: clamp(12px, 2vw, 20px);
  box-shadow: 0 24px 50px -12px #000;
}

.case-phone img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: clamp(9px, 1.6vw, 16px);
}

.case-story {
  display: grid;
  gap: var(--space-3) var(--space-4);
}

.case-story section {
  padding-top: var(--space-2);
  border-top: 1px solid var(--line);
}

.case-story h4 { margin-top: 0; }

/* the other screens: a strip that runs to the dialog's edges and scrolls
   sideways - by keyboard too, which is why it can take focus */
.case-screens {
  display: flex;
  gap: var(--space-3);
  margin: var(--space-4) calc(var(--space-4) * -1) 0;
  padding: 0 var(--space-4) var(--space-2);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--space-4);
  scrollbar-width: thin;
  scrollbar-color: var(--brass-dark) transparent;
}

.case-screens:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: -2px;
}

.case-screens figure {
  flex: none;
  width: min-content;
  margin: 0;
  scroll-snap-align: start;
}

.case-screens img {
  display: block;
  width: auto;
  max-width: none;
  height: clamp(12rem, 26vw, 17rem);
  border: 1px solid var(--line);
}

.case-screens .is-phone img { border-radius: 10px; }

.case-screens figcaption {
  margin-top: var(--space-1);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  line-height: 1.5;
  color: var(--bone-muted);
}

@media (min-width: 40rem) {
  .case-story { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 40rem) {
  .case-hero { padding-right: 10%; }
  .case-phone { width: 28%; }
}

/* 11. THE LIBRARY */

/* The introduction: bio larger, AI note quieter */
.library .room-header + p { font-size: var(--text-lg); }

.library .room-header + p + p {
  margin-top: var(--space-2);
  color: var(--bone-muted);
}

/* Shelf labels: EXPERIENCE ———— */
.library > h3,
.library-piece > h3,
.process-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-5) 0 var(--space-3);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brass);
}

.library > h3::after,
.library-piece > h3::after,
.process-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgb(184 149 90 / 0.35);
}

/* The shelf */
.timeline {
  display: grid;
  gap: var(--space-2);
  list-style: none;
  padding: 0 0 var(--space-2);
  border-bottom: 2px solid rgb(184 149 90 / 0.35);
  box-shadow: 0 12px 20px -14px #000;
}

/* Each volume */
.timeline li {
  display: grid;
  position: relative;
  align-content: center;
  min-height: 11rem;
  padding: var(--space-3) var(--space-3) var(--space-3) calc(3.25rem + var(--space-3));
  background:
    linear-gradient(90deg, rgb(0 66 37 / 0.25), transparent 40%),
    var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform var(--base) var(--ease), border-color var(--base) var(--ease);
}

.timeline li:hover {
  transform: translateX(6px);
  border-color: rgb(184 149 90 / 0.45);
}

/* The spine: dates run down it like a title, brass bands top and bottom */
.timeline-date {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3.25rem;
  writing-mode: vertical-rl;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: var(--bone);
  background:
    linear-gradient(var(--brass), var(--brass)) 0 10px / 100% 1px no-repeat,
    linear-gradient(var(--brass), var(--brass)) 0 14px / 100% 1px no-repeat,
    linear-gradient(var(--brass), var(--brass)) 0 calc(100% - 10px) / 100% 1px no-repeat,
    linear-gradient(var(--brass), var(--brass)) 0 calc(100% - 14px) / 100% 1px no-repeat,
    var(--racing-green);
}

.timeline h4 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.5rem;
  line-height: 1.2;
}

.timeline li p:not(.timeline-date) {
  margin-top: var(--space-1);
  color: var(--bone-muted);
}

/* The glass cabinet */
.skills {
  display: grid;
  gap: var(--space-2);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
}

.skills div {
  padding: var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(160deg, rgb(233 230 222 / 0.06), transparent 35%),
    var(--surface);
  box-shadow: inset 0 1px 0 rgb(233 230 222 / 0.08);
}

.skills dt {
  margin-bottom: var(--space-1);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brass);
}

.skills dd {
  font-size: var(--text-sm);
  color: var(--bone-muted);
}

/* Certifications with brass medallions */
.certs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  list-style: none;
  padding: 0;
}

.certs li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  border: 1px solid rgb(184 149 90 / 0.45);
  border-radius: var(--radius);
}

.certs li::before {
  content: "";
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #E2C58F, var(--brass) 55%, #6E5630);
  box-shadow: 0 0 0 2px rgb(184 149 90 / 0.25);
}

.library-cv { margin-top: var(--space-4); }

/* =========================================================
   Paste this into css/style.css at the END of section 11
   (THE LIBRARY) - immediately above the comment that opens
   section 12, THE GALLERY.
   ========================================================= */

/* =========================================================
   Paste this into css/style.css at the END of section 11
   (THE LIBRARY) - immediately above the comment that opens
   section 12, THE GALLERY.
   ========================================================= */

/* 11b. THE PAWN: a piece standing on the Compétences rule */

/* NOTE: wrapping that heading in .library-piece stops `.library > h3` in
   section 11 from matching it - the `>` is a direct-child combinator - which
   would leave the piece standing on a rule that is no longer drawn. Two
   one-line edits up in section 11 re-attach it; they are in the message
   alongside this file. Do those first, or the drawing floats.

   The margin override below has to stay AFTER them in the file: both
   selectors have the same specificity, so source order is what decides. */

/* The drawing has no shelf of its own. It stands on the brass rule the
   Compétences heading already draws, so it is positioned against that
   heading rather than taking a place of its own in the flow.
   The wrapper is sized to hug the heading exactly - the heading's margins
   move out here - which is what makes `bottom: 50%` below land on the rule
   instead of somewhere in the middle of a taller box. */
.library-piece {
  position: relative;
  /* room for a drawing that reserves none of its own: its height is its
     width times the viewBox ratio, 230/540 */
  margin: calc(min(34rem, 62%) * 0.426 + var(--space-2)) 0 var(--space-3);
}

.library-piece > h3 { margin: 0; }

/* Pushed clear of the heading's own word. The rule only begins after the
   text, so a piece standing at the left edge would be standing on the gap -
   and on the word itself. 36% clears "COMPÉTENCES" and the shorter English
   "SKILLS" at every width, and 36 + 62 = 98 keeps the whole drawing inside
   the room however narrow it gets. */
.pawn {
  position: absolute;
  left: 36%;
  bottom: 50%;              /* the heading's rule is vertically centred */
  width: min(34rem, 62%);
  overflow: visible;
  pointer-events: none;     /* the heading underneath stays selectable */
}

/* On black the engraving inverts: the lines are light, and shadow is where
   they stop. The body is filled with the page so the lamp's glow does not
   shine through the piece standing in front of it. */
.pawn-body {
  fill: var(--black);
  stroke: var(--bone);
  stroke-opacity: 0.85;
  stroke-width: 1.5;
  stroke-linejoin: round;
}

/* Hatch only where shadow pools - the lamp is upper left, so the right flank
   is the shaded one. The strokes follow the turning, because on a lathed
   form the shadow wraps rather than running straight down. */
.pawn-hatch {
  fill: none;
  stroke: var(--bone);
  stroke-opacity: 0.45;
  stroke-width: 0.9;
  stroke-linecap: round;
}

/* She is drawn in the page's own black, which is only visible because the
   glow is behind her. A shadow is an absence of light, and on a black page
   that is the only way it can be one. */
.pawn-cast { fill: var(--black); }

/* ---------------------------------------------------------------------------
   The lamp.

   At rest it sits where every other light in this house sits: upper left.
   That rest position is baked into the geometry, so a visitor who never
   hovers - or who is on a phone, or who asked for reduced motion - sees a
   piece lit exactly like the watch, the seal and the quill. The house rule
   is the default state. The curiosity is what you find by moving.

   script.js then sets two custom properties:
     --sway   -1 to 1, where the lamp is. Positive means it has moved right,
              so she leans left: a shadow runs away from the light.
     --reach  how long she is. A low lamp throws a long shadow.
   --------------------------------------------------------------------------- */

.pawn-cast,
.pawn-glow {
  /* transform-box makes the origin below resolve in the drawing's own
     coordinates rather than against the element's bounding box, so the foot
     stays nailed to the rule however much she swings. */
  transform-box: view-box;
  transition: transform var(--base) var(--ease);
}

/* her foot, in viewBox units */
.pawn-cast {
  transform-origin: 164px 230px;
  transform: skewX(calc(var(--sway, 0) * 11deg)) scaleY(var(--reach, 1));
}

/* the lit patch travels with the lamp, opposite to the way she leans */
.pawn-glow {
  transform-origin: 222px 114px;
  transform: translateX(calc(var(--sway, 0) * 26px));
}

/* 11c. THE ORRERY: the stack in orbit round what it is for

   The Library's way of showing skills. scripts/orrery.py draws the whole
   mechanism at rest; js/script.js sets it turning and adds .is-live to the
   room. Everything under .is-live is the enhancement - without it the
   drawing stands still and the seven cards are the glass cabinet, laid out
   beneath it as they always were.

   Engraver's register, so nothing here draws itself and nothing carries
   --lit-line. Brass is the mechanism: the core, the stand and the arms.
   Colour is the orbits: see the tones below. */

.orrery-room {
  display: grid;
  gap: var(--space-3);
}

.orrery-stand { margin: 0; }

.orrery {
  width: 100%;
  overflow: visible;
}

/* A tone for each ring, worn by the ring and by every body on it. They are
   the house's own three materials in the order light would find them:
   brass nearest the core's lamp, bone further out, and the racing green -
   which in this house means depth - at the edge. Warm near, cool far. The
   first line of each pair is for a browser without color-mix(). */
.orrery-tone-1 { --tone: var(--brass-light); }
.orrery-tone-2 { --tone: var(--bone); }
.orrery-tone-3 { --tone: #8FB5A3; --tone: color-mix(in srgb, var(--bone) 45%, var(--green-glow)); }
.orrery-tone-4 { --tone: var(--cyan); }   /* the comet's own */

.orrery-ring {
  fill: none;
  stroke: var(--tone);
  stroke-opacity: 0.42;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

/* The sky stays inside this drawing. Dots are zero-length strokes with
   round caps, so one path is a whole layer of stars. */
.orrery-star {
  fill: none;
  stroke: var(--bone);
  stroke-linecap: round;
}

.orrery-star-faint  { stroke-width: 0.9; stroke-opacity: 0.22; }
.orrery-star-mid    { stroke-width: 1.3; stroke-opacity: 0.4; }
.orrery-star-bright { stroke-width: 1.8; stroke-opacity: 0.7; }

/* The comet's road is the one cyan line: cyan is what is live, and this is
   the skill that is on its way in. Dashed like a construction line, because
   it is a path being worked out rather than one already kept. */
.orrery-road {
  fill: none;
  stroke: var(--cyan);
  stroke-opacity: 0.5;
  stroke-width: 1;
  stroke-dasharray: 4 6;
  vector-effect: non-scaling-stroke;
}

.orrery-brass,
.orrery-leader {
  fill: none;
  stroke: var(--brass);
  stroke-width: 1.1;
  stroke-linecap: round;
}

.orrery-leader { stroke-opacity: 0.55; stroke-width: 0.7; }

.orrery-arm {
  stroke: var(--brass);
  stroke-opacity: 0.38;
  stroke-width: 0.9;
  transition: stroke-opacity var(--base) var(--ease);
}

/* Filled with the page's own black, so a body hides the ring and the arm
   that pass behind it instead of being drawn through by them. */
.orrery-sun,
.orrery-globe {
  fill: var(--black);
  stroke-linejoin: round;
}

.orrery-sun {
  stroke: var(--brass-light);
  stroke-width: 1.4;
  filter: drop-shadow(0 0 8px rgb(184 149 90 / 0.6));
}

.orrery-sun-hatch {
  fill: none;
  stroke: var(--brass);
  stroke-width: 0.9;
  stroke-linecap: round;
}

/* A body is its ring's tone twice: the line at full strength, and a little
   of it stirred into the black inside, so it reads as a solid thing with a
   colour rather than as a hole with an outline. */
.orrery-globe {
  fill: var(--surface-raised);
  fill: color-mix(in srgb, var(--tone) 16%, var(--black));
  stroke: var(--tone);
  stroke-width: 1.5;
  transition: filter var(--base) var(--ease), stroke-width var(--base) var(--ease);
}

.orrery-hatch {
  fill: none;
  stroke: var(--tone);
  stroke-opacity: 0.55;
  stroke-width: 0.8;
  stroke-linecap: round;
}

.orrery-moon { fill: var(--tone); opacity: 0.75; }

.orrery-hit { fill: transparent; }

.orrery-name,
.orrery-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
}

.orrery-name {
  fill: var(--tone);
  fill-opacity: 0.75;
  transition: fill-opacity var(--base) var(--ease);
}

.orrery-label { fill: var(--brass); }

.orrery-hint,
.orrery-keys { display: none; }

/* ---------------------------------------------------------------- it turns */

.is-live .orrery {
  cursor: grab;
  /* a finger moving up or down is scrolling the page, not turning the crank */
  touch-action: pan-y;
  user-select: none;
}

.is-live .orrery.is-turning { cursor: grabbing; }
.is-live .orrery-body { cursor: pointer; }

/* The picked body does not change colour - its colour is its ring. It lights
   up in it, and its arm goes to full brass: the mechanism pointing. */
.is-picked .orrery-globe {
  stroke-width: 2.2;
  filter: drop-shadow(0 0 5px var(--tone));
}
.orrery-name.is-picked { fill-opacity: 1; }

/* Seven names on seven moving bodies will cross. Where two would, the
   script keeps the one that matters more - the picked one, then whichever
   is nearer - and lets the other fade until there is room for it again. */
.orrery-name.is-crowded { fill-opacity: 0; }
.is-picked .orrery-moon { opacity: 1; }
.orrery-arm.is-picked   { stroke: var(--brass-light); stroke-opacity: 1; stroke-width: 1.3; }

.is-live .orrery-hint {
  display: block;
  margin-top: var(--space-1);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
  color: var(--bone-muted);
}

/* The plate: all seven cards in one cell of a grid, one of them showing.
   Stacked rather than swapped, so the plate is always as tall as its
   tallest card and the page never jumps when a short one follows a long
   one. visibility takes the hidden six out of the tab order and away from
   screen readers; the keys walk through them. */
.is-live .skills { grid-template-columns: minmax(0, 1fr); }

.is-live .skills div {
  grid-area: 1 / 1;
  border-color: var(--brass-dark);
  visibility: hidden;
  opacity: 0;
  transition:
    opacity var(--base) var(--ease),
    visibility 0s linear var(--base);
}

.is-live .skills div.is-shown {
  visibility: visible;
  opacity: 1;
  transition-delay: 0s;
}

.is-live .skills dt { font-size: 0.85rem; }
.is-live .skills dd { font-size: var(--text-base); color: var(--bone); }

.is-live .orrery-keys:not([hidden]) {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.orrery-key {
  width: 2.25rem;
  height: 2.25rem;
  font: 1rem / 1 var(--font-mono);
  color: var(--brass-light);
  background: transparent;
  border: 1px solid var(--brass);
  cursor: pointer;
  transition: background-color var(--quick) var(--ease);
}

.orrery-key:hover,
.orrery-key:focus-visible { background: rgb(184 149 90 / 0.18); }

.orrery-count {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  letter-spacing: 0.1em;
  color: var(--bone-muted);
}

/* Room for both: the mechanism, and the plate it is pointing at beside it */
@media (min-width: 56.25rem) {
  .orrery-room.is-live {
    grid-template-columns: minmax(0, 2.3fr) minmax(0, 1fr);
    align-items: center;
    gap: var(--space-3);
  }
}

/* On a phone the drawing is a little over half size, and seven names at
   that size are seven smudges. So only the picked body is named there, and
   in letters big enough to survive the scaling: 16 of the drawing's units
   is about 9px on a 360px screen. The sheet annotation goes, as the
   coupé's does. */
@media (max-width: 640px) {
  .orrery-name,
  .orrery-label,
  .orrery-leader { display: none; }

  .orrery-name.is-picked {
    display: block;
    font-size: 16px;
    letter-spacing: 0.1em;
    /* a dark edge under the letters, so a ring crossing them cannot */
    paint-order: stroke;
    stroke: var(--black);
    stroke-width: 4px;
  }
}

/* 12. THE GALLERY */
.artwork { margin: 0; }

/* Dark walnut frame, brass edge, hanging off the wall */
.artwork-frame {
  position: relative;
  display: block;
  width: 100%;
  font: inherit;
  color: inherit;
  cursor: zoom-in;
  padding: 0.75rem;
  background: #1A1712;
  border: 1px solid rgb(184 149 90 / 0.6);
  box-shadow:
    inset 0 0 0 1px rgb(0 0 0 / 0.6),
    0 24px 40px -18px #000;
  transition: transform var(--base) var(--ease);
}

/* Brass fillet between frame and poster */
.artwork-frame img {
  width: 100%;
  box-shadow: 0 0 0 1px rgb(184 149 90 / 0.5);
}

/* The picture light: a brass bar above the frame */
.artwork-frame::before {
  content: "";
  position: absolute;
  top: -12px;
  left: 30%;
  right: 30%;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(#E2C58F, var(--brass) 60%, #6E5630);
  box-shadow: 0 4px 8px -2px #000;
}

/* ...and the warm light it casts */
.artwork-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 55% at 50% 0%, rgb(255 236 200 / 0.22), transparent 70%);
  opacity: 0;
  transition: opacity var(--base) var(--ease);
  pointer-events: none;
}

.artwork-frame:hover,
.artwork-frame:focus-visible { transform: translateY(-4px); }

.artwork-frame:hover::after,
.artwork-frame:focus-visible::after { opacity: 1; }

/* The museum label */
.artwork-plaque {
  display: grid;
  gap: 0.25rem;
  margin-top: var(--space-3);
  padding-left: var(--space-2);
  border-left: 2px solid var(--brass);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--bone-muted);
}

.artwork-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: 0;
  color: var(--bone);
}

/* The salon: smaller frames, hung close. This grid is what a visitor
   without a script sees - every piece, with him beneath; the script turns
   it into the stand (12b). */
.salon {
  display: grid;
  gap: var(--space-4) var(--space-3);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr));
  align-items: center;
}

@media (min-width: 40rem) {
  .artwork--diptych { grid-column: span 2; }
}

.diptych {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}

.salon .artwork-frame { padding: 0.5rem; }
.salon .artwork-frame::before { display: none; }
.salon .artwork-plaque { margin-top: var(--space-2); }
.salon .artwork-title { font-size: 1rem; }

/* The viewer */
.viewer {
  width: fit-content;
  max-width: min(92vw, 56rem);
  padding: var(--space-5) var(--space-3) var(--space-3);
  text-align: center;
}

.viewer-img {
  width: auto;
  max-height: 72svh;
  margin-inline: auto;
}

.viewer-caption {
  max-width: none;
  margin-top: var(--space-2);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--bone-muted);
}

/* 12b. THE SALON'S ROOM: the ledge, the one sitting on it, the stage and the rail */

/* Without the stage (no script, or a narrow screen) the salon stays the grid
   above and the drawing sits under it. Its left half is the bare wall the
   stage would stand against, so the drawing is shown from his side:
   190% wide, pulled left, clipped by the wrap. */
.vigil-wrap {
  margin: var(--space-3) 0 0;
  overflow: hidden;
}

/* margin-top lifts the drawing so that the bare wall above the lamp is
   clipped away too, not only the bare wall to his left. */
.vigil {
  display: block;
  width: 190%;
  max-width: none;
  height: auto;
  margin: -9% 0 0 -90%;
}

.vigil-figure { fill: var(--black); }
.vigil-brass  { fill: var(--brass-light); }
.vigil-bulb   { fill: var(--brass-light); }

/* He moves in two places, and each turns about a point given in the
   drawing's own units - transform-box: view-box, the way the pawn's shadow
   keeps its foot on the rule. scripts/character.py prints both points; if
   the script moves them, move them here.

   The head. As drawn he looks up, at the main wall. When the salon has the
   visitor's attention - js/script.js says when - he lowers it to the piece
   on the stage. */
.vigil-head,
.vigil-leg { transform-box: view-box; }

.vigil-head {
  transform-origin: 1109.9px 345.5px;     /* the neck */
  transition: transform 1.1s var(--ease);
}

.salon-room.is-watching .vigil-head { transform: rotate(-20deg); }

/* THE STAND ON A SMALL SCREEN. No room for the stand beside him, so it gets
   a box of its own above him, square-ish and never taller than most of the
   screen; js/script.js scales the stand to the box. The work is above him
   here, so he looks higher - whatever else is going on. */
@media (max-width: 56.24rem) {
  .salon-room.is-turning .salon {
    position: relative;
    display: block;
    width: 100%;
    max-height: 70svh;
    aspect-ratio: 1 / 0.95;
    margin-inline: auto;
  }

  /* the name sits centred under the piece, inside the screen */
  .is-turning.is-compact .artwork-plaque {
    left: 50%;
    width: min(17rem, 82vw);
    transform: translateX(-50%);
  }

  .salon-room.is-compact .vigil-head,
  .salon-room.is-compact.is-watching .vigil-head { transform: rotate(13deg); }
}

/* The leg over the edge. It is drawn hanging at rest, and swings a little
   either side of that - slowly, the way a leg does when its owner is
   thinking about something else. */
.vigil-leg { transform-origin: 914.5px 497.1px; }     /* the knee */

@keyframes leg-swing {
  from { transform: rotate(-6deg); }
  to   { transform: rotate(9deg); }
}

@media (prefers-reduced-motion: no-preference) {
  .vigil-leg { animation: leg-swing 2.6s ease-in-out infinite alternate; }
}

.vigil-line,
.vigil-floor,
.vigil-fine,
.vigil-rail { fill: none; }

.vigil-line  { stroke: var(--bone);  stroke-width: 1;   opacity: 0.5; }
.vigil-floor { stroke: var(--bone);  stroke-width: 1.2; opacity: 0.7; }
.vigil-fine  { stroke: var(--cyan);  stroke-width: 0.8; opacity: 0.55; stroke-dasharray: 3 4; }
.vigil-rail  { stroke: var(--brass); stroke-width: 1;   opacity: 0; }

.rail-keys[hidden] { display: none; }

/* THE STAND, turned by js/script.js. Every piece hangs at the same point
   and the script gives each its place on the ring as a transform: an angle,
   and the ring's radius in front of and behind it. The pieces turned away
   fall back into the dark by how far round they are (--away, set with the
   transform); the one facing the room is whole, lit, and named. */
.salon-room.is-turning {
  touch-action: pan-y;        /* a finger still scrolls the page up and down */
  -webkit-user-select: none;
  user-select: none;
}

.is-turning .salon .artwork {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: auto;
  backface-visibility: hidden;
}

/* 0.9s for a piece to come round: a rhythm of character, so it is written
   out rather than taken from a token. Under a hand the stand follows at
   once, with no lag behind the finger. */
.is-turning.is-live:not(.is-dragging):not(.is-drifting) .salon .artwork {
  transition:
    transform 0.9s var(--ease),
    opacity var(--base) var(--ease);
}

/* A piece turned away is darkened by a veil of the room's black, not by a
   filter: the stand moves every frame, and an opacity costs the browser
   next to nothing where a filter would be redrawn on every poster. */
.is-turning .artwork-frame::before {
  content: "";
  display: block;
  position: absolute;
  inset: 0;
  height: auto;
  border-radius: 0;
  background: var(--black);
  box-shadow: none;
  opacity: calc(0.24 * var(--away, 0));
  pointer-events: none;
  transition: opacity var(--base) var(--ease);
}

.is-turning .artwork:not(.is-stage) .artwork-frame:hover::before,
.is-turning .artwork:not(.is-stage) .artwork-frame:focus-visible::before { opacity: 0.08; }

/* Facing the room: lit from the lamp's side, not from above */
.is-turning .artwork.is-stage .artwork-frame {
  box-shadow:
    inset 0 0 0 1px rgb(0 0 0 / 0.6),
    26px 0 54px -26px rgb(226 197 143 / 0.5),
    -18px 26px 40px -20px #000;
}

.is-turning .artwork-plaque {
  position: absolute;
  top: 100%;
  left: 0;
  width: max-content;
  max-width: 22rem;
  opacity: 0;
  transition: opacity var(--base) var(--ease);
}

.is-turning .artwork.is-stage .artwork-plaque { opacity: 1; }

/* While the stand is moving - by hand or by itself - no piece is facing
   the room yet; the name comes up when it stops */
.is-turning.is-dragging .artwork.is-stage .artwork-plaque,
.is-turning.is-drifting .artwork.is-stage .artwork-plaque { opacity: 0; }

/* The stand's keys and its count, like the orrery's: ← 03 / 07 → */
.rail-keys {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.rail-count {
  max-width: none;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: var(--bone-muted);
}

.rail-now { color: var(--brass-light); }

.rail-key {
  width: 2.25rem;
  height: 2.25rem;
  font: 1rem / 1 var(--font-mono);
  color: var(--brass-light);
  background: transparent;
  border: 1px solid var(--brass);
  cursor: pointer;
  transition: background-color var(--quick) var(--ease);
}

.rail-key:hover,
.rail-key:focus-visible { background: rgb(184 149 90 / 0.18); }

/* The stand's own turning: ❚❚ while it turns, ▶ once stopped */
.rail-auto { margin-left: var(--space-1); font-size: 0.7rem; }
.rail-auto[aria-pressed="false"] { color: var(--bone-muted); }

/* In the wide room the stand stands in the drawing. The room takes the
   drawing's own proportions, so a place given in the drawing's units lands
   on the drawing at any width, and it is never taller than the screen can
   show under the header. */
@media (min-width: 56.25rem) {
  .salon-room.is-turning {
    position: relative;
    aspect-ratio: 1200 / 660;
    max-width: calc((100svh - 7rem) * 1200 / 660);
    margin-inline: auto;
  }

  .is-turning .vigil-wrap {
    position: absolute;
    inset: 0;
    margin: 0;
    overflow: visible;
  }

  .is-turning .vigil {
    width: 100%;
    height: 100%;
    margin: 0;        /* all of it: the small-screen crop lifts it as well */
  }

  /* The stand lies over the drawing and lets clicks through to nothing:
     only the pieces take them. */
  .is-turning .salon {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: block;
    pointer-events: none;
  }

  .is-turning .rail-keys {
    position: absolute;
    z-index: 2;
    left: 0;
    bottom: 6%;
    margin: 0;
  }
}

/* 13. THE SMALLER VILLA: navigation by screen size */
.menu-toggle,
.plan-toggle,
.plan-close {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--bone);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.25rem 0.75rem;
  cursor: pointer;
}

.menu-toggle:hover,
.plan-toggle:hover,
.plan-close:hover { border-color: var(--brass); color: var(--brass); }

/* Tablets and up: the rooms are links in the header, and the plan has its
   own key beside them */
.menu-toggle { display: none; }

@media (min-width: 48rem) {
  .site-nav {
    display: block;
    margin: 0 0 0 auto;
  }
}

/* Tablets: links stay in the header, room names step aside */
@media (min-width: 48rem) and (max-width: 64rem) {
  .nav-room { display: none; }
}

/* Phones: no row of links - the Menu key opens the plan, which is the
   whole directory */
@media (max-width: 47.99rem) {
  .site-header { gap: var(--space-2); }
  .site-nav,
  .plan-toggle { display: none; }
  .sound-toggle { margin-left: auto; }
  .menu-toggle { display: inline-block; }
}

/* 13b. THE PLAN: the house directory, drawn (scripts/plan.py). Two floor
   plans in the architect's register - bone walls in solid poche, fine bone
   furniture, dashed cyan for what is overhead or below - on the blueprint
   grid Doka's bay already uses. Every room lights under the pointer; the
   one you are in carries a brass dot that breathes. On a laptop it is a
   sheet over the page; on a phone, the whole screen. */
.plan {
  position: fixed;
  inset: 0;
  width: min(66rem, calc(100% - 2rem));
  height: fit-content;
  max-height: calc(100svh - 2rem);
  margin: auto;
  padding: var(--space-4);
  overflow: auto;
  color: var(--bone);
  background:
    linear-gradient(rgb(51 225 237 / 0.05) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, rgb(51 225 237 / 0.05) 1px, transparent 1px) 0 0 / 24px 24px,
    rgb(7 10 9 / 0.97);
  border: 1px solid rgb(184 149 90 / 0.45);
  border-radius: var(--radius);
  box-shadow: 0 40px 80px -20px rgb(0 0 0 / 0.9);

  /* the sheet comes down into place */
  opacity: 1;
  transform: none;
  transition:
    opacity 0.35s var(--ease),
    transform 0.45s var(--ease),
    overlay 0.35s allow-discrete,
    display 0.35s allow-discrete;
}

.plan:not(:popover-open) {
  opacity: 0;
  transform: translateY(-12px);
}

@starting-style {
  .plan:popover-open {
    opacity: 0;
    transform: translateY(-12px);
  }
}

.plan::backdrop {
  background: rgb(7 10 9 / 0.6);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

/* The page stays still while the plan is open */
html:has(#plan:popover-open) { overflow: hidden; }

.plan-head { padding-right: 6rem; }

.plan-name {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass);
}

.plan-hint {
  margin-top: var(--space-1);
  font-size: var(--text-sm);
  color: var(--bone-muted);
}

.plan-close {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
}

.plan-sheets {
  display: grid;
  gap: var(--space-3);
  margin: var(--space-3) 0;
}

.plan-sheet {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

/* the rooms: a floor you can point at, its name, and the dot */
.plan-floor {
  fill: transparent;
  transition: fill var(--quick) var(--ease);
}

.plan-room.is-here .plan-floor { fill: rgb(226 197 143 / 0.06); }
.plan-room:hover .plan-floor,
.plan-room.is-lit .plan-floor { fill: rgb(226 197 143 / 0.13); }

.plan-label {
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.12em;
  text-anchor: middle;
  fill: var(--bone-muted);
  transition: fill var(--quick) var(--ease);
}

.plan-room:is(:hover, .is-lit, .is-here) .plan-label { fill: var(--brass-light); }

.plan-here { opacity: 0; }
.plan-room.is-here .plan-here { opacity: 1; }
.plan-dot { fill: var(--brass-light); }

.plan-pulse {
  fill: none;
  stroke: var(--brass-light);
  stroke-width: 1;
  transform-box: fill-box;
  transform-origin: center;
  animation: plan-pulse 2.4s var(--ease) infinite;
}

@keyframes plan-pulse {
  from { opacity: 0.9; transform: scale(1); }
  to   { opacity: 0; transform: scale(3.2); }
}

/* the drawing itself: walls, furniture, what is overhead */
.plan-drawing { pointer-events: none; }

.plan-wall,
.plan-partition {
  fill: none;
  stroke: var(--bone);
  stroke-linecap: square;
}

.plan-wall { stroke-width: 4.6; }
.plan-partition { stroke-width: 2.4; }

.plan-claustra {
  fill: none;
  stroke: var(--bone);
  stroke-width: 1;
}

.plan-fine,
.plan-glass {
  fill: none;
  stroke: var(--bone);
  stroke-opacity: 0.7;
  stroke-width: 0.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.plan-swing {
  fill: none;
  stroke: var(--bone);
  stroke-opacity: 0.5;
  stroke-width: 0.7;
  stroke-dasharray: 2 2;
}

.plan-overhead {
  fill: none;
  stroke: var(--cyan);
  stroke-opacity: 0.55;
  stroke-width: 0.8;
  stroke-dasharray: 4 3;
}

.plan-core { fill: var(--brass); }

.plan-title {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  fill: var(--brass);
}

.plan-note {
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.1em;
  fill: var(--bone-muted);
}

/* the directory in words: what keyboards and screen readers are given */
.plan-legend ol {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
  gap: 0 var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.plan-legend a {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.6rem 0;
  color: var(--bone);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.plan-no {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--brass);
}

.plan-room-name {
  font-family: var(--font-display);
  font-size: 1.35rem;
  line-height: 1.2;
  transition: color var(--quick) var(--ease);
}

.plan-what {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--bone-muted);
}

.plan-legend a:is(:hover, :focus-visible, .is-lit) .plan-room-name { color: var(--brass-light); }

/* where you are, in words too: the dot beside the name */
.plan-legend a[aria-current] .plan-no::after {
  content: " ●";
  color: var(--brass-light);
}

.plan-block {
  max-width: none;
  margin-top: var(--space-3);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-align: right;
  color: var(--bone-muted);
}

@media (min-width: 48rem) {
  .plan-sheets { grid-template-columns: 1fr 1fr; }
}

/* Phones: the plan is the whole screen, as the directory was */
@media (max-width: 47.99rem) {
  .plan {
    width: 100%;
    height: 100%;
    max-height: none;
    padding: var(--space-5) var(--space-3) var(--space-4);
    border: none;
    border-radius: 0;
  }

  .plan-close {
    top: var(--space-2);
    right: var(--space-2);
  }

  .plan-room-name { font-size: 1.6rem; }
}

/* 14. PHONES: scrolling becomes the scanner */
@keyframes scan-reveal {
  from { clip-path: inset(0 0 100% 0); }
  to   { clip-path: inset(0); }
}

@keyframes scan-line {
  from { top: 0; opacity: 1; }
  to   { top: calc(100% - 2px); opacity: 1; }
}

@keyframes plaque-border {
  0%, 55%   { border-color: var(--brass); }
  60%, 100% { border-color: var(--cyan); }
}

@keyframes plaque-out {
  0%, 55%   { opacity: 1; }
  60%, 100% { opacity: 0; }
}

@keyframes plaque-in {
  0%, 55%   { opacity: 0; }
  60%, 100% { opacity: 1; }
}

@media (hover: none) and (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .portrait { view-timeline-name: --portrait; }

    .portrait-scan,
    .portrait-frame::after,
    .plaque,
    .plaque-paper,
    .plaque-scan {
      animation-timing-function: linear;
      animation-fill-mode: both;
      animation-timeline: --portrait;
      animation-range: contain 10% contain 70%;
    }

    .portrait-scan         { animation-name: scan-reveal; }
    .portrait-frame::after { animation-name: scan-line; }
    .plaque                { animation-name: plaque-border; }
    .plaque-paper          { animation-name: plaque-out; }
    .plaque-scan           { animation-name: plaque-in; }
  }
}

/* 15. THE STUDY: a writing desk */

/* HOW I WORK, before the letter: five steps on one brass line, then what
   every project includes and what follows the launch. What a client most
   wants to know before writing - how it runs, and that I will not vanish
   once it is live. */
.process { margin-bottom: var(--space-5); }

.process-title { margin-top: 0; }

.process-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.process-steps li {
  position: relative;
  display: grid;
  align-content: start;
  gap: 0.35rem;
  padding-top: var(--space-3);
  border-top: 1px solid rgb(184 149 90 / 0.45);
}

/* a brass stud on the line where each step begins */
.process-steps li::before {
  content: "";
  position: absolute;
  top: -4px;
  left: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brass-light);
}

.step-n {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  color: var(--brass);
}

.process-steps strong {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 400;
  line-height: 1.15;
  color: var(--bone);
}

.process-steps li > span:last-child {
  font-size: var(--text-sm);
  color: var(--bone-muted);
}

/* On a phone the line turns down the left edge, and each step's number
   and name share a line: five steps in about half a screen, not one and a
   half. */
@media (max-width: 40rem) {
  .process-steps {
    gap: var(--space-2);
    padding-left: 1.25rem;
    border-left: 1px solid rgb(184 149 90 / 0.45);
  }

  .process-steps li {
    grid-template-columns: auto 1fr;
    align-items: baseline;
    column-gap: 0.6rem;
    row-gap: 0.15rem;
    padding-top: 0;
    border-top: 0;
  }

  .process-steps li::before { top: 0.55rem; left: calc(-1.25rem - 4px); }
  .process-steps strong { font-size: 1.15rem; }
  .process-steps li > span:last-child { grid-column: 1 / -1; }
}

.process-terms {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
  gap: var(--space-4);
  margin-top: var(--space-5);
}

.terms h4 {
  margin-bottom: var(--space-2);
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 400;
  color: var(--bone);
}

.terms ul {
  display: grid;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.terms li {
  position: relative;
  padding-left: 1.1rem;
  font-size: var(--text-sm);
  color: rgb(233 230 222 / 0.82);
}

.terms li::before {
  content: "\25B8" / "";
  position: absolute;
  left: 0;
  color: var(--brass);
}

.desk {
  display: grid;
  gap: var(--space-5);
  align-items: center;
}

@media (min-width: 56rem) {
  .desk { grid-template-columns: 1.4fr 1fr; }
}

/* The letter: warm paper, letterhead stripe, lying slightly askew */
.letter {
  position: relative;
  padding: var(--space-5) var(--space-4) var(--space-4);
  color: #23241F;
  background: linear-gradient(to bottom, #F1EDE4, #D9D3C5);
  border-radius: 1px;
  box-shadow: 0 30px 60px -24px #000;
  transform: rotate(-1deg);
}

.letter::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background:
    linear-gradient(var(--cyan), var(--cyan)) bottom / 100% 1px no-repeat,
    var(--racing-green);
}

.letter p + p { margin-top: var(--space-2); }

.letter-place {
  max-width: none;
  margin-bottom: var(--space-3);
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6E5630;
}

.letter-greeting {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.5rem;
}

.letter-signoff { margin-top: var(--space-3); }

.letter-signature {
  position: relative;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 2.5rem;
  line-height: 1;
  color: var(--racing-green);
}

/* THE SIGNATURE: Andre's AA, drawn by scripts/signature.py. One signature
   in two places - on the portrait in the Foyer, as an artist signs a
   drawing, and at the foot of the letter in the Study, in the quill's ink.
   Each stroke is a filled outline (a pointed pen swells on the way down and
   thins on the way up), shown through a mask whose centreline draws itself:
   the ink appears behind the moving pen. Without a script, or with less
   motion, it is simply there, signed. */
.signature {
  display: block;
  overflow: visible;
  pointer-events: none;
}

.sig-ink,
.sig-drop { fill: currentColor; }

/* Across the portrait's lower corner and out onto the black, in brass:
   racing green would vanish on the black, and the brass is the frame's. A
   dark halo keeps it legible where it crosses the paper. */
.signature--foyer {
  --sig-at: 1.9s;
  position: absolute;
  z-index: 2;
  left: -14%;
  bottom: 2%;
  width: 74%;
  color: var(--brass-light);
  filter: drop-shadow(0 2px 6px rgb(0 0 0 / 0.85)) drop-shadow(0 0 1px #000);
}

/* On a phone the portrait spans the screen: the run-up stays inside it */
@media (max-width: 40rem) {
  .signature--foyer { left: -2%; width: 72%; }
}

/* At the foot of the letter, in the quill's racing green. The quill now
   lies beside the end of the signature, set down after signing. */
.signature--letter {
  --sig-at: 0.3s;
  width: min(15rem, 62%);
  margin: -0.4rem 0 -0.3rem -0.7rem;
  color: var(--racing-green);
}

@media (prefers-reduced-motion: no-preference) {
  /* Armed: the pen not yet on the paper. The Foyer's is on screen at the
     first paint, so it starts unsigned before the script arms it - no
     flash of a finished signature that then vanishes and writes itself. */
  .signature.is-armed .sig-pen { stroke-dasharray: 1; stroke-dashoffset: 1; }
  .signature.is-armed .sig-drop { opacity: 0; }

  @media (scripting: enabled) {
    .signature--foyer:not(.is-drawing) .sig-pen { stroke-dasharray: 1; stroke-dashoffset: 1; }
    .signature--foyer:not(.is-drawing) .sig-drop { opacity: 0; }
  }

  /* 1. the run-up, the peak, the downstroke; 2. the pen rests and leaves
     its drop; 3. the second A, the bar, the name; 4. the last fast stroke.
     Seconds from --sig-at, which waits in the Foyer for the portrait's ink
     to finish arriving. */
  .signature.is-drawing .sig-pen--1 {
    stroke-dasharray: 1;
    animation: draw-line 0.55s var(--ease-pen) var(--sig-at) both;
  }

  .signature.is-drawing .sig-drop {
    transform-box: fill-box;
    transform-origin: 50% 0;
    animation: sig-drop 0.3s var(--ease) calc(var(--sig-at) + 0.5s) both;
  }

  .signature.is-drawing .sig-pen--2 {
    stroke-dasharray: 1;
    animation: draw-line 0.95s var(--ease-pen) calc(var(--sig-at) + 0.75s) both;
  }

  .signature.is-drawing .sig-pen--3 {
    stroke-dasharray: 1;
    animation: draw-line 0.3s cubic-bezier(0.45, 0, 0.8, 0.6) calc(var(--sig-at) + 1.8s) both;
  }
}

@keyframes sig-drop {
  from { opacity: 0; transform: scale(0.3); }
  to   { opacity: 1; transform: none; }
}

/* The quill: it signed the letter and was set down beside the name */
.quill {
  position: absolute;
  top: 1.6rem;
  left: min(14.6rem, 60%);
  width: calc(100% - min(14.6rem, 60%) + var(--space-4) + 1rem);
  pointer-events: none;
}

/* Materials, lit from the upper left */
.steel-light { stop-color: #E4E2DC; }
.steel-mid   { stop-color: #9C9D97; }
.steel-dark  { stop-color: #45473F; }
.horn-light  { stop-color: #F2E8D2; }
.horn-dark   { stop-color: #BFAE89; }

/* On paper the engraving runs the usual way: ink lines on white */
.quill-shadow { fill: var(--ink); opacity: 0.32; }

.vane-lit   { fill: #FBF9F3; }
.vane-shade { fill: #EFEADF; }

.barbs { fill: none; stroke: var(--ink); stroke-linecap: round; }
.barbs-lit   { stroke-width: 0.32; stroke-opacity: 0.5; }
.barbs-shade { stroke-width: 0.4; stroke-opacity: 0.72; }
.barbs-core  { stroke-width: 0.55; stroke-opacity: 0.55; }
.barbs-wisp  { stroke-width: 0.28; stroke-opacity: 0.55; }

.down {
  fill: none;
  stroke: var(--ink);
  stroke-width: 0.28;
  stroke-opacity: 0.45;
  stroke-linecap: round;
}

.rachis {
  fill: #FBF9F3;
  stroke: var(--ink);
  stroke-width: 0.35;
  stroke-opacity: 0.7;
}

.horn { fill: url(#quill-horn); stroke: var(--ink); stroke-width: 0.35; stroke-opacity: 0.6; }
.horn-shine { stroke: #fff; stroke-width: 0.5; stroke-opacity: 0.7; stroke-linecap: round; }

.ferrule rect { fill: url(#quill-brass); stroke: var(--brass-deep); stroke-width: 0.3; }
.knurl { fill: url(#quill-knurl); }
.knurl-line { stroke: var(--brass-deep); stroke-width: 0.35; stroke-opacity: 0.6; }

.nib { fill: url(#quill-steel); stroke: var(--ink); stroke-width: 0.35; }
.nib-shoulder { fill: none; stroke: var(--ink); stroke-width: 0.3; stroke-opacity: 0.6; }
.nib-slit { stroke: var(--ink); stroke-width: 0.4; }
.nib-hole { fill: var(--ink); }

/* The same green as the signature: this is the pen that wrote it */
.nib-ink,
.ink-drop { fill: var(--racing-green); }
.ink-shine { fill: #fff; fill-opacity: 0.55; }

/* The wax seal */
.desk-actions {
  display: grid;
  justify-items: start;
  gap: var(--space-3);
}

.seal {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--bone);
  text-decoration: none;
}

/* The wax seal: green wax, a pressed field, a gilded impression */
.seal-wax {
  display: block;
  width: 6.5rem;
  height: 6.5rem;
  transition: transform var(--quick) var(--ease), filter var(--quick) var(--ease);
  filter: drop-shadow(2px 5px 5px rgb(0 0 0 / 0.75));
}

.seal-face { width: 100%; height: 100%; overflow: visible; }

.seal-wax-body path { fill: var(--racing-green); }

.recess-dark  { stop-color: #001A10; }
.recess-mid   { stop-color: #00331D; }
.recess-light { stop-color: #0F6A44; }

.seal-field { fill: url(#seal-recess); }

.seal-field-catch {
  fill: none;
  stroke: #3FA374;
  stroke-opacity: 0.45;
  stroke-width: 1;
  stroke-linecap: round;
}

.seal-field-edge {
  fill: none;
  stroke: #000;
  stroke-opacity: 0.35;
  stroke-width: 1.2;
}

/* The impression: gilt on the raised parts, like a gilded seal */
.seal-rule {
  fill: none;
  stroke: url(#seal-gilt);
  stroke-width: 0.9;
}

.seal-beads circle,
.seal-points { fill: url(#seal-gilt); }

.seal-monogram {
  font-family: var(--font-display);
  font-size: 30px;
  letter-spacing: -0.04em;
  fill: url(#seal-gilt);
  text-anchor: middle;
  dominant-baseline: central;
}

/* Pressing the seal: it sinks a little and the shadow tightens */
.seal:hover .seal-wax,
.seal:focus-visible .seal-wax {
  transform: scale(0.95) rotate(-4deg);
  filter: drop-shadow(1px 2px 2px rgb(0 0 0 / 0.8));
}

.seal-label {
  font-weight: 500;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--brass);
}

.channel {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--bone-muted);
}

/* The pocket watch: live Abidjan time, and tonight's moon */
.watch {
  display: grid;
  justify-items: start;
  gap: var(--space-1);
  width: min(100%, 25rem);
  margin: var(--space-2) 0 0;
}

.watch-face { width: 100%; }

/* Materials: brass and enamel, lit from the upper left */
.brass-light { stop-color: var(--brass-light); }
.brass-mid   { stop-color: var(--brass); }
.brass-dark  { stop-color: var(--brass-dark); }
.brass-deep  { stop-color: var(--brass-deep); }
.paper-lit   { stop-color: var(--paper); }
.paper-shade { stop-color: var(--paper-shade); }

/* The engraver's hatch */
.hatch-line { stroke: var(--bone); stroke-width: 0.45; }
.reed-line  { stroke: #000; stroke-opacity: 0.4; stroke-width: 0.9; }

.watch-ground { opacity: 0.5; }
.watch-shadow { fill: var(--black); }

/* The chain: one path drawn three times */
.chain-spine,
.chain-links,
.chain-holes { fill: none; stroke-linecap: round; }

.chain-spine { stroke: var(--brass-dark); stroke-width: 1.1; }
.chain-links { stroke: var(--brass); stroke-width: 3.4; stroke-dasharray: 3 4.6; }
.chain-holes { stroke: var(--black); stroke-width: 1.3; stroke-dasharray: 3 4.6; }
.chain-bar   { stroke: var(--brass); stroke-width: 2.6; stroke-linecap: round; }

/* Case and bezel */
.watch-cut {
  fill: none;
  stroke: #000;
  stroke-opacity: 0.45;
  stroke-width: 0.45;
}

.watch-milling {
  fill: none;
  stroke: #000;
  stroke-opacity: 0.3;
  stroke-width: 2.2;
  stroke-dasharray: 0.5 0.5;
}

.watch-shine {
  fill: none;
  stroke: var(--paper);
  stroke-opacity: 0.75;
  stroke-width: 1;
  stroke-linecap: round;
}

.watch-wall { fill: var(--brass-dark); }

/* The dial */
.watch-rail {
  fill: none;
  stroke: var(--ink);
  stroke-width: 0.3;
}

.watch-minutes,
.watch-fives {
  fill: none;
  stroke: var(--ink);
}

.watch-minutes { stroke-width: 2.4; stroke-dasharray: 0.1 0.9; stroke-dashoffset: 0.05; }
.watch-fives   { stroke-width: 3; stroke-dasharray: 0.05 0.95; stroke-dashoffset: 0.025; }

.watch-numerals text {
  font-family: var(--font-display);
  font-size: 7.8px;
  fill: var(--ink);
  text-anchor: middle;
  dominant-baseline: central;
}

.watch-maker {
  font-family: var(--font-display);
  font-size: 3.4px;
  letter-spacing: 0.12em;
  fill: var(--ink);
  fill-opacity: 0.75;
  text-anchor: middle;
}

/* Moon and movement */
.watch-night,
.watch-movement { fill: var(--black); }

.watch-star      { fill: var(--brass-light); }
.watch-moon-dark { fill: rgb(233 230 222 / 0.1); }
.watch-moon-lit  { fill: var(--bone); }

.watch-rim {
  fill: none;
  stroke: var(--brass);
  stroke-width: 1.2;
}

.watch-gear   { fill: var(--brass); }
.watch-pinion { fill: var(--brass-dark); }

.watch-seconds-track {
  fill: none;
  stroke: var(--brass-light);
  stroke-width: 1.4;
  stroke-dasharray: 0.07 0.93;
  stroke-dashoffset: 0.035;
}

/* Hands: ink for the hours, cyan for the one that is alive */
.watch-hands { filter: drop-shadow(0.5px 0.9px 0.5px rgb(0 0 0 / 0.45)); }
.watch-hand  { fill: var(--ink); }

.watch-second { filter: drop-shadow(0 0 0.5px #000); }

.watch-second line {
  stroke: var(--cyan);
  stroke-width: 1;
  stroke-linecap: round;
}

.watch-second circle { fill: var(--cyan); }

.watch-pin {
  fill: var(--brass);
  stroke: var(--ink);
  stroke-width: 0.4;
}

.watch-glass { fill: #fff; fill-opacity: 0.16; }

/* It only moves like a mechanism once it has been set */
.watch-hand,
.watch-second,
.watch-gear { transform-origin: 0 0; }

.watch.is-running .watch-hand,
.watch.is-running .watch-second,
.watch.is-running .watch-gear {
  transition: transform var(--quick) var(--ease);
}

.watch-caption {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brass);
}

.watch-time { color: var(--bone); }

/* Calling cards */
.calling-cards {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-5);
  padding: 0;
  list-style: none;
}

.calling-cards a {
  display: grid;
  gap: 0.25rem;
  min-width: 11rem;
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--bone);
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color var(--quick) var(--ease), transform var(--quick) var(--ease);
}

.calling-cards a:hover,
.calling-cards a:focus-visible {
  border-color: var(--brass);
  transform: translateY(-2px);
}

.card-kind {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brass);
}

/* 16. THE GROUNDS: the house at night */
.grounds {
  margin-top: var(--space-5);
  padding: var(--space-5) var(--space-3) var(--space-3);
  border-top: 1px solid var(--line);
  background: radial-gradient(ellipse 60% 70% at 50% 100%, rgb(11 90 58 / 0.25), transparent 70%);
}

.house {
  display: block;
  width: 100%;
  max-width: 52rem;
  margin-inline: auto;
  overflow: visible;
}

/* The architect's line: bone on black, the main edges firm, the detail fine.
   The structure is lit, the detail is not - the rule is in section 4b. */
.house-line {
  filter: var(--lit-line);
  fill: none;
  stroke: var(--bone);
  stroke-opacity: 0.8;
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.house-fine {
  fill: none;
  stroke: var(--bone);
  stroke-opacity: 0.4;
  stroke-width: 0.7;
  stroke-linecap: round;
}

.house-leaflets { stroke-opacity: 0.55; }

.house-guide {
  fill: none;
  stroke: var(--cyan);
  stroke-opacity: 0.45;
  stroke-width: 1;
  stroke-dasharray: 5 6;
  vector-effect: non-scaling-stroke;
}

/* One room is lit: someone is home */
.house-window {
  fill: var(--brass);
  filter: drop-shadow(0 0 10px rgb(184 149 90 / 0.8));
  animation: window-glow 5s ease-in-out infinite alternate;
}

.house-pool { animation: window-glow 5s ease-in-out infinite alternate; }

@keyframes window-glow {
  from { opacity: 0.75; }
  to   { opacity: 1; }
}

.house-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.15em;
  fill: var(--bone-muted);
}

/* The lines draw themselves as the house arrives, the detail settles in
   behind them, and the window is lit last - 2.4s in all, the lines lighting
   with the window, and the glow takes over from there. Beats in seconds from arrival; section 4b has the why. */
@media (prefers-reduced-motion: no-preference) {

  /* Armed: the ground and the construction lines are set out and nothing is
     built yet. The window's glow has to be switched off here, or it would go
     on painting a lit window over the dark. */
  .house.is-armed .house-fine { opacity: 0; }

  .house.is-armed :is(.house-window, .house-pool) {
    animation: none;
    opacity: 0;
  }

  .house.is-armed .house-line {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
  }

  /* The structure first... */
  .house.is-drawing .house-line {
    animation: draw-line 1.7s var(--ease-pen) both,
               lines-lit 0.5s var(--ease) 1.9s both;
  }

  /* ...then the detail settles in... */
  .house.is-drawing .house-fine {
    animation: arrive 0.7s var(--ease) 1.3s both;
  }

  /* ...and last a light comes on, the lines light with it, and the window
     goes on breathing. Two
     animations: the scroll version had one, and silently lost the breathing
     - it replaced window-glow with its own animation-name, and the lit
     window held still ever after. alternate-reverse so the glow starts at
     full, which is where the arrival left it. */
  .house.is-drawing :is(.house-window, .house-pool) {
    animation:
      arrive 0.5s var(--ease) 1.9s both,
      window-glow 5s ease-in-out 2.4s infinite alternate-reverse;
  }
}

/* 16b. THE HOUSE, TURNED: the house directory, with a body

   scripts/house3d.py un-projects the hand drawing into metres and writes a
   model of it into the same <svg>, lying exactly on the drawing. It stays
   invisible until someone turns the house; then js/script.js adds .is-model,
   the model comes up over the drawing and the drawing goes. There is no 3D
   library and no canvas: the model is SVG paths like everything else, and
   the script re-projects their points.

   The drawing is hidden with `visibility`, not `opacity`: several of its
   parts hold their opacity with an animation (section 4b), and an animated
   property beats a plain declaration. Visibility nobody animates. It goes
   AFTER the model has faded in - that is the delay - so for half a second
   the two are on the sheet together and the eye is carried across. */
.house-model {
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--base) var(--ease), visibility 0s linear var(--base);
}

/* The model is lit like the drawing, but with ONE shadow over the whole
   group and not --lit-line's two on every wall. Measured while it turns, on
   a soft renderer: the pair costs 27ms a frame, the single one below does
   not show up at all. A thing that moves every frame gets the cheap light. */
.house.is-model .house-model {
  filter: drop-shadow(0 0 4px rgb(160 228 232 / 0.3));
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}

.house.is-model > :not(.house-model):not(defs) {
  visibility: hidden;
  transition: visibility 0s linear var(--base);
}

/* The sheet's two annotations are not part of the house and stay put. */
.house.is-model > .house-label:not([data-i18n]) { visibility: visible; }

/* A wall is filled with the page's own black, so a near wall hides a far
   one. That, and drawing far things first, is all the hidden-line removal
   there is. */
.h3-wall,
.h3-board,
.h3-ball {
  fill: var(--black);
  stroke: var(--bone);
  stroke-opacity: 0.8;
  stroke-width: 1.3;
  stroke-linejoin: round;
}

.h3-line,
.h3-fine,
.h3-guide {
  fill: none;
  stroke: var(--bone);
  stroke-linecap: round;
  stroke-linejoin: round;
}

.h3-line  { stroke-opacity: 0.8; stroke-width: 1.3; }
.h3-fine  { stroke-opacity: 0.4; stroke-width: 0.7; }

.h3-guide {
  stroke: var(--cyan);
  stroke-opacity: 0.45;
  stroke-width: 1;
  stroke-dasharray: 5 6;
  vector-effect: non-scaling-stroke;
}

.h3-pool { stroke: none; }

/* A room: nothing to see until it is pointed at, then its opening fills
   with lamplight and its plate comes up. The door is the exception - the
   door is always lit, in the model as in the drawing. */
.h3-hit {
  fill: rgb(226 197 143 / 0);
  stroke: none;
  transition: fill var(--quick) var(--ease);
}

.h3-lit { fill: var(--brass); }

.h3-room:hover .h3-hit,
.h3-room.is-lit .h3-hit { fill: rgb(226 197 143 / 0.42); }

.h3-room:hover .h3-lit,
.h3-room.is-lit .h3-lit { fill: var(--brass-light); }

.h3-tag {
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.14em;
  fill: var(--brass-light);
  /* a black edge, so a wall's lines passing behind cannot cut the letters */
  paint-order: stroke;
  stroke: var(--black);
  stroke-width: 3px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--quick) var(--ease);
}

.h3-room:hover .h3-tag,
.h3-room.is-lit .h3-tag { opacity: 1; }

.house.is-live {
  cursor: grab;
  touch-action: pan-y;      /* up and down is the page; across is the house */
  user-select: none;
}

.house.is-turning { cursor: grabbing; }

.house-tour {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-2) var(--space-3);
  margin-top: var(--space-2);
}

.house-tour[hidden] { display: none; }

.house-hint,
.house-turn,
.house-rooms {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.house-hint { max-width: none; color: var(--bone-muted); }

.house-turn {
  padding: 0.55rem 0.9rem;
  color: var(--brass-light);
  background: transparent;
  border: 1px solid var(--brass);
  cursor: pointer;
  transition: background-color var(--quick) var(--ease);
}

.house-turn:hover,
.house-turn:focus-visible { background: rgb(184 149 90 / 0.18); }

/* The directory in words: five plain links, there with or without the
   model, and the only form of it a screen reader is given. */
.house-rooms ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-1) var(--space-3);
  margin-top: var(--space-3);
  padding: 0;
  list-style: none;
}

.house-rooms a {
  color: var(--bone-muted);
  text-decoration: none;
  transition: color var(--quick) var(--ease);
}

.house-rooms a:hover,
.house-rooms a:focus-visible { color: var(--brass-light); }

.footer-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-2);
  max-width: var(--container);
  margin: var(--space-4) auto 0;
  font-size: var(--text-sm);
  color: var(--bone-muted);
}

.footer-bar p { max-width: none; }

.back-to-top {
  font-family: var(--font-mono);
  text-decoration: none;
}

/* Small screens: keep it calm and readable */
@media (max-width: 640px) {

  .site-header ul { gap: var(--space-2); }
  .room { padding: var(--space-4) var(--space-2); }
  .foyer { padding-block: var(--space-4); }
}

/* 17. THE INTAKE: a dossier on the desk */
.form-page {
  max-width: 46rem;
  margin-inline: auto;
  padding: var(--space-5) var(--space-3) var(--space-6);
}

.form-page h1,
.received h1 { font-size: clamp(2.5rem, 2rem + 2.5vw, 4rem); }

.form-page .lead {
  margin-top: var(--space-3);
  font-size: var(--text-lg);
  color: var(--bone-muted);
}

.intake-form {
  display: grid;
  gap: var(--space-4);
  margin-top: var(--space-5);
}

/* Each part of the dossier is a plate, labelled on its top edge */
.intake-form > fieldset {
  margin: 0;
  padding: var(--space-3);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.intake-form legend {
  padding-inline: var(--space-2);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brass);
}

/* The written fields */
.field { display: grid; gap: var(--space-1); }

.field + .field { margin-top: var(--space-3); }

.field label {
  font-size: var(--text-sm);
  font-weight: 500;
}

.req { color: var(--cyan); }

.optional {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 0.75rem;
  color: var(--bone-muted);
}

.intake-form input:not([type="checkbox"]):not([type="radio"]),
.intake-form select,
.intake-form textarea {
  font: inherit;
  width: 100%;
  padding: 0.7rem 0.85rem;
  color: var(--bone);
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color var(--quick) var(--ease), box-shadow var(--quick) var(--ease);
}

.intake-form textarea { resize: vertical; min-height: 9rem; }

/* The live field: the one place cyan belongs on this page */
.intake-form input:not([type="checkbox"]):not([type="radio"]):focus,
.intake-form select:focus,
.intake-form textarea:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 1px var(--cyan), 0 0 18px -6px var(--cyan);
}

/* Wrong, but only once they have actually typed something */
.intake-form input:not([type="checkbox"]):not([type="radio"]):user-invalid,
.intake-form textarea:user-invalid {
  border-color: #D2635A;
}

.hint {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--bone-muted);
}

/* The choices: boxes you tick, not fields you fill */
.intake-form input[type="checkbox"],
.intake-form input[type="radio"] {
  flex: none;
  width: 1.05rem;
  height: 1.05rem;
  margin: 0.15rem 0 0;
  accent-color: var(--cyan);
  cursor: pointer;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.6rem 0.75rem;
  font-size: var(--text-sm);
  line-height: 1.45;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color var(--quick) var(--ease), background-color var(--quick) var(--ease);
}

.check:hover {
  border-color: var(--line);
  background: var(--surface-raised);
}

/* What has been chosen keeps a brass edge */
.check:has(:checked) {
  border-color: rgb(184 149 90 / 0.5);
  background: var(--surface-raised);
}

.check-grid {
  display: grid;
  gap: 0.25rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  margin-top: var(--space-2);
}

/* The timeline sits on its own small plate */
.radio-group {
  display: grid;
  gap: 0.25rem;
  margin: var(--space-3) 0 0;
  padding: var(--space-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.intake-form button[type="submit"] {
  margin: var(--space-3) 0 var(--space-2);
}

/* What the form says back */
.form-status {
  margin-top: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.5;
}

.form-status:empty { display: none; }

.is-sending { color: var(--cyan); }
.is-error   { color: #D2635A; }

.intake-form button[type="submit"]:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* The honeypot: out of sight, still in the form */
.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* 18. RECEIVED: the letter has landed */
.received {
  display: grid;
  align-content: center;
  justify-items: start;
  min-height: 100svh;
  max-width: 42rem;
  margin-inline: auto;
  padding: var(--space-5) var(--space-3);
}

.received .room-number { color: var(--brass); }

.received h1 { margin-top: var(--space-2); }

.received .lead {
  margin-top: var(--space-3);
  font-size: var(--text-lg);
  color: var(--bone-muted);
}

.received .hint { margin-top: var(--space-3); }

.received-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

/* 19. THE FORM PAGES ON PHONES */
@media (max-width: 640px) {
  /* The dossier gets the same narrower margins as the rooms */
  .form-page,
  .received { padding-inline: var(--space-2); }

  .intake-form > fieldset { padding: var(--space-2); }

  /* A thumb needs more than a mouse does */
  .check { padding: 0.8rem 0.6rem; }

  .intake-form button[type="submit"] { width: 100%; justify-content: center; }
}

/* 20. THE CURSOR: over anything that opens, the room's own object

   The house key where a room has none of its own (the header, the Foyer,
   the Grounds, the Gallery's keys); a car key in the Garage and its case
   studies; the Library's pawn, picked up to be moved; a pen nib in the
   Study; a loupe over a picture. Only over what can be clicked - the
   object turning up is what tells you something opens.

   scripts/cursors.py draws every image. Fine pointers only - a finger has
   no cursor to change. Each url() names a system cursor after it, so one
   that fails to load is an ordinary hand rather than nothing, and the two
   numbers after each url() are its hotspot, the point that clicks: the
   tip of the key, the car key's blade, the crown of the pawn's head, the
   nib's point, the loupe's middle. cursors.py prints them; if it moves
   them, change them here.

   Everywhere else the system keeps its own cursor: the arrow, the text bar
   in a field, the hand on a checkbox, grab where the orrery and the house
   turn, the crosshair over the portrait's scan. A cursor that is brass
   everywhere means nothing anywhere.

   Last in the file on purpose. Buttons across the house set their own
   `cursor: pointer`; coming after them, these win by order, without a
   single !important. */
@media (hover: hover) and (pointer: fine) {
  a[href],
  button:not(:disabled),
  summary,
  .is-live .orrery-body,
  .vigil-head {
    cursor: url("../assets/cursors/key.svg") 5 5, pointer;
  }

  /* The rooms that have an object of their own. The room's id outranks the
     house key's selectors, so these win wherever they apply. */
  :is(#projects, .modal--case) :is(a[href], button:not(:disabled), summary) {
    cursor: url("../assets/cursors/car-key.svg") 5 5, pointer;
  }

  #about :is(a[href], button:not(:disabled), summary),
  #about .is-live .orrery-body {
    cursor: url("../assets/cursors/pawn.svg") 5 5, pointer;
  }

  #contact :is(a[href], button:not(:disabled), summary) {
    cursor: url("../assets/cursors/nib.svg") 5 5, pointer;
  }

  /* An artwork is not opened, it is looked at closely. */
  button.artwork-frame {
    cursor: url("../assets/cursors/loupe.svg") 12 12, zoom-in;
  }

  /* Except a piece turned away on the salon's stand: clicking that one
     brings it round to the front, which is opening the way, not looking. */
  .is-turning .artwork:not(.is-stage) .artwork-frame {
    cursor: url("../assets/cursors/key.svg") 5 5, pointer;
  }

  /* The stand itself is taken hold of and turned */
  .salon-room.is-turning { cursor: grab; }
  .salon-room.is-dragging,
  .salon-room.is-dragging * { cursor: grabbing; }
}

/* Calm house for visitors who prefer less motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}