/* Steelmoth — mobile pass. Tightens type, paddings, layouts,
   and adds the hamburger menu UI. Loaded AFTER styles.css + pages.css. */

/* ============ NAV — hamburger button + overlay ============ */
.menu-btn {
  display: none;
  width: 36px; height: 36px;
  align-items: center; justify-content: center;
  color: var(--ink);
  position: relative;
}
.menu-btn .bar {
  display: block;
  width: 18px; height: 1px;
  background: currentColor;
  position: relative;
  transition: transform 240ms cubic-bezier(.2,.7,.2,1),
              opacity 180ms ease,
              top 180ms ease;
}
.menu-btn .bar + .bar { margin-top: 5px; }
.menu-btn[aria-expanded="true"] .bar:nth-child(1) { transform: translateY(3px) rotate(45deg); }
.menu-btn[aria-expanded="true"] .bar:nth-child(2) { opacity: 0; }
.menu-btn[aria-expanded="true"] .bar:nth-child(3) { transform: translateY(-3px) rotate(-45deg); }

.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--bg);
  display: grid;
  grid-template-rows: 76px 1fr auto;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-12px);
  transition: opacity 260ms ease, transform 320ms cubic-bezier(.2,.7,.2,1);
}
.mobile-menu[data-open="true"] {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.mobile-menu-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--gutter);
  border-bottom: 1px solid var(--line);
}
.mobile-menu-links {
  display: grid;
  align-content: start;
  padding: 56px var(--gutter);
  gap: 6px;
}
.mobile-menu-link {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: 36px;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--ink);
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
  transition: color var(--tr);
}
.mobile-menu-link .arr {
  color: var(--ink-3);
  transition: transform var(--tr), color var(--tr);
}
.mobile-menu-link:hover, .mobile-menu-link.active {
  color: var(--sm-champagne);
}
.mobile-menu-link:hover .arr { transform: translateX(4px); color: var(--ink); }
.mobile-menu-link.active .arr { color: var(--sm-champagne); }

.mobile-menu-cta {
  padding: 32px var(--gutter) 40px;
  display: grid; gap: 20px;
  border-top: 1px solid var(--line);
}
.mobile-menu-meta {
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.mobile-menu-meta .toggle-row {
  display: inline-flex; align-items: center; gap: 14px;
  color: var(--ink);
}

/* prevent body scroll when menu open */
body.menu-open { overflow: hidden; }

/* ============ BREAKPOINT: TABLET (<=960px) — show hamburger ============ */
@media (max-width: 960px) {
  .menu-btn { display: inline-flex; }
  /* hide existing nav-links + the inline theme toggle; theme toggle moves into menu */
  .nav-row .nav-links { display: none; }
  .nav-right .theme-toggle { display: none; }
  /* compact the primary CTA on tablet */
  .nav-right .btn-primary { height: 38px; padding: 0 16px; font-size: 13px; }
}

/* ============ BREAKPOINT: PHONE (<=720px) — major reflow ============ */
@media (max-width: 720px) {

  :root {
    --gutter: 20px;
  }

  /* nav: tighter, hide CTA (it lives in the overlay menu now) */
  .nav-row { height: 64px; }
  .nav-right .btn-primary { display: none; }
  .brand-word { font-size: 12px; letter-spacing: 0.3em; }
  .brand-mark { width: 22px; height: 14px; }
  .mobile-menu { grid-template-rows: 64px 1fr auto; }
  .mobile-menu-link { font-size: 28px; padding: 12px 0; }
  .mobile-menu-links { padding: 32px var(--gutter); }

  /* section padding tighter */
  .section { padding: 56px 0; }
  .page-header { padding: 56px 0 32px; }

  /* type scale down */
  .h-display { font-size: clamp(40px, 11vw, 56px) !important; line-height: 1; }
  .h-section { font-size: clamp(26px, 7vw, 36px) !important; line-height: 1.08; }
  .h-card { font-size: 18px; }
  .lede { font-size: 16px !important; line-height: 1.5; }
  .body { font-size: 15px; line-height: 1.6; }
  h1 { font-size: clamp(36px, 9vw, 48px) !important; line-height: 1.02; }
  .page-header h1 { font-size: clamp(36px, 9vw, 48px) !important; max-width: none; }

  /* hero */
  .hero { padding: 32px 0 40px; }
  .hero-grid { gap: 40px !important; }
  .hero-lhs h1 { margin-bottom: 24px; }
  .hero-lhs .lede { margin-bottom: 32px; }
  .hero-visual img { max-width: 280px; }
  .hero-cta { gap: 18px; }
  .hero-cta .btn { width: 100%; justify-content: center; }
  .hero-cta .linklike { font-size: 13px; }

  /* invariant strip */
  .invariant { margin-top: 56px; gap: 16px; }
  .invariant .quote { font-size: 24px; line-height: 1.18; max-width: none; }
  .invariant .attr { font-size: 10px; letter-spacing: 0.24em; }

  /* twocol */
  .twocol { gap: 24px !important; }
  .twocol .lhs h2 { margin-bottom: 16px; }

  /* section-head */
  .section-head { margin-bottom: 40px; gap: 18px; }

  /* triple cells stacked */
  .triple { gap: 32px !important; }
  .triple-cell { min-height: 0; gap: 14px; }
  .triple-cell h3 { font-size: 22px; }
  .triple-cell p { font-size: 14px; line-height: 1.6; }

  /* steps */
  .steps { gap: 32px !important; }
  .step .num { font-size: 40px; margin-bottom: 16px; }
  .step h3 { font-size: 20px; }
  .step p { font-size: 14px; }

  /* trust grid */
  .trust-grid { gap: 28px !important; }
  .trust-cell { gap: 12px; }
  .trust-cell h4 { font-size: 20px; }
  .trust-cell p { font-size: 14px; }

  /* who-it's-for editorial rows */
  .editorial-row { padding: 20px 0; gap: 6px; }
  .editorial-row .folio { font-size: 11px; letter-spacing: 0.22em; }
  .editorial-row .body-text { font-size: 17px; }
  .editorial-row .tag { font-size: 10px; letter-spacing: 0.18em; }

  /* closing */
  .closing { gap: 32px !important; padding: 48px 0; }
  .closing h2 { font-size: 28px !important; }
  .closing p { font-size: 15px; margin-bottom: 24px; }
  .closing .cta-row .btn { width: 100%; justify-content: center; }
  .closing-art img { max-width: 180px; }

  /* timeline */
  .tl-row { gap: 10px !important; padding: 28px 0; }
  .tl-row .when { font-size: 11px; letter-spacing: 0.22em; }
  .tl-row .when .hour { font-size: 28px; margin-bottom: 6px; }
  .tl-row h3 { font-size: 20px; margin-bottom: 8px; }
  .tl-row p { font-size: 14px; line-height: 1.55; }

  /* cando */
  .cando { gap: 28px !important; }
  .cando-col h4 { margin-bottom: 16px; font-size: 10px; }
  .cando-col li { font-size: 14px; padding: 12px 0; }

  /* principle (security) */
  .principle { gap: 14px !important; padding: 32px 0; }
  .principle .lhs h3 { font-size: 22px; }
  .principle .rhs { font-size: 15px; line-height: 1.65; }

  /* safety lines */
  .safety { gap: 0; margin-top: 16px; }
  .safety-line { padding: 20px 0; gap: 10px; }
  .safety-line .actor { font-size: 10px; }
  .safety-line p { font-size: 16px !important; }

  /* flow stages — show as compact vertical list */
  .flow { margin-top: 32px; gap: 18px; }
  .flow-stage { display: grid; grid-template-columns: 36px 1fr; gap: 14px; padding-right: 0; align-items: baseline; }
  .flow-stage .num { color: var(--line-metal); align-self: start; }
  .flow-stage h4 { font-size: 16px; }
  .flow-stage p { font-size: 13px; max-width: none; grid-column: 2; }
  .flow-stage h4 { grid-column: 2; }

  /* data block */
  .data-block { padding: 24px 20px; }
  .data-block h3 { font-size: 20px; }
  .data-block li { font-size: 14px; padding: 14px 0; }

  /* ledger — collapse to 2-col stacked layout */
  .ledger-collapse { margin-top: 32px; }
  .ledger { margin-top: 32px; }
  .ledger-head {
    grid-template-columns: 64px 1fr !important;
    gap: 14px !important;
    padding: 12px 0;
    font-size: 9px !important;
  }
  .ledger-head > span:nth-child(2),
  .ledger-head > span:nth-child(4) { display: none; }
  .ledger-head > .col-what::after { content: " · status"; }
  .ledger-row {
    grid-template-columns: 64px 1fr !important;
    gap: 8px 14px !important;
    padding: 16px 0;
  }
  .ledger-row .time { font-size: 11px; grid-row: 1; grid-column: 1; }
  .ledger-row .who { font-size: 13px; grid-row: 1; grid-column: 2; align-self: baseline; }
  .ledger-row .what { font-size: 13px; grid-row: 2; grid-column: 2; padding-left: 0 !important; }
  .ledger-row .status { font-size: 9px; grid-row: 2; grid-column: 2; justify-self: end; align-self: end; text-align: right; }

  /* news */
  .news-row { padding: 24px 0 !important; gap: 8px !important; }
  .news-row:hover { padding-left: 0 !important; }
  .news-row .date { font-size: 10px; letter-spacing: 0.22em; }
  .news-row h3 { font-size: 20px !important; line-height: 1.2; }
  .news-row p { font-size: 13px; line-height: 1.5; }
  .news-row .kind { font-size: 10px; letter-spacing: 0.2em; }

  /* article */
  .article-body { margin-top: 32px; gap: 18px; }
  .article-body p { font-size: 15px; line-height: 1.7; }
  .article-body h2 { font-size: 22px; margin-top: 16px; }
  .article-body .pull { font-size: 17px; padding: 16px 0 16px 20px; margin: 16px 0; }
  .article-meta { font-size: 10px; gap: 14px; }
  .page-header h1 { margin-bottom: 24px; }

  /* request invite — clean stack */
  .request-clean { gap: 40px !important; }
  .request-clean .form { gap: 28px; }
  .request-clean .form .submit-row .btn { width: 100%; justify-content: center; order: 2; }
  .request-clean .form .submit-row { gap: 12px; justify-content: flex-start; }
  .request-clean .form .submit-row .reassure { order: 1; }
  .request-clean .promise .row { grid-template-columns: 20px 1fr; gap: 14px; }
  .request-clean .promise .txt { font-size: 17px; }
  .invite-status { padding: 10px 14px; gap: 10px; }
  .invite-status .lbl, .invite-status .val { font-size: 10px; letter-spacing: 0.22em; }
  .field label { font-size: 10px; }
  .field input, .field textarea { font-size: 16px; padding: 10px 0; }

  /* static pages */
  .static-grid { gap: 32px !important; }
  .static-grid > nav {
    overflow-x: auto;
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    gap: 18px !important;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
    /* hide scrollbar */
    scrollbar-width: none;
  }
  .static-grid > nav::-webkit-scrollbar { display: none; }
  .static-grid > nav a { padding: 4px 0; font-size: 10px; letter-spacing: 0.2em; }
  .prose { font-size: 15px; line-height: 1.7; }
  .prose h2 { font-size: 22px; margin-top: 16px; }
  .prose h3 { font-size: 10px; letter-spacing: 0.22em; }

  /* contact */
  .contact-grid { gap: 28px !important; }
  .contact-grid .val { font-size: 15px; word-break: break-word; }
  .contact-grid .lbl { font-size: 10px; }

  /* footer */
  .footer { padding: 56px 0 32px; }
  .footer-grid { grid-template-columns: 1fr 1fr !important; gap: 32px !important; }
  .footer-col h5 { margin-bottom: 14px; font-size: 10px; }
  .footer-col a { font-size: 13px; padding: 4px 0; }
  .footer-tagline { font-size: 13px; margin-top: 14px; }
  .footer-corp { font-size: 11px; line-height: 1.65; margin-top: 18px; }
  .footer-bottom { flex-direction: column; align-items: flex-start; gap: 12px; margin-top: 40px; padding-top: 20px; font-size: 11px; }
  .footer-bottom .trio { font-size: 10px; letter-spacing: 0.28em; }
  /* brand mark in footer first column should span full width */
  .footer-col:first-child { grid-column: 1 / -1; }

  /* page-header folio row tighter */
  .page-header .folio-row { gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
  .page-header .folio-row .rule { width: 40px; }
  .page-header .folio-row .folio { font-size: 10px; letter-spacing: 0.22em; }
  .page-header .metal-rule { margin-bottom: 20px; }
  .page-header .lede { font-size: 15px !important; }

  /* buttons full-width-friendly */
  .btn-lg { height: 48px; padding: 0 22px; font-size: 14px; }
  .btn { height: 42px; padding: 0 18px; font-size: 13px; }
}

/* ============ BREAKPOINT: SMALL PHONE (<=420px) ============ */
@media (max-width: 420px) {
  :root { --gutter: 16px; }
  .h-display { font-size: 36px !important; }
  .h-section { font-size: 24px !important; }
  .hero-visual img { max-width: 240px; }
  .closing-art img { max-width: 140px; }
  .mobile-menu-link { font-size: 24px; }
  .invariant .quote { font-size: 22px; }
}

/* ============ TOUCH POLISH ============ */
@media (hover: none) {
  .news-row:hover { padding-left: 0; }
  .news-row:hover h3 { color: var(--ink); }
  .btn-primary:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); }
  /* but keep tap state */
  .btn-primary:active { background: var(--sm-champagne); color: var(--sm-carbon); border-color: var(--sm-champagne); }
}

/* Safe-area for iOS notch */
@supports (padding: max(0px)) {
  .nav, .footer {
    padding-left: max(var(--gutter), env(safe-area-inset-left));
    padding-right: max(var(--gutter), env(safe-area-inset-right));
  }
  .nav .wrap, .footer .wrap { padding-left: 0; padding-right: 0; }
}

/* Ensure viewport meta-style behavior — prevent inputs from causing zoom on iOS Safari */
input, textarea, select { font-size: 16px; }
