:root {
  --paper: #f5f4f0; --type: #1b1b1a; --muted: #6b6a66; --rule: #d9d7d0;
  --ink: #f4f3ef; --ink-dim: rgba(244, 243, 239, .72); --veil: rgba(14, 14, 14, .55);
  --sans: "IBM Plex Sans", "IBM Plex Sans JP", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --jp: "IBM Plex Sans JP", "IBM Plex Sans", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0d0d0c; color: var(--ink); font: 15px/1.5 var(--sans); }
body.ja { font-family: var(--jp); }
canvas.gl { position: fixed; inset: 0; display: block; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
em { font-style: italic; }
body.ja em { font-style: normal; }

/* ---------- start screen (after 137: quiet paper page, two choices) */
#start { position: fixed; inset: 0; z-index: 30; background: var(--paper); color: var(--type);
  display: grid; grid-template-rows: auto 1fr auto; padding: 24px 32px; transition: opacity .6s ease; }
#start.gone { opacity: 0; pointer-events: none; }
.start-top { font-size: 14px; color: var(--muted); }
.start-inner { align-self: center; justify-self: center; width: min(440px, 100%); }
.start-inner .kicker { margin: 0 0 18px; font-size: 14px; color: var(--muted); }
.start-inner h1 { margin: 0; font: 500 30px/1.15 var(--sans); letter-spacing: -.01em; }
.start-inner h1 .ja { display: block; margin-top: 6px; font: 400 17px/1.4 var(--jp); color: var(--muted); }
.start-inner .years { margin: 6px 0 28px; font-size: 17px; }
#progress { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin-bottom: 22px; font: 12px var(--mono); color: var(--muted); }
#progress .track { grid-column: 1 / -1; height: 2px; background: var(--rule); }
#progress .fill { height: 100%; width: 0; background: var(--type); transition: width .2s; }
#progress.done { visibility: hidden; height: 0; margin: 0; }
.choices { display: grid; gap: 12px; }
.choices button, #endcard button { display: flex; justify-content: space-between; align-items: center; width: 100%;
  padding: 13px 18px; border: 1px solid var(--type); font-size: 17px; text-align: left; transition: background .2s, color .2s; }
.choices button:hover:not(:disabled), #endcard button:hover { background: var(--type); color: var(--paper); }
.choices button:disabled { opacity: .35; cursor: default; }
.start-inner .note { margin: 22px 0 0; font-size: 14px; color: var(--muted); }
.lang-row { margin-top: 18px; display: flex; gap: 14px; font-size: 13px; }
.lang-row .lang { color: var(--muted); border-bottom: 1px solid transparent; }
.lang-row .lang.on { color: var(--type); border-bottom-color: var(--type); }
.start-foot { margin: 0; font-size: 13px; color: var(--muted); text-align: center; }

/* ---------- top bar */
#topbar { position: fixed; left: 0; right: 0; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center;
  padding: 20px 32px; text-shadow: 0 1px 4px rgba(0,0,0,.45); pointer-events: none; opacity: 0; transition: opacity .6s; }
body.in-room #topbar { opacity: 1; }
#topbar .brand { font-size: 14px; line-height: 1.4; color: var(--ink-dim); pointer-events: auto; }   /* CTG, then the Ragnar Digital credit (linked) under it (Oct 30 2026) */
#topbar .brand a { color: inherit; text-decoration: none; }
#topbar .brand a:hover { text-decoration: underline; text-underline-offset: 4px; }
#topbar .brand .b-ctg { display: block; }
#topbar .brand .b-rd { display: block; font-size: 12px; opacity: .75; }
#topbar nav { display: flex; gap: 22px; pointer-events: auto; font-size: 14px; }
#topbar nav button { color: var(--ink); }
#topbar nav button:hover { text-decoration: underline; text-underline-offset: 4px; }
#topbar .mode .dot { display: inline-block; width: 6px; height: 6px; margin-right: 7px; vertical-align: 2px; border-radius: 50%; background: transparent; }
#topbar .mode.on .dot { background: #e0431f; }

/* ---------- caption (tour stops and look-at labels) */
#caption { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; padding: 120px 64px 104px; pointer-events: none;
  background: linear-gradient(to top, rgba(10,10,10,.66), rgba(10,10,10,.28) 55%, rgba(10,10,10,0)); opacity: 0; transition: opacity .5s ease; }
body.walking #caption { padding-bottom: 48px; }
#caption.on { opacity: 1; }
#caption h2 { margin: 0 0 8px; font: 500 25px/1.25 var(--sans); max-width: 760px; }
body.ja #caption h2 { font-family: var(--jp); }
#caption p { margin: 0; max-width: 620px; font-size: 16px; color: rgba(244,243,239,.92); white-space: pre-line; }   /* a stop text's blank line ("\n\n") shows as a paragraph break: first stop, film stop (Michael, Nov 11 2026) */
#caption .hint { margin-top: 12px; font: 12px var(--mono); color: rgba(244,243,239,.6); }
#caption .hint:empty { display: none; }

/* ---------- "About the house": only while in the garden; opens the details panel (Michael, Oct 15 2026) */
#house-btn { position: fixed; left: 64px; bottom: 68px; z-index: 6; display: inline-flex; align-items: center; gap: 14px; padding: 8px 14px;
  border: 1px solid rgba(244,243,239,.7); background: rgba(10,10,10,.32); color: var(--ink); font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .5s ease, background .2s, color .2s; }
body.in-room.outside #house-btn { opacity: 1; pointer-events: auto; }
#house-btn:hover { background: var(--ink); color: var(--type); }
#house-btn.nudge { animation: nudgeLight 1.25s ease-in-out 4; }   /* the "Pause to read" flash, light on dark, for 5 s (Michael, Oct 15 2026) */
@keyframes nudgeLight { 0%, 100% { background: rgba(10,10,10,.32); color: var(--ink); box-shadow: 0 0 0 0 rgba(244, 243, 239, 0); }
  50% { background: var(--ink); color: var(--type); box-shadow: 0 0 0 7px rgba(244, 243, 239, .18); } }
body.walking #house-btn { bottom: 32px; }
body.ja #house-btn { font-family: var(--jp); }

/* ---------- tour controls */
#tourbar { position: fixed; left: 48px; right: 48px; bottom: 30px; z-index: 6; display: none; align-items: center; gap: 18px;
  font-size: 15px; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
body.touring #tourbar { display: flex; }
#tourbar button { min-width: 22px; color: var(--ink); }
#t-prev, #t-next { font-size: 24px; line-height: 1; }
#t-scrub { position: relative; flex: 1; height: 24px; cursor: pointer; touch-action: none; }
#t-scrub .rail, #t-scrub .done { position: absolute; left: 0; top: 11px; height: 2px; background: rgba(255,255,255,.35); right: 0; }
#t-scrub .done { right: auto; width: 0; background: #e8e6e0; }
#t-scrub .ticks i { position: absolute; top: 7px; width: 1px; height: 10px; background: rgba(255,255,255,.65); }
#t-scrub .knob { position: absolute; top: 6px; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25); }
#t-time { font: 13px var(--mono); color: var(--ink-dim); min-width: 92px; text-align: right; }
#t-speed { font: 13px var(--mono); }

/* ---------- place indicator: plan of the room with your position and the hour */
#place { position: fixed; right: 32px; bottom: 82px; z-index: 6; display: grid; justify-items: end; gap: 6px; opacity: 0; transition: opacity .6s;
  font: 12px var(--mono); color: var(--ink-dim); text-shadow: 0 1px 3px rgba(0,0,0,.5); pointer-events: none; }
body.in-room #place { opacity: 1; }
body.walking #place { bottom: 32px; }
#plan { width: 96px; height: 92px; }

/* ---------- reticle + toast */
#reticle { position: fixed; left: 50%; top: 50%; z-index: 4; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%;
  background: rgba(255,255,255,.72); box-shadow: 0 0 0 1px rgba(0,0,0,.3); pointer-events: none; opacity: 0; transition: opacity .2s, transform .2s; }
body.walking #reticle { opacity: 1; }
#reticle.on { transform: scale(1.9); background: #fff; }
body.hovering canvas.gl { cursor: pointer; }
#hint-toast { position: fixed; left: 50%; top: 84px; z-index: 8; transform: translateX(-50%); padding: 8px 14px; background: var(--veil);
  font-size: 14px; border-radius: 2px; opacity: 0; transition: opacity .4s; pointer-events: none; white-space: nowrap; }
#hint-toast.on { opacity: 1; }

/* ---------- details drawer */
#drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 20; width: min(480px, 100vw); overflow-y: auto;
  background: var(--paper); color: var(--type); padding: 46px 40px 60px; transform: translateX(102%); transition: transform .35s ease;
  box-shadow: -12px 0 40px rgba(0,0,0,.28); font-size: 15px; line-height: 1.6; }
#drawer.open { transform: none; }
/* the tour's bottom sheet on phones and narrow windows (main.js SHEET, body.sheet): the whole text over the lower part of the
   view, scrolling inside when long, the tour bar riding over its foot; no rows, no pictures (the work is in view) */
body.sheet #drawer { top: auto; left: 0; right: 0; bottom: 62px; width: 100vw; max-height: 46vh; padding: 10px 18px 24px; border-radius: 14px 14px 0 0;
  transform: translateY(120%); box-shadow: 0 -10px 36px rgba(0,0,0,.3); font-size: 14px; line-height: 1.5; }   /* the tour bar keeps the strip below it */
body.sheet #drawer.open { transform: none; }
body.sheet #drawer .bar { top: 0; margin: -10px -18px 8px; padding: 8px 14px 8px 18px; }
body.sheet #drawer h2 { font-size: 19px; margin-top: 2px; }
body.sheet #drawer .meta { font-size: 13px; margin-top: 4px; }
body.sheet #drawer dl, body.sheet #drawer .thumbs { display: none; }
body.sheet #drawer .body { margin-top: 10px; }
body.sheet #drawer .body p { margin-bottom: 10px; }
#drawer .close, #help .close { position: absolute; top: 12px; right: 14px; width: 36px; height: 36px; font: 26px/1 var(--sans); color: var(--type); }
/* the drawer's top bar stays in view while the text scrolls: pause the tour, close */
#drawer .bar { position: sticky; top: -46px; z-index: 1; display: flex; justify-content: flex-end; align-items: center; gap: 12px;
  margin: -46px -40px 14px; padding: 12px 14px 12px 40px; background: var(--paper); }
#drawer .bar .close { position: static; flex: none; }
#drawer .tour-toggle { display: none; align-items: center; gap: 10px; margin-right: auto; padding: 8px 15px 8px 13px; border: 1px solid var(--type);
  font-size: 14px; transition: background .2s, color .2s; }
body.touring #drawer .tour-toggle { display: inline-flex; }
#drawer .tour-toggle:hover { background: var(--type); color: var(--paper); }
#drawer .tour-toggle i { position: relative; width: 10px; height: 12px; }
#drawer .tour-toggle i::before, #drawer .tour-toggle i::after { content: ""; position: absolute; top: 0; width: 3px; height: 12px; background: currentColor; }
#drawer .tour-toggle i::before { left: 1px; } #drawer .tour-toggle i::after { right: 1px; }
#drawer .tour-toggle.paused i::after { display: none; }
#drawer .tour-toggle.paused i::before { left: 1px; width: 0; height: 0; background: none; border-style: solid; border-width: 6px 0 6px 10px; border-color: transparent transparent transparent currentColor; }
/* the tour's first details panel flashes the button so a visitor sees it is there; it stops once the tour has been paused */
#drawer .tour-toggle.nudge { animation: nudge 1.3s ease-in-out infinite; }
@keyframes nudge { 0%, 100% { background: transparent; color: var(--type); box-shadow: 0 0 0 0 rgba(27, 27, 26, 0); }
  50% { background: var(--type); color: var(--paper); box-shadow: 0 0 0 7px rgba(27, 27, 26, .14); } }
#drawer .kicker { font: 12px var(--mono); color: var(--muted); }
#drawer h2 { margin: 8px 0 0; font: 500 27px/1.2 var(--sans); }
body.ja #drawer h2 { font-family: var(--jp); font-size: 24px; }
#drawer h2 .yr { color: var(--muted); font-weight: 400; }
#drawer .meta { margin-top: 8px; font-size: 14px; color: var(--muted); }
#drawer .meta:empty { display: none; }
#drawer dl { display: grid; grid-template-columns: 104px 1fr; gap: 10px 16px; margin: 24px 0; padding: 18px 0;
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); font-size: 13.5px; line-height: 1.5; }
#drawer dl:empty { display: none; }
#drawer dt { font: 12px/1.6 var(--mono); color: var(--muted); }
#drawer dd { margin: 0; }
#drawer a { color: inherit; text-decoration-color: #a9a7a0; text-underline-offset: 2px; }
#drawer .body { margin-top: 18px; }
#drawer .body p { margin: 0 0 14px; }
#drawer .thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 18px; }
#drawer .thumbs:empty { display: none; }
#drawer .thumbs button { aspect-ratio: 3 / 4; background: #e8e6df; overflow: hidden; }
#drawer .thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
#drawer .thumbs button.wide { grid-column: 1 / -1; aspect-ratio: auto; }
#drawer .thumbs button.wide img { height: auto; }
#drawer .src { margin-top: 28px; font: 12px var(--mono); color: var(--muted); }
#lightbox { position: fixed; inset: 0; z-index: 25; display: none; place-items: center; background: rgba(8,8,8,.92); padding: 24px; cursor: zoom-out; }
#lightbox.open { display: grid; }
#lightbox img { max-width: 100%; max-height: calc(100vh - 110px); }
#lightbox .cap { max-width: 720px; margin: 12px 0 0; font-size: 14px; color: var(--ink-dim); text-align: center; }
/* ‹ › through the panel's pictures (Michael, Oct 15 2026) */
#lightbox.multi { padding: 24px 80px; }
#lightbox .lb-prev, #lightbox .lb-next { position: absolute; top: 50%; transform: translateY(-50%); display: none; width: 56px; height: 80px;
  font-size: 46px; line-height: 1; color: var(--ink); background: rgba(255,255,255,.06); cursor: pointer; transition: background .2s; }
#lightbox .lb-prev { left: 14px; } #lightbox .lb-next { right: 14px; }
#lightbox.multi .lb-prev, #lightbox.multi .lb-next { display: block; }
#lightbox .lb-prev:hover, #lightbox .lb-next:hover { background: rgba(255,255,255,.18); }
@media (max-width: 760px) { #lightbox.multi { padding: 24px 44px; } #lightbox .lb-prev, #lightbox .lb-next { width: 36px; height: 64px; font-size: 34px; }
  #lightbox .lb-prev { left: 4px; } #lightbox .lb-next { right: 4px; } }

/* ---------- end card + help */
#endcard { position: fixed; left: 50%; top: 50%; z-index: 15; transform: translate(-50%, -50%); width: min(380px, calc(100vw - 32px));
  background: var(--paper); color: var(--type); padding: 28px; display: none; gap: 12px; }
#endcard.open { display: grid; }
#endcard p { margin: 0 0 6px; }
#help { position: fixed; inset: 0; z-index: 22; display: none; place-items: center; background: rgba(8,8,8,.5); }
#help.open { display: grid; }
#help .panel { position: relative; width: min(520px, calc(100vw - 32px)); background: var(--paper); color: var(--type); padding: 32px 32px 26px; }
#help h2 { margin: 0 0 16px; font: 500 22px var(--sans); }
#help dl { display: grid; grid-template-columns: 110px 1fr; gap: 10px 14px; margin: 0; font-size: 14px; }
#help dt { font: 12px/1.7 var(--mono); color: var(--muted); }
#help dd { margin: 0; }
#help .small { margin: 18px 0 0; font-size: 13px; color: var(--muted); }

/* ---------- touch */
#touch-ui { display: none; }
body.touch.walking #touch-ui { display: block; }
#stick { position: fixed; left: 28px; bottom: 36px; z-index: 6; width: 108px; height: 108px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.45); background: rgba(10,10,10,.18); touch-action: none; }
#stick i { position: absolute; left: 50%; top: 50%; width: 42px; height: 42px; margin: -21px; border-radius: 50%; background: rgba(255,255,255,.5); }
body.touch #btn-full, body.touch .brand { display: none; }
body.touch.walking #caption { padding-bottom: 168px; }
body.touch.walking #house-btn { bottom: 160px; left: 28px; }

@media (max-width: 760px) {
  #start { padding: 18px 16px; }
  #topbar { padding: 14px 16px; }
  #topbar nav { gap: 14px; font-size: 13px; }
  #btn-help { display: none; }
  #place { display: none; }
  #caption { padding: 80px 16px 92px; }
  #caption h2 { font-size: 19px; } #caption p { font-size: 14px; }
  #house-btn { left: 16px; bottom: 60px; font-size: 13px; }
  #tourbar { left: 16px; right: 16px; bottom: 22px; gap: 12px; }
  #t-time { display: none; }
  #place { right: 16px; bottom: 70px; }
  #drawer { padding: 40px 18px 48px; }
  #drawer .bar { top: -40px; margin: -40px -18px 12px; padding: 10px 8px 10px 18px; }
}

/* ---------- intro: who CTG were (the catalog's introduction, English or Japanese) */
#intro { position: fixed; inset: 0; z-index: 26; display: none; place-items: center; padding: 16px; background: rgba(13, 13, 12, .42); }
#intro.open { display: grid; animation: introIn .5s ease; }
@keyframes introIn { from { opacity: 0; } to { opacity: 1; } }
/* the essay scrolls; Begin stays put at the bottom of the card (Michael, Oct 15 2026) */
#intro .panel { width: min(600px, 100%); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); display: flex; flex-direction: column;
  overflow: hidden; background: var(--paper); color: var(--type); box-shadow: 0 18px 60px rgba(0,0,0,.35); }
#intro .scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 32px 40px 8px; border-bottom: 1px solid var(--rule); }
#intro .intro-meta { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 16px; margin: 0 0 16px; }   /* kicker and credit share one line; they stack where they can't fit (Michael, Nov 7 2026) */
#intro .kicker { margin: 0; font: 12px var(--mono); color: var(--muted); }
#intro .byline { margin: 0; font-size: 13px; color: var(--muted); }   /* Michael's credit (Oct 30 2026) */
#intro blockquote { margin: 0 0 18px; padding-left: 16px; border-left: 2px solid var(--type); }
#intro blockquote p { margin: 0; font-size: 16px; line-height: 1.45; }
#intro blockquote cite { display: block; margin-top: 8px; font: normal 12px var(--mono); color: var(--muted); }
#intro .intro-body p { margin: 0 0 10px; font-size: 14.5px; line-height: 1.55; }
#intro .intro-body .lede { font-size: 20px; font-weight: 500; line-height: 1; }   /* where the essay starts (Michael, Oct 15 2026) */
#intro .intro-body blockquote.callout { margin: 14px 0 18px; }
#intro .intro-body blockquote.callout p { font-size: 14.5px; line-height: 1.55; }
#intro-go { flex: none; display: flex; justify-content: space-between; margin: 16px 40px 28px; padding: 13px 18px;
  border: 1px solid var(--type); background: var(--paper); font-size: 17px; transition: background .2s, color .2s; }
#intro-go:hover { background: var(--type); color: var(--paper); }
body.ja #intro { font-family: var(--jp); }

/* ---------- reader: an essay's full text, opened from its details panel; same card as the intro (Michael, Oct 15 2026) */
#reader { position: fixed; inset: 0; z-index: 27; display: none; place-items: center; padding: 16px; background: rgba(13, 13, 12, .42); }
#reader.open { display: grid; animation: introIn .4s ease; }
#reader .panel { width: min(640px, 100%); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); display: flex; flex-direction: column;
  overflow: hidden; background: var(--paper); color: var(--type); box-shadow: 0 18px 60px rgba(0,0,0,.35); }
#reader .scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 32px 40px 12px; border-bottom: 1px solid var(--rule); }
#reader .kicker { margin: 0 0 10px; font: 12px var(--mono); color: var(--muted); }
#reader h2 { margin: 0 0 6px; font: 500 24px/1.25 var(--sans); }
#reader .meta { margin: 0 0 18px; font: 12px var(--mono); color: var(--muted); }
#reader .reader-body h4 { margin: 22px 0 8px; font: 500 16px/1.3 var(--sans); }
#reader .reader-body p { margin: 0 0 10px; font-size: 14.5px; line-height: 1.6; }
#reader .reader-body p.note { font-size: 13px; color: var(--muted); }
#reader-close { flex: none; display: flex; justify-content: space-between; margin: 16px 40px 28px; padding: 13px 18px;
  border: 1px solid var(--type); background: var(--paper); font-size: 17px; transition: background .2s, color .2s; }
#reader-close:hover { background: var(--type); color: var(--paper); }
body.ja #reader, body.ja #reader h2, body.ja #reader h4 { font-family: var(--jp); }
@media (max-width: 760px) { #reader .scroll { padding: 28px 20px 10px; } #reader-close { margin: 14px 20px 20px; } }
#drawer .read-essay { display: flex; justify-content: space-between; width: 100%; margin: 18px 0 4px; padding: 11px 15px;
  border: 1px solid var(--type); font-size: 15px; transition: background .2s, color .2s; }
#drawer .read-essay:hover { background: var(--type); color: var(--paper); }
@media (max-width: 760px) { #intro .scroll { padding: 28px 20px 8px; } #intro-go { margin: 14px 20px 20px; } #intro blockquote p { font-size: 15px; } }

/* ---------- fade to black between two stops */
#fade { position: fixed; inset: 0; z-index: 3; background: #050505; opacity: 0; pointer-events: none; }
