/* ============================================
   RESPONSIVE STYLES
   All media queries for tablet, mobile, and accessibility
   ============================================ */

/* ============================================
   RESPONSIVE: TABLET (max-width: 900px)
   - Hamburger visible, nav collapses to dropdown
   - Hero grid stacks
   - Grids go 2-column
   - KPIs go 2x2
   ============================================ */
@media (max-width: 900px) {
  .hamburger {
    display: inline-flex;
    align-items: center;
    order: 10;
    margin-left: 0.45rem;
  }

  .brand {
    order: 1;
    margin-right: auto;
  }

  .cta-row {
    display: inline-flex;
    gap: 0.5rem;
    order: 2;
  }

  .cta-row .btn {
    font-size: 0.82rem;
    padding: 0.65rem 0.85rem;
  }

  .topbar-row {
    position: relative;
    flex-direction: row;
    align-items: center;
    flex-wrap: nowrap;
  }

  /* Nav becomes dropdown */
  .nav-links {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 1rem;
    right: 1rem;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(246, 251, 255, 0.96));
    backdrop-filter: blur(16px) saturate(140%);
    flex-direction: column;
    gap: 0.2rem;
    box-shadow:
      0 20px 50px rgba(10, 37, 64, 0.15),
      0 0 0 1px rgba(15, 23, 42, 0.08);
    border-radius: 18px;
    padding: 0.8rem;
    display: none !important;
    z-index: 99;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    border: 1px solid rgba(13, 148, 136, 0.1);
    animation: menu-slide-in 280ms cubic-bezier(0.16, 1, 0.3, 1);
  }

  .nav-links.is-open {
    display: flex !important;
  }

  .nav-links a {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    text-align: left;
    font-size: 0.92rem;
    font-weight: 600;
    transition:
      background 180ms ease,
      color 180ms ease,
      transform 140ms ease;
  }

  .nav-links a:hover,
  .nav-links a.active {
    background: linear-gradient(90deg, rgba(13, 148, 136, 0.12), rgba(11, 95, 255, 0.08));
    color: var(--ink);
    transform: translateX(2px);
  }

  .nav-cta-mobile {
    display: none;
  }

  /* Hero grid stacks at tablet */
  .hero-grid {
    grid-template-columns: 1fr;
  }

  /* Grids go 2-column */
  .split,
  .split-70,
  .grid-4,
  .grid-3,
  .grid-2,
  .kpis,
  .badge-grid,
  .about-highlight-mosaic,
  .about-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.1rem 1rem;
  }

  /* Story rail hidden on smaller screens */
  .story-rail {
    display: none;
  }

  /* Hero adjustments */
  .hero::after {
    width: 300px;
    height: 300px;
    top: 60px;
  }

  /* Comparison table stacks */
  .compare-head {
    display: none;
  }

  .compare-row {
    grid-template-columns: 1fr;
    gap: 0.45rem;
  }

  .compare-capability {
    padding-left: 0.2rem;
  }

  .compare-value {
    text-align: left;
  }

  .compare-value::before {
    content: attr(data-label) ' ';
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-right: 0.35rem;
    opacity: 0.85;
  }

  /* Climax section responsive */
  .climax-section {
    min-height: 56vh;
  }

  .chapter-hud {
    left: auto;
    right: 1rem;
    bottom: 1rem;
    justify-content: flex-start;
  }
}

/* ============================================
   RESPONSIVE: MOBILE (max-width: 639px)
   - Desktop CTAs hidden, mobile CTAs in menu
   - All grids single-column
   - Full-width buttons
   - Increased touch targets
   ============================================ */
@media (max-width: 639px) {
  /* Hide desktop CTA row */
  .cta-row {
    display: none !important;
  }

  /* Show CTAs inside hamburger menu */
  .nav-cta-mobile {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    width: 100%;
    padding: 0.8rem 0.5rem 0.3rem;
    margin-top: 0.5rem;
    border-top: 1px solid rgba(13, 148, 136, 0.15);
  }

  .nav-cta-mobile .btn {
    width: 100%;
    justify-content: center;
    text-align: center;
    font-size: 0.88rem;
    padding: 0.8rem 0.98rem;
  }

  /* All grids single-column */
  .hero-grid,
  .split,
  .split-70,
  .grid-4,
  .grid-3,
  .grid-2,
  .kpis,
  .about-highlight-mosaic,
  .about-stats,
  .footer-grid {
    grid-template-columns: 1fr;
  }

  /* About page responsive adjustments */
  .about-highlight-tile,
  .about-highlight-tile-featured {
    grid-column: span 1;
    min-height: auto;
  }

  /* Badge grid stays 2-col for compactness */
  .badge-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Chapter adjustments */
  .chapter::before {
    left: 1rem;
    top: 0.75rem;
    font-size: 0.66rem;
  }

  .chapter-hud {
    left: auto;
    right: 1rem;
    bottom: 1rem;
    justify-content: flex-start;
  }

  /* Hero mobile optimization */
  .hero {
    padding-top: 2.8rem;
  }

  .hero,
  .subhead {
    min-height: 3em;
  }

  .hero-cycler-word {
    display: inline-block;
    padding: 0.14rem 0.48rem;
    border-radius: 999px;
    background: linear-gradient(
      90deg,
      rgba(13, 148, 136, 0.2),
      rgba(11, 95, 255, 0.18),
      rgba(234, 88, 12, 0.2)
    );
    color: #0f172a;
    min-width: 11ch; /* was 5.9ch — now fits "with confidence" */
    text-align: center;
  }

  h1 {
    max-width: 100%;
  }

  .hero-actions {
    flex-direction: column;
  }

  .hero-actions .btn {
    width: 100%;
    justify-content: center;
  }

  /* Touch target optimization */
  .hamburger {
    padding: 0.5rem;
  }

  /* Typography adjustments */
  .code {
    font-size: 0.78rem;
  }

  .feature,
  .hero-card,
  .cta {
    padding: 1rem;
  }

  .section-intro {
    color: #1f3346;
    line-height: 1.68;
  }

  .feature p,
  .feature li,
  .microcopy {
    color: #334155;
    line-height: 1.62;
  }

  .muted-link {
    color: #334155;
  }

  .footer .section-intro {
    color: #334155;
  }

  .footer .microcopy,
  .footer-meta p,
  .footer-meta-links a {
    color: #475569;
  }

  .footer {
    padding: 1.7rem 0 1.9rem;
  }

  .footer-meta {
    align-items: flex-start;
    flex-direction: column;
  }

  .metric-strip {
    gap: 0.45rem;
  }

  .pill {
    padding: 0.42rem 0.6rem;
    font-size: 0.76rem;
  }

  .climax-section {
    min-height: 50vh;
    max-height: 90vh;
  }

  .climax-wrap {
    padding: 1.5rem 0;
  }

  .climax-subtitle {
    font-size: 0.92rem;
  }
}

@media (max-width: 480px) {
  .container {
    width: calc(100% - 1.5rem);
  }

  .topbar-row {
    padding: 0.75rem 0;
    gap: 0.4rem;
  }

  .brand {
    font-size: 0.9rem;
    gap: 0.5rem;
  }

  .brand-mark {
    width: 26px;
    height: 26px;
  }

  .hamburger {
    padding: 0.4rem 0.5rem;
    margin-left: 0.25rem;
  }

  .hamburger-box {
    width: 24px;
    height: 20px;
  }

  .hamburger-inner {
    width: 24px;
    height: 3px;
  }

  .hamburger-inner::before,
  .hamburger-inner::after {
    width: 24px;
    height: 3px;
  }

  .nav-links {
    left: 0.5rem;
    right: 0.5rem;
    padding: 0.6rem;
    gap: 0.15rem;
  }

  .nav-links a {
    padding: 0.65rem 0.85rem;
    font-size: 0.87rem;
  }

  .nav-cta-mobile {
    padding: 0.6rem 0.4rem 0.25rem;
    gap: 0.5rem;
  }

  .nav-cta-mobile .btn {
    font-size: 0.84rem;
    padding: 0.7rem 0.85rem;
  }

  h1 {
    font-size: clamp(1.75rem, 9vw, 2.2rem);
    letter-spacing: -0.015em;
  }

  h2 {
    font-size: clamp(1.35rem, 5.5vw, 1.8rem);
  }

  h3 {
    font-size: clamp(1.05rem, 4vw, 1.25rem);
  }

  .btn {
    font-size: 0.84rem;
    padding: 0.68rem 0.85rem;
    gap: 0.35rem;
  }

  .hero {
    padding-top: 2.2rem;
    padding-bottom: clamp(1.2rem, 3vw, 1.6rem);
  }

  .hero::after {
    width: 240px;
    height: 240px;
    top: 40px;
    right: -40px;
  }

  .hero-actions {
    margin-top: 1.1rem;
    gap: 0.55rem;
  }

  .section {
    padding: clamp(1.8rem, 5vw, 2.45rem) 0;
  }

  .feature,
  .hero-card,
  .card {
    padding: 0.85rem;
  }

  .feature h3,
  .hero-card h3 {
    font-size: 0.98rem;
  }

  .feature p,
  .feature li {
    font-size: 0.88rem;
  }

  .code {
    font-size: 0.75rem;
    padding: 0.7rem;
    border-radius: 12px;
  }

  .chapter-hud {
    left: auto;
    right: 0.75rem;
    padding: 0.4rem 0.55rem;
    gap: 0.45rem;
  }

  .chapter-hud-index {
    width: 26px;
    height: 22px;
    font-size: 0.7rem;
  }

  .chapter-hud-title {
    font-size: 0.8rem;
  }

  .badge-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }

  .badge {
    padding: 0.55rem 0.65rem;
    font-size: 0.78rem;
  }

  .eyebrow {
    font-size: 0.7rem;
    gap: 0.35rem;
  }

  .microcopy {
    font-size: 0.82rem;
  }

  .subhead {
    font-size: 0.92rem;
  }

  .footer {
    padding: 1.5rem 0 1.7rem;
  }

  .footer h4 {
    font-size: 0.7rem;
  }

  .footer a,
  .footer p {
    font-size: 0.84rem;
  }

  .back-to-top {
    min-width: 44px;
    min-height: 36px;
    padding: 0.4rem 0.65rem;
    font-size: 0.74rem;
    right: 0.75rem;
    bottom: 0.75rem;
  }

  .skip-link {
    font-size: 0.78rem;
    padding: 0.45rem 0.6rem;
  }

  .climax-section {
    min-height: 44vh;
    max-height: 85vh;
  }

  .climax-kicker {
    font-size: 0.68rem;
  }

  .climax-subtitle {
    font-size: 0.86rem;
  }
}

@media (max-width: 360px) {
  .container{
    width: calc(100% - 1rem);
  }

  .topbar-row {
    padding: 0.65rem 0;
    gap: 0.3rem;
  }

  .brand {
    font-size: 0.88rem;
    gap: 0.45rem;
  }

  .brand-mark {
    width: 24px;
    height: 24px;
  }

  .hamburger {
    padding: 0.35rem 0.4rem;
  }

  h1 {
    font-size: clamp(1.6rem, 8.5vw, 1.9rem);
  }

  .hero {
    padding-top: 2rem;
  }

  .btn {
    font-size: 0.82rem;
    padding: 0.65rem 0.75rem;
  }

  .section {
    padding: 1.6rem 0;
  }

  .climax-section {
    min-height: 40vh;
    max-height: 80vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }

  .scroll-reveal {
    opacity: 1;
    transform: none;
  }

  .hero-constellation,
  .global-constellation,
  .hero.hero-spotlight::before {
    display: none;
  }

  .back-to-top {
    transition: none;
  }

  body.has-intro-motion .topbar,
  body.has-intro-motion main,
  body.has-intro-motion .footer,
  body.has-intro-motion.is-ready .topbar,
  body.has-intro-motion.is-ready main,
  body.has-intro-motion.is-ready .footer {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
