/* SupportGenie — 2026 v2 "Atelier Lab"
   Multi-color editorial system. Bold grotesk, no serifs, saturated color sections. */

:root {
  /* Palette — SAGE STUDIO. Soft pistachio paper, neutral cool ink,
     terracotta + royal indigo + mustard. Not cream, not gray, not black. */
  --bg: #d9e2c8;            /* pistachio sage paper */
  --paper: #e6edd3;
  --paper-2: #c5d2af;
  --ink: #1a1d22;           /* cool neutral near-black */
  --ink-2: #2d3138;
  --ink-soft: #5e6168;
  --ink-mute: #8d9094;
  --rule: rgba(26, 29, 34, 0.18);
  --rule-strong: rgba(26, 29, 34, 0.40);

  /* Saturated accent system — same names as before, fresh hex values */
  --persimmon: #c8421e;     /* deeper terracotta replaces neon orange */
  --persimmon-deep: #8a2812;
  --cobalt: #2c1d6b;        /* deep royal indigo replaces bright cobalt */
  --cobalt-deep: #190f44;
  --teal: #102a20;          /* deep moss/emerald for dark sections */
  --teal-2: #1a4030;
  --yellow: #d4a017;        /* warm mustard replaces neon yellow */
  --bone: #f0eddf;          /* warm off-white for dark-section type */

  /* Backwards-compat aliases for older component refs */
  --accent: var(--persimmon);
  --accent-deep: var(--persimmon-deep);
  --heat: var(--cobalt);

  /* Type — bold grotesk system, no serifs */
  --font-display: "Bricolage Grotesque", "Space Grotesk", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-ui: "Space Grotesk", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", "Geist Mono", ui-monospace, monospace;

  --gutter: clamp(20px, 4vw, 64px);
  --bleed: clamp(16px, 3vw, 32px);
  --max: 1440px;
}

[data-theme="dark"] {
  --bg: #14181c;
  --paper: #1c2026;
  --paper-2: #252a30;
  --ink: #e3e7d9;
  --ink-2: #c8ccbe;
  --ink-soft: #8d9094;
  --ink-mute: #5e6168;
  --rule: rgba(227, 231, 217, 0.16);
  --rule-strong: rgba(227, 231, 217, 0.36);
  --bone: #1c2026;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-weight: 400;
  font-size: 17px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body { overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--persimmon); color: var(--bone); }

/* ─── Type system ────────────────────────────────── */
/* .serif is a legacy class name. It now points to Bricolage Grotesque (bold sans). */

.serif {
  font-family: var(--font-display);
  font-weight: 700;
  font-variation-settings: "wdth" 100, "opsz" 96;
  letter-spacing: -0.025em;
}

.mono  {
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: 0;
  font-feature-settings: "ss01", "ss02", "calt", "zero";
}

/* "italic" — kept as class name but now does color/weight emphasis, NOT slant */
.italic {
  font-style: normal;
  color: var(--persimmon);
  font-weight: 700;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-soft);
  font-weight: 500;
}

.display-xxl {
  font-family: var(--font-display);
  font-size: clamp(56px, 9.4vw, 168px);
  line-height: 0.88;
  letter-spacing: -0.04em;
  font-weight: 700;
  font-variation-settings: "wdth" 100, "opsz" 96;
}

.display-xl {
  font-family: var(--font-display);
  font-size: clamp(48px, 7vw, 112px);
  line-height: 0.92;
  letter-spacing: -0.035em;
  font-weight: 700;
  font-variation-settings: "wdth" 100, "opsz" 96;
}

.display-l {
  font-family: var(--font-display);
  font-size: clamp(36px, 5vw, 72px);
  line-height: 0.96;
  letter-spacing: -0.03em;
  font-weight: 700;
}

.display-m {
  font-family: var(--font-display);
  font-size: clamp(28px, 3.2vw, 48px);
  line-height: 1.02;
  letter-spacing: -0.025em;
  font-weight: 700;
}

.lead {
  font-family: var(--font-ui);
  font-size: clamp(18px, 1.4vw, 22px);
  line-height: 1.5;
  color: var(--ink-2);
  max-width: 60ch;
  font-weight: 400;
}

.body { font-size: 17px; line-height: 1.55; color: var(--ink-2); }
.body-sm { font-size: 14px; line-height: 1.5; color: var(--ink-soft); }

/* ─── Layout ─────────────────────────────────────── */

.shell {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.row { display: flex; }
.col { display: flex; flex-direction: column; }
.gap-1 { gap: 8px; } .gap-2 { gap: 16px; } .gap-3 { gap: 24px; } .gap-4 { gap: 32px; } .gap-6 { gap: 48px; }

.rule { height: 1px; background: var(--rule); width: 100%; border: 0; margin: 0; }
.rule-strong { background: var(--rule-strong); }

/* ─── Buttons ────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  padding: 14px 22px;
  border-radius: 2px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--bone);
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(.2,.7,.2,1), background 0.18s, color 0.18s, border-color 0.18s;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover { transform: translate(-2px, -2px); box-shadow: 4px 4px 0 var(--ink); }
.btn .arr { transition: transform 0.2s; display: inline-block; }
.btn:hover .arr { transform: translate(2px, 0); }

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

.btn-accent {
  background: var(--persimmon);
  border-color: var(--persimmon);
  color: var(--ink);
}
.btn-accent:hover { background: var(--ink); color: var(--persimmon); border-color: var(--ink); box-shadow: 4px 4px 0 var(--persimmon); }

.btn-heat {
  background: var(--cobalt);
  border-color: var(--cobalt);
  color: var(--bone);
}
.btn-heat:hover { background: var(--ink); color: var(--cobalt); border-color: var(--ink); box-shadow: 4px 4px 0 var(--cobalt); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px 7px 10px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink);
  text-transform: uppercase;
  background: var(--paper);
}

.pill .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--persimmon);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--persimmon) 30%, transparent);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ─── Sections ────────────────────────────────── */

.section {
  padding-top: clamp(72px, 9vw, 140px);
  padding-bottom: clamp(72px, 9vw, 140px);
  position: relative;
}

.section--tight { padding-top: clamp(48px, 6vw, 96px); padding-bottom: clamp(48px, 6vw, 96px); }

/* Section variants — saturated color blocks */
.section--teal { background: var(--teal); color: var(--bone); }
.section--teal h2, .section--teal h3 { color: var(--bone); }
.section--teal .rule { background: color-mix(in oklab, var(--bone) 20%, transparent); }

.section--ink { background: var(--ink); color: var(--bone); }
.section--persimmon { background: var(--persimmon); color: var(--ink); }
.section--cobalt { background: var(--cobalt); color: var(--bone); }
.section--yellow { background: var(--yellow); color: var(--ink); }

.section-head {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 24px;
  align-items: baseline;
  padding-bottom: 32px;
  border-bottom: 1px solid currentColor;
  margin-bottom: clamp(40px, 5vw, 80px);
  border-bottom-color: var(--rule);
}

.section--teal .section-head { border-bottom-color: color-mix(in oklab, var(--bone) 24%, transparent); }
.section--ink .section-head  { border-bottom-color: color-mix(in oklab, var(--bone) 24%, transparent); }

.section-head .num {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: currentColor;
  opacity: 0.55;
}

.section-head .label {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: currentColor;
  opacity: 0.7;
}

.card {
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 0;
  padding: 24px;
}

.tag {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--persimmon);
  outline-offset: 2px;
}

@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

.caret {
  display: inline-block;
  width: 0.5ch;
  background: currentColor;
  animation: blink 1s steps(2) infinite;
  margin-left: 2px;
  vertical-align: -0.05em;
  height: 1em;
}

@keyframes blink {
  50% { opacity: 0; }
}

.wave {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 16px;
}
.wave i {
  display: block;
  width: 2px;
  background: currentColor;
  height: 30%;
  animation: wave 1.2s ease-in-out infinite;
}
.wave i:nth-child(1) { animation-delay: 0s; }
.wave i:nth-child(2) { animation-delay: 0.12s; }
.wave i:nth-child(3) { animation-delay: 0.24s; }
.wave i:nth-child(4) { animation-delay: 0.36s; }
.wave i:nth-child(5) { animation-delay: 0.48s; }
.wave i:nth-child(6) { animation-delay: 0.6s; }
.wave i:nth-child(7) { animation-delay: 0.72s; }

@keyframes wave {
  0%, 100% { height: 25%; }
  50% { height: 95%; }
}

/* ─── Nav ───────────────────────────────────────── */

.nav {
  position: sticky;
  top: 0;
  z-index: 60;
  backdrop-filter: blur(12px);
  background: color-mix(in oklab, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--ink);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px var(--gutter);
  max-width: var(--max);
  margin: 0 auto;
}

.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.025em;
}

.nav-brand .glyph {
  width: 28px; height: 28px;
  background: var(--persimmon);
  color: var(--ink);
  border-radius: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  transform: rotate(-6deg);
}

.nav-links {
  display: flex;
  gap: 28px;
  font-size: 14px;
  font-weight: 500;
}

.nav-links a {
  color: var(--ink-2);
  position: relative;
  padding: 4px 0;
}

.nav-links a:hover { color: var(--ink); }
.nav-links a.active { color: var(--ink); }
.nav-links a.active::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  bottom: -2px;
  height: 2px;
  background: var(--persimmon);
}

@media (max-width: 760px) {
  .nav-links { display: none; }
}

/* ─── Footer ────────────────────────────────────── */

.foot {
  background: var(--ink);
  color: var(--bone);
  padding: clamp(48px, 6vw, 96px) var(--gutter);
  margin-top: 0;
}

.foot-inner { max-width: var(--max); margin: 0 auto; }
.foot a { color: var(--bone); }
.foot a:hover { color: var(--persimmon); }

.foot-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 48px;
  padding-bottom: 64px;
  border-bottom: 1px solid color-mix(in oklab, var(--bone) 20%, transparent);
}

.foot-col h5 {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: color-mix(in oklab, var(--bone) 50%, transparent);
  margin: 0 0 16px 0;
  font-weight: 500;
}

.foot-col ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; font-size: 14px; }

.foot-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 24px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: color-mix(in oklab, var(--bone) 60%, transparent);
}

@media (max-width: 760px) {
  .foot-grid { grid-template-columns: 1fr 1fr; }
  .foot-bottom { flex-direction: column; gap: 12px; align-items: flex-start; }
}

/* ─── Prose page ────────────────────────────────── */

.prose-page { padding: clamp(56px, 7vw, 120px) 0 0 0; }

.page-hero {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 32px;
  align-items: end;
  border-bottom: 1px solid var(--ink);
  padding-bottom: clamp(40px, 5vw, 72px);
}

.page-hero .num {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--ink-mute);
  align-self: start;
  padding-top: 12px;
}

@media (max-width: 760px) {
  .page-hero, .section-head { grid-template-columns: 32px 1fr; gap: 16px; }
}

/* ─── Big stencil heading utility ──────────────── */
.stencil {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 0.82;
  font-variation-settings: "wdth" 100, "opsz" 96;
}

/* ─────────────────────────────────────────────────
   MOBILE / RESPONSIVE — comprehensive small-screen pass
   ───────────────────────────────────────────────── */

@media (max-width: 980px) {
  /* Section heads — give the title more breathing room */
  .section-head,
  .page-hero {
    grid-template-columns: 40px 1fr !important;
    gap: 16px !important;
  }
  .section-head .num,
  .page-hero .num {
    font-size: 11px !important;
  }

  /* Services accordion — stack the row */
  ol > li > button {
    grid-template-columns: 32px 1fr 32px !important;
    gap: 12px !important;
    padding: 20px 18px !important;
  }
  /* Hide tags column on mobile (third grid column) */
  ol > li > button > div[style*="justify-content: flex-end"] {
    display: none !important;
  }

  /* Services expanded panel — stack copy + artifact */
  ol > li > div > div {
    grid-template-columns: 32px 1fr !important;
    gap: 14px !important;
  }
  ol > li > div > div > div > p {
    margin-bottom: 16px;
  }
  /* Artifact view takes full width */
  ol > li > div > div > div + div {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  :root {
    --gutter: 20px;
  }

  /* Body type bumps down slightly */
  html, body { font-size: 16px; }

  /* Nav: ensure right-side button doesn't push brand off-screen */
  .nav-inner { gap: 8px; }
  .nav-brand { font-size: 18px; }
  .nav-brand > span:last-child { display: none; } /* hide /sf · v26 tag */
  .nav-brand .glyph { width: 24px; height: 24px; }

  /* Nav CTA shrinks */
  .nav-inner > a.btn {
    padding: 8px 12px !important;
    font-size: 12px !important;
  }

  /* Section padding scales down */
  .section {
    padding-top: clamp(48px, 10vw, 80px);
    padding-bottom: clamp(48px, 10vw, 80px);
  }

  /* Display headings get tighter on mobile */
  .display-xxl { font-size: clamp(40px, 11vw, 64px); line-height: 0.95; }
  .display-xl  { font-size: clamp(36px, 9vw, 56px);  line-height: 0.98; }
  .display-l   { font-size: clamp(28px, 7vw, 44px);  line-height: 1.02; }

  /* Hero grid stacks (already at 980), tighten gap */
  .hero-grid { gap: 32px !important; }

  /* Section head — pull the rule tighter */
  .section-head,
  .page-hero {
    grid-template-columns: 28px 1fr !important;
    gap: 12px !important;
    padding-bottom: 20px !important;
    margin-bottom: 32px !important;
  }
  .section-head .label,
  .section-head .num {
    font-size: 10px !important;
  }

  /* Footer collapses fully */
  .foot-grid { grid-template-columns: 1fr !important; gap: 32px !important; }
  .foot { padding-left: 20px; padding-right: 20px; }
  .foot-col h5 { margin-bottom: 12px !important; }

  /* Buttons in flex rows — let them wrap and shrink */
  .btn {
    padding: 12px 18px;
    font-size: 13px;
  }

  /* Pill row in hero — let it stack */
  .hero-grid + * { gap: 12px !important; }

  /* Cards / lists generic gap normalization */
  .gap-6 { gap: 24px; }
  .gap-4 { gap: 20px; }

  /* Pricing configurator presets — wrap nicely */
  .cfg-preset {
    font-size: 11px !important;
    padding: 7px 10px !important;
  }
}

@media (max-width: 600px) {
  /* Very small phones — kill remaining horizontal pressure */
  :root {
    --gutter: 16px;
  }

  /* Hero IrisPanel — kill the persimmon offset shadow on small screens */
  .hero-demo > div[style*="box-shadow"] {
    box-shadow: none !important;
  }

  /* Headline scale */
  .display-xxl { font-size: clamp(34px, 10vw, 48px); }
  .display-xl  { font-size: clamp(30px, 9vw, 44px); }

  /* Nav: hide the "Book intro" CTA to keep header clean */
  .nav-inner > a.btn { padding: 6px 10px !important; font-size: 11px !important; }

  /* Section padding tighter */
  .section { padding-top: 56px; padding-bottom: 56px; }
  .section--tight { padding-top: 40px; padding-bottom: 40px; }

  /* Services row — even tighter */
  ol > li > button {
    grid-template-columns: 24px 1fr 28px !important;
    gap: 10px !important;
    padding: 16px 14px !important;
  }
  ol > li > button h3 {
    font-size: 18px !important;
    line-height: 1.15 !important;
  }
  ol > li > button > span:first-child {
    font-size: 11px !important;
  }
  /* Expanded artifact view — keep but smaller */
  ol > li > div > div {
    padding: 0 14px 18px 14px !important;
  }
  ol > li > div > div > div + div pre {
    font-size: 10px !important;
    padding: 14px 12px !important;
  }

  /* Footer-bottom: stack the meta line */
  .foot-bottom { flex-direction: column; align-items: flex-start; gap: 12px; }

  /* Lead text margins */
  .lead { font-size: 16px; line-height: 1.45; }

  /* Cmd-K palette uses full width on tiny phones already (we set in component) */
}

/* ─── Horizontal-scroll safety — wrap wide code blocks ─── */
@media (max-width: 760px) {
  pre {
    font-size: 11px !important;
    overflow-x: auto !important;
    white-space: pre !important;
  }
  pre > div {
    white-space: pre !important;
  }
}

/* ─── Never let any container exceed viewport ─── */
img, svg, video, iframe { max-width: 100%; }
@media (max-width: 760px) {
  iframe.gcal-frame, iframe.calendar-embed { min-height: 540px; }

  /* Hero sub-stats: 3 columns crushes copy on phones — let them stack as 1 col w/ horizontal rule */
  .hero-stats { grid-template-columns: 1fr !important; gap: 12px !important; }
  .hero-stats > div { padding: 12px 0; border-bottom: 1px solid var(--rule); }
  .hero-stats > div:last-child { border-bottom: none; }

  /* Currently-shipping terminal: horizontal scroll on very narrow */
  #now pre, #now div[style*="font-family"] { font-size: 11px !important; }
  #now div[style*="overflow:hidden"], #now > div > div > div[style*="background:#1a1d22"] {
    overflow-x: auto !important;
  }

  /* Studio Shelf tabs: allow horizontal scroll if they overflow */
  #shelf > div > div[style*="border-bottom: 1px solid"] {
    overflow-x: auto;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch;
  }
  #shelf > div > div[style*="border-bottom: 1px solid"] button {
    flex-shrink: 0;
    font-size: 10px !important;
    padding: 12px 16px !important;
  }

  /* Voice A/B: tighten panel padding on phones */
  .ab-grid > article { padding: 22px !important; min-height: 0 !important; }

  /* Compared cards: tighten padding */
  .cmp-grid > article { padding: 24px !important; min-height: 0 !important; }

  /* Process cards: tighten */
  .process-grid > article { padding: 26px 22px !important; min-height: 0 !important; }

  /* Configurator: stack the two columns earlier already (980); tighten inner padding */
  .cfg-grid > div { padding: 22px !important; }
  #cfg-total { font-size: clamp(40px, 12vw, 64px) !important; }

  /* Pricing presets row scrolls horizontally if needed */
  #configurator div[style*="margin-top:28px"] {
    overflow-x: auto;
    flex-wrap: nowrap !important;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }
  #configurator .cfg-preset { flex-shrink: 0; }

  /* Discovery wizard step buttons can scroll */
  #discovery > div > div[role="tablist"],
  #discovery > div > div[style*="display: flex"][style*="border: 1px solid"] {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}
