/* dither.one — Ink Archive (DESIGN.md v2.3).
   Tokens verbatim from §11.1; dither recipes from §2.6.
   Monochrome discipline: no gradients, no shadows beyond spec, no color
   outside the two functional signals (unused here — nothing to verify). */

:root,
:root[data-theme="dark"] {
  --bg: #131211;
  --ink: #f4f2ee;
  --text2: #a9a59d;
  --muted: #a19d96;
  --faint: #6b6862;
  --hairline: rgba(255, 255, 255, 0.1);
  --ghost: rgba(255, 255, 255, 0.18);
  --surface: #1c1b19;
  --on-ink: #131211;
  --dither-overlay: rgba(244, 242, 238, 0.1);
  --serif: "Instrument Serif", Georgia, "Times New Roman", serif;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #fbfbfa;
    --ink: #0d0d0c;
    --text2: #6e6b66;
    --muted: #9a9894;
    --faint: #c9c7c2;
    --hairline: rgba(0, 0, 0, 0.08);
    --ghost: rgba(0, 0, 0, 0.16);
    --surface: #f1f0ed;
    --on-ink: #fbfbfa;
    --dither-overlay: rgba(13, 13, 12, 0.13);
  }
}

/* Instrument Serif (OFL) — display, section labels, titles. Latin only;
   Spoqa carries body and any Korean. Mirrors the app's type roles (§3.1). */
@font-face {
  font-family: "Instrument Serif";
  src: url("fonts/InstrumentSerif-Regular.ttf") format("truetype");
  font-weight: 400 700;
  font-display: swap;
}

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

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Spoqa Han Sans Neo", system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.7; /* CJK body §3.2 */
  word-break: keep-all;
}

main {
  position: relative;
  z-index: 1; /* above the ambient backdrop */
  max-width: 680px;
  margin: 0 auto;
  padding: 0 24px; /* §5.2 side margins */
}

/* ---- ambient dithered-shape backdrop (fixed, cycles via JS) ---- */
.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: grid;
  place-items: start end; /* anchor to the upper-right corner */
  overflow: hidden;
  pointer-events: none;
}

.ambient img {
  width: min(70vmin, 560px);
  height: auto;
  transform: translate(14%, -12%); /* bleed off the top-right corner */
  opacity: 0.13; /* ambient texture, keeps body copy legible */
  transition: opacity 90ms linear;
  will-change: opacity;
}

@media (prefers-color-scheme: light) {
  /* the source art is light; invert so it reads on a light background */
  .ambient img {
    filter: invert(1);
    opacity: 0.1;
  }
}

a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--faint);
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-color: var(--ink);
}

/* ---- brand lockup ----

   One asset, one signature: lockup.svg carries the mark, the wordmark as
   outlines, and its own light/dark rule (regenerate with
   tools/gen_lockup.py — never re-assemble the lockup by hand). */

.lockup {
  display: block;
  height: 64px;
  width: auto;
}

a.lockup-link {
  display: inline-block;
  text-decoration: none;
  line-height: 0;
}

/* ---- standalone torus mark (hero only; the lockup is lockup.svg) ---- */

.mark {
  display: block;
  flex: none;
  object-fit: contain;
}

.hero-mark {
  width: 60px;
  height: 60px;
  margin-bottom: 28px;
}

/* The logo art is a light dither on transparent; invert it on light mode. */
@media (prefers-color-scheme: light) {
  .mark {
    filter: invert(1);
  }
}

/* ---- type roles (§3.2) ---- */

.display {
  font-family: var(--serif);
  font-size: clamp(44px, 9.5vw, 68px);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.08;
  color: var(--ink);
}

h2 {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.4;
}

.caps {
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.readout {
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  font-feature-settings: "tnum";
  color: var(--text2);
}

.secondary {
  font-size: 14px;
  line-height: 22px;
  color: var(--text2);
}

/* ---- structure ---- */

header.site {
  padding: 28px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hero {
  padding: 96px 0 72px;
}

.hero p {
  margin-top: 24px;
  max-width: 34em;
  color: var(--text2);
}

.hero .caps {
  display: block;
  margin-top: 40px;
}

/* Hairline feature rows — no cards (§5.5). */
.rows {
  list-style: none;
  border-top: 1px solid var(--hairline);
  margin-top: 16px;
}

.rows li {
  padding: 18px 0;
  border-bottom: 1px solid var(--hairline);
}

.rows h2 {
  font-size: 15px;
}

.rows p {
  margin-top: 4px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text2);
}

section {
  padding: 40px 0 8px;
}

section > .caps {
  display: block;
  margin-bottom: 4px;
}

/* ---- prose pages (privacy/support) ---- */

.prose {
  padding: 56px 0 0;
}

.prose h1 {
  font-family: var(--serif);
  font-size: 46px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.05;
}

.prose h2 {
  margin: 40px 0 8px;
}

.prose p,
.prose li {
  color: var(--text2);
  margin-top: 8px;
}

.prose ul {
  padding-left: 20px;
}

.prose .updated {
  display: block;
  margin-top: 12px;
}

.prose .en {
  color: var(--faint);
}

/* ---- footer ---- */

footer.site {
  margin-top: 88px;
  padding: 24px 0 48px;
  border-top: 1px solid var(--hairline);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  justify-content: space-between;
  align-items: center;
}

footer.site .secondary a {
  color: var(--text2);
}

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