/* Sticky nav: the page runtime sets #dc-root and .sc-host to height:100%, which
   limits the sticky header's travel to one viewport. Let them grow with content. */
#dc-root, #dc-root > .sc-host { height: auto !important; min-height: 100%; }

/* Closing block hands straight to the footer: a shorter tail, then the footer's top rule marks the change. */
main > section.closing:last-child { padding-bottom: 72px; }

/* Babav — responsive rules.
   The design-system stylesheet is injected into <head> at runtime and can land
   after this file, so rules colliding with a DS selector of equal specificity
   carry !important. That is deliberate — load order is not something this file
   can rely on.
     <=720px   phone    — single column throughout
     721-1024  tablet   — two columns, burger nav active
     >1024     desktop  — design-system defaults, untouched
   Keep every rule here rather than in page <style> blocks: one edit, nine pages. */

/* ---------- Phone ---------- */
@media (max-width: 720px) {

  /* clip, not hidden: hidden on both html and body turns body into its own scroll
     container on some mobile browsers, so window.scrollTo (jump links) does nothing. */
  html, body { overflow-x: clip; }
  @supports not (overflow-x: clip) { body { overflow-x: hidden; } }

  /* Heading measures are set in `ch` for the desktop composition; on a phone
     the container is the measure, and text-wrap: balance finds even lines. */
  .hero-h1, .closing-h, .chap-title, .display, h1, h2 { max-width: none !important; text-wrap: balance; }

  /* inline style attributes, so !important is the only way to release them */
  [style*="white-space:nowrap"], [style*="white-space: nowrap"] { white-space: normal !important; }

  /* Display type: a phone scale that still reads as Babav's editorial voice.
     The DS clamps are tuned to a 1280px measure. */
  .hero .hero-h1, .hero-h1 { font-size: clamp(40px, 12vw, 52px) !important; line-height: 1.0 !important; }
  .closing .closing-h, .closing-h { font-size: clamp(34px, 10vw, 44px) !important; line-height: 1.04 !important; }
  .display { font-size: clamp(30px, 8.6vw, 40px) !important; line-height: 1.08 !important; }
  .chap .chap-title, .chap-title { font-size: clamp(30px, 8.6vw, 40px) !important; }
  .chap-num { font-size: 64px !important; }
  .section-lede { font-size: 16px !important; }
  .hero-sub { font-size: 16px !important; }

  /* Gutters and vertical rhythm: one scale, 20px gutter, 56px between sections. */
  .wrap, .nav-inner, .hero-meta, .hero-grid, .chap-grid, .foot-grid { padding-left: 20px !important; padding-right: 20px !important; }
  .section { padding-top: 56px !important; padding-bottom: 56px !important; }
  .section.dense { padding-top: 44px !important; padding-bottom: 44px !important; }
  .closing { padding-top: 56px !important; padding-bottom: 56px !important; }
  .chap { padding-top: 44px !important; padding-bottom: 44px !important; }
  .hero { padding-top: 32px !important; padding-bottom: 44px !important; }

  /* Heading-to-body spacing, consistent across every section. */
  .hero-h1 { margin-bottom: 20px !important; }
  .hero-sub { margin-bottom: 26px !important; }
  .hero-ctas { margin-bottom: 28px !important; }
  .section-head, .section-head.merged { margin-bottom: 32px !important; }
  .section-tagline { margin-top: 12px !important; }

  /* Two-column section heads stack, and the optical offset is removed. */
  .section-head, .section-head.merged { grid-template-columns: minmax(0, 1fr) !important; gap: 16px !important; }
  .lede-align { margin-top: 0 !important; }
  .hero-grid { grid-template-columns: minmax(0, 1fr) !important; gap: 28px !important; }
  .chap-grid { grid-template-columns: minmax(0, 1fr) !important; gap: 14px !important; }

  /* Every card grid collapses to one column. The DS sets several of these with
     equal specificity and loads late, so these need !important. */
  .shape-grid, .pricing-grid, .econ-grid, .curators-grid, .idk-grid,
  .closing-ctas, .foot-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .shape-card { border-right: 0; border-bottom: 1px solid var(--rule-soft); }
  .shape-card:last-child { border-bottom: 0; }

  /* Any inline multi-column grid written into a template collapses too —
     at phone width one column is the rule, with the few exceptions restated
     further down (they must come after this to win). */
  /* Product demos are scaled as a whole (zoom), so their inner grids keep the desktop layout. */
  [style*="grid-template-columns"]:not(.pane .demo *):not(.mv-scroll *) { grid-template-columns: minmax(0, 1fr) !important; }

  /* A grid track can't shrink below its content's min-content width, so flex
     rows inside one (avatar + text cards) need permission to shrink and wrap. */
  [style*="display: flex"], [style*="display:flex"] { min-width: 0; }
  [style*="display: flex"] > *, [style*="display:flex"] > * { min-width: 0; }

  /* Long unbroken strings (emails, URLs) must not push a column wide. */
  p, li, dd, dt, td, th, span, em, strong, a, h1, h2, h3, h4 { overflow-wrap: break-word; }

  /* Ruled rows: label above value rather than a squeezed two-column track. */
  .lib-row { grid-template-columns: minmax(0, 1fr) !important; gap: 4px; }
  .qrow { grid-template-columns: minmax(0, 1fr) !important; gap: 6px; }

  /* Exceptions to the single-column rule above — these must stay multi-track. */
  .demo-toolbar { grid-template-columns: auto 1fr !important; row-gap: 8px; }
  .nav-sheet-link { grid-template-columns: auto 1fr !important; }

  /* The header is one row: wordmark left, CTA + burger right. Flex rather than
     a grid track count, so the blanket collapse above can't stack it. */
  .nav-inner { display: flex !important; align-items: center; justify-content: space-between; gap: 12px; }
  .nav-right { display: flex; align-items: center; gap: 10px; }

  /* Horizontal tab strips: every tab visible, laid out as a tidy grid rather
     than a ragged wrap, and sitting tight against the panel it controls so
     trigger and content read as one component. */
  .tabstrip {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 6px !important;
    overflow-x: visible !important;
    margin-bottom: 10px !important;
    padding-bottom: 0 !important;
  }
  .tabstrip button {
    width: 100%;
    justify-content: flex-start !important;
    text-align: left;
    min-height: 44px;
  }
  .tabpanel { scroll-margin-top: 80px; }

  /* Any other horizontal scroller reveals its full contents. */
  [style*="overflow-x: auto"]:not(.tabstrip), [style*="overflow-x:auto"]:not(.tabstrip) { flex-wrap: wrap !important; overflow-x: visible !important; }
  .demo-unlimited { grid-column: 1 / -1; justify-self: start; }

  /* Footer: wrapping flex rows, not an inline run that forces a wide track. */
  footer .foot-grid { gap: 16px; }
  footer .foot-grid > div { display: flex; flex-wrap: wrap; gap: 10px 18px; width: auto; }
  footer .foot-grid > div > a { margin: 0; }

  /* Tap targets: 44px minimum on anything genuinely tappable. Inline links
     inside a sentence are exempt — padding them would break the text flow.
     Element-level, because class and attribute selectors miss the tab strips. */
  button, .btn, .nav-cta, .cta-card .arrow { min-height: 44px; display: inline-flex; align-items: center; }
  button { justify-content: flex-start; }
  .hero-ctas { flex-direction: column; align-items: stretch; gap: 10px; }
  .hero-ctas .btn { justify-content: center; }
  .nav-sheet-link { min-height: 44px; }
  .brand { min-height: 44px; display: inline-flex; align-items: center; }
  footer .foot-grid > div > a { min-height: 44px; display: inline-flex; align-items: center; }
  .ph-linkedin, [aria-label*="LinkedIn"] { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  input, select, textarea { min-height: 44px; }

  /* Cascade reveals fire together rather than staggering down a long column. */
  /* Diagram labels are sized in viewBox units, so a 600-unit diagram rendered
     at ~350px shrinks a 10px label to ~6px. Scale the mono labels and italic
     glosses back to a legible rendered size; the diagrams have the whitespace. */
  svg text[style*="font-size:9"], svg text[style*="font-size:10"],
  svg text[style*="font-size:11"] { font-size: 16px !important; letter-spacing: .1em !important; }
  svg text[style*="font-size:12"], svg text[style*="font-size:13"] { font-size: 17px !important; }
  svg text[style*="font-size:15"], svg text[style*="font-size:16"] { font-size: 21px !important; }

  /* Images and media never exceed their column. */
  img, svg, video, canvas, iframe { max-width: 100%; }
  img { height: auto; }

  .cascade-ready .lib-row, .cascade-ready .qrow, .cascade-ready .shape-card,
  .cascade-ready .curator { animation-delay: 0ms !important; }
}

/* ---------- Touch ---------- */
/* On a touch device :hover latches after a tap and stays lit until the user
   taps elsewhere — a card left in its hover treatment reads as "selected",
   which is exactly the wrong signal on a page of links. So on pointer-coarse
   devices every hover treatment is restated to its base value, and :active
   provides the tap feedback instead. Nothing depends on hover to reveal
   content, so nothing is lost. */
@media (hover: none) {

  /* Ink CTA cards */
  .cta-card:hover { background: transparent !important; color: var(--paper) !important; }
  .cta-card:hover .arrow::after { transform: none !important; }

  /* Paper cards */
  .curator:hover, .curator.linkable:hover, .curator.photo:hover,
  .lib-row:hover, .promise:hover, .owcard:hover { background: transparent !important; }
  .curator.linkable:hover::after { opacity: 0 !important; transform: translateY(4px) !important; }
  .lib-row:hover .lib-title { color: var(--ink) !important; }

  /* Pricing tiers keep their alternating surfaces rather than flipping to ink */
  .tier-ink:hover { background: var(--paper-white) !important; border-color: var(--rule-soft) !important; }
  .tier-ink.alt:hover { background: var(--paper-2) !important; }
  .tier-ink:hover .tier-name { color: var(--ink) !important; }
  .tier-ink:hover .tier-price { color: var(--ink) !important; }
  .tier-ink:hover .tier-suf, .tier-ink:hover .tier-billing, .tier-ink:hover .tier-blurb { color: var(--ink-2) !important; }
  .promise:hover h3 { color: var(--ink) !important; }
  .promise:hover p { color: var(--ink-2) !important; }
  .promise:hover .label { color: var(--ink-3) !important; }

  /* Ink-reversal cards — the biggest latch risk, since a tapped card would
     stay solid black. Restated to the paper base. */
  #curation .shape-card:hover, #story .shape-card:hover,
  #what-you-do .shape-card:hover { background: transparent !important; border-color: var(--rule-soft) !important; }
  #curation .shape-card:hover .shape-num, #story .shape-card:hover .shape-num,
  #what-you-do .shape-card:hover .shape-num { color: var(--ink-3) !important; }
  #curation .shape-card:hover h3, #story .shape-card:hover h3,
  #what-you-do .shape-card:hover h3 { color: var(--ink) !important; }
  #curation .shape-card:hover p, #story .shape-card:hover p,
  #what-you-do .shape-card:hover p { color: var(--ink-2) !important; }
  #curation .shape-card:hover em, #story .shape-card:hover em,
  #what-you-do .shape-card:hover em { color: var(--accent) !important; }
  #story .shape-card:hover strong, #what-you-do .shape-card:hover strong { color: var(--ink) !important; }

  /* Ruled question and application rows */
  #applications .lib-row:hover, .qrow:hover { background: transparent !important; }
  #applications .lib-row:hover .lib-title { color: var(--ink) !important; }
  .qrow:hover .qrow-q { color: var(--ink) !important; }

  /* Buttons and nav */
  .btn:hover::after { transform: none !important; }
  .btn.primary:hover { background: var(--ink) !important; color: var(--paper) !important; }
  .btn.ghost:hover { background: transparent !important; color: var(--ink) !important; }
  .nav-cta:hover { background: var(--ink) !important; color: var(--paper) !important; }
  .nav-cta.ghost:hover { background: transparent !important; color: var(--ink) !important; border-color: var(--ink) !important; }
  .brand:hover { color: var(--ink) !important; }
  a:hover { color: var(--accent) !important; }
  .foot-grid a:hover { color: rgba(245, 241, 232, 0.6) !important; }
  .nav-sheet-link:hover { color: var(--paper) !important; }
  .nav-sheet-cta.solid:hover { background: var(--paper) !important; color: var(--ink) !important; }
  .nav-sheet-cta.line:hover { border-color: rgba(245, 241, 232, 0.35) !important; color: var(--paper) !important; }
  .ph-linkedin:hover { background: transparent !important; color: var(--ink-2) !important; }

  /* Ink cards keep their paper text; only the background flip is suppressed. */
  #curation .shape-card:active, #story .shape-card:active,
  #what-you-do .shape-card:active { background: var(--paper) !important; }

  /* Tap feedback, since hover no longer provides it. Brief and quiet. */
  .btn:active, .nav-cta:active, .nav-sheet-cta:active { opacity: .72; }
  .cta-card:active { background: rgba(245, 241, 232, 0.06) !important; }
  .curator:active, .lib-row:active, .promise:active, .owcard:active,
  .tier-ink:active { background: var(--paper-2) !important; }
  .tabstrip button:active { opacity: .8; }
}

/* ---------- Tablet ---------- */
@media (min-width: 721px) and (max-width: 1024px) {

  /* !important throughout: the DS selectors for these elements are
     higher-specificity, so plain declarations lose even loading last. */

  /* Same single-row header rule as the phone band — the burger is active here too. */
  .nav-inner { display: flex !important; align-items: center; justify-content: space-between; gap: 16px; }

  .wrap, .nav-inner, .hero-meta, .hero-grid, .chap-grid, .foot-grid { padding-left: 32px !important; padding-right: 32px !important; }
  .section { padding-top: 72px !important; padding-bottom: 72px !important; }
  .closing { padding-top: 72px !important; padding-bottom: 72px !important; }
  .chap { padding-top: 56px !important; padding-bottom: 56px !important; }

  /* Section heads stack — two columns of prose is too tight at this width. */
  .section-head, .section-head.merged { grid-template-columns: minmax(0, 1fr) !important; gap: 20px; }
  .lede-align { margin-top: 0 !important; }
  .hero-grid { grid-template-columns: minmax(0, 1fr) !important; gap: 36px; }
  .chap-grid { grid-template-columns: minmax(0, 1fr) !important; }

  /* Three-up card rows become two-up; four-up pricing becomes two-up. */
  .shape-grid, .pricing-grid, .curators-grid, .idk-grid,
  .closing-ctas { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  [style*="repeat(3,minmax(0,1fr))"], [style*="repeat(4,minmax(0,1fr))"],
  [style*="repeat(3, minmax(0, 1fr))"], [style*="repeat(4, minmax(0, 1fr))"],
  [style*="minmax(300px"], [style*="minmax(320px"], [style*="minmax(340px"] { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }

  /* Two-column body grids that hold prose read better stacked. */
  [style*="grid-template-columns:1.05fr"], [style*="grid-template-columns:1.1fr"],
  [style*="grid-template-columns: 1.05fr"], [style*="grid-template-columns: 1.1fr"] { grid-template-columns: minmax(0, 1fr) !important; }

  button { min-height: 44px; display: inline-flex; align-items: center; }

  .hero-h1 { font-size: clamp(52px, 8vw, 78px) !important; }

  /* Tabs: two tidy columns rather than a ragged wrap or a hidden scroller. */
  .tabstrip { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; overflow-x: visible; margin-bottom: 14px; }
  .tabstrip button { width: 100%; justify-content: flex-start; text-align: left; min-height: 44px; }
}

/* ---------- Mobile navigation (all widths; the sheet only shows <=1024) ---------- */
.nav-burger {
  display: none;
  width: 44px; height: 44px;
  border: 1px solid var(--rule-soft); border-radius: 8px;
  background: transparent;
  flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  cursor: pointer; padding: 0; flex: 0 0 auto;
}
.nav-burger span { display: block; width: 17px; height: 1.5px; background: var(--ink); transition: transform .2s; }
.nav-burger[aria-expanded="true"] span:first-child { transform: translateY(3.25px) rotate(45deg); }
.nav-burger[aria-expanded="true"] span:last-child { transform: translateY(-3.25px) rotate(-45deg); }

.nav-sheet { display: none; }

@media (max-width: 1024px) {
  .nav .nav-links { display: none; }
  .nav-burger { display: flex; }
  .nav-right .nav-cta.ghost { display: none; }
  .nav-sheet.open {
    display: flex; position: fixed;
    left: 0; right: 0; top: var(--nav-h, 66px); bottom: 0;
    background: var(--ink);
    padding: 12px 22px 24px;
    flex-direction: column; z-index: 80;
    animation: navIn .28s cubic-bezier(.4, 0, .2, 1);
    overflow-y: auto;
  }
}

/* The header menu items (Organizations, Curators, Pricing, About): the design system colors the <nav>, not its links, so
   they showed the browser's link color (Bernd, 2026-10-01: #4A433A; on hover #B8421C). */
.nav-links a { color: #4A433A; }
.nav-links a:hover { color: #B8421C; }   /* the underline on hover is the design system's (nav.css) */

.nav-sheet-link {
  display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: baseline;
  padding: 14px 0; border-bottom: 1px solid rgba(245, 241, 232, 0.16);
  font-family: var(--display); font-size: clamp(24px, 6vw, 29px); font-weight: 300;
  letter-spacing: -.02em; color: var(--paper); text-decoration: none;
}
.nav-sheet-link:hover { color: var(--highlight); }
.nav-sheet-link span { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; color: var(--highlight); }

.nav-sheet-cta {
  text-align: center; font-family: var(--mono); font-size: 10.5px; letter-spacing: .16em;
  text-transform: uppercase; padding: 16px; border-radius: 999px; text-decoration: none;
  min-height: 44px; display: flex; align-items: center; justify-content: center;
}
.nav-sheet-cta.solid { background: var(--paper); color: var(--ink); }
.nav-sheet-cta.solid:hover { background: var(--highlight); color: var(--ink); }
.nav-sheet-cta.line { border: 1px solid rgba(245, 241, 232, 0.35); color: var(--paper); }
.nav-sheet-cta.line:hover { border-color: var(--highlight); color: var(--highlight); }

body.nav-locked { overflow: hidden; }

@keyframes navIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

@media (prefers-reduced-motion: reduce) {
  .nav-sheet.open { animation: none; }
}


/* Form fields: iOS Safari zooms the page on focus when a field's text is under 16px,
   and does not zoom back out — so the thank-you panel appears to overflow after submit.
   16px on touch-sized screens prevents the zoom. Desktop keeps its 14px. */
@media (max-width:720px){
  input:not([type=hidden]):not([type=checkbox]):not([type=radio]),
  textarea,
  select{font-size:16px!important}
}


/* Page-opening headings: align every page to the Home / Organizations / Curators hero.
   Pages whose opening section is a .section (Pricing, Contact, Become a curator, legal
   notices, 404) sat 24px lower, and Pricing's hero-grid added its own gutter inside
   .wrap, doubling the side inset. */
@media (max-width:720px){
  main > section:first-of-type:has(h1){padding-top:32px!important}
  .wrap .hero-grid,.wrap .hero-meta{padding-left:0!important;padding-right:0!important}
}

/* Touch: give email links a comfortable tap area without changing their look. */
@media (hover: none) {
  a[href^="mailto:"] { display: inline-block; padding-block: 12px; margin-block: -12px; }
}

/* Nav link colour pin: page-level link rules (a, li a) must never recolour the top nav. */
html:root .nav .nav-links a, html:root .nav .nav-links a:visited { color: var(--ink-2); }
html:root .nav .nav-links a:hover { color: var(--accent); }

/* Footer (slim colophon, Oct 2026) */
@media (max-width:720px){
  footer.ft { padding-top:0 !important; padding-bottom:24px !important; }
  footer.ft.ft-solo { padding-top:48px !important; }
  footer.ft.ft div.ft-top.ft-top[style*="border-top"] { padding-top:40px !important; }
  .ft-wrap { padding-left:20px !important; padding-right:20px !important; }
  footer.ft.ft div.ft-top.ft-top[style] { grid-template-columns:minmax(0,1fr) !important; gap:36px !important; }
  footer.ft.ft nav.ft-groups.ft-groups[style] { grid-template-columns:repeat(2,minmax(0,1fr)) !important; gap:28px 24px !important; }
  .ft-talk { grid-column:1 / -1; }
  footer.ft .ft-top > div > a { min-height:44px; display:inline-flex !important; align-items:center; }
  .ft-links { gap:0 !important; }
  .ft-talk .ft-links { flex-direction:row !important; flex-wrap:wrap; column-gap:28px !important; }
  .ft-link { font-size:16px !important; min-height:44px; display:inline-flex !important; align-items:center; }
  .ft-legal { flex-direction:column-reverse !important; align-items:flex-start !important; gap:8px !important; margin-top:36px !important; padding-top:8px !important; }
  .ft-legal-links { column-gap:24px !important; row-gap:0 !important; }
  .ft-legal-links a { min-height:44px; display:inline-flex; align-items:center; }
}
@media (hover:none){
  footer.ft .ft-link:hover { color:var(--paper) !important; }
  footer.ft .ft-legal a:hover { color:var(--on-dark) !important; }
}
