/* base.css — editorial foundation for the Scholialang v2 site.
 *
 * Palette + typography tokens, modern reset, type scale. No layout
 * primitives here — those live in editorial.css.
 */

/* ---------------------------- fonts ---------------------------- */

@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 300 700;
  font-display: optional;
  src: url("../fonts/space-grotesk/space-grotesk-latin.woff2") format("woff2");
}

@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 100 900;
  font-display: optional;
  src: url("../fonts/fraunces/fraunces-latin-roman.woff2") format("woff2");
}

@font-face {
  font-family: "Fraunces";
  font-style: italic;
  font-weight: 100 900;
  font-display: optional;
  src: url("../fonts/fraunces/fraunces-latin-italic.woff2") format("woff2");
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: optional;
  src: url("../fonts/inter/inter-latin.woff2") format("woff2");
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 600;
  font-display: optional;
  src: url("../fonts/jetbrains-mono/jetbrains-mono-latin.woff2") format("woff2");
}

@font-face {
  font-family: "Caveat";
  font-style: normal;
  font-weight: 400 700;
  font-display: optional;
  src: url("../fonts/caveat/caveat-latin.woff2") format("woff2");
}

@font-face {
  font-family: "UnifrakturMaguntia";
  font-style: normal;
  font-weight: 400;
  font-display: optional;
  src: url("../fonts/unifrakturmaguntia/unifrakturmaguntia-regular.ttf") format("truetype");
}

/* ---------------------------- tokens --------------------------- */

:root {
  /* Editorial palette — see design spec 2.1. Exact values mandated by PRD. */
  --paper: #fafaf9;
  --ink: #0a0a0a;
  --ink-soft: #555555;
  --ink-muted: #888888;
  --rule: #e8e5e0;
  --surface: #ffffff;
  --surface-raised: rgba(255, 255, 255, 0.75);

  /* Conic mesh stops — full sunset cycle. */
  --mesh-1: #ff5e7a;
  --mesh-2: #ffa862;
  --mesh-3: #ffe16a;
  --mesh-4: #9be27d;
  --mesh-5: #6ac9f2;
  --mesh-6: #c07dff;

  /* Category colors (atoms grouped by NOTATION_REFERENCE 3). */
  --cat-reasoning: #ff5e7a;
  --cat-evidence: #6ac9f2;
  --cat-control: #9be27d;
  --cat-reference: #ffa862;
  --cat-social: #c07dff;
  --cat-meta: #ffe16a;

  /* Operator kinds — colored text in the spec operator table. */
  --op-logical: #ff5e7a;
  --op-quantifier: #9be27d;
  --op-temporal: #6ac9f2;
  --op-reference: #c07dff;
  --op-identity: #0a0a0a;

  /* Typography stacks. */
  --font-display: "Fraunces", "Iowan Old Style", "Palatino", "Georgia", serif;
  --font-body: "Space Grotesk", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-hand: "Caveat", "Patrick Hand", "Kalam", "Bradley Hand", cursive;
  --font-blackletter: "UnifrakturMaguntia", "Old English Text MT", "Cloister Black", serif;

  /* Layout. */
  --container: 1160px;
  --gutter: clamp(20px, 4vw, 32px);
  --radius-card: 14px;
  --radius-card-inner: 8px;
  --radius-pill: 999px;

  /* Rhythm — 56/80/120 per design spec 2.3. */
  --space-sm: clamp(48px, 7vw, 56px);
  --space-md: clamp(64px, 9vw, 80px);
  --space-lg: clamp(80px, 12vw, 120px);

  /* Shadow-as-border — three-layer depth, adapts to any surface. */
  --shadow-border:
    0 0 0 1px rgba(0, 0, 0, 0.06),
    0 1px 2px -1px rgba(0, 0, 0, 0.06),
    0 2px 4px 0 rgba(0, 0, 0, 0.04);
  --shadow-border-hover:
    0 0 0 1px rgba(0, 0, 0, 0.10),
    0 2px 4px -1px rgba(0, 0, 0, 0.08),
    0 4px 10px -2px rgba(0, 0, 0, 0.05);
  --shadow-elevated:
    0 0 0 1px rgba(0, 0, 0, 0.06),
    0 10px 24px -6px rgba(0, 0, 0, 0.12),
    0 24px 48px -12px rgba(0, 0, 0, 0.08);

  /* Easing. */
  --ease-out: cubic-bezier(0.2, 0, 0, 1);
}

/* ---------------------------- reset ---------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-gutter: stable;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html {
  background: var(--paper);
}

body {
  margin: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: var(--ink);
  text-wrap: balance;
}

p,
li,
figcaption,
blockquote,
.lede {
  text-wrap: pretty;
}

h1 {
  font-size: clamp(44px, 7vw, 84px);
  letter-spacing: -0.03em;
}
h2 {
  font-size: clamp(32px, 5vw, 56px);
}
h3 {
  font-size: 24px;
  font-family: var(--font-body);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.2;
}
h4 {
  font-size: 18px;
  font-family: var(--font-body);
  font-weight: 600;
  line-height: 1.2;
}

p {
  margin: 0;
}

em {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
}

small,
.small {
  font-size: 13px;
  line-height: 1.5;
}

a {
  color: var(--ink);
  text-decoration-color: var(--rule);
  text-underline-offset: 3px;
  transition-property: text-decoration-color, color;
  transition-duration: 150ms;
  transition-timing-function: var(--ease-out);
}

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

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

/* Client-side route + gallery navigation moves focus to the destination
   heading or section so keyboard and screen-reader users land in the right
   place. That focus is programmatic, not user-initiated, so suppress the
   visible focus ring the browser would otherwise paint around the title or
   section — notably Safari/iOS, which rings programmatically focused
   tabindex="-1" elements. Keyboard focus on real interactive controls is
   unaffected. */
[data-route-focus]:focus,
[data-route-focus]:focus-visible,
[data-gallery-focus]:focus,
[data-gallery-focus]:focus-visible {
  outline: none;
}

code,
pre,
kbd {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

img,
svg,
canvas {
  display: block;
  max-width: 100%;
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

button {
  font: inherit;
  color: inherit;
  background: transparent;
  border: 0;
  cursor: pointer;
}

input,
textarea,
select {
  font: inherit;
}

ul,
ol {
  margin: 0;
  padding-left: 1.4em;
}

figure {
  margin: 0;
}

/* Skip link. */
.skip-link {
  position: absolute;
  top: -40px;
  left: 16px;
  background: var(--ink);
  color: var(--paper);
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-weight: 500;
  font-size: 13px;
  z-index: 1000;
  transition: top 150ms ease;
}

.skip-link:focus {
  top: 12px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Selection. */
::selection {
  background: var(--mesh-1);
  color: var(--paper);
}
