/* Nairobi — responsive layout (mobile ≤640px, tablet 641–900px, desktop 901px+) */

html {
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  overflow-x: hidden;
  max-width: 100%;
}

img,
svg,
video,
image-slot {
  max-width: 100%;
}

/* ── Site nav ─────────────────────────────────────────────────────────── */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-nav__bar {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.site-nav__start {
  display: flex;
  align-items: center;
  gap: 40px;
  min-width: 0;
}

.site-nav__links {
  display: flex;
  gap: 26px;
  font-size: 14.5px;
  color: #56554f;
  letter-spacing: -0.01em;
}

.site-nav__links a,
.site-nav__links span {
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}

.site-nav__end {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-shrink: 0;
}

.site-nav__toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid #e2e0da;
  border-radius: 10px;
  background: #fff;
  color: #14140f;
  cursor: pointer;
  flex-shrink: 0;
}

.site-nav__toggle-icon {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  position: relative;
  border-radius: 1px;
}

.site-nav__toggle-icon::before,
.site-nav__toggle-icon::after {
  content: "";
  position: absolute;
  left: 0;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transition: transform 0.2s ease, top 0.2s ease;
}

.site-nav__toggle-icon::before {
  top: -6px;
}

.site-nav__toggle-icon::after {
  top: 6px;
}

.site-nav.is-open .site-nav__toggle-icon {
  background: transparent;
}

.site-nav.is-open .site-nav__toggle-icon::before {
  top: 0;
  transform: rotate(45deg);
}

.site-nav.is-open .site-nav__toggle-icon::after {
  top: 0;
  transform: rotate(-45deg);
}

.site-nav__panel {
  display: none;
  border-top: 1px solid #efede8;
  background: rgba(255, 255, 255, 0.98);
  padding: 12px 20px 20px;
}

.site-nav.is-open .site-nav__panel {
  display: block;
}

.site-nav__panel-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.site-nav__panel-links a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #36352f;
  text-decoration: none;
  font-size: 16px;
  font-weight: 500;
}

.site-nav__panel-links a:hover,
.site-nav__panel-links a:focus {
  background: #f6f5f1;
}

.site-nav__panel-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  margin-top: 12px;
  padding: 14px 20px;
  border-radius: 10px;
  background: #14140f;
  color: #fff !important;
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
}

@media (max-width: 900px) {
  /* Hide desktop nav links/actions by structure — survives DC React re-renders */
  #dc-root nav > .site-nav__bar > .site-nav__start > .site-nav__links,
  #dc-root nav > div > div:first-child > div:last-child:not(:only-child),
  #dc-root nav > .site-nav__bar > .site-nav__end,
  #dc-root nav > div > div:nth-child(2):not(.site-nav__panel):not(.site-nav__toggle),
  .site-nav__links,
  .site-nav__end {
    display: none !important;
  }

  #dc-root nav > .site-nav__bar,
  #dc-root nav > div:first-child {
    justify-content: space-between;
    align-items: center;
  }

  #dc-root nav .site-nav__toggle,
  header.site-nav .site-nav__toggle {
    display: inline-flex !important;
  }

  .site-nav__start {
    flex: 1;
    min-width: 0;
  }

  .site-nav__bar {
    gap: 12px;
  }
}

@media (min-width: 901px) {
  .site-nav__panel,
  .site-nav__toggle {
    display: none !important;
  }
}

/* ── Marketing page shell ─────────────────────────────────────────────── */

[data-screen-label="Page"] {
  overflow-x: hidden;
  max-width: 100%;
}

[data-screen-label="Page"] section {
  max-width: 100%;
}

/* ── Tablet ─────────────────────────────────────────────────────────── */

@media (min-width: 641px) and (max-width: 900px) {
  [data-screen-label="Page"] div[style*="grid-template-columns:repeat(3,1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  [data-screen-label="Page"] div[style*="grid-template-columns:repeat(4,1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  [data-screen-label="Page"] section[style*="padding:96px"],
  [data-screen-label="Page"] section[style*="padding:104px"],
  [data-screen-label="Page"] section[style*="padding:108px"] {
    padding-top: 64px !important;
    padding-bottom: 64px !important;
  }

  [data-screen-label="Hero"] h1,
  [data-screen-label="Page"] h1[style*="font-size:64px"],
  [data-screen-label="Page"] h1[style*="font-size:66px"],
  [data-screen-label="Page"] h1[style*="font-size:74px"] {
    font-size: clamp(2.25rem, 6vw, 3.5rem) !important;
  }

  [data-screen-label="Page"] h2[style*="font-size:50px"],
  [data-screen-label="Page"] h2[style*="font-size:52px"],
  [data-screen-label="Page"] h2[style*="font-size:42px"] {
    font-size: clamp(1.75rem, 4.5vw, 2.5rem) !important;
  }
}

/* ── Mobile ─────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  /* Nav bar padding */
  .site-nav__bar {
    padding: 0 16px;
    min-height: 56px;
  }

  /* Section padding */
  [data-screen-label="Page"] section {
    padding-left: 20px !important;
    padding-right: 20px !important;
  }

  [data-screen-label="Hero"] {
    padding-top: 48px !important;
    padding-bottom: 32px !important;
  }

  [data-screen-label="Page"] section[style*="padding:88px"],
  [data-screen-label="Page"] section[style*="padding:96px"],
  [data-screen-label="Page"] section[style*="padding:104px"],
  [data-screen-label="Page"] section[style*="padding:108px"] {
    padding-top: 48px !important;
    padding-bottom: 48px !important;
  }

  [data-screen-label="CTA"] {
    padding-top: 32px !important;
    padding-bottom: 64px !important;
  }

  /* Typography */
  [data-screen-label="Hero"] h1,
  [data-screen-label="Page"] h1 {
    font-size: clamp(2rem, 9vw, 2.75rem) !important;
    line-height: 1.08 !important;
    letter-spacing: -0.025em !important;
  }

  #rotWord {
    white-space: normal !important;
  }

  [data-screen-label="Page"] h2 {
    font-size: clamp(1.5rem, 6.5vw, 2rem) !important;
    line-height: 1.12 !important;
  }

  [data-screen-label="Page"] h3[style*="font-size:34px"],
  [data-screen-label="Page"] h3[style*="font-size:40px"] {
    font-size: clamp(1.35rem, 5.5vw, 1.75rem) !important;
  }

  [data-screen-label="Page"] div[style*="font-size:20px"],
  [data-screen-label="Page"] div[style*="font-size:19px"],
  [data-screen-label="Page"] div[style*="font-size:18px"] {
    font-size: 17px !important;
  }

  [data-screen-label="Page"] div[style*="font-size:34px"][style*="font-weight:500"] {
    font-size: clamp(1.25rem, 5vw, 1.5rem) !important;
  }

  [data-screen-label="Page"] div[style*="font-size:54px"],
  [data-screen-label="Page"] div[style*="font-size:40px"][style*="font-weight:600"] {
    font-size: clamp(2rem, 8vw, 2.5rem) !important;
  }

  /* Grids → single column (icon grids overridden below) */
  [data-screen-label="Page"] section div[style*="display:grid"][style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  /* Product mockup: hide sidebar on mobile */
  [data-screen-label="Page"] div[style*="grid-template-columns:236px"] > div:first-child {
    display: none !important;
  }

  [data-screen-label="Page"] div[style*="grid-template-columns:236px"] {
    min-height: auto !important;
  }

  /* Comparison mockup: stack columns */
  [data-screen-label="Page"] div[style*="grid-template-columns:1fr 1fr"][style*="border-bottom"] {
    grid-template-columns: 1fr !important;
  }

  /* Reorder two-column feature sections (mockup below text) */
  [data-screen-label="Page"] div[style*="grid-template-columns:1fr 1.05fr"],
  [data-screen-label="Page"] div[style*="grid-template-columns:1.05fr 1fr"] {
    gap: 32px !important;
  }

  [data-screen-label="Page"] div[style*="order:0"] {
    order: 0 !important;
  }

  [data-screen-label="Page"] div[style*="order:1"] {
    order: 1 !important;
  }

  /* Inner section padding in cards/mockups */
  [data-screen-label="Page"] div[style*="padding:56px"] {
    padding: 28px 20px !important;
  }

  [data-screen-label="Page"] div[style*="padding:64px"] {
    padding: 32px 20px !important;
  }

  /* Tab buttons */
  [data-screen-label="Capabilities"] > div[style*="justify-content:center"] {
    justify-content: flex-start !important;
    overflow-x: auto;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
    margin-left: -4px;
    margin-right: -4px;
  }

  [data-screen-label="Capabilities"] button {
    flex-shrink: 0;
  }

  /* Icon / logo grids: 2 columns on small screens */
  [data-screen-label="Integrations"] div[style*="repeat(3,1fr)"],
  [data-screen-label="Creation"] div[style*="repeat(3,1fr)"],
  [data-screen-label="Hero"] div[style*="repeat(3,1fr)"],
  [data-screen-label="Workflow"] div[style*="repeat(4,1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* CTA button rows */
  [data-screen-label="CTA"] div[style*="display:flex"][style*="gap:14px"],
  [data-screen-label="Page"] section[style*="text-align:center"] div[style*="display:flex"][style*="gap:14px"] {
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100%;
  }

  [data-screen-label="Hero"] a[style*="border-radius:10px"],
  [data-screen-label="CTA"] a[style*="border-radius:10px"],
  [data-screen-label="CTA"] a[style*="border-radius:9px"],
  [data-screen-label="Page"] section[style*="text-align:center"] a[style*="border-radius:10px"] {
    min-height: 44px !important;
    justify-content: center !important;
    width: 100% !important;
    box-sizing: border-box;
  }

  /* Footer */
  [data-screen-label="Page"] footer {
    padding: 48px 20px 32px !important;
  }

  [data-screen-label="Page"] footer div[style*="padding-top:28px"] {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 16px !important;
  }

  /* Image slots */
  image-slot[style*="height:420px"],
  image-slot[style*="height:440px"],
  image-slot[style*="height:460px"],
  image-slot[style*="height:380px"] {
    height: min(52vw, 280px) !important;
    min-height: 200px !important;
  }

  image-slot[style*="position:absolute"] {
    min-height: 280px !important;
  }

  [data-screen-label="Moment"] {
    min-height: 320px !important;
  }

  /* Mockup fixed heights */
  [data-screen-label="Page"] div[style*="height:400px"] {
    height: auto !important;
    min-height: 280px !important;
  }

  /* Submission table: card layout */
  [data-screen-label="Submissions"] div[style*="text-transform:uppercase"] {
    display: none !important;
  }

  [data-screen-label="Submissions"] div[style*="grid-template-columns:2fr"] {
    gap: 8px !important;
    padding: 16px 20px !important;
    border-bottom: 1px solid #f4f2ec !important;
  }

  [data-screen-label="Submissions"] div[style*="grid-template-columns:2fr"] > span,
  [data-screen-label="Submissions"] div[style*="grid-template-columns:2fr"] > div {
    justify-self: start !important;
  }

  /* Pricing cards */
  [data-screen-label="Plans"] > div {
    gap: 16px !important;
  }

  /* Dark app promo block */
  [data-screen-label="App"] > div {
    gap: 32px !important;
  }

  /* Stats section */
  [data-screen-label="Stats"] {
    padding-top: 56px !important;
    padding-bottom: 56px !important;
  }

  /* Logo marquee */
  [data-screen-label="Logos"] {
    padding-bottom: 40px !important;
  }

  /* Window chrome URL bar */
  [data-screen-label="Page"] div[style*="nairobi.ai / workspace"] {
    font-size: 10px !important;
    padding: 4px 10px !important;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* ── Legal pages ──────────────────────────────────────────────────────── */

body.legal-page main {
  padding: 40px 20px 72px;
}

body.legal-page h1 {
  font-size: clamp(1.75rem, 6vw, 2.5rem);
}

body.legal-page h2 {
  font-size: clamp(1.1rem, 4vw, 1.25rem);
}

body.legal-page p,
body.legal-page li {
  font-size: 16px;
}

body.legal-page footer {
  padding: 32px 20px;
}

body.legal-page footer .inner {
  flex-direction: column;
  align-items: flex-start;
  gap: 20px;
}

body.legal-page footer .legal-links {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

body.legal-page footer .legal-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 4px 0;
  font-size: 15px;
}

@media (max-width: 640px) {
  body.legal-page .nav {
    padding: 14px 16px;
  }
}
