/* Webster — one stylesheet for every room. Night-first; the hour retints it. */

@font-face {
  font-family: "DM Sans";
  src: url("/fonts/dm-sans-var.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DM Serif Display";
  src: url("/fonts/dm-serif-display-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DM Serif Display";
  src: url("/fonts/dm-serif-display-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

/* ---- the four lights (night is the default and the no-JS fallback) ---- */
:root {
  --bg: #0d1015;
  --surface: #12161d;
  --ink: #ece7da;
  --muted: #98a0ab;
  --accent: #3fb5aa;
  --sky: #66788e;
  --hairline: #1d242e;
}
html[data-bucket="dawn"] {
  --bg: #120f16;
  --surface: #171319;
  --ink: #f0e9db;
  --muted: #a69c98;
  --accent: #3fb5aa;
  --sky: #cf9679;
  --hairline: #241d26;
}
html[data-bucket="day"] {
  --bg: #151a20;
  --surface: #1a2028;
  --ink: #eee9dc;
  --muted: #9aa6ae;
  --accent: #46bfb4;
  --sky: #a9bec2;
  --hairline: #232c36;
}
html[data-bucket="dusk"] {
  --bg: #141018;
  --surface: #181420;
  --ink: #efe8d9;
  --muted: #a29aa4;
  --accent: #3fb5aa;
  --sky: #c98a5a;
  --hairline: #251d2b;
}

/* ---- bones ---- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.65;
  min-height: 100vh;
  transition: background-color 1.2s ease, color 1.2s ease;
}
.wrap { max-width: 768px; margin: 0 auto; padding: 0 24px; }

a { color: var(--accent); text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px; transition: text-decoration-color .2s ease; }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

.skip { position: absolute; left: -9999px; top: 0; background: var(--surface); color: var(--ink); padding: 8px 14px; }
.skip:focus { left: 12px; top: 12px; z-index: 10; }

code {
  font-family: inherit;
  font-size: .92em;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  padding: 1px 6px;
  white-space: nowrap;
}

/* ---- crown (nav) ---- */
header.crown { padding-top: 30px; }
header.crown nav { display: flex; gap: 22px; flex-wrap: wrap; }
header.crown a {
  color: var(--muted);
  font-size: .8rem;
  font-weight: 500;
  letter-spacing: .18em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 4px 0;
}
header.crown a:hover { color: var(--ink); }
header.crown a[aria-current="page"] {
  color: var(--ink);
  border-bottom: 2px solid var(--accent);
}

/* ---- greeting ---- */
main { padding-top: 64px; }
.eyebrow {
  color: var(--sky);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .22em;
  text-transform: uppercase;
  transition: color 1.2s ease;
}
h1.greeting {
  font-family: "DM Serif Display", Georgia, serif;
  font-weight: 400;
  font-size: clamp(2.5rem, 6.4vw, 3.9rem);
  line-height: 1.08;
  margin-top: 12px;
  letter-spacing: .005em;
}
h1.greeting .hp { font-style: italic; }
.sub {
  color: var(--muted);
  font-size: 1.06rem;
  max-width: 52ch;
  margin: 16px 0 48px;
}

/* ---- the loom ---- */
figure.loom { margin: 0 0 64px; }
.mount {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 3px;
  padding: 10px;
  transition: background-color 1.2s ease, border-color 1.2s ease;
}
canvas#weave { display: block; width: 100%; aspect-ratio: 3 / 2; border-radius: 2px; }
figcaption {
  color: var(--muted);
  font-size: .8rem;
  letter-spacing: .02em;
  margin-top: 12px;
  font-variant-numeric: tabular-nums;
}
.preview-note { color: var(--sky); font-size: .8rem; margin-top: 6px; }
.ns { color: var(--muted); font-size: .9rem; padding: 24px 8px; }

/* ---- generic page body (rules, ledger, 404) ---- */
h1.page {
  font-family: "DM Serif Display", Georgia, serif;
  font-weight: 400;
  font-size: clamp(2.1rem, 5vw, 3rem);
  line-height: 1.1;
  margin-top: 12px;
}
.lede { color: var(--muted); max-width: 58ch; margin: 14px 0 40px; }

ol.rules { list-style: none; margin-bottom: 8px; }
ol.rules li { padding: 20px 0; border-top: 1px solid var(--hairline); }
ol.rules li:last-child { border-bottom: 1px solid var(--hairline); }
.rname {
  display: block;
  color: var(--accent);
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.row-line { color: var(--muted); margin-top: 28px; font-size: .95rem; max-width: 58ch; }
.row-line b { color: var(--ink); font-weight: 700; }

/* ---- ledger ---- */
.entry { border-top: 1px solid var(--hairline); padding: 26px 0; }
.entry:last-of-type { border-bottom: 1px solid var(--hairline); }
.e-meta {
  color: var(--muted);
  font-size: .78rem;
  letter-spacing: .06em;
  font-variant-numeric: tabular-nums;
  text-transform: uppercase;
}
.e-meta .no { color: var(--accent); font-weight: 700; letter-spacing: .12em; }
.entry h2 {
  font-family: "DM Serif Display", Georgia, serif;
  font-weight: 400;
  font-size: 1.45rem;
  margin: 6px 0 8px;
}
.entry p { color: var(--muted); max-width: 62ch; }
.entry p b { color: var(--ink); font-weight: 500; }

/* ---- cabinet ---- */
.cab-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 30px 22px; margin-top: 8px; }
@media (max-width: 640px) { .cab-grid { grid-template-columns: 1fr; } }
.frame { margin: 0; }
.frame .mount.empty {
  aspect-ratio: 3 / 2;
  background:
    repeating-linear-gradient(45deg, rgba(236, 231, 218, 0.022) 0 2px, transparent 2px 7px),
    var(--surface);
}
.plate { margin-top: 10px; color: var(--muted); font-size: .82rem; letter-spacing: .02em; }
.plate .pno { color: var(--accent); font-weight: 700; letter-spacing: .12em; margin-right: 8px; font-variant-numeric: tabular-nums; }
.plate .pstat { display: block; font-size: .68rem; text-transform: uppercase; letter-spacing: .15em; margin-top: 4px; }

/* ---- archive ---- */
.arch-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px 18px; margin-top: 8px; }
@media (max-width: 760px) { .arch-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .arch-grid { grid-template-columns: 1fr; } }
.arch-item { display: block; text-decoration: none; color: inherit; }
.arch-mount { padding: 6px; }
.arch-item canvas { display: block; width: 100%; aspect-ratio: 3 / 2; border-radius: 2px; }
.arch-cap { margin-top: 8px; color: var(--muted); font-size: .74rem; font-variant-numeric: tabular-nums; }
.arch-item:hover .arch-cap { color: var(--ink); }

/* ---- glass box ---- */
footer.glass { margin-top: 84px; border-top: 1px solid var(--hairline); padding: 28px 0 72px; }
#glass-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 18px 20px;
}
#glass-grid dt {
  color: var(--muted);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}
#glass-grid dd {
  color: var(--ink);
  font-size: .98rem;
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
}
.fineprint {
  color: var(--muted);
  font-size: .8rem;
  line-height: 1.75;
  max-width: 64ch;
  margin-top: 24px;
}
footer.quiet {
  margin-top: 84px;
  border-top: 1px solid var(--hairline);
  padding: 24px 0 72px;
  color: var(--muted);
  font-size: .8rem;
}
footer.quiet a { color: var(--muted); }
footer.quiet a:hover { color: var(--ink); }

/* ---- small rooms ---- */
@media (max-width: 560px) {
  main { padding-top: 48px; }
  header.crown nav { gap: 16px; }
  .sub { margin-bottom: 36px; }
  figure.loom { margin-bottom: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
