/* ============================================================
   mtchl.dev — Schematic Editorial
   Design tokens, themes, texture, base type
   ============================================================ */

:root {
  --font-display: 'Anton', 'Arial Narrow', sans-serif;
  --font-sans: 'IBM Plex Sans', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;

  --accent: #ff3853;
  --accent-ink: #ffffff;

  --maxw: 1180px;
  --gutter: clamp(20px, 5vw, 64px);

  --ease: cubic-bezier(.2, .7, .2, 1);
}

/* ---- DARK (primary) ---- */
[data-theme="dark"] {
  --bg: #0e0f11;
  --bg-elev: #15161a;
  --bg-elev-2: #1a1c21;
  --ink: #dedcd4;
  --ink-dim: #9a9ca1;
  --ink-faint: #5e6066;
  --line: rgba(255,255,255,.11);
  --line-strong: rgba(255,255,255,.20);
  --grid: rgba(255,255,255,.05);
  --tick: rgba(255,255,255,.20);
  --accent-soft: rgba(255,56,83,.14);
  --shadow: 0 30px 80px -30px rgba(0,0,0,.8);
  color-scheme: dark;
}

/* ---- LIGHT ---- */
[data-theme="light"] {
  --bg: #f4f3ef;
  --bg-elev: #ffffff;
  --bg-elev-2: #fbfaf7;
  --ink: #1a1b1e;
  --ink-dim: #5f616a;
  --ink-faint: #9a9ca3;
  --line: rgba(0,0,0,.14);
  --line-strong: rgba(0,0,0,.26);
  --grid: rgba(0,0,0,.065);
  --tick: rgba(0,0,0,.26);
  --accent-soft: rgba(255,56,83,.10);
  --shadow: 0 30px 70px -34px rgba(0,0,0,.30);
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

/* override preview-injected `html,body{background:transparent}` (higher specificity) */
html[data-theme] { background: var(--bg); transition: background .35s var(--ease); }
html[data-theme] body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background .35s var(--ease), color .35s var(--ease);
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background .35s var(--ease), color .35s var(--ease);
}

/* schematic substrate — an abstract composition of thin-line shapes (orbital
   arcs sweeping from the corners, long flow curves, a small circuit trace +
   nodes) drawn as a fixed, masked SVG behind all content. Strokes stay a crisp
   1px at any size via non-scaling-stroke; the radial mask fades the art out so
   it reads as quiet background texture rather than competing with text. */
.bg-art {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  color: var(--grid);
  -webkit-mask-image: radial-gradient(135% 100% at 50% 0%, #000 30%, transparent 92%);
  mask-image: radial-gradient(135% 100% at 50% 0%, #000 30%, transparent 92%);
}
.bg-art path, .bg-art circle { vector-effect: non-scaling-stroke; }
.bg-art-accent { stroke: var(--accent); opacity: .14; }

#root { position: relative; z-index: 1; }

::selection { background: var(--accent); color: #fff; }

a { color: inherit; text-decoration: none; }

/* ---------- type primitives ---------- */
.mono {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.mono-accent { color: var(--accent); }

.display {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: .92;
  letter-spacing: .005em;
  text-transform: none;
}

h1,h2,h3,h4 { margin: 0; font-weight: 600; }

/* ---------- layout shell ---------- */
.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.rule {
  height: 1px;
  background: var(--line);
  border: 0;
  margin: 0;
}
.rule-strong { background: var(--line-strong); }

/* hairline section marker:  // LABEL ───────────── */
.sec-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 0 26px;
}
.sec-head .lab {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-dim);
  white-space: nowrap;
}
.sec-head .lab b { color: var(--accent); font-weight: 400; }
.sec-head .line { flex: 1; height: 1px; background: var(--line); }

/* corner registration ticks */
.ticked { position: relative; }
.ticked > .tick {
  position: absolute;
  width: 6px; height: 6px;
  pointer-events: none;
  opacity: .5;
}
.ticked > .tick::before, .ticked > .tick::after {
  content: ""; position: absolute; background: var(--tick);
}
.ticked > .tick::before { width: 6px; height: 1px; top: 0; }
.ticked > .tick::after { width: 1px; height: 6px; left: 0; }
.tick.tl { top: -1px; left: -1px; }
.tick.tr { top: -1px; right: -1px; transform: scaleX(-1); }
.tick.bl { bottom: -1px; left: -1px; transform: scaleY(-1); }
.tick.br { bottom: -1px; right: -1px; transform: scale(-1,-1); }

/* ---------- buttons / cta ---------- */
.btn {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  transition: all .18s var(--ease);
}
.btn:hover { border-color: var(--ink); }
.btn-accent {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.btn-accent:hover { filter: brightness(1.08); border-color: var(--accent); }

/* ---------- issue tag ---------- */
.issue {
  font-family: var(--font-mono);
  font-size: .42em;
  letter-spacing: .06em;
  color: var(--ink-faint);
  vertical-align: middle;
  white-space: nowrap;
}
.issue b { color: var(--accent); font-weight: 400; }

/* ---------- focus ---------- */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* hide scrollbars on horizontal rails but keep usable */
.norm-scroll::-webkit-scrollbar { height: 8px; }
.norm-scroll::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 8px; }

/* link underline animation */
.ulink { background-image: linear-gradient(var(--accent),var(--accent)); background-size: 0% 1.5px; background-repeat: no-repeat; background-position: 0 100%; transition: background-size .25s var(--ease); }
.ulink:hover { background-size: 100% 1.5px; }

/* fade-in */
@media (prefers-reduced-motion: no-preference) {
  .rise { opacity: 0; transform: translateY(14px); animation: rise .6s var(--ease) forwards; }
  @keyframes rise { to { opacity: 1; transform: none; } }
}
