/* ==========  Aldar v2.1 · Calm minimal + dark mode  ========== */

/* Light theme is the default; also applies whenever an ancestor is data-theme="light"
   (used to lock the phone-mock interior to the light palette regardless of root mode). */
:root,
[data-theme="light"] {
  /* Surface */
  --paper:    #FAFAF7;
  --paper-2:  #F2F0EA;
  --paper-3:  #E8E5DD;
  --line:     rgba(14,14,16,0.08);
  --line-2:   rgba(14,14,16,0.14);
  --line-3:   rgba(14,14,16,0.22);

  /* Ink */
  --ink:      #0E0E10;
  --ink-1:    #1A1A1D;
  --ink-2:    #4A4A50;
  --ink-3:    #84848C;
  --ink-4:    #B5B4AE;

  /* Single accent */
  --amber:     #C9842B;
  --amber-d:   #A66A1F;
  --amber-tint:#F2E5CC;

  /* Semantic data only */
  --green:    #2F7A47;
  --red:      #B33A2A;

  /* Translucent paper for sticky-nav blur */
  --paper-translucent-0: rgba(250,250,247,0);
  --paper-translucent-1: rgba(250,250,247,0.82);

  /* Type */
  --serif: 'Instrument Serif', 'Times New Roman', serif;
  --sans:  'Geist', system-ui, sans-serif;
  --mono:  'Geist Mono', ui-monospace, monospace;

  /* Radius */
  --r-1: 8px;
  --r-2: 12px;
  --r-3: 18px;
  --r-4: 24px;

  /* Shadow (light-mode tuned) */
  --shadow-1: 0 1px 0 rgba(14,14,16,0.04), 0 1px 2px rgba(14,14,16,0.04);
  --shadow-2: 0 4px 24px -8px rgba(14,14,16,0.10), 0 1px 0 rgba(14,14,16,0.04);
  --shadow-3: 0 24px 64px -24px rgba(14,14,16,0.18), 0 8px 24px -12px rgba(14,14,16,0.08);
}

/* Dark theme — applies when root has data-theme="dark"
   Phone-mock children opt back into light via [data-theme="light"]. */
[data-theme="dark"] {
  --paper:    #0E0E10;
  --paper-2:  #16161A;
  --paper-3:  #1F1F24;
  --line:     rgba(250,250,247,0.10);
  --line-2:   rgba(250,250,247,0.18);
  --line-3:   rgba(250,250,247,0.26);

  --ink:      #FAFAF7;
  --ink-1:    #F0EFEA;
  --ink-2:    #B5B4AE;
  --ink-3:    #84848C;
  --ink-4:    #4A4A50;

  --amber:     #E2A150;
  --amber-d:   #C9842B;
  --amber-tint:#3A2F1F;

  --green:    #4FAE6C;
  --red:      #DD5949;

  --paper-translucent-0: rgba(14,14,16,0);
  --paper-translucent-1: rgba(14,14,16,0.78);

  --shadow-1: 0 1px 0 rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.5);
  --shadow-2: 0 4px 24px -8px rgba(0,0,0,0.45), 0 1px 0 rgba(0,0,0,0.5);
  --shadow-3: 0 24px 64px -24px rgba(0,0,0,0.6), 0 8px 24px -12px rgba(0,0,0,0.4);
}

/* If the user hasn't explicitly chosen, follow the OS preference. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --paper:    #0E0E10;
    --paper-2:  #16161A;
    --paper-3:  #1F1F24;
    --line:     rgba(250,250,247,0.10);
    --line-2:   rgba(250,250,247,0.18);
    --line-3:   rgba(250,250,247,0.26);
    --ink:      #FAFAF7;
    --ink-1:    #F0EFEA;
    --ink-2:    #B5B4AE;
    --ink-3:    #84848C;
    --ink-4:    #4A4A50;
    --amber:    #E2A150;
    --amber-d:  #C9842B;
    --amber-tint:#3A2F1F;
    --green:    #4FAE6C;
    --red:      #DD5949;
    --paper-translucent-0: rgba(14,14,16,0);
    --paper-translucent-1: rgba(14,14,16,0.78);
    --shadow-1: 0 1px 0 rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.5);
    --shadow-2: 0 4px 24px -8px rgba(0,0,0,0.45), 0 1px 0 rgba(0,0,0,0.5);
    --shadow-3: 0 24px 64px -24px rgba(0,0,0,0.6), 0 8px 24px -12px rgba(0,0,0,0.4);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'ss01' on, 'cv11' on;
  transition: background-color 240ms ease, color 240ms ease;
}

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

.serif { font-family: var(--serif); font-weight: 400; }
.mono  { font-family: var(--mono); font-feature-settings: 'tnum' on; }
.tnum  { font-feature-settings: 'tnum' on, 'lnum' on; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 32px; }
.container-wide { max-width: 1320px; margin: 0 auto; padding: 0 32px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 14px; font-weight: 500;
  transition: all 160ms ease;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn-primary {
  background: var(--ink); color: var(--paper);
}
.btn-primary:hover { background: var(--amber); color: #FAFAF7; transform: translateY(-1px); box-shadow: var(--shadow-2); }
.btn-ghost {
  background: transparent; color: var(--ink); border-color: var(--line-2);
}
.btn-ghost:hover { border-color: var(--ink); }

/* Icon button (for theme toggle, hamburger) */
.btn-icon {
  width: 38px; height: 38px;
  border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-2);
  background: transparent; color: var(--ink);
  transition: all 160ms ease;
}
.btn-icon:hover { border-color: var(--ink); background: var(--paper-2); }

/* Cards */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
}

/* Hover-lift utility — cards get tactile feedback on pointer devices */
@media (hover: hover) {
  .lift {
    transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
  }
  .lift:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-2);
    border-color: var(--line-2);
  }
}

/* Ticker */
.ticker-wrap { overflow: hidden; mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); }
.ticker-track { display: flex; gap: 48px; animation: ticker 80s linear infinite; white-space: nowrap; }
.ticker-wrap:hover .ticker-track { animation-play-state: paused; }
@keyframes ticker { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* Reveal */
.reveal { opacity: 0; transform: translateY(12px); transition: opacity 700ms ease, transform 700ms ease; }
.reveal.in { opacity: 1; transform: translateY(0); }

/* Up/down */
.up   { color: var(--green); }
.down { color: var(--red); }

/* Eyebrow */
.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* Phone mock — frame is always dark, screen is always light (locked via data-theme="light") */
.phone {
  width: 100%;
  aspect-ratio: 9 / 19;
  border-radius: 44px;
  background: #0E0E10;
  padding: 10px;
  box-shadow: var(--shadow-3);
  position: relative;
}
.phone-screen {
  width: 100%; height: 100%;
  border-radius: 36px;
  background: #FAFAF7;
  overflow: hidden;
  position: relative;
}

/* Dark-mode: phone frame would vanish against the body — give it a subtle outline */
[data-theme="dark"] .phone {
  outline: 1px solid rgba(250,250,247,0.06);
  outline-offset: 0;
}

/* Section spacing */
section { padding: 120px 0; }
section.tight { padding: 80px 0; }

/* Tab pill (used in product section) */
.tabs {
  display: inline-flex; gap: 4px;
  padding: 4px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.tab {
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  transition: color 160ms ease, background 160ms ease;
  white-space: nowrap;
}
.tab.active { background: var(--ink); color: var(--paper); }

/* Mobile-only show helper (paired with hide-md) */
.show-md { display: none; }

/* Mobile sheet (nav) */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(14,14,16,0.45);
  opacity: 0; pointer-events: none;
  transition: opacity 220ms ease;
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed; top: 0; left: 0; right: 0; z-index: 61;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  transform: translateY(-100%);
  transition: transform 280ms cubic-bezier(0.22, 1, 0.36, 1);
  padding: 24px 24px 32px;
  max-height: 100vh; overflow-y: auto;
}
.sheet.open { transform: translateY(0); }

/* Footer grid — multi-step responsive instead of 5-col -> 1-col jump */
.grid-footer {
  display: grid;
  grid-template-columns: 2fr repeat(4, 1fr);
  gap: 32px;
}

/* Responsive tiers — added 768px intermediate so tablets aren't crushed.
   Order matters: 1100 -> 768 -> 640 narrows progressively. */
@media (max-width: 1100px) {
  .container, .container-wide { padding: 0 24px; }
  .grid-2 { grid-template-columns: 1fr !important; }
  .grid-3 { grid-template-columns: 1fr !important; }
  .hide-md { display: none !important; }
  .show-md { display: inherit; }
  section { padding: 80px 0; }

  .grid-footer {
    grid-template-columns: 1fr 1fr 1fr 1fr;
  }
  .grid-footer > :first-child {
    grid-column: 1 / -1;
    margin-bottom: 8px;
  }
}
@media (max-width: 768px) {
  .grid-footer { grid-template-columns: 1fr 1fr; }
  section { padding: 72px 0; }
}
@media (max-width: 640px) {
  .container, .container-wide { padding: 0 20px; }
  .grid-2-sm { grid-template-columns: 1fr !important; }
  section { padding: 64px 0; }
}

/* Text selection */
::selection { background: var(--amber); color: #FAFAF7; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--line-3); }

/* ==========================================================
 * Interactivity layer — cursor glow, live pulse, flash, shine
 * ========================================================== */

/* Global cursor glow — radial amber halo follows the pointer.
   Hidden on touch + reduced motion. */
.cursor-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(
    520px circle at var(--mx, 50%) var(--my, 50%),
    rgba(201, 132, 43, 0.10),
    rgba(201, 132, 43, 0.04) 40%,
    transparent 65%
  );
  transition: background 220ms ease;
  mix-blend-mode: normal;
}
[data-theme="dark"] .cursor-glow {
  background: radial-gradient(
    520px circle at var(--mx, 50%) var(--my, 50%),
    rgba(226, 161, 80, 0.16),
    rgba(226, 161, 80, 0.06) 42%,
    transparent 68%
  );
}
@media (hover: none), (prefers-reduced-motion: reduce) {
  .cursor-glow { display: none; }
}

/* Live pulse — heartbeat dot for "LIVE" indicators */
.live-pulse {
  position: relative;
  display: inline-block;
  width: var(--lp-size, 8px);
  height: var(--lp-size, 8px);
  vertical-align: middle;
}
.live-pulse-dot {
  position: absolute; inset: 0;
  border-radius: 50%;
  background: var(--lp-color, var(--green));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--lp-color, #2F7A47) 22%, transparent);
}
.live-pulse-ring {
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: var(--lp-color, var(--green));
  opacity: 0.5;
  animation: pulseRing 2s cubic-bezier(0.22, 1, 0.36, 1) infinite;
}
@keyframes pulseRing {
  0%   { transform: scale(0.8); opacity: 0.55; }
  80%  { transform: scale(2.6); opacity: 0;    }
  100% { transform: scale(2.6); opacity: 0;    }
}

/* Flash — amber-tinted background pulse on a number when its value ticks */
@keyframes flashUp {
  0%   { background: rgba(47,122,71,0.22); color: var(--green); }
  100% { background: transparent; color: inherit; }
}
@keyframes flashDown {
  0%   { background: rgba(179,58,42,0.22); color: var(--red); }
  100% { background: transparent; color: inherit; }
}
.flash-up   { animation: flashUp   900ms ease-out; border-radius: 4px; padding: 0 4px; margin: 0 -4px; }
.flash-down { animation: flashDown 900ms ease-out; border-radius: 4px; padding: 0 4px; margin: 0 -4px; }

/* Word cascade — used for hero/section H1/H2 letter-by-word entry */
@keyframes wordIn {
  from { opacity: 0; transform: translateY(0.4em); filter: blur(4px); }
  to   { opacity: 1; transform: translateY(0);     filter: blur(0);   }
}

/* Button shine — diagonal sweep on hover for primary CTAs */
.btn-primary { position: relative; overflow: hidden; }
.btn-primary::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.22) 50%, transparent 70%);
  transform: translateX(-130%);
  transition: transform 600ms ease;
  pointer-events: none;
}
.btn-primary:hover::after { transform: translateX(130%); }

/* Reduced motion — kill every transition / animation we own */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1 !important; transform: none !important; }
  .ticker-track, .live-pulse-ring { animation: none !important; }
  .flash-up, .flash-down { animation: none !important; }
}
