/* =====================================================================
   Aakar Kale Portfolio — app styles
   Dark = Kole Jain signature (DM Sans, black, glassy, tight)
   Light = Editorial magazine (Montserrat + Unbounded, cream paper, ink)
   ===================================================================== */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  min-height: 100vh;
  font-family: 'DM Sans', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ============================================================
   THEME: DARK (default, Kole signature)
   ============================================================ */
:root, :root[data-theme='dark'] {
  --surface-0: rgb(9,9,9);
  --surface-1: rgb(16,16,17);
  --surface-2: rgb(20,20,20);
  --surface-3: rgb(23,23,23);
  --surface-4: rgb(31,31,31);
  --surface-5: rgb(36,36,36);
  --border: rgb(46,46,46);
  --border-soft: rgba(255,255,255,0.08);

  --text-0: rgb(255,255,255);
  --text-1: rgb(235,235,235);
  --text-2: rgb(180,180,180);
  --text-3: rgb(153,153,153);
  --text-4: rgb(128,128,128);
  --text-5: rgb(81,81,81);

  --accent: rgb(255,221,85);      /* primary accent */
  --accent-2: rgb(115,115,255);
  --accent-3: rgb(255,133,115);

  --font-head: 'DM Sans', system-ui, sans-serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --font-display: 'DM Sans', system-ui, sans-serif;
  --font-mono: 'Geist', ui-monospace, monospace;

  --body-bg: var(--surface-0);
  --body-fg: var(--text-1);
}

body {
  background: var(--body-bg) !important;
  color: var(--body-fg);
}

/* ============================================================
   Synchronized dark/light cross-fade (View Transitions API)
   One single animation replaces the per-element transitions that
   used to desync and feel glitchy on theme toggle.
   ============================================================ */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 500ms;
  animation-timing-function: cubic-bezier(.2, .8, .2, 1);
}
/* During the transition, pin the snapshots on top of each other so
   the browser cross-fades rather than sliding. */
::view-transition-old(root) { animation-name: vt-fade-out; }
::view-transition-new(root) { animation-name: vt-fade-in; }
@keyframes vt-fade-out { to { opacity: 0; } }
@keyframes vt-fade-in  { from { opacity: 0; } }

/* ============================================================
   THEME: LIGHT (editorial magazine)
   ============================================================ */
:root[data-theme='light'] {
  --surface-0: #F4EFE6;          /* cream paper */
  --surface-1: #EDE6D9;
  --surface-2: #E6DDCB;
  --surface-3: #F9F5EC;
  --surface-4: #FFFFFF;
  --surface-5: #F2ECDF;
  --border: rgba(20,20,20,0.18);
  --border-soft: rgba(20,20,20,0.08);

  --text-0: rgb(15,15,15);
  --text-1: rgb(24,24,24);
  --text-2: rgb(56,56,56);
  --text-3: rgb(90,90,90);
  --text-4: rgb(120,120,120);
  --text-5: rgb(160,160,160);

  --accent: rgb(220,55,40);       /* inky red */
  --accent-2: rgb(30,30,30);
  --accent-3: rgb(180,130,60);

  --font-head: 'Unbounded', 'Montserrat', serif;
  --font-body: 'Montserrat', 'DM Sans', serif;
  --font-display: 'Unbounded', 'Montserrat', serif;
  --font-mono: 'Geist', ui-monospace, monospace;

  --body-bg: var(--surface-0);
  --body-fg: var(--text-1);
}

/* paper grain in light mode */
:root[data-theme='light'] body {
  background-color: var(--surface-0) !important;
  background-image:
    radial-gradient(rgba(0,0,0,0.035) 1px, transparent 1px),
    radial-gradient(rgba(0,0,0,0.025) 1px, transparent 1px) !important;
  background-size: 3px 3px, 7px 7px;
  background-position: 0 0, 1px 2px;
}

/* ============================================================
   Selection + scrollbars
   ============================================================ */
::selection { background: var(--accent); color: #000; }
html { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }

/* ============================================================
   Custom cursor (hover state) — dark mode only
   ============================================================ */
.cursor-dot, .cursor-ring {
  position: fixed; top: 0; left: 0;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  mix-blend-mode: difference;
  transition: opacity 200ms;
}
.cursor-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #fff;
}
.cursor-ring {
  width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.6);
  transition: width 220ms cubic-bezier(.2,.8,.2,1), height 220ms cubic-bezier(.2,.8,.2,1), border-color 220ms, background 220ms, opacity 200ms;
}
.cursor-ring.on-link {
  width: 56px; height: 56px;
  background: rgba(255,221,85,0.14);
  border-color: rgba(255,221,85,0.8);
}
@media (hover: none), (pointer: coarse) {
  .cursor-dot, .cursor-ring { display: none; }
}

/* ============================================================
   Layout primitives
   ============================================================ */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}
@media (min-width: 768px) {
  .container { padding: 0 48px; }
}

/* ============================================================
   Top bar
   ============================================================ */
.topbar {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  background: color-mix(in oklab, var(--body-bg) 70%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-soft);
}
@media (min-width: 768px) {
  .topbar { padding: 20px 48px; }
}

.logo-btn {
  all: unset; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--surface-4);
  border: 1px solid var(--border);
  font-weight: 700; font-size: 13px;
  color: var(--text-0);
  letter-spacing: -0.02em;
  transition: transform 180ms cubic-bezier(.2,.8,.2,1), background 200ms;
  user-select: none;
  flex-shrink: 0;
}
@media (min-width: 768px) {
  .logo-btn { width: 40px; height: 40px; border-radius: 12px; font-size: 14px; }
}
.logo-btn:hover { transform: scale(0.96); }
.logo-btn:active { transform: scale(0.92); }

/* Soft accent glow that pulses in when the cursor is over the logo.
   Lives at the App root so it can sit between the page and the topbar. */
.logo-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 90;
  opacity: 0;
  transition: opacity 420ms cubic-bezier(.2,.8,.2,1);
  background: radial-gradient(
    circle at 28px 28px,
    var(--accent) 0%,
    transparent 42%
  );
}
@media (min-width: 768px) {
  .logo-glow {
    background: radial-gradient(
      circle at 32px 32px,
      var(--accent) 0%,
      transparent 44%
    );
  }
}
.logo-glow.on { opacity: 0.42; }
:root[data-theme='light'] .logo-glow.on { opacity: 0.55; }
@media (hover: none) {
  .logo-glow { display: none; }
}

.theme-toggle {
  all: unset; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px 8px 10px; border-radius: 100px;
  background: var(--surface-4);
  border: 1px solid var(--border);
  font: 500 12px/1 var(--font-body); letter-spacing: 0.02em;
  color: var(--text-2);
  text-transform: uppercase;
  transition: all 220ms;
}
.theme-toggle:hover { background: var(--surface-5); color: var(--text-0); }
.theme-toggle .swatch {
  width: 18px; height: 18px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--accent), var(--accent-2));
  box-shadow: inset 0 0 0 1px var(--border);
  transition: transform 500ms cubic-bezier(.2,.8,.2,1);
}
:root[data-theme='light'] .theme-toggle .swatch { transform: rotate(180deg); }

.topbar-right {
  display: flex; align-items: center; gap: 12px;
}
.top-nav {
  display: none;
  gap: 6px; align-items: center;
  padding: 4px; border-radius: 100px;
  background: var(--surface-4);
  border: 1px solid var(--border);
}
@media (min-width: 900px) { .top-nav { display: inline-flex; } }
.top-nav a {
  padding: 8px 14px; border-radius: 100px;
  font: 500 13px/1 var(--font-body); letter-spacing: -0.01em;
  color: var(--text-3); text-decoration: none;
  transition: all 220ms;
}
.top-nav a:hover { color: var(--text-0); }
.top-nav a.active { color: var(--text-0); background: var(--surface-5); }

/* ============================================================
   Section scaffolding
   ============================================================ */
section[data-section] {
  padding: 96px 0;
  position: relative;
}
@media (max-width: 768px) {
  section[data-section] { padding: 72px 0; }
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--text-3);
  display: inline-flex; align-items: center; gap: 10px;
}
.eyebrow::before {
  content: '';
  width: 20px; height: 1px;
  background: var(--text-4);
}

/* editorial eyebrow in light mode */
:root[data-theme='light'] .eyebrow {
  font-family: var(--font-head);
  letter-spacing: 0.32em;
  color: var(--accent);
}
:root[data-theme='light'] .eyebrow::before { background: var(--accent); }

/* ============================================================
   Utility
   ============================================================ */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 100px;
  background: var(--surface-4);
  border: 1px solid var(--border);
  font: 500 12px/1 var(--font-body);
  color: var(--text-2);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

:root[data-theme='light'] .chip {
  background: transparent;
  border: 1px solid var(--text-2);
  color: var(--text-1);
}

.divider { height: 1px; background: var(--border); margin: 48px 0; }

.btn {
  all: unset; cursor: pointer;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 22px; border-radius: 100px;
  font: 600 14px/1 var(--font-body); letter-spacing: -0.01em;
  transition: all 220ms cubic-bezier(.2,.8,.2,1);
  user-select: none;
}
.btn-primary {
  background: var(--text-0); color: var(--body-bg);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(0,0,0,0.4); }
.btn-ghost {
  background: transparent; color: var(--text-1);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface-4); color: var(--text-0); }

/* ============================================================
   Reveal animation (used across sections)
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 700ms cubic-bezier(.2,.8,.2,1), transform 700ms cubic-bezier(.2,.8,.2,1);
}
.reveal.in {
  opacity: 1;
  transform: none;
}

/* light mode uses a different reveal: ink bleed */
:root[data-theme='light'] .reveal {
  opacity: 0;
  transform: translateY(10px);
  filter: blur(4px);
  transition: opacity 900ms ease-out, transform 900ms ease-out, filter 900ms ease-out;
}
:root[data-theme='light'] .reveal.in {
  opacity: 1; transform: none; filter: none;
}

/* ============================================================
   Long-press easter egg overlay
   ============================================================ */
.long-press-ring {
  position: absolute; inset: -4px;
  border-radius: 16px;
  border: 2px solid var(--accent);
  opacity: 0; pointer-events: none;
  transition: opacity 150ms;
}
.logo-btn.pressing .long-press-ring { opacity: 1; animation: ring-fill 800ms linear forwards; }
@keyframes ring-fill {
  0% { clip-path: inset(0 100% 0 0); }
  100% { clip-path: inset(0 0 0 0); }
}

/* Konami unlock */
@keyframes konami-shake {
  0%,100% { transform: translate(0,0); }
  25% { transform: translate(-3px, 2px); }
  50% { transform: translate(3px, -2px); }
  75% { transform: translate(-2px, -3px); }
}
.konami-pulse { animation: konami-shake 280ms 3; }
