/* ==========================================================================
   Zentek — mobile refinements
   Loaded after each page's inline <style> so these rules win on equal
   specificity. Scope: everything here is inside a max-width media query
   except the intrinsic-sizing guards, which are safe at every width.
   ========================================================================== */

/* --- Intrinsic sizing guards (all widths) --------------------------------
   `1fr` tracks resolve to minmax(auto,1fr), so a long unbreakable value like
   "~US$64.0B" or "99.9992%" forces the track wider than its container and
   pushes the grid off screen. Letting the items shrink fixes the whole class
   of overflow at once. */
.stats > *,
.cards3 > *,
.cards4 > *,
.block > *,
.forms-grid > *,
.gd-cards > *,
.gd-card > *,
.release-item > *,
.toc > * { min-width: 0; }

/* .hero is a flex container and .wrap its item, so the item would otherwise be
   sized by its longest word rather than by the viewport. */
.hero > .wrap { width: 100%; min-width: 0; }

img, canvas, svg, video, iframe, table { max-width: 100%; }
img { height: auto; }

/* Never hyphenate. Automatic hyphenation broke display headlines mid-word
   ("materi-als"), which reads as a typo at these sizes. Applied to everything so
   no page or component can opt back in. */
*, *::before, *::after {
  -webkit-hyphens: none;
  hyphens: none;
}

/* Long tokens (tickers, URLs, spec strings) should break rather than scroll */
.stat .n, .stat .l, .card p, .prose p, .legal, .f-note, .rowitem a,
.gd-line, .gd-title, .tbd { overflow-wrap: break-word; }

/* Headlines are the other common offender: a single long word at the clamp
   minimum can be wider than a 320px viewport. It breaks without a hyphen. */
.hero h1, h2.big, .copy-b h2, .define .word, .gd-hero h1, .prose h3 {
  overflow-wrap: break-word;
}

/* ========================================================================== */
@media (max-width: 920px) {
  .sec { padding: 76px 0; }
  .define { padding: 84px 0; }
  .quote { padding: 84px 24px; }
  footer { padding: 60px 0 44px; }
}

/* ========================================================================== */
@media (max-width: 760px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { padding: 26px 20px; }
  .stat .n { font-size: 27px; }
  .cards3, .cards4 { grid-template-columns: minmax(0, 1fr); }
  .cards4 .card { padding: 28px 24px; }
  .hero p.lede, .sec p.intro { font-size: 16px; }
}

/* ========================================================================== */
@media (max-width: 640px) {
  .wrap { padding: 0 20px; }
  .nav-in { padding: 14px 20px; }
  .copy-b { padding: 48px 20px; }
  .quote { padding: 68px 20px; }

  .hero .wrap { padding-top: 48px; padding-bottom: 48px; }
  .hero { min-height: 62vh; }
  .hero.short { min-height: 46vh; }
  .hero h1 { font-size: clamp(34px, 11vw, 52px); }
  .gd-hero { padding: 76px 0 60px; }
  .gd-hero h1 { font-size: clamp(34px, 11vw, 52px); }

  /* News rows read better stacked than as a squeezed two-column row */
  .rowitem { flex-direction: column; align-items: flex-start; gap: 6px; font-size: 15px; }
  .rowitem .date { white-space: normal; }

  /* Chapter cards: the 100px number column plus a nowrap CTA cannot fit */
  .gd-card { grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 24px 20px; }
  .gd-cta2 { white-space: normal; }
  .gd-num { font-size: 30px; }

  /* Stays absolutely positioned — it is a flex child of .hero, so taking it
     out of position would push the hero copy sideways. Just fit it. */
  .photo-note { top: 12px; right: 12px; left: 12px; max-width: none; font-size: 9px; padding: 5px 7px; }
  .media.photo figcaption { font-size: 10px; padding: 32px 18px 14px; }
}

/* ========================================================================== */
@media (max-width: 520px) {
  .stats { grid-template-columns: minmax(0, 1fr); }
  .stat .n { font-size: 30px; }
  .define .word { font-size: clamp(30px, 10vw, 44px); }
  .define .meaning, .hero p.lede, .sec p.intro { font-size: 15.5px; }
  .toc { padding: 22px 20px; }
  .f-in { gap: 28px; }
  .legal-links { gap: 8px 16px; }
}

/* --------------------------------------------------------------------------
   Mobile navigation
   The desktop link row is hidden below 920px and nothing replaced it, so
   there was no way to navigate the site on a phone. mobile-nav.js clones the
   existing links into the panel below; these rules style it.
   -------------------------------------------------------------------------- */
.mnav-toggle { display: none; }

@media (max-width: 920px) {
  .mnav-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 0 10px;
    margin-right: -10px;
    background: none;
    border: 0;
    cursor: pointer;
    color: inherit;
  }
  .mnav-toggle span {
    display: block;
    width: 100%;
    height: 1.5px;
    background: var(--ink);
    transition: transform .2s ease, opacity .2s ease;
  }
  .mnav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
  .mnav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .mnav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

  .mnav-panel {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 18px 40px rgba(12, 14, 12, .10);
    padding: 8px 28px 20px;
    max-height: calc(100vh - 68px);
    overflow-y: auto;
  }
  .mnav-panel[hidden] { display: none; }
  .mnav-panel a {
    display: block;
    padding: 13px 0;
    font-size: 15px;
    font-weight: 500;
    color: var(--ink);
    border-bottom: 1px solid var(--line);
  }
  .mnav-panel a:last-child { border-bottom: 0; }
  .mnav-panel a.on { color: var(--green); }

  .nav-tick { font-size: 10px; }
}

@media (max-width: 640px) {
  .mnav-panel { padding: 8px 20px 20px; }
}

@media (max-width: 460px) {
  /* The ticker string and a logo and a toggle will not share one line */
  .nav-tick { display: none; }
}
