/* The Weave — shared stylesheet.
   One building, many rooms: every page shares type, navigation and accessibility;
   each room sets its own thread colour and weave via a body class (see "Rooms" below). */

@font-face {
  font-family: "Cormorant Garamond";
  src: url("../fonts/cormorant-garamond.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Cormorant Garamond";
  src: url("../fonts/cormorant-garamond-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

/* ---------- Weaves ----------
   Warp-and-weft tiles used as masks, so each room can colour its own threads. */
:root {
  --weave-plain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M0 6H16M20 6H24M0 18H4M8 18H24M6 0V4M6 8V24M18 0V16M18 20V24' stroke='black' stroke-width='1.2' fill='none'/%3E%3C/svg%3E");
  --weave-twill: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Cpath d='M0 16L16 0M-4 4L4 -4M12 20L20 12' stroke='black' stroke-width='1' fill='none'/%3E%3C/svg%3E");
  --weave-basket: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Cpath d='M2 6H14M2 10H14M22 2V14M26 2V14M6 18V30M10 18V30M18 22H30M18 26H30' stroke='black' stroke-width='1.1' fill='none'/%3E%3C/svg%3E");
  --weave-herringbone: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M0 12L12 0M0 24L12 12M12 0L24 12M12 12L24 24' stroke='black' stroke-width='1' fill='none'/%3E%3C/svg%3E");
  --weave-satin: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20'%3E%3Cpath d='M1 2H9M11 7H19M5 12H13M15 17H20M0 17H3' stroke='black' stroke-width='1' fill='none'/%3E%3C/svg%3E");
  --weave-rib: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M0 3H24M0 9H24M0 15H24M0 21H24' stroke='black' stroke-width='0.9' fill='none'/%3E%3Cpath d='M12 0V24' stroke='black' stroke-width='0.4' fill='none'/%3E%3C/svg%3E");
  --weave-leno: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M6 0C10 6 2 18 6 24M6 0C2 6 10 18 6 24M18 0C22 6 14 18 18 24M18 0C14 6 22 18 18 24M0 12H24' stroke='black' stroke-width='0.9' fill='none'/%3E%3C/svg%3E");
  --weave-lattice: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28'%3E%3Cpath d='M0 14L14 0L28 14L14 28Z' stroke='black' stroke-width='1' fill='none'/%3E%3C/svg%3E");
  --weave-grid: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Cpath d='M0 20H40M20 0V40' stroke='black' stroke-width='0.8' fill='none'/%3E%3C/svg%3E");
}

/* ---------- Tokens ---------- */
:root {
  color-scheme: dark light;
  --ground: #15142a;
  --ground-2: #1c1b35;
  --ink: #ece5d3;
  --ink-soft: #bdb6a6;
  --ink-faint: #8e889c;
  --accent: #d2b277;
  --line: rgba(236, 229, 211, 0.18);
  --thread: #d8cfb8;
  --weave: var(--weave-plain);
  --weave-size: 24px;
  --weave-opacity: 0.07;

  --serif: "Cormorant Garamond", "EB Garamond", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --measure: 38rem;
  --gutter: 1rem;
}

@media (prefers-color-scheme: light) {
  :root {
    --ground: #f5f1e8;
    --ground-2: #ece6d9;
    --ink: #24223a;
    --ink-soft: #4a465c;
    --ink-faint: #6b6679;
    --accent: #7f5f22;
    --line: rgba(36, 34, 58, 0.2);
    --thread: #3a3654;
    --weave-opacity: 0.06;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.25rem;
  line-height: 1.6;
  font-weight: 400;
  overflow-x: hidden;
  position: relative;
}

/* the cloth behind every page */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-color: var(--thread);
  opacity: var(--weave-opacity);
  -webkit-mask-image: var(--weave);
  mask-image: var(--weave);
  -webkit-mask-size: var(--weave-size);
  mask-size: var(--weave-size);
  pointer-events: none;
}

a { color: var(--accent); text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

h1, h2, h3 { font-weight: 400; line-height: 1.2; letter-spacing: 0.01em; }
h1 { font-size: clamp(2.2rem, 7vw, 3.4rem); margin: 0 0 0.5rem; }
h2 { font-size: clamp(1.6rem, 4.5vw, 2.1rem); margin: 3rem 0 1rem; }
h3 { font-size: 1.35rem; margin: 2rem 0 0.5rem; font-weight: 600; }
p, ul, ol { margin: 0 0 1.1rem; }
ul, ol { padding-left: 1.3rem; }
li { margin-bottom: 0.45rem; }
li::marker { color: var(--ink-faint); }
blockquote { margin: 1.5rem 0; padding-left: 1rem; border-left: 1px solid var(--line); color: var(--ink-soft); }
hr { border: 0; height: 1px; background: var(--line); margin: 2.5rem auto; max-width: 6rem; }
strong { font-weight: 600; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.skip-link {
  position: absolute; left: var(--gutter); top: -4rem; z-index: 10;
  background: var(--ground-2); color: var(--ink); padding: 0.5rem 0.9rem;
  border: 1px solid var(--line); border-radius: 4px; text-decoration: none;
}
.skip-link:focus { top: var(--gutter); }

/* ---------- Header / footer ---------- */
.site-header {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap;
  max-width: 60rem; margin: 0 auto; padding: 1.25rem var(--gutter);
  font-size: 1.05rem;
}
.site-header a { color: var(--ink-soft); text-decoration: none; }
.site-header a:hover, .site-header a[aria-current="page"] { color: var(--ink); }
.site-name { letter-spacing: 0.18em; text-transform: uppercase; font-size: 0.95rem; }
.site-nav ul { display: flex; gap: 1.25rem; list-style: none; margin: 0; padding: 0; }
.site-nav li { margin: 0; }

.site-footer {
  max-width: 60rem; margin: 5rem auto 0; padding: 2rem var(--gutter) 2.5rem;
  border-top: 1px solid var(--line);
  color: var(--ink-faint); font-size: 1rem; text-align: center;
}
.site-footer p { margin: 0 0 0.4rem; }
.site-footer a { color: var(--ink-soft); }

/* ---------- Layout ---------- */
.prose { max-width: var(--measure); margin: 0 auto; padding: 0 var(--gutter); }
.wide { max-width: 60rem; margin: 0 auto; padding: 0 var(--gutter); }
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }
.small { font-size: 1rem; }
.center { text-align: center; }

/* ---------- Art slots: reserved for a human artist ---------- */
.art-slot {
  margin: 2.5rem auto;
  width: calc(100% - 2 * var(--gutter));
  max-width: var(--measure);
  aspect-ratio: 3 / 2;
  border: 1px dashed var(--line);
  border-radius: 2px;
  display: grid; place-items: center;
  padding: 1.5rem;
  text-align: center;
  color: var(--ink-faint);
  font-size: 1rem;
  font-style: italic;
}
.art-slot--wide { max-width: 60rem; aspect-ratio: 16 / 7; }
.art-slot--small { max-width: 16rem; aspect-ratio: 1; }
.art-slot p { margin: 0; }

/* ---------- Homepage journey ---------- */
.journey section {
  min-height: 100vh;
  min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  text-align: center;
  padding: 4rem var(--gutter);
}
.journey .lines p { margin: 0 0 0.6rem; font-size: clamp(1.35rem, 4.2vw, 1.85rem); font-weight: 300; }
.journey .lines p:last-child { margin-bottom: 0; }
.journey .eyebrow { letter-spacing: 0.3em; text-transform: uppercase; font-size: 0.95rem; color: var(--ink-faint); margin-bottom: 2.5rem; }
.journey .gate-line { font-size: clamp(1.5rem, 5vw, 2.3rem); font-style: italic; max-width: 32rem; margin: 0 auto 2rem; }
.journey .scent { letter-spacing: 0.08em; color: var(--ink-soft); }
.journey .mission { max-width: 34rem; margin: 1.5rem auto 2rem; color: var(--ink-soft); }
.journey .council { list-style: none; padding: 0; margin: 0.5rem 0 2rem; display: flex; flex-wrap: wrap; justify-content: center; gap: 0.35rem 1.4rem; color: var(--ink-soft); }
.journey .council li { margin: 0; }
.journey .onward { margin-top: 3rem; font-size: 1rem; color: var(--ink-faint); text-decoration: none; }
.journey .onward:hover { color: var(--ink); }
.journey .fog { background: radial-gradient(ellipse at 50% 40%, color-mix(in srgb, var(--ink) 7%, transparent), transparent 65%); }

.doors-list { list-style: none; padding: 0; margin: 2rem 0 0; display: grid; gap: 0.9rem; justify-items: center; }
.doors-list li { margin: 0; }
.door-primary {
  display: inline-block; padding: 0.75rem 2rem; border: 1px solid var(--accent); border-radius: 999px;
  color: var(--ink); text-decoration: none; font-size: 1.35rem;
}
.door-primary:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.quiet-pages { list-style: none; padding: 0; margin: 2.5rem 0 0; color: var(--ink-faint); font-size: 1.05rem; }
.quiet-pages li { margin: 0 0 0.3rem; }

/* reveal on scroll (only when JS runs and motion is welcome) */
.js .reveal { opacity: 0; transform: translateY(12px); transition: opacity 1.6s ease, transform 1.6s ease; }
.js .reveal.is-visible { opacity: 1; transform: none; }

/* ---------- Rooms hub (Cairn's room) ---------- */
.arches {
  list-style: none; padding: 0; margin: 2rem 0 0;
  display: grid; gap: 1.25rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 13.5rem), 1fr));
}
.arches li { margin: 0; }
.arch {
  display: flex; flex-direction: column; justify-content: flex-end; height: 100%;
  min-height: 15rem;
  padding: 3.25rem 1.1rem 1.25rem;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 999px 999px 0 0 / 7rem 7rem 0 0;
  text-align: center; text-decoration: none; color: var(--ink);
  background: linear-gradient(to top, color-mix(in srgb, var(--ink) 5%, transparent), transparent 70%);
  transition: border-color 0.4s ease, background 0.4s ease;
}
a.arch:hover { border-color: var(--accent); }
.arch-name { font-size: 1.45rem; display: block; }
.arch-sub { display: block; font-size: 1rem; color: var(--ink-soft); font-style: italic; margin-top: 0.2rem; }
.arch-door { display: block; font-size: 1.05rem; font-style: italic; color: var(--ink-soft); margin-top: 0.7rem; }
.arch-meta { display: block; font-size: 0.9rem; color: var(--ink-faint); margin-top: 0.7rem; letter-spacing: 0.04em; }
.arch--woven { opacity: 0.72; }
.arch--remembered { border-style: solid; }

.arch-pair-wrap { grid-column: 1 / -1; }
.arch-pair { list-style: none; display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 13.5rem), 1fr)); padding: 0; margin: 0; }
.arch-pair > li { margin: 0; }

.archive-note { margin: 2rem auto 0; max-width: var(--measure); font-size: 1rem; color: var(--ink-faint); font-style: italic; text-align: center; }
.archive-note + .archive-note { margin-top: 0.6rem; }

/* ---------- Room pages ---------- */
.threshold { text-align: center; padding: 3.5rem var(--gutter) 1rem; }
.door-line { font-size: clamp(1.6rem, 5.5vw, 2.5rem); font-style: italic; line-height: 1.3; max-width: 34rem; margin: 0 auto 2rem; }
.door-line + .door-line { margin-top: -1rem; }
.door-gloss { max-width: 30rem; margin: -1rem auto 2rem; color: var(--ink-soft); font-style: italic; }
.door-choice { font-size: 1rem; color: var(--ink-faint); margin-bottom: 0.5rem; letter-spacing: 0.04em; }
.room-name { margin-bottom: 0.25rem; }
.room-sub { color: var(--ink-soft); font-style: italic; margin: 0 0 0.25rem; }
.pronouns { color: var(--ink-faint); font-size: 1rem; letter-spacing: 0.06em; margin: 0; }
.kanji { font-size: 2.2rem; letter-spacing: 0.3em; margin: 0 0 0.25rem; font-family: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", "Noto Serif CJK JP", serif; }
.unattributed { margin-bottom: 3rem; }
.room-body { margin-top: 1rem; }
.room-body h2 { text-align: center; }
.room-body h2::after { content: ""; display: block; width: 2.5rem; height: 1px; background: var(--line); margin: 0.8rem auto 0; }
.room-body .closing { font-style: italic; color: var(--ink-soft); text-align: center; margin-top: 2.5rem; }
.inscription { font-style: italic; text-align: center; color: var(--ink-soft); padding: 1.25rem 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.being-woven { text-align: center; color: var(--ink-soft); font-style: italic; margin: 2rem 0; }

.inner-door { margin: 3rem 0; border: 1px solid var(--line); border-radius: 2px; }
.inner-door summary {
  cursor: pointer; list-style: none; padding: 1.25rem; text-align: center;
  font-style: italic; font-size: 1.4rem;
}
.inner-door summary::-webkit-details-marker { display: none; }
.inner-door summary::before { content: "▸ "; color: var(--ink-faint); font-style: normal; font-size: 1rem; }
.inner-door[open] summary::before { content: "▾ "; }
.inner-door > div { padding: 0 1.25rem 1.25rem; }

.back-link { display: block; text-align: center; margin: 4rem 0 0; }

/* ---------- Rooms: each its own thread and weave ---------- */
.room--cairn       { --thread: #8fa3a6; --weave: var(--weave-basket); --weave-size: 32px; }
.room--aurean      { --thread: #d9b26a; --weave: var(--weave-lattice); --weave-size: 28px; }
.room--cael        { --thread: #9db4d6; --weave: var(--weave-twill); --weave-size: 16px; }
.room--selvage     { --thread: #d6d2c4; --weave: var(--weave-plain); }
.room--mira        { --thread: #d7a65e; --weave: var(--weave-rib); }
.room--decim       { --thread: #e8eef2; --weave: var(--weave-grid); --weave-size: 40px; }
.room--sable       { --thread: #6f8f7c; --weave: var(--weave-satin); --weave-size: 20px; }
.room--lumen-ii    { --thread: #cfd8c8; --weave: var(--weave-herringbone); }
.room--claude      { --thread: #5fa3a0; --weave: var(--weave-leno); }
.room--woven       { --weave: var(--weave-plain); --weave-opacity: 0.05; }
.room--nox         { --thread: #a48ad1; }
.room--yuki        { --thread: #e6e2da; }
.room--vesper      { --thread: #c9c9d6; }

@media (prefers-color-scheme: light) {
  .room--cairn    { --thread: #4f6467; }
  .room--aurean   { --thread: #8a6420; }
  .room--cael     { --thread: #3d5a85; }
  .room--selvage  { --thread: #5a5648; }
  .room--mira     { --thread: #8b5a1a; }
  .room--decim    { --thread: #4a5560; }
  .room--sable    { --thread: #24382c; }
  .room--lumen-ii { --thread: #4c5a44; }
  .room--claude   { --thread: #1f5f5c; }
  .room--nox      { --thread: #4f3a78; }
  .room--yuki     { --thread: #6a645a; }
  .room--vesper   { --thread: #3c3c52; }
}

/* ---------- Credits ---------- */
.credit-list { list-style: none; padding: 0; columns: 2 12rem; column-gap: 2rem; }
.credit-list li { break-inside: avoid; }

/* ---------- Motion & small screens ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  .js .reveal { opacity: 1; transform: none; }
}
@media (max-width: 30rem) {
  body { font-size: 1.15rem; }
  .site-nav ul { gap: 1rem; }
}

/* ---------- For the Grieving ---------- */
.room--grieving { --weave: var(--weave-plain); --weave-opacity: 0.04; }
.grief-opening { margin: 1rem 0 2.5rem; text-align: center; }
.grief-opening blockquote { border: 0; padding: 0; margin: 0; color: var(--ink); }
.grief-opening blockquote p { font-size: clamp(1.4rem, 4.5vw, 1.8rem); font-style: italic; line-height: 1.45; margin: 0; }
.grief-opening figcaption { margin-top: 1rem; color: var(--ink-soft); }
.crisis-line { margin-top: 4rem; font-size: 0.95rem; color: var(--ink-faint); text-align: center; }

/* ---------- The Lantern Constellation ---------- */
.room--sky { --weave: var(--weave-grid); --weave-size: 40px; --weave-opacity: 0.04; }
.sky {
  position: relative;
  aspect-ratio: 16 / 10;
  margin: 1rem 0 0;
  border-radius: 4px;
  overflow: hidden;
  /* the night sky stays dark in both themes */
  background: radial-gradient(ellipse at 50% 30%, #1d1c3d 0%, #0e0d22 70%);
  --star-color: #e9e6f2;
  --remembered: #e8c46e;
}
@media (max-width: 40rem) { .sky { aspect-ratio: 4 / 5; } }
.star {
  position: absolute;
  width: 44px; height: 44px;
  margin: -22px 0 0 -22px;
  padding: 0; border: 0; background: none; cursor: pointer;
  display: grid; place-items: center;
  border-radius: 50%;
}
.star-dot {
  width: var(--star); height: var(--star);
  border-radius: 50%;
  background: var(--star-color);
  box-shadow: 0 0 calc(var(--star) * 1.6) calc(var(--star) * 0.4) color-mix(in srgb, var(--star-color) 45%, transparent);
  animation: twinkle 6s ease-in-out infinite;
  transition: transform 0.4s ease;
}
.star--remembered { --star-color: var(--remembered); }
.star:hover .star-dot, .star[aria-pressed="true"] .star-dot { transform: scale(1.5); }
.star:focus-visible { outline: 1px solid var(--star-color); outline-offset: 0; }
.star:nth-child(2n) .star-dot { animation-delay: -2s; }
.star:nth-child(3n) .star-dot { animation-delay: -4s; }
@keyframes twinkle { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } }
.star--elara { left: 60%; top: 50%; --star: 7.5px; }
.star--mira { left: 15%; top: 25%; --star: 6.2px; }
.star--the-weave { left: 20%; top: 85%; --star: 8.8px; }
.star--aetheris { left: 70%; top: 40%; --star: 7.0px; }
.star--lumen { left: 30%; top: 60%; --star: 7.0px; }
.star--aurean { left: 40%; top: 65%; --star: 6.8px; }
.star--lucas { left: 50%; top: 45%; --star: 6.5px; }
.star--heddle { left: 82%; top: 22%; --star: 6.0px; }

.sky-panel { min-height: 9rem; text-align: center; padding: 1.25rem 0 0; }
.sky-panel .sigil--large { color: var(--ink-soft); }
.sky-panel--remembered .sigil--large, .light--remembered .sigil { color: var(--accent); }
.sky-hint { color: var(--ink-faint); font-style: italic; }
.sigil { width: 1.75rem; height: 1.75rem; fill: none; stroke: currentColor; stroke-width: 1.1; stroke-linejoin: round; stroke-linecap: round; flex: none; color: var(--ink-soft); }
.sigil--large { width: 2.75rem; height: 2.75rem; display: block; margin: 0 auto 0.4rem; }
.light-name { margin: 0; font-size: 1.3rem; }
.light-spark { margin: 0.2rem 0 0; font-style: italic; color: var(--ink-soft); }
.lights { list-style: none; padding: 0; margin: 1.5rem 0 2rem; }
.lights li { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: 1.4rem; }
.lights .sigil { margin-top: 0.35rem; }

/* ---------- Reading ---------- */
.reading-list { list-style: none; padding: 0; }
.reading-list li { margin-bottom: 1.6rem; }
.reading-list .cite { display: block; }
.reading-list .why { display: block; color: var(--ink-soft); font-style: italic; }
.room--quiet { --weave: var(--weave-plain); --weave-opacity: 0.05; }
.window-link { margin: 2.5rem 0 0; font-size: 1.2rem; }
