/* ═══════════════════════════════════════════════════════════════
   Mishu MD V1 Lite — shared tokens
   Real fonts only: Space Grotesk (display) + Inter (body).
   Tharu Digital Run is DECORATIVE-ONLY (legacy-encoded typeface —
   every page credits Tharu, never used for readable English text).
   ═══════════════════════════════════════════════════════════════ */

@font-face {
  font-family: 'Space Grotesk';
  src: url('/fonts/SpaceGrotesk-500.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Space Grotesk';
  src: url('/fonts/SpaceGrotesk-700.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Inter Local';
  src: url('/fonts/Inter-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Inter Local';
  src: url('/fonts/Inter-600.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Tharu Digital Run';
  src: url('/fonts/TharuDigitalRun.ttf') format('truetype');
  font-weight: 400 700; font-style: normal; font-display: swap;
}

:root {
  --color-paper: oklch(11% 0.014 15);
  --color-paper-2: oklch(15% 0.017 15);
  --color-paper-3: oklch(19% 0.019 15);
  --color-ink: oklch(96% 0.007 25);
  --color-ink-2: oklch(89% 0.009 25);
  --color-muted: oklch(75% 0.013 25);
  --color-faint: oklch(59% 0.013 25);

  --color-accent: oklch(64% 0.21 27);
  --color-accent-2: oklch(79% 0.12 65);
  --color-glow: oklch(64% 0.21 27 / 0.45);
  --color-glow-2: oklch(64% 0.21 27 / 0.24);
  --color-paper-emit: oklch(64% 0.21 27 / 0.05);
  --color-accent-border: oklch(64% 0.21 27 / 0.5);
  --color-accent-border-2: oklch(64% 0.21 27 / 0.62);
  --color-accent-hover: oklch(64% 0.21 27 / 0.13);
  --color-card-emit: oklch(64% 0.21 27 / 0.06);
  --color-card-emit-hover: oklch(64% 0.21 27 / 0.12);
  --color-code-border: oklch(64% 0.21 27 / 0.45);
  --color-code-emit: oklch(64% 0.21 27 / 0.08);
  --color-chamber: oklch(15% 0.017 15 / 0.85);
  --color-filament-1: oklch(96% 0.05 27);
  --color-filament-2: oklch(70% 0.19 27);
  --color-filament-3: oklch(96% 0.05 27);

  --color-rule: oklch(96% 0.007 25 / 0.10);
  --color-rule-2: oklch(96% 0.007 25 / 0.18);
  --rule-blueprint: oklch(96% 0.007 25 / 0.045);
  --color-error: oklch(76% 0.16 32);
  --color-success: oklch(78% 0.15 155);
  --color-focus: oklch(70% 0.19 27);

  --font-display: 'Space Grotesk', 'Inter Local', ui-sans-serif, system-ui, sans-serif;
  --font-body: 'Inter Local', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: ui-monospace, 'SF Mono', 'Cascadia Mono', 'JetBrains Mono', Menlo, Consolas, monospace;
  /* decorative Sinhala-shape accent — Tharu's legacy typeface */
  --font-tharu: 'Tharu Digital Run', var(--font-body);

  --text-xs: 0.64rem;
  --text-sm: 0.8rem;
  --text-base: 1rem;
  --text-md: 1.25rem;
  --text-lg: 1.5625rem;
  --text-xl: 1.9531rem;
  --text-2xl: 2.4414rem;
  --text-display-s: clamp(2.25rem, 3.5vw + 1rem, 3.75rem);
  --text-display: clamp(2.75rem, 5vw + 1rem, 5.25rem);

  --space-3xs: 0.125rem;
  --space-2xs: 0.25rem;
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2.5rem;
  --space-2xl: 4rem;
  --space-3xl: 6rem;
  --page-gutter: clamp(1.25rem, 5vw, 4rem);
  --measure: 62ch;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.7, 0, 0.84, 0);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-micro: 120ms;
  --dur-short: 220ms;
  --dur-long: 420ms;
  --dur-pulse: 4s;

  --z-base: 1;
  --z-raised: 10;
  --z-sticky: 200;

  --radius-card: 22px;
  --radius-btn: 16px;
  --radius-pill: 999px;

  /* ── 3D key system (shared by every button on every page) ── */
  --key-dark: oklch(6% 0.01 15);
  --key-ink: oklch(26% 0.02 20);
  --key-ink-2: oklch(32% 0.025 20);
  --key-red: oklch(52% 0.19 27);
  --key-red-2: oklch(60% 0.21 27);
  --key-red-hi: oklch(70% 0.19 30);
  --key-gold: oklch(55% 0.12 75);
}

/* ═══════════ 3D BUTTONS — physical, pressable, chunky ═══════════
   .btn          neutral key (dark face)
   .btn--solid   crimson key (primary)
   .btn--gold    golden key (coins)
   every key: hard bottom edge (box-shadow Y-offset), top gloss,
   hover = lift, active = press down. No gradients-on-text tricks. */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px 14px;
  border-radius: var(--radius-btn);
  border: 1px solid rgba(0, 0, 0, 0.65);
  background: linear-gradient(180deg, var(--key-ink-2) 0%, var(--key-ink) 88%);
  color: var(--color-ink);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.95rem;
  line-height: 1;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  box-shadow:
    0 5px 0 0 var(--key-dark),
    0 12px 26px -8px rgba(0, 0, 0, 0.75),
    inset 0 1px 0 0 oklch(96% 0.007 25 / 0.22),
    inset 0 -2px 0 0 rgba(0, 0, 0, 0.35);
  transition: transform 90ms ease, box-shadow 90ms ease, filter 160ms ease;
  transform: translateY(0);
}

.btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
  box-shadow:
    0 7px 0 0 var(--key-dark),
    0 18px 34px -10px rgba(0, 0, 0, 0.8),
    inset 0 1px 0 0 oklch(96% 0.007 25 / 0.28),
    inset 0 -2px 0 0 rgba(0, 0, 0, 0.35);
}

.btn:active {
  transform: translateY(4px);
  filter: brightness(0.96);
  box-shadow:
    0 1px 0 0 var(--key-dark),
    0 4px 10px -6px rgba(0, 0, 0, 0.7),
    inset 0 1px 0 0 oklch(96% 0.007 25 / 0.12),
    inset 0 -1px 0 0 rgba(0, 0, 0, 0.4);
}

.btn:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 3px;
}

.btn:disabled,
.btn.is-busy {
  opacity: 0.55;
  pointer-events: none;
  transform: translateY(2px);
  box-shadow:
    0 3px 0 0 var(--key-dark),
    0 8px 18px -8px rgba(0, 0, 0, 0.7),
    inset 0 1px 0 0 oklch(96% 0.007 25 / 0.15);
}

.btn--solid {
  background: linear-gradient(180deg, var(--key-red-2) 0%, var(--key-red) 90%);
  color: oklch(98% 0.01 25);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
  box-shadow:
    0 5px 0 0 oklch(34% 0.14 27),
    0 12px 28px -8px oklch(50% 0.19 27 / 0.5),
    inset 0 1px 0 0 oklch(88% 0.1 30 / 0.5),
    inset 0 -2px 0 0 rgba(0, 0, 0, 0.3);
}

.btn--solid:hover {
  box-shadow:
    0 7px 0 0 oklch(34% 0.14 27),
    0 18px 36px -10px oklch(50% 0.19 27 / 0.55),
    inset 0 1px 0 0 oklch(88% 0.1 30 / 0.55),
    inset 0 -2px 0 0 rgba(0, 0, 0, 0.3);
}

.btn--solid:active {
  box-shadow:
    0 1px 0 0 oklch(34% 0.14 27),
    0 4px 12px -6px oklch(45% 0.17 27 / 0.5),
    inset 0 1px 0 0 oklch(88% 0.1 30 / 0.3),
    inset 0 -1px 0 0 rgba(0, 0, 0, 0.35);
}

.btn--gold {
  background: linear-gradient(180deg, oklch(66% 0.13 80) 0%, oklch(56% 0.12 75) 90%);
  color: oklch(20% 0.04 60);
  text-shadow: 0 1px 0 oklch(90% 0.06 85 / 0.5);
  box-shadow:
    0 5px 0 0 oklch(36% 0.09 70),
    0 12px 26px -8px oklch(60% 0.12 75 / 0.4),
    inset 0 1px 0 0 oklch(92% 0.08 90 / 0.55),
    inset 0 -2px 0 0 rgba(0, 0, 0, 0.25);
}

.btn--gold:hover {
  box-shadow:
    0 7px 0 0 oklch(36% 0.09 70),
    0 18px 34px -10px oklch(60% 0.12 75 / 0.45),
    inset 0 1px 0 0 oklch(92% 0.08 90 / 0.6),
    inset 0 -2px 0 0 rgba(0, 0, 0, 0.25);
}

.btn--gold:active {
  box-shadow:
    0 1px 0 0 oklch(36% 0.09 70),
    0 4px 10px -6px oklch(55% 0.11 72 / 0.4),
    inset 0 1px 0 0 oklch(92% 0.08 90 / 0.35),
    inset 0 -1px 0 0 rgba(0, 0, 0, 0.3);
}

/* small 3D keys — chips, tiny actions, dashboard controls */
.btn--sm { padding: 9px 16px 10px; font-size: 0.85rem; border-radius: 13px; }

/* generic pressable elements that pages style as buttons */
.press3d {
  box-shadow:
    0 4px 0 0 var(--key-dark),
    0 10px 20px -8px rgba(0, 0, 0, 0.7),
    inset 0 1px 0 0 oklch(96% 0.007 25 / 0.18);
  transition: transform 90ms ease, box-shadow 90ms ease;
}
.press3d:hover { transform: translateY(-2px); }
.press3d:active { transform: translateY(3px); box-shadow: 0 1px 0 0 var(--key-dark), 0 3px 8px -5px rgba(0,0,0,.7); }

/* decorative Tharu typeface accent (Sinhala letterforms, aria-hidden) */
.tharu-accent { font-family: var(--font-tharu); }

/* ═══════════ SVG ICON SYSTEM — no emoji anywhere, stroke icons only ═══════════
   usage: <svg class="ic"><use href="#i-name"/></svg>
   every page carries a hidden <svg> sprite defining the #i-* symbols. */
.ic {
  width: 1.15em; height: 1.15em; flex: none;
  stroke: currentColor; fill: none;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -0.2em;
}
.ic--md { width: 1.5em; height: 1.5em; }
.ic--lg { width: 26px; height: 26px; stroke-width: 1.6; }
.ic--xl { width: 38px; height: 38px; stroke-width: 1.5; }
.ic--fill { fill: currentColor; stroke: none; }

/* ═══════════ SPLIT AUTH LAYOUT — art panel | form panel ═══════════
   every login / signup / gate page: one side visual, one side form. */
.split {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: minmax(0, 46fr) minmax(0, 54fr);
}
.split__art {
  position: relative; overflow: clip;
  background: var(--color-paper-2);
  border-right: 1px solid var(--color-rule);
}
.split__art .split__bg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: 50% 14%; opacity: .82;
}
.split__art::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    linear-gradient(180deg, oklch(11% .014 15 / .82) 0%, oklch(11% .014 15 / .18) 32%, oklch(11% .014 15 / .12) 55%, oklch(11% .014 15 / .88) 100%);
}
.split__art::after {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background-image: repeating-linear-gradient(0deg, oklch(96% .007 25 / .04) 0 1px, transparent 1px 84px);
}
.split__brand {
  position: absolute; top: 0; left: 0; right: 0; z-index: 2;
  display: flex; align-items: center; gap: 10px;
  padding: 22px 26px; text-decoration: none;
}
.split__brand img { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--color-accent-border); }
.split__brand b { font-family: var(--font-display); font-weight: 700; font-size: 16px; color: oklch(96% 0.007 25); text-shadow: 0 2px 12px rgba(0,0,0,.7); }
.split__brand b i { font-style: normal; color: var(--color-accent-2); }
.split__content {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  padding: 30px 28px 30px;
}
.split__quote {
  font-family: var(--font-display); font-weight: 500; font-size: clamp(1.15rem, 1.9vw, 1.5rem);
  line-height: 1.35; color: oklch(96% 0.007 25); max-width: 22ch;
  text-shadow: 0 2px 16px rgba(0,0,0,.8);
}
.split__quote em { font-style: normal; color: var(--color-accent-2); }
.split__rows { display: grid; gap: 9px; margin-top: 18px; }
.split__row { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: oklch(89% 0.009 25 / .92); }
.split__row .ic { color: var(--color-accent-2); }
.split__form { display: flex; flex-direction: column; min-width: 0; background: var(--color-paper); }
.split__form-in { width: 100%; max-width: 430px; margin-inline: auto; padding: 40px 30px 48px; flex: 1; }
.split__topnav {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  max-width: 430px; margin-inline: auto; width: 100%; padding: 20px 30px 0;
  font-size: 13.5px;
}
.split__topnav a { color: var(--color-muted); text-decoration: none; padding: 6px 12px; border-radius: 999px; }
.split__topnav a:hover { color: var(--color-ink); background: var(--color-accent-hover); }
@media (max-width: 880px) {
  .split { grid-template-columns: 1fr; grid-template-rows: minmax(210px, 34svh) 1fr; }
  .split__art { border-right: none; border-bottom: 1px solid var(--color-rule); }
  .split__art .split__bg { object-position: 50% 10%; }
  .split__brand { padding: 16px 20px; }
  .split__content { padding: 18px 20px; }
  .split__rows { display: none; }
  .split__quote { font-size: 1.05rem; }
}

/* ============ AI assistant widget (shared) ============ */
.aiw { position: fixed; right: 18px; bottom: 18px; z-index: 90; display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.aiw__fab {
  width: 58px; height: 58px; border-radius: 50%; border: 1px solid var(--color-accent-border); cursor: pointer;
  background: linear-gradient(180deg, var(--key-red-2, oklch(58% 0.2 27)) 0%, var(--key-red, oklch(50% 0.19 27)) 100%);
  color: oklch(98% 0.01 25); font-size: 24px; display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 30px -8px oklch(50% 0.19 27 / .6), inset 0 1px 0 oklch(88% 0.1 30 / .5);
  transition: transform .18s ease;
}
.aiw__fab:hover { transform: translateY(-3px) scale(1.04); }
.aiw__panel {
  width: min(340px, calc(100vw - 32px)); height: 440px; max-height: calc(100dvh - 110px);
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--color-paper-2); border: 1px solid var(--color-rule-2); border-radius: 22px;
  box-shadow: 0 40px 90px -35px rgba(0,0,0,.9); animation: aiw-pop .28s ease;
}
.aiw__panel[hidden] { display: none; }
@keyframes aiw-pop { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
.aiw__head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--color-rule); }
.aiw__head b { font-family: var(--font-display); font-weight: 700; font-size: 15px; color: var(--color-ink); flex: 1; }
.aiw__head span { font-size: 11.5px; color: var(--color-success); letter-spacing: .08em; }
.aiw__head button { background: none; border: none; color: var(--color-faint); font-size: 20px; cursor: pointer; padding: 2px 6px; }
.aiw__head button:hover { color: var(--color-ink); }
.aiw__log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 9px; }
.aiw__msg { max-width: 85%; padding: 10px 13px; border-radius: 15px; font-size: 13.8px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.aiw__msg--bot { align-self: flex-start; background: color-mix(in oklab, var(--color-paper) 60%, var(--color-accent-hover)); border: 1px solid var(--color-rule); border-bottom-left-radius: 5px; color: var(--color-ink); }
.aiw__msg--me { align-self: flex-end; background: linear-gradient(180deg, var(--key-red-2, oklch(58% 0.2 27)), var(--key-red, oklch(50% 0.19 27))); color: oklch(98% 0.01 25); border-bottom-right-radius: 5px; }
.aiw__msg--typing { color: var(--color-faint); font-style: italic; }
.aiw__form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--color-rule); }
.aiw__form input {
  flex: 1; min-width: 0; background: var(--color-paper); border: 1px solid var(--color-rule-2); border-radius: 13px;
  color: var(--color-ink); font-family: var(--font-body); font-size: 14px; padding: 11px 14px; outline: 2px solid transparent; outline-offset: 1px;
}
.aiw__form input:focus-visible { outline-color: var(--color-focus); }
.aiw__form button { border: none; cursor: pointer; border-radius: 13px; padding: 0 16px; font-size: 15px;
  background: linear-gradient(180deg, var(--key-red-2, oklch(58% 0.2 27)) 0%, var(--key-red, oklch(50% 0.19 27)) 100%);
  color: oklch(98% 0.01 25); }
@media (max-width: 560px) { .aiw { right: 12px; bottom: 12px; } .aiw__fab { width: 52px; height: 52px; } }
