/* ============================================================
   DEX — DESIGN TOKENS
   Mixing board: every value here is a fader the Tweaks panel
   can grab. Keep the list small on purpose.
   ============================================================ */

@font-face {
  font-family: "Cormorant Infant";
  src: url("../fonts/CormorantInfant.ttf") format("truetype-variations");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Cormorant Infant";
  src: url("../fonts/CormorantInfant-Italic.ttf") format("truetype-variations");
  font-weight: 300 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/Inter.ttf") format("truetype-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/Inter-Italic.ttf") format("truetype-variations");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

:root {
  /* ---------- Paper (backgrounds) ---------- */
  --paper-50:  #FBFAF7;
  --paper-100: #F6F4EE;
  --paper-200: #EFECE3;
  --paper-300: #E8E4D9;

  /* ---------- Ink (text) ---------- */
  --ink-900: #15130F;
  --ink-800: #241F18;
  --ink-700: #3A3329;

  /* ---------- Warm greys ---------- */
  --grey-100: #DAD4C6;
  --grey-200: #BCB5A4;
  --grey-300: #9A9284;
  --grey-400: #7A7266;
  --grey-500: #5B544A;
  --grey-600: #403A33;

  /* ---------- Amber ---------- */
  --amber-400: #F4B26A;
  --amber-500: #EF9F46;
  --amber-600: #D88A3A;
  --amber-700: #B26E26;

  /* ---------- Borders ---------- */
  --border-faint: #EDE9DF;
  --border: #E4DFD5;
  --border-strong: #CFC9BC;

  /* ---------- Semantic (quantitative) ---------- */
  --q-up: #3D7A4A;
  --q-down: #B94A3A;
  --q-ref: #4A6781;

  /* ---------- Radii / shadows ---------- */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;

  --shadow-sm: 0 1px 2px rgba(21,19,15,0.04), 0 1px 1px rgba(21,19,15,0.03);
  --shadow-md: 0 4px 12px rgba(21,19,15,0.06), 0 1px 3px rgba(21,19,15,0.04);
  --shadow-lg: 0 20px 40px rgba(21,19,15,0.12), 0 2px 8px rgba(21,19,15,0.06);

  /* ---------- Motion ---------- */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --dur-hover: 120ms;
  --dur-state: 180ms;
  --dur-layout: 320ms;

  /* ---------- Container widths ---------- */
  --w-prose: 68ch;
  --w-app: 1200px;
  --w-wide: 1320px;

  /* ---------- Direction token (overridden by [data-direction]) ---------- */
  --bg-page: var(--paper-50);
  --bg-raised: var(--paper-100);
  --bg-sunken: var(--paper-200);
  --fg: var(--ink-900);
  --fg-muted: var(--grey-500);
  --fg-faint: var(--grey-400);
  --accent: var(--amber-500);
  --accent-hover: var(--amber-600);
}

/* ============================================================
   BASE RESET + TYPE
   ============================================================ */

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

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

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

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--fg);
  background: var(--bg-page);
  font-feature-settings: "ss01", "cv11"; /* nicer Inter */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 320ms var(--ease), color 320ms var(--ease);
}

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

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

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

input, select, textarea {
  font: inherit;
  color: inherit;
}

::selection {
  background: var(--amber-500);
  color: var(--ink-900);
}

/* Display face */
.serif, h1, h2, .h1, .h2 {
  font-family: "Cormorant Infant", Georgia, serif;
  font-weight: 500;
  letter-spacing: -0.005em;
}

/* Eyebrow */
.eyebrow {
  font-family: "Inter", sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; }
.tabular { font-variant-numeric: tabular-nums; }

/* The amber dot — the one decorative brand primitive */
.dot {
  display: inline-block;
  width: 0.32em;
  height: 0.32em;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: baseline;
  transform: translateY(-0.08em);
  margin-left: 0.03em;
}
.dot-lg { width: 0.45em; height: 0.45em; }

/* ============================================================
   DIRECTIONS
   ============================================================ */

/* EDITORIAL — strict DS. Warm paper dominant, amber sparing.  */
[data-direction="editorial"] {
  --bg-page: var(--paper-50);
  --bg-raised: var(--paper-100);
  --bg-sunken: var(--paper-200);
  --fg: var(--ink-900);
  --fg-muted: var(--grey-500);
  --accent: var(--amber-500);
  --accent-hover: var(--amber-600);
}

/* TRADING FLOOR — denser, mono-inflected, slight warm-grey. */
[data-direction="floor"] {
  --bg-page: #F2EFE6;
  --bg-raised: #FBFAF7;
  --bg-sunken: #E6E1D3;
  --fg: #15130F;
  --fg-muted: #4D4740;
  --accent: #D88A3A;
  --accent-hover: #B26E26;
}

/* SOVEREIGN — softer, more whitespace, warmer. */
[data-direction="sovereign"] {
  --bg-page: #FCFBF7;
  --bg-raised: #F5F1E6;
  --bg-sunken: #EDE7D6;
  --fg: #1A1510;
  --fg-muted: #5B544A;
  --accent: #EF9F46;
  --accent-hover: #D88A3A;
}

/* Dark surface (a rhythm break). Applied via .dark class. */
.dark {
  --bg-page: #15130F;
  --bg-raised: #1E1A14;
  --bg-sunken: #0F0D0A;
  --fg: #FBFAF7;
  --fg-muted: #BCB5A4;
  --fg-faint: #9A9284;
  background: var(--bg-page);
  color: var(--fg);
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.005em;
  transition:
    background-color var(--dur-hover) var(--ease),
    color var(--dur-hover) var(--ease),
    border-color var(--dur-hover) var(--ease),
    transform var(--dur-hover) var(--ease);
  white-space: nowrap;
  border: 1px solid transparent;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--accent);
  color: var(--ink-900);
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-ghost {
  background: transparent;
  color: var(--fg);
  border-color: var(--border-strong);
}
.btn-ghost:hover { background: var(--bg-raised); border-color: var(--fg); }

.dark .btn-ghost { border-color: rgba(255,255,255,0.25); color: var(--fg); }
.dark .btn-ghost:hover { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.45); }

.btn-lg { padding: 14px 24px; font-size: 15px; }

/* Arrow icon pops forward on hover — universal treatment for arrow icons inside buttons and text links */
.btn svg,
.link svg,
.link-accent svg {
  transition: transform 220ms var(--ease);
  will-change: transform;
}
.btn:hover svg,
.link:hover svg,
.link-accent:hover svg {
  transform: translateX(3px);
}

/* Text link */
.link {
  color: var(--fg);
  border-bottom: 1px solid var(--grey-200);
  transition: border-color var(--dur-hover) var(--ease);
  padding-bottom: 1px;
}
.link:hover { border-color: var(--accent); }
.link-accent { color: var(--accent); border-color: var(--accent); }
.link-accent:hover { border-color: var(--accent-hover); color: var(--accent-hover); }

/* ============================================================
   CARDS / INPUTS
   ============================================================ */

.card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.card-flush {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.dark .card, .dark .card-flush {
  background: var(--bg-raised);
  border-color: rgba(255,255,255,0.1);
}

.input, .textarea, .select {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--fg);
  transition: border-color var(--dur-hover) var(--ease), background-color var(--dur-hover) var(--ease);
}
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--fg);
  background: #fff;
}
.textarea { resize: vertical; min-height: 100px; font-family: inherit; }

.label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-muted);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}

/* Focus */
:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ============================================================
   LAYOUT HELPERS
   ============================================================ */

.container { max-width: var(--w-app); margin: 0 auto; padding: 0 24px; }
.container-wide { max-width: var(--w-wide); margin: 0 auto; padding: 0 24px; }
.container-prose { max-width: var(--w-prose); margin: 0 auto; padding: 0 24px; }

@media (min-width: 768px) {
  .container, .container-wide, .container-prose { padding: 0 48px; }
}

.divider-rule {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 0;
}
.divider-hair {
  border: 0;
  border-top: 1px solid var(--border-faint);
  margin: 0;
}

/* ============================================================
   SHARED ANIMATIONS
   ============================================================ */

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.reveal { animation: fadeInUp 0.5s var(--ease) both; }
.reveal-1 { animation-delay: 0.05s; }
.reveal-2 { animation-delay: 0.12s; }
.reveal-3 { animation-delay: 0.20s; }
.reveal-4 { animation-delay: 0.28s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   SCROLLBAR (subtle)
   ============================================================ */

* { scrollbar-width: thin; scrollbar-color: var(--grey-200) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--grey-200); border-radius: 999px; border: 2px solid var(--bg-page); }
*::-webkit-scrollbar-thumb:hover { background: var(--grey-300); }
