/* MMRL — Market Microstructure Research Lab
   Custom design system. No template borrowings. */

:root {
  /* Light theme — "stone lab" */
  --bg: #F2F0EB;
  --bg-elev: #ECEAE3;
  --bg-deep: #E5E2DA;
  --surface: rgba(255, 253, 247, 0.62);
  --surface-strong: rgba(255, 253, 247, 0.86);
  --hairline: rgba(28, 27, 24, 0.10);
  --hairline-strong: rgba(28, 27, 24, 0.22);
  --ink: #1B1A17;
  --ink-2: #3A3833;
  --ink-3: #6B6862;
  --ink-4: #9A968D;
  --accent: #1F3A6B;        /* cobalt */
  --accent-2: #3A6BB0;      /* cobalt mid */
  --positive: #1F5C3A;
  --negative: #8B2A1F;
  --grid-tint: rgba(28, 27, 24, 0.04);
  --glass-tint: rgba(255, 253, 247, 0.55);
  --glass-border: rgba(255, 253, 247, 0.9);
  --shadow-1: 0 1px 0 rgba(28,27,24,0.04), 0 8px 32px -16px rgba(28,27,24,0.18);
  --shadow-glass: 0 1px 0 rgba(255,255,255,0.6) inset, 0 -1px 0 rgba(28,27,24,0.04) inset, 0 24px 60px -32px rgba(28,27,24,0.20);
}

[data-theme="dark"] {
  /* Dark theme — "deep graphite" */
  --bg: #0E0F11;
  --bg-elev: #141518;
  --bg-deep: #0A0B0D;
  --surface: rgba(28, 30, 34, 0.55);
  --surface-strong: rgba(28, 30, 34, 0.78);
  --hairline: rgba(240, 236, 226, 0.08);
  --hairline-strong: rgba(240, 236, 226, 0.20);
  --ink: #F0ECE2;
  --ink-2: #C9C5BB;
  --ink-3: #8E8B82;
  --ink-4: #5A5852;
  --accent: #7B98D9;
  --accent-2: #9BB5E8;
  --positive: #6FB089;
  --negative: #D9694F;
  --grid-tint: rgba(240, 236, 226, 0.035);
  --glass-tint: rgba(40, 42, 46, 0.45);
  --glass-border: rgba(240, 236, 226, 0.10);
  --shadow-1: 0 1px 0 rgba(240,236,226,0.04) inset, 0 8px 32px -16px rgba(0,0,0,0.6);
  --shadow-glass: 0 1px 0 rgba(240,236,226,0.06) inset, 0 -1px 0 rgba(0,0,0,0.4) inset, 0 24px 60px -32px rgba(0,0,0,0.7);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

html {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter Tight', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  font-feature-settings: "ss01", "ss02", "cv11", "tnum";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: -0.005em;
  transition: background 0.5s cubic-bezier(.2,.8,.2,1), color 0.5s cubic-bezier(.2,.8,.2,1);
}

body {
  min-height: 100vh;
  background:
    radial-gradient(1400px 800px at 78% -8%,  color-mix(in oklab, var(--accent) 9%, transparent),  transparent 55%),
    radial-gradient(1000px 600px at -8% 18%,  color-mix(in oklab, var(--accent-2) 6%, transparent), transparent 50%),
    radial-gradient(800px  500px at 50% 70%,  color-mix(in oklab, var(--accent) 4%, transparent),  transparent 60%),
    var(--bg);
  background-attachment: fixed;
}

/* Grain texture — paper-like surface */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.028;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  background-size: 300px 300px;
}
[data-theme="dark"] body::before { opacity: 0.045; }

/* TYPOGRAPHY ============================================ */
.serif { font-family: 'Newsreader', 'Iowan Old Style', Georgia, serif; font-feature-settings: "ss01"; }
.mono { font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace; font-feature-settings: "tnum", "zero", "ss01"; }
.display {
  font-family: 'Inter Tight', sans-serif;
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 0.96;
}

.eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
}

.idx {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--ink-3);
  letter-spacing: 0.05em;
}

/* HAIRLINES ============================================== */
.hr-x { height: 1px; background: var(--hairline); width: 100%; }
.hr-y { width: 1px; background: var(--hairline); align-self: stretch; }

/* LIQUID GLASS =========================================== */
.glass {
  background: var(--glass-tint);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-glass),
              0 2px 0 rgba(255,255,255,0.55) inset,
              0 40px 80px -20px rgba(0,0,0,0.12);
  border-radius: 16px;
  position: relative;
  isolation: isolate;
  transition: transform 0.5s cubic-bezier(.2,.8,.2,1),
              box-shadow 0.5s cubic-bezier(.2,.8,.2,1),
              border-color 0.5s;
}
[data-theme="dark"] .glass {
  box-shadow: var(--shadow-glass),
              0 1px 0 rgba(255,255,255,0.06) inset,
              0 40px 100px -20px rgba(0,0,0,0.55);
}
.glass:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-glass),
              0 2px 0 rgba(255,255,255,0.55) inset,
              0 60px 100px -24px rgba(0,0,0,0.18),
              0 0 0 1px color-mix(in oklab, var(--accent) 18%, transparent);
}
[data-theme="dark"] .glass:hover {
  box-shadow: var(--shadow-glass),
              0 1px 0 rgba(255,255,255,0.06) inset,
              0 60px 120px -24px rgba(0,0,0,0.7),
              0 0 0 1px color-mix(in oklab, var(--accent) 28%, transparent);
}
.glass::before {
  /* responsive lighting sheen */
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255,255,255,0.16), transparent 40%, transparent 60%, rgba(255,255,255,0.06));
  pointer-events: none;
  mix-blend-mode: overlay;
  opacity: 0.7;
}
[data-theme="dark"] .glass::before {
  background: linear-gradient(135deg, rgba(240,236,226,0.06), transparent 40%, transparent 60%, rgba(240,236,226,0.02));
}

/* GRID =================================================== */
.shell {
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding: 0 40px;
}
@media (max-width: 800px) {
  .shell { padding: 0 20px; }
}

/* SCROLLBAR ============================================== */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--hairline-strong); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-4); }

/* SELECTION ============================================== */
::selection { background: color-mix(in oklab, var(--accent) 30%, transparent); color: var(--ink); }

/* UTILITIES ============================================== */
.tabular { font-variant-numeric: tabular-nums; }
.upper { text-transform: uppercase; letter-spacing: 0.16em; }
.muted { color: var(--ink-3); }
.muted-2 { color: var(--ink-4); }

button { font-family: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }

/* MOTION ================================================= */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fade-up 0.9s cubic-bezier(.2,.8,.2,1) both; }

@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.9); }
}
.live-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  animation: pulse-dot 1.6s ease-in-out infinite;
  display: inline-block;
}

/* SECTION SCAFFOLD ====================================== */
.section {
  padding: 160px 0 60px;
  position: relative;
  z-index: 1;
}
.section-head {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 32px;
  align-items: baseline;
  padding-bottom: 36px;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 64px;
  position: relative;
}
.section-head h2 {
  margin: 0;
  font-size: clamp(32px, 4vw, 56px);
  font-weight: 460;
  letter-spacing: -0.035em;
  line-height: 0.96;
  text-wrap: pretty;
}

/* Giant watermark numeral behind each section */
.section-watermark {
  position: absolute;
  right: -20px;
  top: -60px;
  font-family: 'Inter Tight', sans-serif;
  font-size: clamp(120px, 16vw, 220px);
  font-weight: 600;
  letter-spacing: -0.05em;
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1px color-mix(in oklab, var(--ink) 8%, transparent);
  text-stroke: 1px color-mix(in oklab, var(--ink) 8%, transparent);
  pointer-events: none;
  user-select: none;
  z-index: 0;
  transition: -webkit-text-stroke-color 0.5s;
}

/* Full-bleed section break — REMOVED (kept class names for back-compat, no styles) */

/* INPUT ================================================== */
input, textarea {
  font-family: inherit;
  background: transparent;
  border: none;
  outline: none;
  color: var(--ink);
  font-size: 15px;
}

/* LINK STYLE ============================================= */
.link-arrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px;
  color: var(--ink);
  border-bottom: 1px solid var(--hairline-strong);
  padding-bottom: 4px;
  transition: gap 0.3s cubic-bezier(.2,.8,.2,1), border-color 0.3s;
}
.link-arrow:hover { gap: 14px; border-color: var(--accent); }
.link-arrow svg { transition: transform 0.3s; }
.link-arrow:hover svg { transform: translateX(2px); }

/* SCROLL REVEAL ========================================== */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.9s cubic-bezier(.2,.8,.2,1), transform 0.9s cubic-bezier(.2,.8,.2,1);
  will-change: opacity, transform;
}
.reveal.reveal-in {
  opacity: 1;
  transform: translateY(0);
}
.reveal.delay-1 { transition-delay: 0.08s; }
.reveal.delay-2 { transition-delay: 0.16s; }
.reveal.delay-3 { transition-delay: 0.24s; }
.reveal.delay-4 { transition-delay: 0.32s; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
  [data-parallax] { transform: none !important; }
}

/* CUSTOM CURSOR ========================================== */
html.cursor-on,
html.cursor-on body,
html.cursor-on * { cursor: none !important; }

.mmrl-arrow {
  position: fixed;
  top: 0; left: 0;
  pointer-events: none;
  z-index: 9999;
  transform: translate3d(-100px, -100px, 0);
  transition: transform 0.08s linear;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.18));
  will-change: transform;
}
.mmrl-arrow svg { display: block; overflow: visible; position: absolute; top: 0; left: 0; }
.mmrl-arrow-fill {
  fill: var(--bg);
  transition: fill 0.25s ease, opacity 0.2s ease;
}
.mmrl-arrow-stroke {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.1;
  stroke-linejoin: round;
  stroke-linecap: round;
  transition: stroke 0.25s ease, opacity 0.2s ease;
}
.mmrl-arrow-halo {
  fill: var(--accent);
  opacity: 0;
  transform-origin: 2px 2px;
  transform: scale(1);
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(.2,.8,.2,1);
}

/* Hand glyph — appears on hover over interactive elements */
.mmrl-hand {
  opacity: 0;
  transform: scale(0.85);
  transform-origin: 11px 12px;
  transition: opacity 0.2s ease, transform 0.25s cubic-bezier(.5,1.4,.4,1);
  filter: drop-shadow(0 0 6px color-mix(in oklab, var(--accent) 70%, transparent))
          drop-shadow(0 0 14px color-mix(in oklab, var(--accent) 40%, transparent));
}
.mmrl-hand-fill {
  fill: var(--bg);
}
.mmrl-hand-stroke {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.25;
  stroke-linejoin: round;
  stroke-linecap: round;
}

/* Hover state — swap arrow for hand */
.mmrl-arrow[data-hover="1"] svg:not(.mmrl-hand) .mmrl-arrow-fill,
.mmrl-arrow[data-hover="1"] svg:not(.mmrl-hand) .mmrl-arrow-stroke,
.mmrl-arrow[data-hover="1"] svg:not(.mmrl-hand) .mmrl-arrow-halo { opacity: 0; }
.mmrl-arrow[data-hover="1"] .mmrl-hand { opacity: 1; transform: scale(1); }

@media (pointer: coarse) {
  .mmrl-arrow { display: none !important; }
}

/* DEPTH FIELD — fixed background world ==================== */
.depth-field {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.df-plane {
  position: absolute;
  inset: -10%;
  will-change: transform;
}

/* Far plane — huge soft accent orbs, deeply blurred */
.df-far { filter: blur(80px); opacity: 0.55; }
[data-theme="dark"] .df-far { opacity: 0.42; }

.df-orb {
  position: absolute;
  border-radius: 50%;
}
.df-orb-1 {
  width: 720px; height: 720px;
  left: -8%; top: 5%;
  background: radial-gradient(circle, color-mix(in oklab, var(--accent) 40%, transparent), transparent 65%);
  animation: df-drift-1 32s ease-in-out infinite alternate;
}
.df-orb-2 {
  width: 880px; height: 880px;
  right: -12%; top: 28%;
  background: radial-gradient(circle, color-mix(in oklab, var(--accent-2) 30%, transparent), transparent 65%);
  animation: df-drift-2 41s ease-in-out infinite alternate;
}
.df-orb-3 {
  width: 640px; height: 640px;
  left: 18%; top: 62%;
  background: radial-gradient(circle, color-mix(in oklab, var(--accent) 25%, transparent), transparent 70%);
  animation: df-drift-3 28s ease-in-out infinite alternate;
}

/* Mid plane — sharper, smaller forms */
.df-mid { filter: blur(40px); opacity: 0.35; }
[data-theme="dark"] .df-mid { opacity: 0.28; }

.df-orb-4 {
  width: 360px; height: 360px;
  right: 22%; top: 12%;
  background: radial-gradient(circle, color-mix(in oklab, var(--accent) 38%, transparent), transparent 65%);
  animation: df-drift-2 24s ease-in-out infinite alternate;
}
.df-orb-5 {
  width: 280px; height: 280px;
  left: 8%; top: 78%;
  background: radial-gradient(circle, color-mix(in oklab, var(--accent-2) 35%, transparent), transparent 65%);
  animation: df-drift-1 19s ease-in-out infinite alternate;
}

/* Grid plane — the world's surveyor lines */
.df-grid {
  background-image:
    linear-gradient(0deg, transparent 49.5%, color-mix(in oklab, var(--ink) 10%, transparent) 50%, transparent 50.5%),
    linear-gradient(90deg, transparent 49.5%, color-mix(in oklab, var(--ink) 10%, transparent) 50%, transparent 50.5%);
  background-size: 120px 120px;
  opacity: 0.06;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 50%, #000 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 50%, #000 30%, transparent 80%);
}
[data-theme="dark"] .df-grid { opacity: 0.10; }

/* Near plane — drifting specks, like dust catching the light */
.df-near { mix-blend-mode: normal; }
.df-speck {
  position: absolute;
  width: 3px; height: 3px;
  border-radius: 50%;
  background: color-mix(in oklab, var(--accent) 75%, transparent);
  box-shadow: 0 0 8px color-mix(in oklab, var(--accent) 60%, transparent);
  opacity: 0.55;
  animation: df-speck-pulse 6s ease-in-out infinite;
}
[data-theme="dark"] .df-speck { opacity: 0.7; }

@keyframes df-drift-1 {
  0%   { transform: translate(0, 0)       scale(1); }
  100% { transform: translate(60px, -40px) scale(1.08); }
}
@keyframes df-drift-2 {
  0%   { transform: translate(0, 0)        scale(1); }
  100% { transform: translate(-50px, 50px) scale(0.94); }
}
@keyframes df-drift-3 {
  0%   { transform: translate(0, 0)         scale(1); }
  100% { transform: translate(40px, 30px)   scale(1.05); }
}
@keyframes df-speck-pulse {
  0%, 100% { opacity: 0.2; transform: scale(0.6); }
  50%      { opacity: 0.8; transform: scale(1.3); }
}

/* Make sure all foreground content sits ABOVE the depth field */
header, main, footer { position: relative; z-index: 1; }

@media (prefers-reduced-motion: reduce) {
  .df-orb { animation: none !important; }
  .df-speck { animation: none !important; }
}
