/* Susdle legal-site styles — the apex chapbook.
   Tokens copied verbatim from packages/client/src/design/tokens.css
   (locked in DESIGN.md). Duplicated intentionally so the static apex site
   stays fully decoupled from the app build — no framework, no workspace import.
   Treatments (paper grain, wordmark, ornaments, village plate) are reproduced
   from the shipped app (global.css, Wordmark.css, ChapbookDivider.css,
   VillageIllustration.css) so the apex reads as the same printed world. */

/* ------------------------------------------------------------------ Fonts */
@font-face {
  font-family: 'EB Garamond Variable';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('/fonts/eb-garamond-latin-wght-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'EB Garamond Variable';
  font-style: italic;
  font-weight: 400 800;
  font-display: swap;
  src: url('/fonts/eb-garamond-latin-wght-italic.woff2') format('woff2');
}

/* ------------------------------------------------------------------ Tokens */
:root {
  /* Color — warm-paper foundation, ink-deep type. No #000, no #fff. */
  --susdle-paper:        oklch(93% 0.022 84);
  --susdle-paper-bright: oklch(95% 0.016 84);
  --susdle-vellum:       oklch(89% 0.024 82);
  --susdle-ink:          oklch(22% 0.024 60);
  --susdle-ink-soft:     oklch(35% 0.022 60);
  --susdle-ink-deep:     oklch(15% 0.024 55);
  --susdle-ash-ink:      oklch(50% 0.020 70);  /* readable secondary tier, AA on paper */
  --susdle-ash-soft:     oklch(72% 0.018 78);  /* hairline / decoration only */
  --susdle-oxblood:      oklch(36% 0.115 25);  /* reserved — not spent on these pages */
  --susdle-sepia-rule:   oklch(38% 0.055 82);  /* warm ornament fill (wordmark divider) */
  --susdle-desk-highlight: oklch(98% 0.010 84);

  --susdle-font-display: 'EB Garamond Variable', 'EB Garamond', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;

  --susdle-ls-mark:    0.08em;
  --susdle-ls-frontis: 0.28em;

  --susdle-text-sm:   0.875rem;
  --susdle-text-base: 1rem;
  --susdle-reading:   1.1875rem;   /* EB Garamond runs small; 19px is its comfortable body */

  --susdle-space-1: 0.25rem;
  --susdle-space-2: 0.5rem;
  --susdle-space-3: 0.75rem;
  --susdle-space-4: 1rem;
  --susdle-space-5: 1.5rem;
  --susdle-space-6: 2rem;
  --susdle-space-7: 3rem;
  --susdle-space-8: 4rem;
  --susdle-space-9: 6rem;

  --susdle-measure: 34rem;   /* ~62ch of EB Garamond at the reading size */

  --susdle-ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --susdle-dur-fast: 180ms;
  --susdle-dur-breath: 12s;
}

/* ------------------------------------------------------------------ Reset */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--susdle-paper);
  color: var(--susdle-ink);
  font-family: var(--susdle-font-display);
  font-size: var(--susdle-reading);
  line-height: 1.65;
  font-optical-sizing: auto;
  font-feature-settings: 'kern' 1, 'liga' 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;

  /* Subtle paper grain + top radial highlight, reproduced from the app's
     global.css so the page feels printed, not screen-clean. */
  background-image:
    radial-gradient(1200px 800px at 50% -20%, var(--susdle-desk-highlight) 0%, transparent 60%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='3'/><feColorMatrix values='0 0 0 0 0.13   0 0 0 0 0.10   0 0 0 0 0.05   0 0 0 0.07 0'/></filter><rect width='240' height='240' filter='url(%23n)'/></svg>");
  background-blend-mode: multiply;
  background-attachment: fixed;
}

::selection {
  background: var(--susdle-vellum);
  color: var(--susdle-ink-deep);
}

:focus-visible {
  outline: 2px solid var(--susdle-ink);
  outline-offset: 3px;
  border-radius: 1px;
}

/* ------------------------------------------------------------------ Column */
.page {
  max-width: var(--susdle-measure);
  margin: 0 auto;
  padding: clamp(var(--susdle-space-6), 6vw, var(--susdle-space-9))
           var(--susdle-space-5) var(--susdle-space-6);
}

/* ------------------------------------------------------------------ Masthead */
.masthead {
  text-align: center;
  margin-bottom: var(--susdle-space-8);
}

.masthead__wordmark {
  display: inline-block;
  font-family: var(--susdle-font-display);
  font-weight: 500;
  font-size: clamp(1.75rem, 4.2vw, 2.5rem);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--susdle-ink-deep);
  line-height: 1;
  text-decoration: none;
  border: 0;
  /* the trailing tracking pushes optical mass right; nudge back to center */
  padding-left: 0.06em;
}
.masthead__wordmark:hover { color: var(--susdle-ink); }

/* Hand-drawn frontispiece rule under the wordmark (wordmark-divider.png mask,
   warm sepia fill, multiplied into the paper). From Wordmark.css. */
.masthead__rule {
  display: block;
  width: clamp(150px, 24vw, 220px);
  aspect-ratio: 20 / 1;
  margin: var(--susdle-space-4) auto var(--susdle-space-5);
  background-color: var(--susdle-sepia-rule);
  -webkit-mask: url('/assets/wordmark-divider.png') center / 100% 100% no-repeat;
          mask: url('/assets/wordmark-divider.png') center / 100% 100% no-repeat;
  -webkit-mask-mode: alpha;
          mask-mode: alpha;
  opacity: 0.85;
  mix-blend-mode: multiply;
}

.masthead__title {
  margin: 0;
  font-family: var(--susdle-font-display);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(2rem, 5vw, 2.75rem);
  line-height: 1.1;
  color: var(--susdle-ink-deep);
  text-wrap: balance;
}

.masthead__updated {
  margin: var(--susdle-space-3) 0 0;
  font-family: var(--susdle-font-display);
  font-style: italic;
  font-variant-caps: all-small-caps;
  letter-spacing: var(--susdle-ls-mark);
  font-size: var(--susdle-text-base);
  color: var(--susdle-ash-ink);
}

/* ------------------------------------------------------------------ Prose */
.prose { font-size: var(--susdle-reading); }

.prose p,
.prose ul { margin: 0 0 var(--susdle-space-5); }

.prose p { text-wrap: pretty; }

.lede {
  color: var(--susdle-ink-soft);
  margin-bottom: var(--susdle-space-6);
}

.prose h2 {
  font-family: var(--susdle-font-display);
  font-weight: 600;
  font-size: 1.375rem;
  line-height: 1.25;
  color: var(--susdle-ink-deep);
  letter-spacing: 0.01em;
  text-wrap: balance;
  /* a fine printed rule sets each section off */
  margin: var(--susdle-space-7) 0 var(--susdle-space-4);
  padding-top: var(--susdle-space-4);
  border-top: 1px solid var(--susdle-ash-soft);
}

/* The first section after the masthead doesn't need a leading rule. */
.prose > h2:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.prose ul {
  list-style: none;
  padding-left: var(--susdle-space-5);
}
.prose li {
  position: relative;
  margin-bottom: var(--susdle-space-2);
}
/* Aldine-leaf bullet in soft ink — a printer's mark, not a disc. */
.prose li::before {
  content: '\203B';            /* ※ reference mark, reads as a small printed star */
  position: absolute;
  left: calc(-1 * var(--susdle-space-5));
  color: var(--susdle-ash-ink);
  font-size: 0.85em;
  top: 0.15em;
}

.prose em { font-style: italic; }
.prose strong { font-weight: 600; color: var(--susdle-ink-deep); }

/* Links — underlined aged ink. The Two-Accent Rule kept strict: no Oxblood
   or Spectral Silver-Blue spent on legal-page chrome. */
.prose a {
  color: var(--susdle-ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--susdle-ash-ink);
  text-underline-offset: 0.18em;
  transition: color var(--susdle-dur-fast, 180ms) var(--susdle-ease-out-quart),
              text-decoration-color var(--susdle-dur-fast, 180ms) var(--susdle-ease-out-quart);
}
.prose a:hover {
  color: var(--susdle-ink-deep);
  text-decoration-color: var(--susdle-ink-deep);
}

/* ------------------------------------------------------------------ Footer */
.site-footer {
  max-width: var(--susdle-measure);
  margin: var(--susdle-space-8) auto 0;
  padding: 0 var(--susdle-space-5) var(--susdle-space-8);
  text-align: center;
  color: var(--susdle-ash-ink);
  font-size: var(--susdle-text-sm);
}

/* Chapbook section-break ornament above the footer (chapbook-divider.png mask,
   painted by currentColor). From ChapbookDivider.css. */
.chapbook-rule {
  display: block;
  width: clamp(170px, 26vw, 240px);
  aspect-ratio: 24 / 1;
  margin: 0 auto var(--susdle-space-6);
  background-color: var(--susdle-ash-ink);
  -webkit-mask: url('/assets/chapbook-divider.png') center / 100% 100% no-repeat;
          mask: url('/assets/chapbook-divider.png') center / 100% 100% no-repeat;
  -webkit-mask-mode: alpha;
          mask-mode: alpha;
  opacity: 0.7;
  transform: rotate(-0.34deg);   /* counter the asset's measured tilt */
}

.site-footer nav {
  display: flex;
  justify-content: center;
  gap: var(--susdle-space-5);
  margin-bottom: var(--susdle-space-4);
  font-family: var(--susdle-font-display);
  font-style: italic;
  font-variant-caps: all-small-caps;
  letter-spacing: var(--susdle-ls-mark);
  font-size: var(--susdle-text-base);
}
.site-footer a {
  color: var(--susdle-ash-ink);
  text-decoration: underline;
  text-decoration-color: var(--susdle-ash-soft);
  text-underline-offset: 0.18em;
  /* generous tap target on mobile */
  display: inline-block;
  padding: var(--susdle-space-1) var(--susdle-space-1);
}
.site-footer a:hover { color: var(--susdle-ink); text-decoration-color: var(--susdle-ink); }
.site-footer p { margin: 0; max-width: 40ch; margin-inline: auto; }

/* ------------------------------------------------------------------ Apex */
/* The apex page is a full-height flex column: the hero takes the slack and the
   disclaimer sits in normal flow at the foot, so nothing overlaps at any
   viewport (including short landscape phones). */
body.apex-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.apex {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--susdle-space-8) var(--susdle-space-5);
  gap: var(--susdle-space-5);
}

.apex__village {
  display: block;
  width: clamp(240px, 46vw, 460px);
  max-height: 44dvh;          /* compose to fit short / landscape viewports */
  aspect-ratio: 827 / 455;
  object-fit: contain;
  mix-blend-mode: multiply;
  /* remaps the engraving's blacks into warm aged ink, from VillageIllustration.css */
  filter: sepia(0.65) saturate(1.25) brightness(0.93) contrast(1.04);
  animation: village-breath var(--susdle-dur-breath) ease-in-out infinite;
}

@keyframes village-breath {
  0%   { filter: sepia(0.65) saturate(1.25) brightness(0.93) contrast(1.04); }
  55%  { filter: sepia(0.69) saturate(1.20) brightness(0.90) contrast(1.06); }
  68%  { filter: sepia(0.69) saturate(1.20) brightness(0.90) contrast(1.06); }
  100% { filter: sepia(0.65) saturate(1.25) brightness(0.93) contrast(1.04); }
}

.apex__wordmark {
  font-family: var(--susdle-font-display);
  font-weight: 500;
  font-size: clamp(2.5rem, 7vw, 4rem);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--susdle-ink-deep);
  line-height: 1;
  margin: 0;
  padding-left: 0.06em;
}

.apex__tagline {
  font-style: italic;
  color: var(--susdle-ink-soft);
  max-width: 30ch;
  margin: 0;
  text-wrap: balance;
}

/* Short / landscape viewports: tighten the apex so it composes to fit. */
@media (max-height: 540px) {
  .apex { gap: var(--susdle-space-3); padding-block: var(--susdle-space-5); }
}

/* ------------------------------------------------------------------ Motion */
@media (prefers-reduced-motion: reduce) {
  .apex__village { animation: none; }
  .prose a, .site-footer a, .apex__links a { transition: none; }
  body { background-attachment: scroll; }
}
