/* ──────────────────────────────────────────────────────────────────
   NatorOS · responsive overrides
   ──────────────────────────────────────────────────────────────────
   The site is built with inline styles inside React components, so
   instead of rewriting every component we use CSS attribute selectors
   like  [style*="grid-template-columns: 1fr 1fr 1fr"]  to find inline
   patterns and override them with !important at narrow viewports.

   This file is loaded by every HTML entry point AS A REGULAR <link>,
   so it applies BEFORE React mounts. It also keeps the FOUC styled.
   ────────────────────────────────────────────────────────────────── */

/* Always-on: never let the page horizontal-scroll.
   Use `clip` instead of `hidden` — `hidden` implicitly forces overflow-y:auto
   which creates a scroll container and breaks `position: sticky` on descendants
   (the sticky nav sticks to body instead of viewport). `clip` clips without
   establishing a scroll context. Safari 16+, all modern browsers. */
html, body { overflow-x: clip; max-width: 100%; }
img, svg, video { max-width: 100%; }

/* Hide the pre-hydration SEO/crawler fallback that lives inside #root.
   It exists for non-rendering crawlers (LLM scrapers, OG generators)
   that parse raw HTML — they still see it in the response. React
   replaces #root entirely when it mounts, so this rule only matters
   for the brief paint between HTML parse and React hydration. The
   inline <style> block in each page's <head> also carries this rule
   so it applies even if responsive.css hasn't finished loading. */
#root > main { display: none; }

/* (Mobile nav hiding moved inside @media (max-width: 720px) below so the
   desktop layout is never affected by the mobile-menu.js attribute.) */

/* ╭──────────────────────────────────────────────────────────────────╮
   │  TABLET — 1024px and below                                       │
   ╰──────────────────────────────────────────────────────────────────╯ */
@media (max-width: 1024px) {
  /* Reduce horizontal padding on every section from 60px → 32px */
  .nat-page > header[style*="padding: 26px 60px"],
  .nat-page > section[style*="60px"]:not([style*="80px"]) {
    padding-left: 32px !important;
    padding-right: 32px !important;
  }

  /* Hero h1 96 → 72 */
  .nat-page h1[style*="font-size: 96"] { font-size: 72px !important; }

  /* Section h2 120 → 88 */
  .nat-page h2[style*="font-size: 120"] { font-size: 88px !important; }
  .nat-page h2[style*="font-size: 56"]  { font-size: 44px !important; }
  .nat-page h2[style*="font-size: 52"]  { font-size: 42px !important; }

  /* Product mock 3-col → stack right rail under main */
  .nat-page [style*="grid-template-columns: 220px 1fr 320px"] {
    grid-template-columns: 200px 1fr !important;
  }
  .nat-page [style*="grid-template-columns: 220px 1fr 320px"] > div:last-child {
    grid-column: 1 / -1 !important;
    border-left: none !important;
    border-top: 1px solid rgba(17,17,17,0.1) !important;
  }
}

/* ╭──────────────────────────────────────────────────────────────────╮
   │  MOBILE — 720px and below                                        │
   ╰──────────────────────────────────────────────────────────────────╯ */
@media (max-width: 720px) {

  /* ─── NAV ───────────────────────────────────────────────────── */
  .nat-page > header[style*="grid-template-columns: 1fr auto 1fr"],
  .nat-page > header[style*="grid-template-columns: 1fr auto 1fr"][style*="padding: 26px 60px"] {
    grid-template-columns: 1fr auto !important;
    padding: 16px 20px !important;
    gap: 12px;
  }
  /* Hide centered desktop links */
  .nat-page > header > nav { display: none !important; }
  /* Hide sign-in + theme toggle in the cramped row — they live in the
     mobile menu sheet instead. Keep the "Book a demo" CTA visible. */
  .nat-page > header > div:last-child > a[href*="nator.tars"],
  .nat-page > header > div:last-child > button[aria-label*="mode"] {
    display: none !important;
  }
  .nat-page > header > div:last-child {
    gap: 8px !important;
  }
  /* Shrink the CTA button on mobile so the nav row stays one line */
  .nat-page > header > div:last-child > a[style*="padding: 12px 20px"] {
    padding: 10px 14px !important;
    font-size: 13px !important;
  }

  /* ─── SECTIONS — pad everything tighter ─────────────────────── */
  .nat-page > section {
    padding-left: 20px !important;
    padding-right: 20px !important;
  }
  .nat-page > section[style*="padding: 120px 60px 80px"]  { padding: 64px 20px 48px !important; }
  .nat-page > section[style*="padding: 100px 60px 80px"]  { padding: 56px 20px 44px !important; }
  .nat-page > section[style*="padding: 100px 60px"]       { padding: 56px 20px !important; }
  .nat-page > section[style*="padding: 70px 60px"]        { padding: 36px 20px !important; }
  .nat-page > section[style*="padding: 70px 60px 40px"]   { padding: 32px 20px 24px !important; }
  .nat-page > section[style*="padding: 80px 60px"]        { padding: 48px 20px !important; }

  /* ─── TYPE — clamp the giant display sizes ──────────────────── */
  .nat-page h1[style*="font-size: 96"]   { font-size: 44px !important; letter-spacing: -0.025em !important; }
  .nat-page h1[style*="font-size: 88"]   { font-size: 40px !important; }
  .nat-page h2[style*="font-size: 120"]  { font-size: 48px !important; line-height: 1.02 !important; }
  .nat-page h2[style*="font-size: 96"]   { font-size: 44px !important; }
  .nat-page h2[style*="font-size: 64"]   { font-size: 36px !important; }
  .nat-page h2[style*="font-size: 56"]   { font-size: 32px !important; }
  .nat-page h2[style*="font-size: 52"]   { font-size: 32px !important; }
  .nat-page h2[style*="font-size: 44"]   { font-size: 30px !important; }
  .nat-page h3[style*="font-size: 32"]   { font-size: 24px !important; }
  .nat-page h3[style*="font-size: 28"]   { font-size: 22px !important; }
  .nat-page [style*="font-size: 26"][style*="Crimson Pro"] { font-size: 20px !important; }

  /* Hero lede paragraph 20 → 16 */
  .nat-page p[style*="font-size: 20"]  { font-size: 16px !important; line-height: 1.5 !important; }
  .nat-page p[style*="font-size: 18"]  { font-size: 15px !important; }

  /* Hero pill margin */
  .nat-page [style*="marginBottom: 28"] { margin-bottom: 18px !important; }

  /* ─── GRIDS — stack to one column ───────────────────────────── */
  /* "How it works" 3-col, spotlights, integrations, etc. */
  .nat-page [style*="grid-template-columns: 1fr 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  /* FAQ 2-col + gap 80 */
  .nat-page [style*="grid-template-columns: 1fr 1.6fr"],
  .nat-page [style*="grid-template-columns: 1.6fr 1fr"],
  .nat-page [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 28px !important;
  }
  /* Generic 2-col patterns */
  .nat-page [style*="grid-template-columns: 1.2fr 1fr"],
  .nat-page [style*="grid-template-columns: 1.4fr 1fr"],
  .nat-page [style*="grid-template-columns: 1.1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* ─── PRODUCT MOCK ─ stack vertically ──────────────────────── */
  .nat-page [style*="grid-template-columns: 220px 1fr 320px"] {
    grid-template-columns: 1fr !important;
  }
  .nat-page [style*="grid-template-columns: 220px 1fr 320px"] > div {
    border-right: none !important;
    border-left: none !important;
    border-bottom: 1px solid rgba(17,17,17,0.1) !important;
  }
  .nat-page [style*="grid-template-columns: 220px 1fr 320px"] > div:last-child {
    border-bottom: none !important;
  }
  /* Metric strip inside mock — keep 3-col but make it scroll on tiny */
  .nat-page [style*="grid-template-columns: 1fr 1fr 1fr"][style*="marginBottom: 22"] {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 6px !important;
  }
  /* The feed rows: 1fr 1fr 140px → stack each label */
  .nat-page [style*="grid-template-columns: 1fr 1fr 140px"] {
    grid-template-columns: 1fr !important;
    gap: 4px !important;
  }
  .nat-page [style*="grid-template-columns: 1fr 1fr 140px"] > span:last-child {
    text-align: left !important;
  }

  /* ─── FLEX rows that should wrap or stack on mobile ────────── */
  /* Footer CTA "row" (justify-between with 2 columns) */
  .nat-page [style*="justify-content: space-between"][style*="align-items: end"][style*="flex-wrap: wrap"] {
    flex-direction: column !important;
    align-items: flex-start !important;
  }
  /* "Ask an AI" row */
  .nat-page [style*="justify-content: space-between"][style*="flex-wrap: wrap"][style*="border-top"] {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px !important;
  }

  /* ─── BUTTONS — full-width hero CTA group ──────────────────── */
  .nat-page section > div[style*="display: flex"][style*="gap: 12"][style*="justify-content: center"] {
    flex-direction: column !important;
    width: 100%;
    align-items: stretch !important;
  }
  .nat-page section > div[style*="display: flex"][style*="gap: 12"][style*="justify-content: center"] > * {
    justify-content: center !important;
    width: 100%;
  }

  /* ─── DS pages: the design-system layouts ──────────────────── */
  .ds-page {
    padding: 32px 20px 48px !important;
  }
  .ds-page .head-grid,
  .ds-page .hero,
  .ds-page .blocks,
  .ds-page .grid-2,
  .ds-page .pair,
  .ds-page .proof {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
  }
  .ds-page .principles,
  .ds-page .micro-row,
  .ds-page .radii,
  .ds-page .swatch-row,
  .ds-page .status-grid,
  .ds-page .avatar-row,
  .ds-page .bp,
  .ds-page .spectrum,
  .ds-page .stat-strip {
    grid-template-columns: 1fr 1fr !important;
  }
  .ds-page .chapter-grid {
    grid-template-columns: 1fr !important;
  }
  .ds-page .chapter.lead,
  .ds-page .chapter[style*="grid-column: span 2"] {
    grid-column: span 1 !important;
    grid-row: auto !important;
  }
  .ds-page h1 { font-size: 44px !important; line-height: 1.05 !important; }
  .ds-page .cover h1 { font-size: 56px !important; }
  .ds-page .ds-title { font-size: 36px !important; }
  .ds-page .ds-meta-row {
    flex-wrap: wrap !important;
    gap: 8px 16px !important;
  }
  .ds-page .principle,
  .ds-page .bp-cell,
  .ds-page .stat {
    padding: 18px 16px !important;
  }
  .ds-page .quote,
  .ds-page .north {
    grid-template-columns: 1fr !important;
    padding: 24px !important;
    gap: 16px !important;
  }
  .ds-page .quote p,
  .ds-page .north p {
    font-size: 20px !important;
  }
  .ds-page .quote .ribbon,
  .ds-page .north .ribbon {
    writing-mode: horizontal-tb !important;
    transform: none !important;
  }
  .ds-page .foot {
    grid-template-columns: 1fr 1fr !important;
    gap: 20px !important;
  }
  .ds-page .foot .colo-row {
    grid-column: span 2 !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
  }
}

/* ╭──────────────────────────────────────────────────────────────────╮
   │  Pre-React shell (loading skeleton)                              │
   │  Renders inside #root before React mounts, then React replaces.  │
   ╰──────────────────────────────────────────────────────────────────╯ */
.nat-shell {
  min-height: 100vh;
  background: #F9F8F6;
  color: #111;
  font-family: 'Geist', 'Inter Tight', -apple-system, system-ui, sans-serif;
  display: flex;
  flex-direction: column;
}
.nat-shell-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 26px 60px;
  border-bottom: 1px solid rgba(17,17,17,0.10);
  gap: 16px;
}
.nat-shell-logo {
  display: flex; align-items: center; gap: 10px;
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 22px; letter-spacing: -0.02em;
  color: #111;
  text-decoration: none;
  flex-shrink: 0;
}
.nat-shell-logo .mark {
  width: 22px; height: 22px; border-radius: 6px;
  background: #111; color: #fff;
  display: grid; place-items: center;
  font-family: 'Geist', sans-serif;
  font-size: 13px; font-weight: 600;
}
.nat-shell-cta {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 20px; border-radius: 999px;
  background: #111; color: #fff;
  font-size: 14.5px; font-weight: 500;
  text-decoration: none;
}
.nat-shell-hero {
  padding: 70px 60px 40px;
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
}
.nat-shell-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px;
  border: 1px solid rgba(17,17,17,0.10);
  background: rgba(17,17,17,0.035);
  font-size: 13px; color: rgba(17,17,17,0.58);
  margin-bottom: 28px;
}
.nat-shell-pill .dot {
  width: 7px; height: 7px; border-radius: 999px;
  background: #15803d;
}
.nat-shell-h1 {
  font-family: 'Crimson Pro', Georgia, serif;
  font-weight: 400; font-size: 96px;
  line-height: 1.0; letter-spacing: -0.035em;
  margin: 0; max-width: 1100px;
  text-wrap: balance;
}
.nat-shell-h1 em {
  font-style: italic; color: #111; font-weight: 400;
}
.nat-shell-lede {
  max-width: 660px;
  font-size: 20px; line-height: 1.45;
  color: rgba(17,17,17,0.58);
  margin: 32px 0 36px;
  text-wrap: pretty;
}
@media (max-width: 1024px) {
  .nat-shell-nav { padding: 20px 32px; }
  .nat-shell-hero { padding: 48px 32px 32px; }
  .nat-shell-h1 { font-size: 72px; }
}
@media (max-width: 720px) {
  .nat-shell-nav { padding: 16px 20px; }
  .nat-shell-hero { padding: 36px 20px 24px; }
  .nat-shell-h1 { font-size: 44px; }
  .nat-shell-lede { font-size: 16px; margin: 22px 0 24px; }
  .nat-shell-cta { padding: 10px 14px; font-size: 13px; }
  .nat-shell-pill { margin-bottom: 18px; }
}

/* ╭──────────────────────────────────────────────────────────────────╮
   │  Mobile menu — injected by parts/mobile-menu.js                  │
   ╰──────────────────────────────────────────────────────────────────╯ */
.nat-burger {
  display: none;
  width: 40px; height: 40px;
  border: 1px solid rgba(17,17,17,0.10);
  border-radius: 999px;
  background: transparent;
  color: #111;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
}
html[data-nat-theme="dark"] .nat-burger {
  border-color: rgba(241,239,233,0.12);
  color: #F1EFE9;
}
.nat-burger svg { display: block; }
@media (max-width: 720px) {
  .nat-burger { display: inline-flex; }
}

.nat-sheet {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(17,17,17,0.20);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}
.nat-sheet.is-open {
  opacity: 1;
  pointer-events: auto;
}
.nat-sheet-panel {
  position: absolute;
  top: 0; left: 0; right: 0;
  background: #F9F8F6;
  color: #111;
  padding: 20px 24px 40px;
  transform: translateY(-100%);
  transition: transform 280ms cubic-bezier(0.2, 0.7, 0.3, 1);
  box-shadow: 0 24px 60px rgba(35,25,20,0.18);
}
.nat-sheet.is-open .nat-sheet-panel {
  transform: translateY(0);
}
html[data-nat-theme="dark"] .nat-sheet-panel {
  background: #0E0E0D;
  color: #F1EFE9;
}
.nat-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(17,17,17,0.10);
  margin-bottom: 18px;
}
html[data-nat-theme="dark"] .nat-sheet-head {
  border-bottom-color: rgba(241,239,233,0.12);
}
.nat-sheet-head .lockup {
  display: flex; align-items: center; gap: 10px;
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 22px; letter-spacing: -0.02em;
}
.nat-sheet-head .lockup .mark {
  width: 22px; height: 22px; border-radius: 6px;
  background: #111; color: #fff;
  display: grid; place-items: center;
  font-family: 'Geist', sans-serif;
  font-size: 13px; font-weight: 600;
}
.nat-sheet-head .close {
  width: 36px; height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(17,17,17,0.10);
  background: transparent;
  color: inherit;
  cursor: pointer;
  display: grid; place-items: center;
}
html[data-nat-theme="dark"] .nat-sheet-head .close {
  border-color: rgba(241,239,233,0.12);
}
.nat-sheet-links {
  display: flex;
  flex-direction: column;
}
.nat-sheet-links a {
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 32px;
  letter-spacing: -0.02em;
  color: inherit;
  text-decoration: none;
  padding: 14px 0;
  border-bottom: 1px solid rgba(17,17,17,0.06);
}
html[data-nat-theme="dark"] .nat-sheet-links a {
  border-bottom-color: rgba(241,239,233,0.08);
}
.nat-sheet-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 24px;
}
.nat-sheet-actions a {
  display: flex; align-items: center; justify-content: center;
  padding: 14px 20px;
  border-radius: 999px;
  font-size: 15px; font-weight: 500;
  text-decoration: none;
}
.nat-sheet-actions a.primary {
  background: #111; color: #fff;
}
.nat-sheet-actions a.ghost {
  border: 1px solid rgba(17,17,17,0.10);
  color: inherit;
}
html[data-nat-theme="dark"] .nat-sheet-actions a.primary {
  background: #F1EFE9; color: #111;
}
html[data-nat-theme="dark"] .nat-sheet-actions a.ghost {
  border-color: rgba(241,239,233,0.12);
}
.nat-sheet-meta {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px dashed rgba(17,17,17,0.10);
  font-size: 12px;
  color: rgba(17,17,17,0.58);
  display: flex;
  justify-content: space-between;
}
html[data-nat-theme="dark"] .nat-sheet-meta {
  border-top-color: rgba(241,239,233,0.10);
  color: rgba(241,239,233,0.62);
}
body.nat-locked { overflow: hidden; }
