/* Daily Prep — design tokens & base styles
   Warm-bone paper on graphite ink. Dieter Rams restraint with Ive warmth. */

@font-face {
  font-family: "R Sans";
  src: url("./fonts/RSans-Variable.woff2") format("woff2-variations"),
       url("./fonts/RSans-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "R Sans";
  src: url("./fonts/RSans-Italic-Variable.woff2") format("woff2-variations"),
       url("./fonts/RSans-Italic-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "R Mono";
  src: url("./fonts/RMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "R Mono";
  src: url("./fonts/RMono-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "R Mono";
  src: url("./fonts/RMono-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Neutrals */
  --paper:    oklch(0.97 0.012 85);
  --paper-2:  oklch(0.94 0.014 82);
  --paper-3:  oklch(0.91 0.016 80);
  --ink:      oklch(0.22 0.020 270);
  --ink-2:    oklch(0.45 0.015 270);
  --ink-3:    oklch(0.62 0.012 270);
  --rule:     oklch(0.86 0.010 90);
  --rule-strong: oklch(0.78 0.012 88);

  /* The single earned accent */
  --accent:   oklch(0.62 0.18 35);
  --accent-2: oklch(0.50 0.20 35);

  /* Source-context palette — constant L/C, hue only */
  --track-leetcode:      oklch(0.62 0.10 30);
  --track-system-design: oklch(0.62 0.10 260);
  --track-project:       oklch(0.62 0.10 130);
  --track-reading:       oklch(0.62 0.10 290);
  --track-other:         oklch(0.62 0.10 90);

  --signal: oklch(0.55 0.22 25);

  /* Type scale */
  --display: "R Sans", "DM Sans", "Söhne Breit", system-ui, sans-serif;
  --body:    "R Sans", "DM Sans", system-ui, sans-serif;
  --mono:    "R Mono", "JetBrains Mono", "IBM Plex Mono", ui-monospace, monospace;

  /* Radii — industrial 0, warm 2-4. Tweakable. */
  --radius: 2px;

  /* Density factor — 0.9 compact, 1.0 base, 1.15 airy */
  --density: 1;

  /* Page width */
  --measure: 720px;
  --measure-wide: 1080px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "ss02", "tnum", "kern";
}

body {
  min-height: 100vh;
}

#root {
  min-height: 100vh;
}

/* Typography roles */
.mono {
  font-family: var(--mono);
  font-feature-settings: "tnum", "ss01";
  font-variant-numeric: tabular-nums;
}

.meta {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.meta-sm {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.display {
  font-family: var(--display);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.text-pretty {
  text-wrap: pretty;
}

/* Layout */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.shell {
  max-width: var(--measure-wide);
  width: 100%;
  margin: 0 auto;
  padding: 0 32px;
}

.shell--narrow {
  max-width: var(--measure);
}

/* Top bar */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--paper);
  padding: calc(20px * var(--density)) 0 calc(16px * var(--density));
  border-bottom: 1px solid var(--rule);
}

.nav__inner {
  display: flex;
  align-items: baseline;
  gap: 32px;
}

.nav__mark {
  font-family: var(--display);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-right: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.nav__mark-glyph {
  width: 14px;
  height: 14px;
  display: inline-block;
  color: var(--ink);
  flex-shrink: 0;
  transform: translateY(1px);
}

.nav__links {
  display: flex;
  gap: 28px;
  align-items: baseline;
}

.nav__link {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-family: var(--body);
  font-size: 15px;
  color: var(--ink-2);
  cursor: default;
  letter-spacing: -0.005em;
  position: relative;
}

.nav__link:hover { color: var(--ink); }

.nav__link[aria-current="page"] {
  color: var(--ink);
  font-weight: 500;
}

.nav__link[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  bottom: calc(-17px * var(--density));
  height: 1px;
  background: var(--ink);
}

/* Main */
.main {
  flex: 1;
  padding: calc(40px * var(--density)) 0 calc(72px * var(--density));
}

/* Buttons */
.btn {
  appearance: none;
  border: 0;
  background: none;
  padding: 8px 14px;
  font-family: var(--body);
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  cursor: default;
  letter-spacing: -0.005em;
  border-radius: var(--radius);
  transition: background 180ms cubic-bezier(0.2, 0.7, 0.2, 1),
              color 180ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.btn--primary {
  background: var(--accent);
  color: var(--paper);
  padding: 9px 18px;
}

.btn--primary:hover { background: var(--accent-2); }

.btn--ghost {
  color: var(--ink-2);
  padding: 9px 12px;
}
.btn--ghost:hover { color: var(--ink); }

.btn--quiet {
  background: var(--paper-2);
  color: var(--ink);
}
.btn--quiet:hover { background: var(--paper-3); }

/* Hairline */
.hr {
  border: 0;
  height: 1px;
  background: var(--rule);
  margin: 0;
}

/* Inputs */
.input {
  appearance: none;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--rule);
  padding: 8px 0;
  font: inherit;
  font-family: var(--body);
  color: var(--ink);
  width: 100%;
  outline: none;
  border-radius: 0;
  transition: border-color 200ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.input:focus { border-bottom-color: var(--ink); }

.input::placeholder { color: var(--ink-3); }

/* Track mark */
.track-mark {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--track);
  flex-shrink: 0;
}

/* Track left rule */
.track-rule {
  border-left: 1px solid var(--track);
  padding-left: 12px;
}

/* ── Task ordinal ───────────────────────────────────────────────────────
   The stable plan number (curriculum order). A quiet mono index that leads
   each task so the same task carries the same number on every surface, with
   tabular figures so the numbers align into a scannable column. Off-plan
   (user-added) tasks have no plan number → faint placeholder via .ord--none.
   Reads as metadata — no new color, --ink-3 like other quiet mono. */
.ord {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  flex-shrink: 0;
  user-select: none;
}

.ord--none { opacity: 0.45; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ── Refs ──────────────────────────────────────────────────────────────
   A task's references row. Mono, low-contrast — reads as metadata.
   URL refs become quiet anchors with a hairline underline on hover.
   Textbook citations render as plain mono text.
*/
.refs {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.04em;
  line-height: 1.6;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  row-gap: 4px;
}

.refs__a {
  color: var(--ink-2);
  text-decoration: underline;
  text-decoration-color: var(--rule-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  cursor: default;
  transition: color 180ms cubic-bezier(0.2, 0.7, 0.2, 1),
              text-decoration-color 180ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.refs__a:hover {
  color: var(--ink);
  text-decoration-color: var(--ink);
  cursor: pointer;
}

.refs__a:focus-visible {
  outline: none;
  color: var(--ink);
  text-decoration-color: var(--ink);
}

.refs__text {
  color: var(--ink-2);
}

.refs__sep {
  color: var(--ink-3);
  padding: 0 8px;
  user-select: none;
}

.refs__overflow {
  color: var(--ink-3);
}

/* Lead-in label for a backlink row ("↳ Refers to …"). Quieter than the
   referenced links that follow, so the chips read as the actionable part. */
.refs__lead {
  color: var(--ink-3);
  margin-right: 8px;
  white-space: nowrap;
}

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--rule-strong);
  border-radius: 5px;
  border: 2px solid var(--paper);
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--ink-3); background-clip: content-box; border: 2px solid var(--paper); }
