/* v4 - Ink in Water (Kanagawa Dragon)

   Deliberate palette deviations from the brief, all AA-driven at the
   0.72rem mono label size where --muted / --accent are set:
   - dark --muted #847f76, not brief #727169 (3.98:1 on #0d0c0c, fails AA;
     #847f76 is 4.91:1)
   - light --accent #46626f, not brief #5C7A8A (3.59:1 on #EAE4D3, fails AA)
   - light --accent2 #77653a, not brief #8A7749 (used on the toggle dot and
     fallback wash only, kept consistent with the accent darkening)
   Everything else is the brief's Kanagawa Dragon verbatim. */

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0c0c;
  --bg2: #181616;
  --raised: #1d1c19;
  --text: #c5c9c5;
  --warm: #c8c093;
  --muted: #847f76;
  --accent: #8ba4b0;
  --accent2: #c4b28a;
  --rule: #282727;
  --scrim: rgba(13, 12, 12, 0.55);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eae4d3;
  --bg2: #e1dac6;
  --raised: #e1dac6;
  --text: #181616;
  --warm: #4d4438;
  --muted: #625e5a;
  --accent: #46626f;
  --accent2: #77653a;
  --rule: #cfc6ae;
  --scrim: rgba(234, 228, 211, 0.55);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scrollbar-gutter: stable; }

body {
  /* the fixed canvas covers the viewport in live view; this gradient echoes
     the shader palette so full-page captures and print degrade gracefully
     below the fold instead of falling to flat --bg */
  background:
    radial-gradient(60rem 40rem at 78% 22%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 62%),
    radial-gradient(52rem 38rem at 12% 72%, color-mix(in srgb, var(--accent2) 6%, transparent), transparent 60%),
    linear-gradient(180deg, var(--bg2), var(--bg)) var(--bg);
  color: var(--text);
  font-family: "iA Writer Quattro", Georgia, serif;
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---- the painting ---- */
#ink {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  display: block;
}

/* CSS fallback when WebGL is unavailable: layered gradients that read as ink */
body.no-webgl #ink { display: none; }
body.no-webgl::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(90rem 46rem at 82% 8%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 62%),
    radial-gradient(70rem 52rem at 8% 74%, color-mix(in srgb, var(--accent2) 11%, transparent), transparent 60%),
    radial-gradient(48rem 34rem at 62% 96%, color-mix(in srgb, var(--warm) 8%, transparent), transparent 65%),
    linear-gradient(180deg, var(--bg2), var(--bg));
}

/* ---- layout ---- */
.page {
  position: relative;
  max-width: 40rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* soft vertical scrim so type always sits on calm water; gradient, never a card */
.page::before {
  content: "";
  position: fixed;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(52rem, 100vw);
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--scrim) 22%, var(--scrim) 78%, transparent);
}

.hero {
  min-height: 88vh;
  min-height: 88svh;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding-top: 22vh;
}

.kicker {
  font-family: "iA Writer Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  color: var(--muted);
  margin-bottom: 1.4rem;
}

h1 {
  font-family: "iA Writer Quattro Var", "iA Writer Quattro", serif;
  font-weight: 600;
  font-size: clamp(2.4rem, 6vw, 3.4rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 1.1rem;
}

.hero-lines {
  color: var(--warm);
  font-size: 1.1rem;
  line-height: 1.7;
  max-width: 30rem;
}

/* ---- sections ---- */
.sect { padding: 4.5rem 0 0; }
.sect:last-of-type { padding-bottom: 2rem; }

.label {
  font-family: "iA Writer Mono", monospace;
  font-weight: 400;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.3rem;
}
.label::after {
  content: "";
  display: block;
  width: 2.2rem;
  height: 1px;
  margin-top: 0.7rem;
  background: var(--rule);
}

.prose p { max-width: 34rem; margin-bottom: 1rem; }
.prose p:last-child { margin-bottom: 0; }
.prose .quiet { color: var(--muted); font-size: 0.95rem; margin-top: 1.6rem; }

/* ---- links ---- */
.links { list-style: none; max-width: 24rem; }
.links li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--rule);
}
.links li:first-child { border-top: 1px solid var(--rule); }
.links a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 140ms ease;
}
.links a:hover { color: var(--accent); }
.handle {
  font-family: "iA Writer Mono", monospace;
  font-size: 0.78rem;
  color: var(--muted);
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---- footer ---- */
footer {
  padding: 5rem 0 2.2rem;
  font-family: "iA Writer Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}
footer a.bakeoff {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}
footer a.bakeoff:hover { color: var(--accent); }

/* ---- theme toggle ---- */
#theme-toggle {
  position: fixed;
  top: 1.2rem;
  right: 1.4rem;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: none;
  cursor: pointer;
  font-family: "iA Writer Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: var(--muted);
  padding: 0.5rem 0.6rem;
  transition: color 140ms ease;
}
#theme-toggle:hover { color: var(--text); }
.tt-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--accent2);
  box-shadow: 0 0 0.6rem color-mix(in srgb, var(--accent2) 55%, transparent);
}

/* ---- small screens ---- */
@media (max-width: 480px) {
  body { font-size: 16px; }
  .hero { min-height: 72vh; min-height: 72svh; padding-top: 18vh; }
  .sect { padding-top: 3.6rem; }
  .links li { flex-direction: row; }
  .handle { font-size: 0.72rem; }
}

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