/* =====================================================================
   MMO Design System — single source of truth
   Dark default, light optional via [data-theme="light"]
   Brand tokens are supplied by base.html from TenantBranding (--brand-*).
   ===================================================================== */

/* ----- BRAND (set inline from server) ----- */
:root {
  --brand-primary: #2563eb;
  --brand-secondary: #0f172a;
  --brand-accent: #f8fafc;
  --brand-font: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --brand-heading: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;

  --brand-primary-rgb: 37 99 235;
  --brand-secondary-rgb: 15 23 42;
}

/* ----- DARK THEME (default) ----- */
:root,
:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #050816;
  --bg-grad: radial-gradient(circle at 12% -10%, rgba(var(--brand-primary-rgb) / 0.35), transparent 42%),
             radial-gradient(circle at 88% 0%, rgba(var(--brand-secondary-rgb) / 0.9), transparent 36%),
             linear-gradient(180deg, #02030a 0%, #060b1b 50%, #050816 100%);
  --surface-1: rgba(13, 20, 38, 0.78);
  --surface-2: rgba(20, 28, 50, 0.82);
  --surface-3: rgba(28, 38, 64, 0.85);
  --surface-glass: rgba(255, 255, 255, 0.04);

  --text: #e6edf7;
  --text-strong: #ffffff;
  --text-muted: #94a3b8;
  --text-subtle: rgba(226, 232, 240, 0.7);

  --border: rgba(148, 163, 184, 0.16);
  --border-strong: rgba(148, 163, 184, 0.28);

  --accent: #60a5fa;
  --accent-2: #38bdf8;
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;

  --shadow-sm: 0 4px 14px rgba(2, 6, 23, 0.45);
  --shadow-md: 0 12px 36px rgba(2, 6, 23, 0.55);
  --shadow-lg: 0 30px 80px rgba(2, 6, 23, 0.6);
  --shadow-glow: 0 20px 60px rgba(var(--brand-primary-rgb) / 0.35);

  --grid-line: rgba(255, 255, 255, 0.035);
}

/* ----- LIGHT THEME ----- */
:root[data-theme="light"] {
  color-scheme: light;

  --bg: #f6f8fb;
  --bg-grad: radial-gradient(circle at 12% -10%, rgba(var(--brand-primary-rgb) / 0.16), transparent 42%),
             radial-gradient(circle at 88% 0%, rgba(var(--brand-secondary-rgb) / 0.08), transparent 36%),
             linear-gradient(180deg, #ffffff 0%, #f4f7fc 50%, #eef2f9 100%);
  --surface-1: rgba(255, 255, 255, 0.92);
  --surface-2: rgba(255, 255, 255, 0.98);
  --surface-3: #ffffff;
  --surface-glass: rgba(255, 255, 255, 0.6);

  --text: #1e293b;
  --text-strong: #0f172a;
  --text-muted: #64748b;
  --text-subtle: rgba(30, 41, 59, 0.75);

  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.16);

  --accent: #2563eb;
  --accent-2: #0ea5e9;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;

  --shadow-sm: 0 4px 12px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 12px 32px rgba(15, 23, 42, 0.1);
  --shadow-lg: 0 30px 80px rgba(15, 23, 42, 0.12);
  --shadow-glow: 0 16px 48px rgba(var(--brand-primary-rgb) / 0.2);

  --grid-line: rgba(15, 23, 42, 0.04);
}

/* ----- TOKENS ----- */
:root {
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-2xl: 36px;
  --radius-pill: 999px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast: 160ms;
  --dur: 280ms;
  --dur-slow: 480ms;

  --container: min(1240px, calc(100vw - 2rem));
  --container-narrow: min(880px, calc(100vw - 2rem));

  --fs-micro: 0.78rem;
  --fs-small: 0.875rem;
  --fs-base: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.375rem;
  --fs-2xl: 1.75rem;
  --fs-3xl: clamp(2rem, 4vw, 2.75rem);
  --fs-4xl: clamp(2.5rem, 5vw, 3.75rem);
  --fs-hero: clamp(2.75rem, 7vw, 5.5rem);
}

/* ----- RESET ----- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; overflow-x: hidden; }
html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: var(--brand-font);
  font-size: var(--fs-base);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
  overflow-x: hidden;
  overflow-wrap: break-word;
  word-break: break-word;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0));
}

img, svg, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; transition: color var(--dur) var(--ease); }
a:hover { color: var(--accent); }
button { font-family: inherit; cursor: pointer; }
::selection { background: rgba(var(--brand-primary-rgb) / 0.4); color: var(--text-strong); }

/* ----- TYPOGRAPHY ----- */
h1, h2, h3, h4, h5, h6 {
  margin: 0 0 0.65em;
  font-family: var(--brand-heading);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--text-strong);
}
h1 { font-size: var(--fs-4xl); }
h2 { font-size: var(--fs-3xl); }
h3 { font-size: var(--fs-2xl); }
h4 { font-size: var(--fs-xl); }
p { margin: 0 0 1rem; }
small, .text-micro { font-size: var(--fs-micro); }
.text-muted { color: var(--text-muted); }
.text-strong { color: var(--text-strong); }
.text-gradient {
  background: linear-gradient(135deg, var(--accent), var(--brand-primary), var(--accent-2));
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
}

/* ----- LAYOUT ----- */
.container { width: var(--container); margin-inline: auto; position: relative; z-index: 1; }
.container-narrow { width: var(--container-narrow); margin-inline: auto; position: relative; z-index: 1; }

.section { padding: var(--space-20) 0; position: relative; }
.section-tight { padding: var(--space-12) 0; }
.section-flush { padding-top: 0; }

.grid { display: grid; gap: var(--space-6); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-auto-lg { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mt-12 { margin-top: var(--space-12); }

/* ----- HEADER / NAV ----- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  backdrop-filter: saturate(140%) blur(20px);
  -webkit-backdrop-filter: saturate(140%) blur(20px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--border);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.site-header.is-scrolled {
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  box-shadow: var(--shadow-sm);
}
.header-inner {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}
.brand { display: inline-flex; align-items: center; gap: var(--space-3); color: var(--text-strong); }
.brand:hover { color: var(--text-strong); }
.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  object-fit: contain;
  background: var(--surface-glass);
  padding: 4px;
  border: 1px solid var(--border);
}
.brand-text { display: grid; gap: 2px; line-height: 1.1; }
.brand-title { font-family: var(--brand-heading); font-weight: 700; font-size: 1rem; letter-spacing: -0.01em; }
.brand-sub { font-size: 0.78rem; color: var(--text-muted); }

.nav { display: flex; align-items: center; gap: var(--space-1); }
/* The CTA block only renders inside the drawer on mobile (hidden on desktop). */
.nav .nav-cta { display: none; }
.nav a {
  position: relative;
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-subtle);
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.nav a:hover, .nav a.is-active { color: var(--text-strong); background: var(--surface-glass); }
.nav a.is-active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  transform: translateX(-50%);
}

.header-actions { display: inline-flex; align-items: center; gap: var(--space-2); }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-pill);
  background: var(--surface-glass);
  border: 1px solid var(--border);
  color: var(--text);
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.icon-btn:hover { transform: translateY(-1px); background: var(--surface-2); color: var(--text-strong); }
.icon-btn svg { width: 18px; height: 18px; }

.menu-btn {
  display: none;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-pill);
  background: var(--surface-glass);
  border: 1px solid var(--border);
  color: var(--text-strong);
  align-items: center;
  justify-content: center;
}
.menu-btn .bars { width: 18px; height: 12px; position: relative; }
.menu-btn .bars::before,
.menu-btn .bars::after,
.menu-btn .bars span {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.menu-btn .bars::before { top: 0; }
.menu-btn .bars span { top: 5px; }
.menu-btn .bars::after { top: 10px; }
.menu-btn[aria-expanded="true"] .bars::before { transform: translateY(5px) rotate(45deg); }
.menu-btn[aria-expanded="true"] .bars span { opacity: 0; }
.menu-btn[aria-expanded="true"] .bars::after { transform: translateY(-5px) rotate(-45deg); }

/* Honeypot — invisible to humans, irresistible to bots */
.honeypot {
  position: absolute !important;
  left: -10000px !important;
  top: auto !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Cart button + badge */
.cart-btn { position: relative; }
.cart-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, var(--brand-primary), var(--accent-2));
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  font-family: var(--brand-heading);
  letter-spacing: 0.02em;
  box-shadow: 0 4px 12px rgba(var(--brand-primary-rgb) / 0.35);
  border: 1.5px solid var(--bg);
  line-height: 1;
}

/* Theme toggle icon swap — applies to both header and drawer variants */
.theme-toggle .sun, .nav-theme-btn .sun { display: none; }
:root[data-theme="light"] .theme-toggle .sun,
:root[data-theme="light"] .nav-theme-btn .sun { display: inline-block; }
:root[data-theme="light"] .theme-toggle .moon,
:root[data-theme="light"] .nav-theme-btn .moon { display: none; }

/* ----- BUTTONS ----- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.78rem 1.2rem;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.94rem;
  line-height: 1;
  color: var(--text-strong);
  background: var(--surface-2);
  cursor: pointer;
  white-space: nowrap;
  transition: transform var(--dur) var(--ease),
              background var(--dur) var(--ease),
              border-color var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease),
              color var(--dur) var(--ease);
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(var(--brand-primary-rgb) / 0.45);
}
.btn-primary {
  background: linear-gradient(135deg, var(--brand-primary), var(--accent-2));
  color: #ffffff;
  box-shadow: var(--shadow-glow);
}
.btn-primary:hover { color: #ffffff; box-shadow: 0 22px 50px rgba(var(--brand-primary-rgb) / 0.5); }
.btn-ghost {
  background: var(--surface-glass);
  border-color: var(--border-strong);
  color: var(--text-strong);
}
.btn-ghost:hover { background: var(--surface-2); }
.btn-soft {
  background: color-mix(in srgb, var(--brand-primary) 12%, transparent);
  border-color: color-mix(in srgb, var(--brand-primary) 25%, transparent);
  color: var(--accent);
}
.btn-soft:hover { color: var(--text-strong); }
.btn-sm { padding: 0.55rem 0.9rem; font-size: 0.85rem; }
.btn-lg { padding: 1rem 1.6rem; font-size: 1rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.55; pointer-events: none; }

/* ----- KICKERS / CHIPS / BADGES ----- */
.kicker {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}
.kicker::before {
  content: "";
  width: 28px;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-pill);
  background: var(--surface-glass);
  border: 1px solid var(--border);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}
.chip-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.6rem;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--brand-primary) 14%, transparent);
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.badge-success { background: color-mix(in srgb, var(--success) 14%, transparent); color: var(--success); }
.badge-warning { background: color-mix(in srgb, var(--warning) 14%, transparent); color: var(--warning); }
.badge-danger { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }

/* ----- CARDS / PANELS ----- */
.card, .panel {
  position: relative;
  padding: var(--space-6);
  background: linear-gradient(180deg, var(--surface-1), var(--surface-2));
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: transform var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease),
              border-color var(--dur) var(--ease);
}
.card-hover:hover, .panel-hover:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
}
.card-media {
  margin: calc(var(--space-6) * -1) calc(var(--space-6) * -1) var(--space-5);
  aspect-ratio: 16 / 10;
  overflow: hidden;
  position: relative;
}
.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 600ms var(--ease);
}
.card:hover .card-media img,
.card-hover:hover .card-media img { transform: scale(1.06); }
.card-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 60%, rgba(2, 6, 23, 0.55));
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}
.card:hover .card-media::after { opacity: 1; }
.card-title { margin-bottom: var(--space-2); }
.card-text { color: var(--text-muted); margin-bottom: var(--space-4); }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }

/* ----- HERO ----- */
.hero { position: relative; padding: var(--space-20) 0 var(--space-16); overflow: hidden; }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: var(--space-12);
  align-items: center;
}
.hero-headline {
  font-size: var(--fs-hero);
  line-height: 0.96;
  letter-spacing: -0.035em;
  margin-bottom: var(--space-5);
}
.hero-lead {
  max-width: 60ch;
  font-size: 1.1rem;
  color: var(--text-subtle);
  margin-bottom: var(--space-6);
}
.hero-visual {
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: var(--radius-2xl);
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}
.hero-visual img { width: 100%; height: 100%; object-fit: cover; }
.hero-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at top left, rgba(var(--brand-primary-rgb) / 0.45), transparent 55%);
  pointer-events: none;
  z-index: 1;
}
.hero-orbit { position: absolute; inset: -10%; pointer-events: none; z-index: 0; }
.hero-orbit::before, .hero-orbit::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  border: 1px dashed rgba(148, 163, 184, 0.22);
  animation: spin 60s linear infinite;
}
.hero-orbit::before { inset: 8%; }
.hero-orbit::after { inset: 18%; animation-duration: 90s; animation-direction: reverse; }
@keyframes spin { to { transform: rotate(360deg); } }

.hero-stat-card {
  position: absolute;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  border: 1px solid var(--border-strong);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow-md);
  font-size: 0.85rem;
  color: var(--text);
  z-index: 2;
}
.hero-stat-card strong {
  display: block;
  font-family: var(--brand-heading);
  font-size: 1.1rem;
  color: var(--text-strong);
}

/* ----- SECTION HEADING ----- */
.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-8);
  margin-bottom: var(--space-10);
}
.section-heading p { max-width: 56ch; color: var(--text-muted); margin: 0; }
.section-heading h2 { margin-bottom: 0; }

/* ----- STATS / COUNTERS ----- */
.stat {
  padding: var(--space-6);
  border-radius: var(--radius-xl);
  background: var(--surface-1);
  border: 1px solid var(--border);
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.stat:hover { transform: translateY(-3px); border-color: var(--border-strong); }
.stat-num {
  display: block;
  font-family: var(--brand-heading);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-strong);
  line-height: 1;
  margin-bottom: var(--space-2);
}
.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
}

/* ----- FORMS ----- */
.field { display: grid; gap: var(--space-2); margin-bottom: var(--space-4); }
.label { font-size: 0.85rem; font-weight: 600; color: var(--text-strong); }
.input, .textarea, .select {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--surface-1);
  color: var(--text-strong);
  font: inherit;
  outline: none;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--brand-primary-rgb) / 0.18);
}
.textarea { min-height: 140px; resize: vertical; }

.input-group {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.3rem 0.3rem 0.3rem 1rem;
  border-radius: var(--radius-pill);
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.input-group:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--brand-primary-rgb) / 0.18);
}
.input-group input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-strong);
  font: inherit;
  min-width: 0;
}
.input-group input::placeholder { color: var(--text-muted); }

/* ----- ALERTS / TOASTS ----- */
.toast-region {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 1000;
  display: grid;
  gap: var(--space-2);
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  color: var(--text-strong);
  font-size: 0.9rem;
  min-width: 260px;
  max-width: 360px;
  animation: toast-in var(--dur) var(--ease-spring);
  border-left: 3px solid var(--accent);
}
.toast-success { border-left-color: var(--success); }
.toast-warning { border-left-color: var(--warning); }
.toast-error { border-left-color: var(--danger); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ----- SEARCH OVERLAY ----- */
.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  background: color-mix(in srgb, var(--bg) 75%, transparent);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  padding: 8vh var(--space-4);
}
.search-overlay.is-open { display: block; animation: fadein var(--dur) var(--ease); }
@keyframes fadein { from { opacity: 0; } }
.search-panel {
  width: min(680px, 100%);
  margin: 0 auto;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.search-input-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5);
  border-bottom: 1px solid var(--border);
}
.search-input-row input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text-strong);
  font-size: 1.05rem;
  font-family: inherit;
}
.search-kbd {
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 0.72rem;
  padding: 0.2rem 0.45rem;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
}
.search-results { max-height: 60vh; overflow-y: auto; padding: var(--space-3); }
.search-results:empty::after {
  content: "Type to search across writing, products, papers, and shoots.";
  display: block;
  padding: var(--space-6);
  color: var(--text-muted);
  text-align: center;
  font-size: 0.9rem;
}
.search-item {
  display: block;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  color: var(--text);
  transition: background var(--dur) var(--ease);
}
.search-item:hover, .search-item.is-active {
  background: var(--surface-1);
  color: var(--text-strong);
}
.search-item .search-type {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-weight: 700;
}
.search-item h4 { margin: 2px 0; font-size: 1rem; }
.search-item p { color: var(--text-muted); font-size: 0.85rem; margin: 0; }

/* ----- TIMELINE ----- */
.timeline { position: relative; display: grid; gap: var(--space-4); padding-left: var(--space-6); }
.timeline::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 8px;
  width: 2px;
  background: linear-gradient(180deg, var(--accent), transparent);
  border-radius: 2px;
}
.timeline-item { position: relative; padding: var(--space-5); }
.timeline-item::before {
  content: "";
  position: absolute;
  top: var(--space-6);
  left: calc(var(--space-6) * -1 + 2px);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
}

/* ----- FOOTER ----- */
.site-footer {
  margin-top: var(--space-20);
  padding: var(--space-16) 0 var(--space-8);
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--bg) 92%, black 6%));
  position: relative;
  z-index: 1;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: var(--space-10);
  margin-bottom: var(--space-10);
}
.footer-col h5 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: var(--space-4);
}
.footer-col ul { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-2); }
.footer-col a { color: var(--text); font-size: 0.92rem; }
.footer-col a:hover { color: var(--accent); }
.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
}
.social-row { display: flex; gap: var(--space-2); }
.social-row .icon-btn { width: 36px; height: 36px; }

/* ----- SCROLL REVEALS ----- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 700ms var(--ease-out), transform 700ms var(--ease-out);
  will-change: opacity, transform;
}
.reveal.is-in { opacity: 1; transform: translateY(0); }
.reveal[data-delay="1"] { transition-delay: 80ms; }
.reveal[data-delay="2"] { transition-delay: 160ms; }
.reveal[data-delay="3"] { transition-delay: 240ms; }
.reveal[data-delay="4"] { transition-delay: 320ms; }
.reveal[data-delay="5"] { transition-delay: 400ms; }

.reveal-scale {
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 600ms var(--ease-out), transform 600ms var(--ease-spring);
}
.reveal-scale.is-in { opacity: 1; transform: scale(1); }

/* Marquee */
.marquee {
  position: relative;
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.marquee-track {
  display: flex;
  gap: var(--space-8);
  width: max-content;
  animation: marquee 28s linear infinite;
}
@keyframes marquee { to { transform: translateX(-50%); } }

/* Empty state */
.empty {
  text-align: center;
  padding: var(--space-12) var(--space-6);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-xl);
  color: var(--text-muted);
  background: var(--surface-glass);
}

/* Pagination */
.pagination {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-8);
}
.pagination a, .pagination span {
  min-width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.75rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text);
  background: var(--surface-1);
}
.pagination a:hover, .pagination .current {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
}

/* Breadcrumbs */
.breadcrumbs {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-muted);
  font-size: 0.85rem;
}
.breadcrumbs a:hover { color: var(--text-strong); }
.breadcrumbs .sep { opacity: 0.5; }

/* Page hero */
.page-hero {
  padding: var(--space-16) 0 var(--space-10);
  border-bottom: 1px solid var(--border);
  background: radial-gradient(ellipse at top, rgba(var(--brand-primary-rgb) / 0.18), transparent 60%);
}
.page-hero h1 { font-size: clamp(2.25rem, 5vw, 3.5rem); }

/* Aspect tiles */
.tile { position: relative; aspect-ratio: 4 / 3; overflow: hidden; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface-1); }
.tile img { width: 100%; height: 100%; object-fit: cover; transition: transform 600ms var(--ease); }
.tile:hover img { transform: scale(1.05); }
.tile-cap {
  position: absolute;
  left: var(--space-3);
  right: var(--space-3);
  bottom: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 0.85rem;
  color: var(--text-strong);
}

/* Loader */
.loader {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

/* ----- RESPONSIVE ----- */
@media (max-width: 1100px) {
  .hero-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  :root { --container: min(1240px, calc(100vw - 2.5rem)); }
  .menu-btn { display: inline-flex; }

  /* Drawer drops from the header — top offset matches the smaller mobile
     header height. */
  .nav {
    position: fixed;
    inset: 64px var(--space-3) auto var(--space-3);
    flex-direction: column;
    align-items: stretch;
    padding: var(--space-3);
    border-radius: var(--radius-lg);
    background: var(--surface-3);
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow-lg);
    transform-origin: top right;
    transform: translateY(-8px) scale(0.98);
    opacity: 0;
    pointer-events: none;
    transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
    max-height: calc(100vh - 80px);
    overflow-y: auto;
  }
  .nav.is-open { transform: translateY(0) scale(1); opacity: 1; pointer-events: auto; }
  .nav a {
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    min-height: 44px;             /* Apple HIG touch-target floor */
    display: flex;
    align-items: center;
  }
  .nav a.is-active::after { display: none; }

  /* "Work with me" gets pushed into the drawer so it's reachable when nav is open. */
  .nav .nav-cta {
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
  }
  .nav .nav-cta .btn { width: 100%; justify-content: center; min-height: 44px; }

  /* Layout collapse — any depth, any inline multi-column grid.
     Exclude auto-fill/auto-fit grids (already self-responsive). */
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  /* grid-auto-lg (340px min) would overflow on narrow phones — force to single column */
  .grid-auto, .grid-auto-lg { grid-template-columns: 1fr; }
  .grid[style*="minmax"]:not([style*="auto-fill"]):not([style*="auto-fit"]),
  .grid[style*="grid-template-columns"]:not([style*="auto-fill"]):not([style*="auto-fit"]) {
    grid-template-columns: 1fr !important;
    grid-auto-flow: row !important;
  }
  aside[style*="position: sticky"],
  aside[style*="top:"] { position: static !important; top: auto !important; }

  .section { padding: var(--space-12) 0; }
  .section-tight { padding: var(--space-8) 0; }
  .section-heading { flex-direction: column; align-items: flex-start; gap: var(--space-4); }
  .section-heading h2 { font-size: clamp(1.6rem, 5vw, 2.2rem); }
  .footer-grid { grid-template-columns: 1fr; gap: var(--space-6); }
  .footer-bottom { flex-direction: column; align-items: flex-start; gap: var(--space-2); }
  .toast-region { left: var(--space-4); right: var(--space-4); }
  .toast { max-width: 100%; }

  /* Header: keep only cart + search + hamburger — everything else lives in the drawer. */
  .brand-sub { display: none; }
  .brand-title {
    font-size: 0.95rem;
    max-width: 46vw;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .brand-logo { width: 36px; height: 36px; flex-shrink: 0; }
  .brand { gap: 0.55rem; min-width: 0; }
  .header-inner { min-height: 64px; gap: var(--space-2); padding-block: 8px; }
  .header-actions { gap: 4px; flex-shrink: 0; }
  .header-actions .btn { padding: 0.55rem 0.85rem; font-size: 0.82rem; min-height: 40px; }
  .header-actions > .icon-btn { width: 38px; height: 38px; }
  .menu-btn { width: 40px; height: 40px; flex-shrink: 0; }

  /* Move theme, sign-in, work-with-me, profile to the drawer — keep header lean. */
  .header-actions .theme-toggle { display: none; }
  .header-actions .btn-primary { display: none; }
  .header-actions .btn-soft { display: none; }
  .header-actions a.icon-btn:not(.cart-btn) { display: none; }

  /* Hero polish */
  .hero { padding: var(--space-12) 0 var(--space-10); }
  .hero-visual { aspect-ratio: 4 / 3; }
  .hero-stat-card { padding: var(--space-2) var(--space-3); font-size: 0.75rem; }
  .hero-stat-card strong { font-size: 0.92rem; }
  .hero-orbit { display: none; }

  .card, .panel { padding: var(--space-5); }
  .card-media { margin: calc(var(--space-5) * -1) calc(var(--space-5) * -1) var(--space-4); }
  .page-hero { padding: var(--space-10) 0 var(--space-8); }
  .timeline { padding-left: var(--space-5); }
  .breadcrumbs { font-size: 0.8rem; flex-wrap: wrap; }
  .grid-auto, .grid-auto-lg { gap: var(--space-4); }

  /* Filter chips / tag rows: scroll horizontally instead of wrapping into a tall column. */
  .chip-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    scrollbar-width: none;
  }
  .chip-row::-webkit-scrollbar { display: none; }
  .chip-row > * { flex-shrink: 0; }

  /* ===== Forms: 16px text to stop iOS auto-zoom, 44px touch targets ===== */
  .input, .textarea, .select {
    font-size: 16px;
    min-height: 44px;
    padding: 0.75rem 0.9rem;
  }
  .textarea { min-height: 140px; }
  .field { gap: var(--space-1); margin-bottom: var(--space-3); }
  .label { font-size: 0.9rem; }

  /* Inline pill-style input groups (used by newsletter): give the button its
     own row on mobile so it doesn't shove the email field into <100px. */
  .input-group {
    flex-direction: column;
    align-items: stretch;
    padding: 0;
    background: transparent;
    border: 0;
    gap: var(--space-2);
  }
  .input-group input {
    width: 100%;
    padding: 0.85rem 1rem;
    background: var(--surface-1);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-pill);
    font-size: 16px;
    min-height: 44px;
  }
  .input-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(var(--brand-primary-rgb) / 0.18);
  }
  .input-group .btn { width: 100%; justify-content: center; min-height: 44px; }

  /* Stretch primary CTAs full-width inside cards on small screens. */
  .card .btn.btn-primary, .panel .btn.btn-primary {
    min-height: 44px;
  }
  .card .btn-block, .panel .btn-block { width: 100%; }

  /* Big inline-styled cards (the contact-section card uses
     style="padding: var(--space-12) var(--space-8)") eat the whole viewport
     on a phone. Force a saner padding regardless of inline style. */
  #contact .card[style*="padding"] {
    padding: var(--space-6) var(--space-4) !important;
  }
  #contact .card[style*="padding"] .grid {
    gap: var(--space-6) !important;
  }

  /* Buttons in general — bump tap targets. */
  .btn { min-height: 40px; }
  .btn-sm { min-height: 38px; padding: 0.45rem 0.85rem; }
  .btn-lg { min-height: 48px; }

  /* Search overlay */
  .search-overlay { padding: 4vh var(--space-3); }
  .search-input-row input { font-size: 16px; }

  /* Page-hero CTA buttons should stack and stretch on mobile */
  .page-hero .flex.flex-wrap.gap-3 > .btn,
  .hero .flex.flex-wrap.gap-3 > .btn { flex: 1 1 auto; min-width: 0; }
}

/* Very small phones: drop one more notch */
@media (max-width: 480px) {
  :root { --container: min(1240px, calc(100vw - 2rem)); }
  h1 { font-size: clamp(1.8rem, 7vw, 2.4rem); }
  .hero-headline { font-size: clamp(2.1rem, 9vw, 3rem); }
  .hero-lead { font-size: 1rem; }
  .btn-lg { padding: 0.85rem 1.1rem; font-size: 0.92rem; }
  .stat-num { font-size: 1.6rem; }
  .stat-label { font-size: 0.75rem; letter-spacing: 0.06em; }
  .stat { padding: var(--space-4); }
  .card { padding: var(--space-4); }
  .card-media { margin: calc(var(--space-4) * -1) calc(var(--space-4) * -1) var(--space-4); }
  .panel { padding: var(--space-4); }
  .footer-col h5 { font-size: 0.72rem; }
  .badge { font-size: 0.7rem; padding: 0.18rem 0.5rem; }
  .chip { font-size: 0.78rem; padding: 0.35rem 0.65rem; }
  .hero-stat-card { display: none; }

  /* Stack contact-form two-up rows even tighter */
  .container .grid.grid-2 { gap: var(--space-2); }

  /* Truncate brand title harder on tiny screens */
  .brand-title { max-width: 40vw; }

  /* Page hero CTA pair: each button on its own row */
  .page-hero .flex.flex-wrap.gap-3 > .btn,
  .hero .flex.flex-wrap.gap-3 > .btn { flex-basis: 100%; }

  /* Toast won't overflow the screen on very small phones */
  .toast { min-width: 0; width: 100%; }

  /* Prevent long email/URLs from forcing horizontal scroll */
  a, p, strong, span { overflow-wrap: break-word; word-break: break-word; }
}

/* Touch-device tap-target safety: independent of screen width.
   Pointer media query applies to anything without a fine-grained pointer. */
@media (pointer: coarse) {
  .btn { min-height: 44px; }
  .icon-btn { min-width: 40px; min-height: 40px; }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal, .reveal-scale { opacity: 1; transform: none; }
}

@media print {
  body::before, .site-header, .site-footer, .toast-region, .search-overlay { display: none !important; }
  .section { padding: 0; }
}
