/* ============================================================
   LumoPlans, Base styles
   Shared reset, typography, surfaces, buttons, forms, utilities.
   Every page loads tokens.css then base.css.
   ============================================================ */

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

/* Selection colors appropriate for the dark surface */
::selection {
  background: rgba(79, 141, 255, 0.32);
  color: var(--ink);
}

/* Scrollbar: thin, dark-themed */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--paper-raised); }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(237, 240, 247, 0.28); }

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

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  color: var(--ink);
  background-color: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Midnight Current atmosphere: electric blue glow from the top + grain.
   Fixed layer so every page shares the same air. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(90rem 44rem at 50% -14rem, rgba(79, 141, 255, 0.16), transparent 62%),
    radial-gradient(60rem 34rem at 86% -10rem, rgba(56, 189, 248, 0.08), transparent 60%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

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

/* ---------- Typography ---------- */

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: var(--leading-tight);
  letter-spacing: -0.02em;
  text-wrap: balance;
}

h1 { font-size: var(--text-hero); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); line-height: var(--leading-snug); }
h4 { font-size: var(--text-lg); line-height: var(--leading-snug); font-weight: 600; }

p { max-width: 65ch; }

a {
  color: var(--lumo-deep);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--speed-fast) ease;
}

a:hover { color: var(--ink); }

strong { font-weight: 600; }

.text-muted { color: var(--muted); }
.text-small { font-size: var(--text-sm); }

.eyebrow {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--lumo-deep);
}

/* Prices, order numbers, receipts, always mono. */
.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

/* ---------- Layout ---------- */

.container {
  width: min(var(--container), 100% - 2.5rem);
  margin-inline: auto;
}

.container-narrow {
  width: min(var(--container-narrow), 100% - 2.5rem);
  margin-inline: auto;
}

.section { padding-block: var(--space-section); }

.section-night {
  background-color: var(--night);
  color: var(--ink-on-night);
}

.section-night h1,
.section-night h2,
.section-night h3 { color: var(--ink-on-night); }

.section-night a { color: var(--lumo-bright); }
.section-night a:hover { color: var(--ink-on-night); }

/* ---------- Surfaces ---------- */

.card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

.card-pad { padding: var(--space-6); }

.well {
  background: var(--paper-deep);
  border-radius: var(--r-lg);
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 3rem;
  padding: 0.75rem 1.5rem;
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1.2;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  text-decoration: none;
  cursor: pointer;
  transition:
    transform var(--speed-fast) var(--ease-out),
    box-shadow var(--speed-fast) var(--ease-out),
    background-color var(--speed-fast) ease,
    color var(--speed-fast) ease,
    border-color var(--speed-fast) ease;
}

.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

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

.btn-primary {
  background: var(--ink);
  color: #0B0E1A;
}

.btn-primary:hover {
  background: #FFFFFF;
  color: #0B0E1A;
  box-shadow: var(--shadow-md);
}

.btn-lumo {
  background: linear-gradient(135deg, var(--lumo-bright), var(--lumo));
  color: #06121F;
}

.btn-lumo:hover { box-shadow: var(--shadow-glow); color: #06121F; }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
}

.btn-ghost:hover {
  border-color: var(--ink);
  background: var(--paper-raised);
  color: var(--ink);
}

.section-night .btn-ghost {
  color: var(--ink-on-night);
  border-color: var(--line-on-night);
}

.section-night .btn-ghost:hover {
  border-color: var(--ink-on-night);
  background: transparent;
  color: var(--ink-on-night);
}

.btn-lg {
  min-height: 3.5rem;
  padding: 1rem 2rem;
  font-size: var(--text-lg);
}

/* ---------- Chips & badges ---------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--r-pill);
  background: var(--lumo-soft);
  color: var(--lumo-deep);
  border: 1px solid rgba(79, 141, 255, 0.35);
}

.chip-trust {
  background: var(--trust-soft);
  color: var(--trust);
  border-color: rgba(52, 211, 153, 0.35);
}

/* ---------- Forms ---------- */

.field { display: grid; gap: 0.4rem; }

.field label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink-soft);
}

.field input,
.field textarea,
.field select {
  font: inherit;
  color: var(--ink);
  background: var(--paper-raised);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  padding: 0.8rem 1rem;
  min-height: 3rem;
  transition: border-color var(--speed-fast) ease, box-shadow var(--speed-fast) ease;
}

.field input::placeholder { color: var(--muted); }

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--lumo);
  box-shadow: 0 0 0 3px var(--lumo-glow);
}

/* ---------- Reveal on scroll (used with js/reveal.js) ---------- */

.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity var(--speed-slow) var(--ease-out),
    transform var(--speed-slow) var(--ease-out);
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

.stagger > * { transition-delay: calc(var(--stagger-i, 0) * 90ms); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}

/* ---------- Accessibility ---------- */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 10000;
  padding: 0.6rem 1rem;
  background: var(--ink);
  color: var(--paper);
  border-radius: 0 0 var(--r-sm) var(--r-sm);
}

.skip-link:focus { top: 0; }

/* ---------- Session menu (header, injected by js/session.js) ---------- */

.session-menu { position: relative; display: inline-flex; }

.session-menu-panel {
  position: absolute;
  top: calc(100% + 0.5rem);
  inset-inline-end: 0;
  z-index: 200;
  min-width: 13rem;
  padding: 0.4rem;
  background: var(--paper-raised);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
}

.session-menu-panel[hidden] { display: none; }

.session-menu-email {
  padding: 0.55rem 0.75rem;
  font-size: var(--text-xs);
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  margin-bottom: 0.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-menu-item {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 0.55rem 0.75rem;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  text-align: start;
  cursor: pointer;
  transition: background-color var(--speed-fast) ease;
}

.session-menu-item:hover { background: var(--paper-deep); }

.session-menu-item:focus-visible {
  outline: 2px solid var(--lumo);
  outline-offset: 2px;
}
