/* =========================================================
   chrome.css: the shared page chrome (core-owned).
   Nav bar + dropdown menus + mobile sheet, breadcrumbs, the
   sub-page hero, the closing CTA band, the footer.
   Markup comes from tools/layout.mjs; behaviour from js/site.js.
   ========================================================= */

/* ---------- nav bar ---------- */
.site-nav {
  position: fixed; inset: 0 0 auto; z-index: 60;
  background: rgba(255, 255, 255, .82);
  -webkit-backdrop-filter: saturate(140%) blur(14px); backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s, background-color .3s;
}
.site-nav.is-solid { border-bottom-color: var(--edge); background: rgba(255, 255, 255, .95); }
html:not(.js) .site-nav { position: relative; }
.nav-bar {
  display: flex; align-items: center; gap: 14px;
  max-width: calc(var(--max) + 2 * var(--gutter)); margin-inline: auto;
  min-height: var(--nav-h); padding-inline: var(--gutter);
}
.nav-panel { display: flex; align-items: center; flex: 1; min-width: 0; }
.nav-links { display: flex; align-items: center; gap: 2px; margin-left: 28px; }
.nav-item { position: relative; }
.nav-btn {
  display: inline-flex; align-items: center; gap: 7px; min-height: 42px; padding: 0 13px;
  border: 0; border-radius: 999px; background: transparent; cursor: pointer;
  font-size: 15px; font-weight: 550; font-stretch: 106%; color: var(--text-2); text-decoration: none;
  transition: background-color .2s, color .2s;
}
.nav-btn:hover, .nav-btn[aria-expanded="true"] { color: var(--text); background: var(--storm-1); }
.nav-item.is-current > .nav-btn { color: var(--text); }
.nav-item.is-current > .nav-btn::after {
  content: ""; position: absolute; left: 50%; bottom: 3px; width: 4px; height: 4px; margin-left: -2px;
  border-radius: 50%; background: var(--blue);
}
.nav-btn .spark { width: 13px; height: 13px; }
.caret { width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translateY(-2px); transition: transform .2s; opacity: .8; }
.nav-btn[aria-expanded="true"] .caret { transform: rotate(-135deg) translate(-2px, -1px); }

.nav-panel-cta, .nav-menu { display: none; }
/* one blue pill per viewport: the nav CTA stays storm grey while any other
   blue primary button is on screen; js/site.js adds .cta-free when none is */
.site-nav:not(.cta-free) .nav-cta { background: var(--storm-2); box-shadow: inset 0 0 0 1px var(--edge-2); }
.site-nav:not(.cta-free) .nav-cta:hover { background: var(--storm-3); }

/* ---------- dropdown panels ---------- */
.dd {
  display: none; position: absolute; top: calc(100% + 14px); left: -8px; z-index: 5;
  padding: 10px; border-radius: var(--radius-l);
  background: var(--storm-1); color: var(--text); border: 1px solid var(--edge);
  box-shadow: 0 40px 80px -30px rgba(28, 32, 14, .28), 0 0 0 1px rgba(28, 32, 14, .08);
}
.dd::before { content: ""; position: absolute; inset: -16px 0 auto; height: 16px; }
.nav-item.is-open > .dd { display: grid; }
html:not(.js) .nav-item:hover > .dd, html:not(.js) .nav-item:focus-within > .dd { display: grid; }
@media (prefers-reduced-motion: no-preference) {
  .nav-item.is-open > .dd { animation: dd-in .22s var(--ease-out) both; }
}
@keyframes dd-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.dd--ai { width: 640px; grid-template-columns: 250px minmax(0, 1fr); gap: 10px; }
.dd--wide { width: 680px; }
#dd-services { width: 600px; }
.dd--res { width: 640px; grid-template-columns: minmax(0, 1fr) 250px; gap: 10px; }
.dd-feature {
  display: grid; align-content: start; gap: 8px; padding: 18px; border-radius: var(--radius-m);
  background: var(--black-2); border: 1px solid var(--edge); text-decoration: none;
  transition: border-color .2s;
}
.dd-feature:hover { border-color: var(--edge-2); }
.dd-feature-k { display: inline-flex; align-items: center; gap: 8px; font: 500 11px/1.3 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.dd-feature-t { font-size: 22px; font-weight: 800; font-stretch: 116%; letter-spacing: -.025em; line-height: 1.05; }
.dd-feature-d { font-size: 14px; line-height: 1.45; color: var(--text-2); }
.dd-feature-go { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; font: 500 12.5px/1 var(--font-mono); color: var(--text); }
.dd-feature-go .ico { width: 14px; height: 14px; color: var(--blue-hi); }
.dd-list { display: grid; gap: 2px; align-content: start; }
.dd-link {
  display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; align-items: center;
  min-height: 56px; padding: 8px 10px; border-radius: 10px; text-decoration: none;
  transition: background-color .15s;
}
.dd-link .ico { width: 34px; height: 34px; padding: 8px; border-radius: 9px; border: 1px solid var(--edge); color: var(--text-2); }
.dd-link:hover { background: var(--storm-2); }
.dd-text { display: grid; gap: 1px; }
.dd-name { font-size: 15px; font-weight: 650; font-stretch: 104%; line-height: 1.25; }
.dd-sub { font-size: 13px; line-height: 1.35; color: var(--muted); }
.dd-link[aria-current="page"], .dd-mod[aria-current="page"], .dd-feature[aria-current="page"] { background: var(--storm-2); box-shadow: inset 2px 0 0 var(--blue); }

.dd-head, .dd-foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 16px;
  padding: 6px 10px 12px; margin-bottom: 6px; border-bottom: 1px solid var(--edge);
  font: 500 12px/1.3 var(--font-mono); color: var(--muted);
}
.dd-head a { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; font: 650 15px/1 var(--font-sans); font-stretch: 106%; color: var(--text); text-decoration: none; }
.dd-head a .ico { width: 15px; height: 15px; color: var(--blue-hi); }
.dd-head a:hover { color: var(--blue-hi); }
.dd-foot { margin: 6px 0 0; padding: 12px 10px 4px; border-top: 1px solid var(--edge); border-bottom: 0; justify-content: flex-start; gap: 6px 22px; }
.dd-foot a { color: var(--text-2); text-decoration: underline; text-decoration-color: var(--edge-2); text-underline-offset: 4px; min-height: 28px; display: inline-flex; align-items: center; }
.dd-foot a:hover { color: var(--text); }
.dd-mods { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 6px; }
.dd-mod {
  display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 6px 10px;
  border-radius: 9px; text-decoration: none; font-size: 14.5px; font-weight: 550; line-height: 1.2; color: var(--text);
  transition: background-color .15s;
}
.dd-mod .ico { width: 16px; height: 16px; color: var(--muted); }
.dd-mod:hover { background: var(--storm-2); }
.dd-mod .tag-new { margin-left: 2px; }
.dd-mods--plain .dd-mod { min-height: 44px; }
.dd-guides { padding: 14px; border-radius: var(--radius-m); background: var(--black-2); border: 1px solid var(--edge); }
.dd-guides-k { font: 500 11px/1.3 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.dd-guides li a { display: grid; gap: 3px; padding: 9px 0; border-top: 1px solid var(--edge); font-size: 13.5px; line-height: 1.35; text-decoration: none; color: var(--text); }
.dd-guides li:first-child a { border-top: 0; }
.dd-guides li a:hover { color: var(--blue-hi); }
.dd-guide-cat { font: 500 11px/1.2 var(--font-mono); color: var(--muted); }

@media (max-width: 1180px) {
  .nav-links { margin-left: 16px; }
  .nav-btn { padding: 0 10px; }
}

/* ---------- mobile sheet (≤ 1023px) ---------- */
@media (max-width: 1023px) {
  .js .nav-menu {
    display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 14px; margin-left: auto;
    border-radius: 999px; border: 1px solid var(--edge-2); background: var(--storm-1); cursor: pointer;
    font-size: 14.5px; font-weight: 600;
  }
  .nav-menu-bars { width: 16px; height: 10px; border-block: 2px solid currentColor; }
  .nav-menu[aria-expanded="true"] .nav-menu-bars { height: 2px; border-bottom: 0; }
  .js .nav-panel {
    display: none; position: fixed; left: 0; right: 0; top: var(--nav-h);
    max-height: calc(100dvh - var(--nav-h)); overflow-y: auto; overscroll-behavior: contain;
    flex-direction: column; align-items: stretch; gap: 16px; padding: 12px var(--gutter) 28px;
    background: var(--black-2); border-bottom: 1px solid var(--edge);
    box-shadow: 0 40px 60px -20px rgba(28, 32, 14, .28);
  }
  .js .nav-panel.is-open { display: flex; }
  html:not(.js) .nav-bar { flex-wrap: wrap; padding-block: 8px; }
  html:not(.js) .nav-panel { order: 5; flex-basis: 100%; }
  .nav-links { flex-direction: column; align-items: stretch; margin-left: 0; gap: 0; width: 100%; }
  .nav-item { border-bottom: 1px solid var(--edge); }
  .nav-btn { width: 100%; justify-content: space-between; min-height: 56px; padding: 0 4px; font-size: 18px; color: var(--text); border-radius: 0; }
  .nav-btn:hover, .nav-btn[aria-expanded="true"] { background: transparent; }
  .nav-btn .caret { margin-left: auto; }
  .nav-btn .spark { margin-right: -2px; }
  .nav-item.is-current > .nav-btn::after { left: auto; right: 34px; bottom: 50%; margin: 0 0 -2px; }
  .dd, .dd--ai, .dd--wide, .dd--res, #dd-services {
    position: static; width: auto; padding: 0 0 14px; border: 0; border-radius: 0; box-shadow: none; background: transparent;
    grid-template-columns: minmax(0, 1fr);
  }
  .dd::before { display: none; }
  .dd-mods { grid-template-columns: minmax(0, 1fr); }
  .dd-feature { padding: 14px; }
  .dd-feature-t { font-size: 19px; }
  .nav-panel-cta { display: inline-flex; align-self: flex-start; }
  .nav-cta { display: none; }
}
@media (max-width: 420px) {
  .wordmark { font-size: 18.5px; }
  .nav-bar { gap: 8px; }
  .nav-menu-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .js .nav-menu { padding: 0 13px; min-width: 44px; justify-content: center; }
}

/* ---------- breadcrumbs ---------- */
.crumbs { margin-bottom: clamp(20px, 3vw, 40px); }
.crumbs ol { display: flex; flex-wrap: wrap; gap: 2px; font: 500 12.5px/1.3 var(--font-mono); color: var(--muted); }
.crumbs li + li::before { content: "/"; margin: 0 8px 0 6px; color: var(--edge-2); }
.crumbs a { display: inline-flex; align-items: center; justify-content: center; min-height: 32px; min-width: 24px; color: var(--text-2); text-decoration: underline; text-decoration-color: var(--edge-2); text-underline-offset: 4px; }
.crumbs a:hover { color: var(--text); }
.crumbs [aria-current] { display: inline-flex; align-items: center; min-height: 32px; color: var(--text-2); }

/* ---------- sub-page hero ---------- */
.page-hero {
  position: relative; overflow: hidden;
  padding: calc(var(--nav-h) + clamp(28px, 4vw, 56px)) 0 clamp(48px, 5.5vw, 84px);
  background:
    radial-gradient(70% 90% at 85% -10%, rgba(50, 205, 50, .07), transparent 60%),
    var(--black);
  border-bottom: 1px solid var(--edge);
}
html:not(.js) .page-hero { padding-top: clamp(28px, 4vw, 56px); }
.page-hero-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px clamp(32px, 5vw, 80px); align-items: end; }
.page-hero--split .page-hero-grid { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.page-hero-text { display: grid; justify-items: start; gap: 0; }
.page-title {
  font-size: clamp(38px, 5.4vw, 84px); font-weight: 800; font-stretch: 122%;
  line-height: .93; letter-spacing: -.04em; text-wrap: balance; max-width: 18ch;
}
.page-lede { margin-top: 22px; font-size: clamp(17.5px, 1.45vw, 21px); line-height: 1.5; max-width: 56ch; color: var(--text-2); text-wrap: pretty; }
.page-hero .actions { margin-top: 30px; }
@media (max-width: 960px) { .page-hero--split .page-hero-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- closing CTA band ---------- */
.cta-band {
  position: relative; overflow: hidden;
  padding-block: clamp(80px, 9vw, 140px) clamp(56px, 6vw, 88px);
  background:
    radial-gradient(60% 120% at 50% 0%, rgba(50, 205, 50, .06), transparent 70%),
    var(--black);
  border-top: 1px solid var(--edge);
}
.cta-title {
  font-size: clamp(42px, 7.6vw, 128px); font-weight: 800; font-stretch: 125%;
  line-height: .88; letter-spacing: -.048em; max-width: 13ch; text-wrap: balance;
  padding-bottom: .06em;
}
.cta-foot {
  margin-top: clamp(36px, 4.4vw, 64px); padding-top: 24px; border-top: 1px solid var(--edge-2);
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 24px 40px;
}
.cta-foot .lede { max-width: 46ch; }

/* ---------- footer ---------- */
.footer { background: var(--black-2); color: var(--text); padding-block: clamp(56px, 6vw, 88px) 28px; border-top: 1px solid var(--edge); }
.footer-top { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 10fr); gap: 48px; padding-bottom: 44px; border-bottom: 1px solid var(--edge); }
.footer-brand { display: grid; gap: 16px; align-content: start; justify-items: start; }
.footer-brand p { color: var(--text-2); font-size: 15px; max-width: 28ch; }
.footer-cols { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 32px 24px; }
.footer-h { display: flex; align-items: center; gap: 7px; font: 500 12px/1.3 var(--font-mono); color: var(--muted); margin-bottom: 12px; letter-spacing: .06em; text-transform: uppercase; }
.footer-cols ul { display: grid; gap: 0; }
.footer-cols a { display: inline-flex; align-items: center; min-height: 30px; padding-block: 3px; color: var(--text-2); text-decoration: none; font-size: 14.5px; line-height: 1.3; }
.footer-cols a:hover { color: var(--text); text-decoration: underline; text-decoration-color: var(--blue); text-underline-offset: 4px; }
.footer-base { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 24px; padding-top: 22px; font: 500 12.5px/1.4 var(--font-mono); color: var(--muted); }
.footer-legal { display: flex; gap: 20px; }
.footer-legal a { display: inline-flex; align-items: center; min-height: 32px; color: var(--text-2); text-underline-offset: 4px; text-decoration-color: var(--edge-2); }
.footer-legal a:hover { color: var(--text); }
@media (max-width: 1180px) {
  .footer-top { grid-template-columns: minmax(0, 1fr); }
  .footer-cols { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .footer-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 16px; }
  .footer-base { flex-direction: column; align-items: flex-start; }
}
