/* SHINMO — one dark world. Left-aligned, single column of text; the trial on Home is the only moving part. */
:root {
  color-scheme: dark;
  --ink: #0F1011;      /* ground */
  --iron: #2E3134;     /* rules, borders */
  --ash: #8C9297;      /* secondary text */
  --stone: #D8D4CC;    /* text, marks */
  --paper: #EDE8DE;    /* emphasis, hover */
  --rule: #23262A;     /* faint dividers */
  --sans: 'Archivo', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --cjk: 'Noto Serif TC', 'Source Han Serif TC', 'Songti TC', serif;
  --measure: 34rem;
  --wrap: 72rem;
  --gutter: clamp(1rem, 4vw, 3rem);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
/* custom cursor (cursor.js): the system cursor hides only once the script has taken over, and only on mouse/trackpad */
html.has-cursor, html.has-cursor * { cursor: none !important; }
html.has-cursor input:not([type="range"]):not([type="checkbox"]):not([type="radio"]):not([type="button"]), html.has-cursor textarea, html.has-cursor [contenteditable="true"] { cursor: text !important; }
html { background: var(--ink); }
body {
  margin: 0;
  background: var(--ink);
  color: var(--stone);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  padding-inline: var(--gutter);
}
img, svg { max-width: 100%; }
a { color: var(--stone); text-decoration-color: var(--iron); text-underline-offset: 0.2em; transition: color 0.2s, text-decoration-color 0.2s; }
a:hover { color: var(--paper); text-decoration-color: var(--ash); }
:focus-visible { outline: 1px solid var(--paper); outline-offset: 4px; }
::selection { background: var(--stone); color: var(--ink); }

.wrap { max-width: var(--wrap); margin-inline: auto; }

/* Header: full-bleed bar; on the home page it floats over the hero and stays hidden while the big wordmark is in view */
.site-head {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10;
  margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter);
  background: var(--ink);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.site-head.is-overlay { position: fixed; top: 0; left: 0; right: 0; margin: 0; padding-top: env(safe-area-inset-top, 0px); border-bottom: 1px solid var(--rule); }
.site-head.is-hidden { opacity: 0; transform: translateY(-100%); pointer-events: none; }
.head-inner { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; padding-block: 1.5rem; }
.site-head .mark { display: block; color: var(--stone); line-height: 0; }
.site-head .mark svg { height: 1.25rem; width: auto; display: block; }
.site-nav { display: flex; gap: clamp(1rem, 3vw, 2rem); font-size: 0.9375rem; }
.site-nav a { text-decoration: none; color: var(--ash); }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--stone); }

/* Home: the trial. Four locks, one name. Practice-grid ground, HUD at the edges, live counters. */
.trial {
  --snap: cubic-bezier(.75, 0, .15, 1);
  position: relative; overflow: hidden;
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: clamp(36rem, 92vh, 54rem);
  margin-inline: calc(-1 * var(--gutter)); padding-inline: 0;
  border-bottom: 1px solid var(--rule);
  background:
    radial-gradient(ellipse at 50% 45%, transparent 35%, rgba(0, 0, 0, 0.5) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96'%3E%3Cpath d='M0 .5H96M.5 0V96' stroke='%23D8D4CC' stroke-opacity='.05' fill='none'/%3E%3Cpath d='M0 48.5H96M48.5 0V96' stroke='%23D8D4CC' stroke-opacity='.035' stroke-dasharray='2 6' fill='none'/%3E%3C/svg%3E") center / 96px 96px,
    var(--ink);
}
.trial .paper { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.hud { position: relative; z-index: 3; }
.hud-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 2rem; padding: clamp(1rem, 2.4vw, 1.75rem) clamp(1rem, 2.6vw, 2rem); }
.hud-top .hud-row { padding-bottom: 0; }
.hud-bottom .hud-row { padding-top: 0; align-items: baseline; }
.mono { font-family: var(--mono); font-size: 0.8125rem; font-variant-numeric: tabular-nums; color: var(--ash); letter-spacing: 0.02em; }
.hud-meta { display: flex; align-items: center; gap: 1.5rem; }
.tbtn { font: inherit; font-family: var(--mono); font-size: 0.8125rem; color: var(--ash); background: none; border: 0; padding: 0.25rem 0; cursor: pointer; letter-spacing: 0.02em; }
.tbtn:hover { color: var(--stone); }
.tbtn[aria-pressed="true"] { color: var(--stone); }

.clue-wrap { display: flex; flex-direction: column; gap: 0.4rem; min-width: 0; flex: 1 1 18rem; }
.clue { position: relative; margin: 0; font-size: clamp(1.0625rem, 1.8vw, 1.375rem); line-height: 1.3; color: var(--stone); justify-self: start; width: fit-content; max-width: 100%; }
.clue::after { content: ""; position: absolute; left: 0; right: 0; bottom: -0.3rem; height: 1px; background: var(--ash); transform-origin: left; transform: scaleX(1); }
.clue.drawing::after { animation: underline 0.42s steps(6, end) both; }
@keyframes underline { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.clue a { color: var(--paper); }
.hint-text { margin: 0; color: var(--ash); font-size: 0.9375rem; }
.acts { display: flex; align-items: baseline; gap: 1.5rem; }
.hud-meta { align-items: baseline; }

/* progress strip: same size as before (1.125rem tall). Shifted down so the band of its lowercase letters
   sits level with the lowercase band of the 13px mono text beside it (x-height centres aligned). */
.inv { font-family: var(--mono); font-size: 0.8125rem; line-height: 1; }
.inv svg { height: 1.125rem; width: auto; display: inline-block; vertical-align: -0.2em; overflow: visible; }
.inv .piece { fill: var(--iron); }
.inv .piece.got { fill: var(--stone); }
.inv.quiet .piece, .inv.quiet .piece.got { fill: transparent; stroke: var(--ash); stroke-width: 1px; vector-effect: non-scaling-stroke; opacity: 0.6; }

.stage { position: relative; z-index: 2; align-self: center; justify-self: center; width: min(58rem, calc(100% - 2 * var(--gutter))); height: clamp(17rem, 50vh, 28rem); }
.stage > .lock { position: absolute; inset: 0; display: grid; place-items: center; }
.stage svg.fill { position: absolute; inset: 0; width: 100%; height: 100%; display: block; overflow: visible; }
.stage .readout { position: absolute; top: 0; right: 0; display: flex; flex-direction: column; gap: 0.3rem; text-align: right; }
.stage .readout b { font-weight: 400; color: var(--stone); }
.stage .cutline { position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--paper); transform: scaleX(0); transform-origin: left; z-index: 5; pointer-events: none; }
.stage .flash { position: absolute; inset: -10%; background: var(--paper); opacity: 0; pointer-events: none; z-index: 4; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Lock 1: rings */
.rings { touch-action: manipulation; cursor: pointer; }
.rings .ring { fill: none; stroke: var(--stone); stroke-width: 12; }
.rings .tick { stroke: var(--iron); stroke-width: 1; }
.rings .tick.major { stroke: var(--ash); }
.rings .zero { stroke: var(--paper); stroke-width: 2; }
.rings .lit { filter: drop-shadow(0 0 6px rgba(237, 232, 222, 0.35)); }

/* Lock 2: rods */
.rods .rod { fill: var(--iron); transition: fill 0.08s steps(1); }
.rods .rod.on { fill: var(--paper); filter: drop-shadow(0 0 10px rgba(237, 232, 222, 0.4)); }
.rods .rod.bad { fill: #5A4A47; }
.rods .hit { fill: transparent; cursor: pointer; }
.rods .base { stroke: var(--ash); stroke-width: 1; }
.rounds { position: absolute; left: 0; bottom: 0; display: flex; gap: 0.5rem; align-items: center; }
.rounds i { width: 6px; height: 6px; background: var(--iron); display: block; }
.rounds i.done { background: var(--stone); }

/* Lock 3: grind the rod */
.grinder { width: 100%; display: flex; flex-direction: column; gap: clamp(1rem, 3vh, 1.75rem); }
.grinder .value { display: flex; align-items: baseline; gap: 0.5rem; font-size: clamp(3.5rem, 11vw, 7.5rem); font-weight: 500; letter-spacing: -0.04em; line-height: 0.9; font-variant-numeric: tabular-nums; color: var(--stone); }
.grinder .value small { font-size: 1rem; letter-spacing: 0; font-weight: 400; color: var(--ash); }
.grinder .bar { height: 14px; background: var(--rule); position: relative; }
.grinder .bar span { position: absolute; left: 0; top: 0; bottom: 0; background: var(--stone); width: 100%; transition: width 0.42s var(--snap); }
.grinder .row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; }
.grinder .tools { display: flex; gap: 0.75rem; }
.tool { font: inherit; font-size: 0.9375rem; color: var(--stone); background: none; border: 1px solid var(--ash); padding: 0.6rem 1.1rem; cursor: pointer; transition: background 0.15s, color 0.15s; }
.tool:hover:not(:disabled) { background: var(--stone); color: var(--ink); }
.tool:disabled { color: #4A4F54; border-color: var(--iron); cursor: default; }
.moves { display: flex; gap: 0.4rem; align-items: center; }
.moves i { width: 10px; height: 10px; border: 1px solid var(--ash); display: block; }
.moves i.used { background: var(--stone); border-color: var(--stone); }

/* Lock 4 and the end: the name */
.trial-mark { margin: 0; width: min(52rem, 92%); line-height: 0; color: var(--stone); }
.trial-mark svg { width: 100%; height: auto; display: block; overflow: visible; }
.trial-mark .p { fill: var(--stone); }
.trial-mark .p.open { fill: transparent; stroke: var(--ash); stroke-width: 1.2px; vector-effect: non-scaling-stroke; }
.rope { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
.stage .trial-mark { position: relative; z-index: 2; }
.handle { position: absolute; width: 48px; height: 48px; margin: -24px 0 0 -24px; background: none; border: 0; padding: 0; cursor: grab; touch-action: none; z-index: 6; }
.handle.held { cursor: grabbing; }
.handle::before { content: ""; position: absolute; left: 50%; top: 50%; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; background: var(--paper); }
.handle.idle::after { content: ""; position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -5px 0 0 -5px; border: 1px solid var(--paper); animation: seek 1.5s steps(9, end) infinite; }
@keyframes seek { from { transform: scale(1); opacity: 0.7; } to { transform: scale(4.2); opacity: 0; } }
.eye-btn { position: absolute; background: none; border: 0; padding: 0; z-index: 5; cursor: pointer; }

@media (max-width: 720px) {
  .hud-bottom .hud-row { flex-direction: column; align-items: flex-start; }
  .clue-wrap { flex: none; }
  .stage { height: clamp(16rem, 52vh, 26rem); }
}
@media (prefers-reduced-motion: reduce) {
  .clue.drawing::after, .handle.idle::after { animation: none; }
  .grinder .bar span, .rods .rod { transition: none; }
}

/* Generic sections */
.section {
  display: grid; grid-template-columns: minmax(0, 14rem) minmax(0, 1fr); gap: 1rem 3rem;
  padding-block: clamp(2.5rem, 6vw, 4.5rem);
  border-bottom: 1px solid var(--rule);
}
.section h2 { margin: 0; font-size: 1rem; font-weight: 500; color: var(--ash); }
.section .body { display: flex; flex-direction: column; gap: 1.25rem; max-width: var(--measure); min-width: 0; }
.section p { margin: 0; }
.lead { font-size: clamp(1.375rem, 2.6vw, 1.875rem); line-height: 1.3; font-weight: 400; letter-spacing: -0.01em; color: var(--stone); text-wrap: balance; }
.quiet { color: var(--ash); }
.data { font-family: var(--mono); font-size: 0.875rem; font-variant-numeric: tabular-nums; color: var(--ash); }

/* Page heads (Lore, Archive, Contact) */
.page-head { padding-block: clamp(3.5rem, 10vw, 7rem) clamp(2rem, 5vw, 3.5rem); border-bottom: 1px solid var(--rule); display: flex; flex-direction: column; gap: 1rem; }
.page-head h1 { margin: 0; font-size: clamp(2.5rem, 7vw, 4.5rem); font-weight: 500; letter-spacing: -0.025em; line-height: 1; }
.page-head p { margin: 0; color: var(--ash); max-width: var(--measure); }

/* Lore */
.story p + p { margin-top: 0; }
.closing { display: flex; align-items: flex-end; gap: 1.5rem; padding-block: clamp(3rem, 8vw, 5rem); }
.closing svg { width: 3.5rem; height: 3.5rem; color: var(--stone); flex-shrink: 0; }
.closing p { margin: 0; color: var(--ash); font-size: 0.9375rem; }

/* Archive ledger */
.ledger { list-style: none; margin: 0; padding: 0; }
.ledger li {
  display: grid; grid-template-columns: 3.5rem 7rem minmax(0, 1fr) minmax(0, 1fr); gap: 0.5rem 1.5rem; align-items: baseline;
  padding-block: 1.1rem; border-bottom: 1px solid var(--rule);
}
.ledger .wk { font-family: var(--mono); font-size: 0.875rem; color: var(--ash); font-variant-numeric: tabular-nums; }
.ledger .date { font-family: var(--mono); font-size: 0.875rem; color: var(--ash); font-variant-numeric: tabular-nums; }
.ledger .piece { min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.ledger .kind { display: none; font-size: 0.8125rem; color: var(--ash); }
.ledger .title { color: var(--stone); }
.ledger .pending .title { color: #4A4F54; }
.ledger li.current .wk, .ledger li.current .date { color: var(--stone); }
.ledger-head { display: grid; grid-template-columns: 3.5rem 7rem minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem; padding-block: 0.75rem; border-bottom: 1px solid var(--iron); font-size: 0.8125rem; color: var(--ash); }

/* Contact */
.contact-email { display: flex; flex-wrap: wrap; align-items: baseline; gap: 1rem; }
.contact-email .addr { font-size: clamp(1.5rem, 4vw, 2.5rem); letter-spacing: -0.015em; user-select: all; }
.copy { font: inherit; font-size: 0.875rem; color: var(--ash); background: none; border: 1px solid var(--iron); padding: 0.35rem 0.8rem; cursor: pointer; }
.copy:hover { color: var(--stone); border-color: var(--ash); }
.handles { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.handles span { color: var(--ash); display: inline-block; width: 6rem; }

/* Footer */
.site-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem 2rem; padding-block: 2.5rem 3rem; font-size: 0.875rem; color: var(--ash); }
.site-foot a { color: var(--ash); text-decoration: none; }
.site-foot a:hover { color: var(--stone); }
.site-foot .links { display: flex; flex-wrap: wrap; gap: 1.5rem; }

@media (max-width: 720px) {
  .section { grid-template-columns: minmax(0, 1fr); }
  .ledger li, .ledger-head { grid-template-columns: 2.5rem minmax(0, 1fr); }
  .ledger .wk { grid-row: span 3; }
  .ledger .date { grid-column: 2; }
  .ledger .piece { grid-column: 2; }
  .ledger .kind { display: block; }
  .ledger-head span:nth-child(n+3) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  a, .site-head { transition: none; }
}
.clue .tbtn { margin-left: 1rem; }
