/*
 * CommitControl shared interior styles, Phase 2 of the brand rebuild.
 * Consumes src/styles/tokens.css. This is the reusable base for every page
 * that is not the homepage: reset, type roles, buttons, nav, footer, and
 * common section primitives, all on the charcoal + green + IBM Plex system,
 * dual theme. Page-specific layout lives in a per-page sheet (e.g.
 * scenarios.css) loaded after this one.
 */

/* ─── Reset + base ──────────────────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--cc-font-sans);
  font-size: var(--cc-fs-body);
  line-height: var(--cc-lh-body);
  color: var(--cc-ink);
  background: var(--cc-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background var(--cc-dur-base) var(--cc-ease-out), color var(--cc-dur-base) var(--cc-ease-out);
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: 0; background: transparent; color: inherit; }
img, video { max-width: 100%; display: block; }
:focus-visible { outline: none; box-shadow: var(--cc-focus-ring); border-radius: var(--cc-r-sm); }
.num, .metric, .kpi { font-family: var(--cc-num); font-variant-numeric: var(--cc-numeric); }

/* ─── Layout primitives ─────────────────────────────────────────────────── */
.wrap { max-width: var(--cc-container); margin-inline: auto; padding-inline: var(--cc-gutter); }
.section { padding-block: var(--cc-section-y); }
.measure { max-width: var(--cc-measure); }
.skip-link {
  position: absolute; left: 8px; top: -48px; z-index: var(--cc-z-toast);
  background: var(--cc-accent-fill); color: var(--cc-accent-on-fill);
  padding: 10px 16px; border-radius: var(--cc-r-sm); transition: top var(--cc-dur-fast);
}
.skip-link:focus { top: 8px; }

/* ─── Typography roles ──────────────────────────────────────────────────── */
h1, h2, h3, h4 { font-weight: var(--cc-w-semibold); line-height: var(--cc-lh-head); letter-spacing: var(--cc-track-head); color: var(--cc-ink); text-wrap: balance; }
.display { font-size: var(--cc-fs-display); line-height: var(--cc-lh-tight); letter-spacing: var(--cc-track-display); font-weight: var(--cc-w-bold); }
.h1 { font-size: var(--cc-fs-h1); }
.h2 { font-size: var(--cc-fs-h2); }
.h3 { font-size: var(--cc-fs-h3); }
.lead { font-size: var(--cc-fs-lead); color: var(--cc-ink-soft); line-height: 1.5; text-wrap: pretty; }
p { text-wrap: pretty; }
.accent { color: var(--cc-accent); }
.playful { font-style: italic; letter-spacing: -0.018em; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--cc-font-mono); font-size: var(--cc-fs-label-code);
  font-weight: var(--cc-w-semibold); letter-spacing: var(--cc-track-label-code);
  text-transform: uppercase; color: var(--cc-ink-mute);
}
.eyebrow::before { content: ""; width: 18px; height: 1px; background: var(--cc-accent-mid); flex: 0 0 auto; }
.eyebrow.center { justify-content: center; }

/* ─── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: var(--cc-r-sm);
  font-weight: var(--cc-w-semibold); font-size: var(--cc-fs-body); min-height: 44px;
  transition: background var(--cc-dur-base) var(--cc-ease-out),
              transform var(--cc-dur-fast) var(--cc-ease-out),
              box-shadow var(--cc-dur-base) var(--cc-ease-out),
              border-color var(--cc-dur-base) var(--cc-ease-out);
  translate: 0 0;
}
.btn .arrow { transition: transform var(--cc-dur-base) var(--cc-ease-out); }
.btn:hover .arrow { transform: translateX(3px); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--cc-accent-fill); color: var(--cc-accent-on-fill); box-shadow: var(--cc-glow-accent); }
.btn-primary:hover { background: var(--cc-accent-fill-hover); }
.btn-lg { padding: 15px 26px; font-size: 1.0625rem; min-height: 52px; }
.btn-secondary { background: transparent; color: var(--cc-ink); border: 1px solid var(--cc-border-strong); }
.btn-secondary:hover { background: var(--cc-surface-2); border-color: var(--cc-ink-faint); }
.btn-text { color: var(--cc-accent); padding: 8px 4px; min-height: 44px; }
.btn-text:hover { color: var(--cc-ink); }

/* ─── Header / nav ──────────────────────────────────────────────────────── */
.nav {
  position: sticky; top: 0; z-index: var(--cc-z-nav);
  background: color-mix(in srgb, var(--cc-bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--cc-dur-base), background var(--cc-dur-base);
}
.nav.scrolled { border-bottom-color: var(--cc-border); background: color-mix(in srgb, var(--cc-bg) 92%, transparent); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 15px; }
.nav-left { display: flex; align-items: center; gap: 28px; }
.nav-links { display: flex; gap: 22px; }
.nav-links a { color: var(--cc-ink-mute); font-size: var(--cc-fs-sm); transition: color var(--cc-dur-fast); }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--cc-ink); }
.nav-right { display: flex; align-items: center; gap: 12px; }

.logo { display: inline-flex; align-items: center; gap: 10px; }
.logo-mark { width: 28px; height: 28px; flex: 0 0 auto; }
.logo-mark svg { width: 100%; height: 100%; display: block; }
.logo-word { font-weight: var(--cc-w-semibold); font-size: 20px; letter-spacing: -0.03em; color: var(--cc-ink); }
.logo-word b { font-weight: var(--cc-w-bold); color: var(--cc-accent); }

.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--cc-r-pill);
  color: var(--cc-ink-mute); transition: color var(--cc-dur-fast), background var(--cc-dur-fast);
}
.theme-toggle:hover { color: var(--cc-accent); background: var(--cc-surface-2); }
.theme-toggle svg { width: 18px; height: 18px; }

/* ─── Section head ──────────────────────────────────────────────────────── */
.sec-head { display: flex; flex-direction: column; gap: 12px; max-width: 760px; }
.sec-head.center { margin-inline: auto; align-items: center; text-align: center; }
.sec-head h2 { font-size: var(--cc-fs-h2); }

/* ─── Subtle hover lift (interactive regions, not text) ─────────────────── */
.hoverable { transition: translate var(--cc-dur-base) var(--cc-ease-out); translate: 0 0; }
@media (hover: hover) { .hoverable:hover { translate: 0 calc(var(--cc-hover-lift) * -1); } }

/* ─── Compliance band + footer (shared) ─────────────────────────────────── */
.compliance { background: var(--cc-surface); border-top: 1px solid var(--cc-border); }
.compliance .wrap { display: flex; flex-direction: column; gap: 16px; padding-block: 40px; }
.compliance-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.compliance-head a { color: var(--cc-accent); font-size: var(--cc-fs-sm); }
.compliance-items { display: flex; flex-wrap: wrap; gap: 14px 32px; }
.compliance-items .ci { display: inline-flex; align-items: center; gap: 10px; color: var(--cc-ink-soft); font-size: var(--cc-fs-sm); }
.compliance-items .ci svg { width: 22px; height: 22px; color: var(--cc-accent); flex: 0 0 auto; }
.compliance .fine { font-size: var(--cc-fs-sm); color: var(--cc-ink-mute); }
.compliance .fine a { color: var(--cc-accent); }

.footer { background: var(--cc-bg-deep); color: #AEB8B6; padding-top: var(--cc-space-16); }
.footer a { color: #AEB8B6; transition: color var(--cc-dur-fast); }
.footer a:hover { color: #EDF1F0; }
.footer-cols { display: grid; gap: 40px; grid-template-columns: 1fr; padding-bottom: var(--cc-space-16); }
@media (min-width: 720px) { .footer-cols { grid-template-columns: 2fr 1fr 1fr 1fr; } }
.footer .logo-word { color: #EDF1F0; }
.footer .logo-word b { color: var(--cc-accent); }
.footer .blurb { color: #8A938B; font-size: var(--cc-fs-sm); line-height: 1.6; max-width: 38ch; margin-top: 14px; }
.footer h4 { color: #EDF1F0; font-size: var(--cc-fs-sm); font-weight: var(--cc-w-semibold); margin-bottom: 14px; }
.footer ul { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.footer ul a { font-size: var(--cc-fs-sm); }
.footer-base { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-block: 24px; border-top: 1px solid #23272E; font-size: var(--cc-fs-xs); color: #6C7480; }

/* ─── Product tilt-and-settle frame (shared) ────────────────────────────────
   Reusable across pages. The scroll controller in home.js drives --settle from
   0 (tilted, entering) to 1 (flat, settled). A page sets --pf-aspect to match
   its screenshot so there is no crop and no layout shift. Default settled so a
   no-JS render is flat and legible. */
.product-scroll { position: relative; width: 100%; max-width: min(860px, 100%); margin-inline: auto; }
.pf-stage { perspective: var(--cc-perspective); overflow-x: clip; }
.product-frame {
  --settle: 1;
  width: 100%; margin-inline: auto; transform-origin: center top;
  transform-style: preserve-3d;
  transform:
    rotateX(calc(var(--cc-tilt-start) * (1 - var(--settle))))
    scale(calc(var(--cc-tilt-scale-start) - (var(--cc-tilt-scale-start) - var(--cc-tilt-scale-end)) * var(--settle)))
    translateY(calc(var(--cc-tilt-rise) * (1 - var(--settle)) * -1));
  will-change: transform;
}
.pf-chrome { border-radius: var(--cc-r-lg); overflow: hidden; border: 1px solid var(--cc-border-strong); background: var(--cc-surface); box-shadow: var(--cc-shadow-lg); }
.pf-media { position: relative; aspect-ratio: var(--pf-aspect, 1600 / 905); background: var(--cc-bg-deep); }
.pf-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top center; opacity: 0; transition: opacity var(--cc-dur-slow) var(--cc-ease-out); }
.pf-media img.active { opacity: 1; }

/* ─── Mobile nav (menu built by theme.js) ───────────────────────────────── */
.nav .btn { white-space: nowrap; }
.nav-menu-toggle { display: none; }
.nav-menu[hidden] { display: none; }
@media (max-width: 900px) {
  .nav.has-menu .nav-links { display: none; }
  .nav-inner { gap: 10px; }
  .nav-left { min-width: 0; }
  .nav-right { gap: 6px; flex: 0 0 auto; }
  .nav.has-menu .nav-right .btn-text, .nav.has-menu .nav-right .theme-toggle { display: none; }
  .nav-right .btn { padding: 10px 14px; font-size: 0.9375rem; min-height: 44px; }
  .logo-word { font-size: 18px; }
  .nav-menu-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; border-radius: var(--cc-r-sm);
    color: var(--cc-ink); border: 1px solid var(--cc-border-strong); background: transparent;
  }
  .nav-menu-toggle svg { width: 20px; height: 20px; }
  .nav.menu-open { border-bottom-color: var(--cc-border); background: var(--cc-bg); }
  .nav-menu { border-top: 1px solid var(--cc-border); background: var(--cc-bg); }
  .nav-menu-links { display: flex; flex-direction: column; padding: 8px var(--cc-gutter, 20px) 16px; }
  .nav-menu-links a, .nav-menu-links button {
    display: flex; align-items: center; min-height: 48px; padding: 0 4px;
    font: inherit; font-size: var(--cc-fs-body); color: var(--cc-ink); text-align: left;
    background: none; border: 0; border-bottom: 1px solid var(--cc-border-soft); cursor: pointer;
  }
  .nav-menu-links a[aria-current="page"] { color: var(--cc-accent); }
  .nav-menu-links .nav-menu-signin { color: var(--cc-accent); }
  .nav-menu-links .nav-menu-theme { color: var(--cc-ink-mute); border-bottom: 0; }
}
.nav-menu-cta { display: none; }
@media (max-width: 420px) {
  .nav-inner { padding-inline: 16px; }
  .nav.has-menu .nav-right .btn-primary { display: none; }
  .nav-menu-links .nav-menu-cta {
    display: flex; justify-content: center; margin: 8px 0 6px; border-bottom: 0;
    color: var(--cc-accent-on-fill); background: var(--cc-accent-fill); border-radius: var(--cc-r-sm);
  }
  .nav-menu-links { padding-inline: 16px; }
  .nav:not(.has-menu) .nav-right .btn-text { display: none; }
}
@media (max-width: 760px) {
  .nav-links { display: none; }
  .product-frame { transform: translateY(calc(var(--cc-tilt-rise) * (1 - var(--settle)) * -0.4)); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .product-frame { transform: none; }
  .pf-media img { transition: none; }
}
