/* ── Sabaki Landing — Shared Styles ──────────────────────────────────────────
   Shared across landing page and all product pages.
   ──────────────────────────────────────────────────────────────────────────── */

/* ── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Landing Feature Tokens ───────────────────────────────────────────────
 * Base tokens (--bg, --surface, --accent, --text, --border, --radius-*,
 * --shadow-*) live in design-tokens.css (v4.3.6 single source of truth).
 * THIS FILE declares ONLY landing-page-specific feature tokens — nav/page
 * geometry, font aliases, section gap.
 * ──────────────────────────────────────────────────────────────────────── */
:root {
  /* Font aliases — shared.css predates design-tokens.css naming. Kept for
   * backward support for inline <style> blocks in product pages that use
   * var(--font-sans) / var(--font-system). */
  --font-sans: var(--font-family-sans);
  --font-system: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;

  /* Landing layout geometry */
  --section-gap: clamp(64px, 10vw, 120px);
  --content-max: 1200px;
  --nav-height: 64px;
}

/* ── Base ─────────────────────────────────────────────────────────────────── */
html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* v4.19 Prompt 02 §G — Focus Not Obscured (WCAG 2.4.11 AA, new in WCAG 2.2).
 * The sticky .nav (height: var(--nav-height) = 64px) can
 * overlap focused / anchored elements that sit near the top of the viewport.
 * scroll-margin pushes the scroll target down so the focus ring and the
 * target itself are fully visible below the nav. Matches nav-height + a
 * 16px breathing gap. */
:target,
:focus-visible {
  scroll-margin-top: calc(var(--nav-height, 64px) + 16px);
  scroll-margin-bottom: 60px;
}
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
img, svg { display: block; max-width: 100%; }

/* ── Skip Link ───────────────────────────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  background: var(--accent);
  color: var(--bg);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius);
  font-weight: var(--font-weight-bold);
  z-index: var(--z-modal);
  transition: top var(--duration-normal) var(--ease-out);
}
.skip-link:focus { top: 8px; }

/* ── Utilities ────────────────────────────────────────────────────────────── */
.container { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--space-5); }
.text-accent { color: var(--accent); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.gradient-text {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-weight: var(--font-weight-bold);
  border-radius: var(--radius-full);
  transition: background-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out), transform 150ms var(--ease-out);
  white-space: nowrap;
}
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button[data-sabaki-button-loading="true"],
.btn[data-sabaki-button-loading="true"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.sabaki-button-spinner {
  width: 1em;
  height: 1em;
  flex: 0 0 auto;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 9999px;
  animation-name: sabaki-button-spinner-orbit;
  animation-duration: 0.8s;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

@keyframes sabaki-button-spinner-orbit {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .sabaki-button-spinner {
    animation-name: none;
    animation-duration: 0s;
  }
}
/* Shared focus-visible utility for interactive nav + footer + mobile-menu surfaces.
 * WCAG 2.2 SC 2.4.7 (Focus Visible, Level AA) + SC 2.4.11 (Focus Appearance, Level AA).
 * Matches the 2px / 2px-offset convention from .btn:focus-visible; accent teal on
 * dark bg is 14.82:1 (see design-tokens.css). Single compound selector per
 * frontend.md CSS-scoping — avoid copy-pasting six near-identical rules. */
.nav-link:focus-visible,
.nav-login:focus-visible,
.nav-logo:focus-visible,
.nav-hamburger:focus-visible,
.footer-link:focus-visible,
.mobile-menu-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius);
}
.btn-primary {
  background: var(--accent);
  color: var(--bg);
  padding: var(--space-3) 28px;
  font-size: 1rem;
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-glow);
}
.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: var(--space-3) 28px;
  font-size: 1rem;
}
.btn-secondary:hover {
  background: var(--accent-subtle);
  color: var(--text);
  border-color: var(--border-hover);
}
.btn-sm { padding: var(--space-2) 20px; font-size: var(--text-base); }
.btn-nav {
  min-height: 40px;
  padding: var(--space-2) 20px;
  font-size: var(--text-base);
  font-weight: var(--font-weight-bold);
}

/* ── Navigation ──────────────────────────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  z-index: var(--z-sticky);
  transition: background var(--duration-normal) var(--ease-out), border-color var(--duration-normal) var(--ease-out);
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: rgba(9, 9, 11, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom-color: var(--border);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--space-5);
}
.nav-logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  font-family: 'Manrope', system-ui, sans-serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.nav-links { display: none; align-items: center; gap: var(--space-1); }
.nav-link {
  position: relative;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: var(--space-2) 14px;
  font-size: var(--text-base);
  color: var(--text-secondary);
  border-radius: var(--radius);
  transition: color var(--duration-fast) var(--ease-out), background var(--duration-fast) var(--ease-out);
}
.nav-link:hover { color: var(--text); background: var(--accent-subtle); }
.nav-actions { display: none; align-items: center; gap: var(--space-2); }
.nav-login {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  color: var(--text-secondary);
  font-size: var(--text-base);
  padding: var(--space-2) 14px;
  border-radius: var(--radius);
  transition: color var(--duration-fast) var(--ease-out);
}
.nav-login:hover { color: var(--text); }

/* Hamburger */
.nav-hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  /* gap: 5px is sub-scale; cosmetic on the hamburger icon — left as literal */
  gap: 5px;
  width: 44px; height: 44px;
  padding: var(--space-3);
}
.nav-hamburger span {
  display: block;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
  transition: transform var(--duration-normal) var(--ease-out), opacity var(--duration-normal) var(--ease-out);
}
.nav-hamburger[aria-expanded="true"] span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.nav-hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-hamburger[aria-expanded="true"] span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* Mobile menu */
.mobile-menu {
  display: none;
  position: fixed;
  inset: var(--nav-height) 0 0 0;
  background: var(--bg);
  /* Mobile menu must sit behind the fixed .nav so the hamburger stays clickable
   * while the menu overlay is visible. See index.html nav structure. */
  z-index: calc(var(--z-sticky) - 1);
  overflow-y: auto;
  padding: var(--space-5);
}
.mobile-menu.open { display: block; }
.mobile-menu-section { border-bottom: 1px solid var(--border); padding: var(--space-4) 0; }
.mobile-menu-heading {
  font-size: var(--text-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0 0 var(--space-2) 0;
}
.mobile-menu-item { display: block; padding: var(--space-3) 0; color: var(--text); font-size: 1rem; }
.mobile-menu-item-desc { display: block; color: var(--text-muted); font-size: var(--text-sm); margin-top: var(--space-1); }
.mobile-menu-actions { padding: var(--space-5) 0; display: flex; flex-direction: column; gap: var(--space-3); }

/* ── Section shared ──────────────────────────────────────────────────────── */
.section { padding: var(--section-gap) var(--space-5); }
.section-heading {
  font-size: clamp(1.75rem, 3vw, 2.75rem);
  font-weight: var(--font-weight-extrabold);
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: var(--space-4);
}
.section-sub {
  font-size: clamp(1rem, 1.2vw, 1.15rem);
  color: var(--text-secondary);
  max-width: 600px;
  line-height: 1.6;
  margin-bottom: var(--space-8);
}

/* ── Feature Cards ───────────────────────────────────────────────────────── */
.features-grid { display: grid; gap: var(--space-5); grid-template-columns: 1fr; }
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  transition: transform var(--duration-normal) var(--ease-out), box-shadow var(--duration-normal) var(--ease-out), border-color var(--duration-normal) var(--ease-out);
}
.feature-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-hover);
}
.feature-icon {
  /* 44x44 is intentional — WCAG 2.5.8 touch target */
  width: 44px; height: 44px;
  border-radius: var(--radius);
  background: var(--accent-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-5);
  color: var(--accent);
}
.feature-icon svg { width: 22px; height: 22px; }
.feature-title { font-size: var(--text-lg); font-weight: var(--font-weight-bold); margin-bottom: var(--space-2); }
.feature-desc { font-size: var(--text-base); color: var(--text-secondary); line-height: 1.6; }

/* ── CTA Section ─────────────────────────────────────────────────────────── */
.cta-section {
  position: relative;
  text-align: center;
  padding: var(--section-gap) var(--space-5);
  overflow: hidden;
}
.cta-glow {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 600px; height: 400px;
  background: radial-gradient(ellipse, var(--accent-glow) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}
.cta-content { position: relative; z-index: 1; max-width: 560px; margin: 0 auto; }
.cta-heading {
  font-size: clamp(1.75rem, 3vw, 2.75rem);
  font-weight: var(--font-weight-extrabold);
  letter-spacing: -0.02em;
  margin-bottom: var(--space-4);
}
.cta-sub {
  font-size: clamp(1rem, 1.2vw, 1.15rem);
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: var(--space-6);
}
.cta-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-3); margin-bottom: var(--space-4); }
.cta-trust { font-size: var(--text-sm); color: var(--text-muted); }

/* ── Footer ───────────────────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  padding: var(--space-10) var(--space-5) var(--space-8);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-8);
  max-width: var(--content-max);
  margin: 0 auto;
}
.footer-brand-name {
  font-family: var(--font-system);
  font-size: 1.3rem;
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--space-2);
}
.footer-brand-desc { font-size: var(--text-base); color: var(--text-secondary); margin-bottom: var(--space-3); line-height: 1.5; }
.footer-copyright { font-size: var(--text-xs); color: var(--text-muted); }
.footer-col-heading {
  font-size: var(--text-xs);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text);
  margin-bottom: var(--space-4);
}
.footer-links { list-style: none; display: flex; flex-direction: column; gap: var(--space-2); }
.footer-link {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  font-size: var(--text-base);
  color: var(--text-secondary);
  transition: color var(--duration-fast) var(--ease-out);
}
.footer-link:hover { color: var(--accent); }

/* ── Responsive ───────────────────────────────────────────────────────────── */
/* --bp-md: 640px */
@media (min-width: 640px) {
  .features-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 2fr 1fr; }
}
/* --bp-xl: 1024px */
@media (min-width: 1024px) {
  .nav-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  }
  .nav-logo { justify-self: start; }
  .nav-links {
    display: flex;
    justify-self: center;
    transform: translateX(-12px);
  }
  .nav-actions {
    display: flex;
    justify-self: end;
  }
  .nav-hamburger { display: none; }
  .features-grid-3 { grid-template-columns: repeat(3, 1fr); }
}

/* v4.3.7 — small phone refinement (≤ 480px). Keeps mobile menu items
 * at 44px tap height AND ensures the mobile menu width fits iPhone SE.
 * See historical plan v4.3.7-premortem.md §R5 + §I4. */
/* --bp-sm: 480px */
@media (max-width: 480px) {
  .mobile-menu { padding: var(--space-4); }
  .mobile-menu-item { min-height: 44px; padding: var(--space-3) 0; }
  .nav-login { min-height: 44px; display: flex; align-items: center; }
  .btn { min-height: 44px; }
}

/* v4.3.7 — on landing + product pages, touch targets ≥ 44px at ≤ 768px
 * for every nav link, hero button, and CTA. */
/* --bp-lg: 768px */
@media (max-width: 768px) {
  .nav-link,
  .nav-login,
  .btn,
  .btn-primary,
  .btn-secondary {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
  /* mobile menu overrides — the menu is already display: none above,
   * but when it's open on tablet-landscape we want 44px rows too. */
  .mobile-menu-item { min-height: 44px; }
}

/* ── Reduced Motion ──────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
}

/* ── Scroll Reveal ───────────────────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--duration-slow) var(--ease-out),
              transform var(--duration-slow) var(--ease-out);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── v4.19: Scale-on-press tactile feedback ───────────────────────────── */
.btn:active,
.btn-primary:active,
.btn-secondary:active,
.btn-sm:active,
.btn-nav:active {
  transform: scale(0.96);
}

@media (prefers-reduced-motion: reduce) {
  .btn:active,
  .btn-primary:active,
  .btn-secondary:active,
  .btn-sm:active,
  .btn-nav:active {
    transform: none;
  }
}
