/* ================================================================
   BOOMY MARKETING — Shared CSS
   Version: 3.1 | 2026-04-14
   Features: CSS @layer · Design Tokens · clamp() fluid type ·
             Container Queries (stats, footer) · :has() body lock
   Compatibility: Chrome 105+ · Firefox 110+ · Safari 16+
================================================================ */

/* ================================================================
   CSS LAYER ARCHITECTURE
================================================================ */
@layer reset, tokens, base, layout, components, utilities;

/* ================================================================
   DESIGN TOKENS
================================================================ */
@layer tokens {
  :root {
    /* Brand colours */
    --bg-deep:       #2D1B69;
    --bg-darker:     #1a0f3e;
    --bg-darkest:    #100930;
    --accent-orange: #FF6B35;
    --accent-yellow: #FFD23F;
    --accent-purple: #7C3AED;
    --text-primary:  #FFFFFF;
    --text-sec:      rgba(255,255,255,0.7);
    --text-muted:    rgba(255,255,255,0.45);
    --card-bg:       rgba(255,255,255,0.08);
    --card-border:   rgba(255,255,255,0.12);

    /* Layout */
    --nav-h: 72px;
    --r-sm:  8px;
    --r-md:  16px;
    --r-lg:  24px;
    --r-xl:  32px;

    /* Spacing scale */
    --space-xs:  0.25rem;
    --space-sm:  0.5rem;
    --space-md:  1rem;
    --space-lg:  1.5rem;
    --space-xl:  2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;

    /* Fluid typography */
    --text-xs:   clamp(0.75rem,  1.5vw,  0.875rem);
    --text-sm:   clamp(0.875rem, 1.8vw,  1rem);
    --text-base: clamp(1rem,     2vw,    1.125rem);
    --text-lg:   clamp(1.125rem, 2.5vw,  1.25rem);
    --text-xl:   clamp(1.25rem,  3vw,    1.5rem);
    --text-2xl:  clamp(1.5rem,   4vw,    2rem);
    --text-3xl:  clamp(2rem,     5vw,    3rem);
    --text-hero: clamp(2.5rem,   6vw,    4.5rem);

    /* Motion */
    --ease:            cubic-bezier(0.4,0,0.2,1);
    --transition-fast: 150ms var(--ease);
    --transition-base: 250ms var(--ease);
    --transition-slow: 400ms var(--ease);

    /* Z-index scale */
    --z-base:     0;
    --z-raised:   10;
    --z-dropdown: 100;
    --z-sticky:   200;
    --z-modal:    300;
    --z-toast:    400;
  }
}

/* ================================================================
   RESET
================================================================ */
@layer reset {
  *, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
}

/* ================================================================
   BASE
================================================================ */
@layer base {
  html { scroll-behavior: smooth; }

  body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-darkest);
    color: var(--text-primary);
    overflow-x: hidden;
    line-height: 1.6;
    -webkit-tap-highlight-color: transparent;
  }

  /* :has() scroll-lock — progressive enhancement */
  body:has(.mobile-menu.open) { overflow: hidden; }

  h1, h2, h3, h4 { line-height: 1.15; font-weight: 800; }

  /* Prevent iOS input zoom */
  input, select, textarea { font-size: max(16px, 1rem); }

  a { color: var(--accent-orange); text-decoration: none; }
}

/* ================================================================
   ACCESSIBILITY
================================================================ */
@layer utilities {
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
      scroll-behavior: auto !important;
    }
  }

  .skip-nav {
    position: absolute;
    top: -100%;
    left: 1rem;
    z-index: var(--z-toast);
    padding: 0.75rem 1.5rem;
    background: var(--accent-orange);
    color: #fff;
    font-weight: 700;
    border-radius: 0 0 var(--r-sm) var(--r-sm);
    text-decoration: none;
    transition: top var(--transition-base);
  }
  .skip-nav:focus { top: 0; }

  :focus-visible {
    outline: 2px solid var(--accent-orange);
    outline-offset: 3px;
    border-radius: 4px;
  }

  .sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
  }

  @media print {
    .navbar, .footer-socials, #starfield, #progressBar, .skip-nav,
    .nav-hamburger, .hamburger, .mobile-menu, .btn-ghost { display: none !important; }
    body { color: #000; background: #fff; }
    a[href]::after { content: " (" attr(href) ")"; font-size: 0.8em; }
  }
}

/* ================================================================
   PROGRESS BAR
================================================================ */
@layer components {
  .progress-bar {
    position: fixed;
    top: 0; left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-orange), var(--accent-yellow));
    z-index: var(--z-toast);
    width: 0%;
    transition: width 0.05s linear;
  }
}

/* ================================================================
   STARFIELD CANVAS
================================================================ */
@layer layout {
  #starfield {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: var(--z-base);
    pointer-events: none;
  }
  .site-wrapper { position: relative; z-index: 1; }
}

/* ================================================================
   TYPOGRAPHY UTILITIES
================================================================ */
@layer utilities {
  .gradient-text {
    background: linear-gradient(135deg, var(--accent-orange), var(--accent-yellow));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }

  .section-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--accent-orange);
    background: rgba(255,107,53,0.12);
    border: 1px solid rgba(255,107,53,0.3);
    padding: 6px 14px;
    border-radius: 100px;
    margin-bottom: 20px;
  }

  .section-title {
    font-size: clamp(2rem, 4.5vw, 3.5rem);
    font-weight: 800;
    margin-bottom: 16px;
  }

  .section-sub {
    font-size: 1.05rem;
    color: var(--text-sec);
    max-width: 560px;
    line-height: 1.7;
  }
}

/* ================================================================
   BUTTONS
================================================================ */
@layer components {
  .btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 15px 32px;
    border-radius: 100px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: transform var(--transition-base), box-shadow var(--transition-base);
    text-decoration: none;
    white-space: nowrap;
    font-family: 'Inter', sans-serif;
    position: relative;
    overflow: hidden;
    min-height: 48px;
    justify-content: center;
  }

  .btn-primary {
    background: linear-gradient(135deg, var(--accent-orange), #e55a28);
    color: #fff;
    box-shadow: 0 8px 32px rgba(255,107,53,0.4);
  }
  .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 44px rgba(255,107,53,0.55);
    color: #fff;
  }

  .btn-ghost {
    background: transparent;
    color: #fff;
    border: 2px solid rgba(255,255,255,0.3);
  }
  .btn-ghost:hover {
    border-color: rgba(255,255,255,0.75);
    transform: translateY(-2px);
    color: #fff;
  }
}

/* ================================================================
   NAVBAR
================================================================ */
@layer components {
  .navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: var(--z-sticky);
    height: var(--nav-h);
    display: flex;
    align-items: center;
    padding: 0 5%;
    background: rgba(16,9,48,0.65);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    transition: background var(--transition-base);
  }
  .navbar.scrolled { background: rgba(16,9,48,0.93); }

  .nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
  }

  .nav-logo {
    font-family: 'Berkshire Swash', cursive;
    font-size: 1.7rem;
    text-decoration: none;
    color: #fff;
  }
  .nav-logo span {
    background: linear-gradient(135deg, var(--accent-orange), var(--accent-yellow));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }

  .nav-links {
    display: flex;
    align-items: center;
    gap: 36px;
    list-style: none;
  }
  .nav-links a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 0.93rem;
    font-weight: 500;
    transition: color var(--transition-fast);
    min-height: 48px;
    display: flex;
    align-items: center;
  }
  .nav-links a:hover { color: #fff; }

  .nav-cta {
    background: linear-gradient(135deg, var(--accent-orange), #e55a28) !important;
    color: #fff !important;
    padding: 9px 22px !important;
    border-radius: 100px !important;
    font-weight: 700 !important;
    box-shadow: 0 4px 20px rgba(255,107,53,0.35);
    min-height: unset !important;
  }
  .nav-cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 28px rgba(255,107,53,0.5) !important;
    color: #fff !important;
  }

  /* Hamburger */
  .nav-hamburger,
  .hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 8px;
    background: none;
    border: none;
    min-width: 48px;
    min-height: 48px;
    align-items: center;
    justify-content: center;
  }
  .nav-hamburger span,
  .hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform var(--transition-base), opacity 0.2s ease;
  }
  .nav-hamburger.open span:nth-child(1),
  .hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-hamburger.open span:nth-child(2),
  .hamburger.open span:nth-child(2) { opacity: 0; }
  .nav-hamburger.open span:nth-child(3),
  .hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  /* Mobile menu */
  .mobile-menu {
    display: none;
    position: fixed;
    top: var(--nav-h);
    left: 0; right: 0;
    background: rgba(16,9,48,0.97);
    backdrop-filter: blur(20px);
    padding: 20px 5%;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    z-index: calc(var(--z-sticky) - 1);
    flex-direction: column;
  }
  .mobile-menu.open { display: flex; }
  .mobile-menu a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 500;
    padding: 15px 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    transition: color var(--transition-fast);
    min-height: 48px;
    display: flex;
    align-items: center;
  }
  .mobile-menu a:last-child { border-bottom: none; color: var(--accent-orange); font-weight: 700; }
  .mobile-menu a:hover { color: var(--accent-orange); }
}

/* ================================================================
   SECTION LAYOUT
   NOTE: NO container-type here — it breaks positioned descendants
================================================================ */
@layer layout {
  .section { padding: 100px 5%; position: relative; }
  .section-header { text-align: center; margin-bottom: 64px; }
  .section-header .section-sub { margin: 0 auto; }
}

/* ================================================================
   PAGE HERO (interior pages)
================================================================ */
@layer components {
  .page-hero {
    min-height: 55vh;
    padding: calc(var(--nav-h) + 60px) 5% 80px;
    display: flex;
    align-items: center;
    background:
      radial-gradient(ellipse at 20% 50%, rgba(124,58,237,0.25) 0%, transparent 60%),
      radial-gradient(ellipse at 80% 30%, rgba(255,107,53,0.12) 0%, transparent 50%),
      linear-gradient(180deg, var(--bg-darker) 0%, var(--bg-deep) 50%, var(--bg-darkest) 100%);
  }
  .page-hero-inner { max-width: 1200px; margin: 0 auto; width: 100%; text-align: center; }
  .page-hero h1 {
    font-size: clamp(2.4rem, 5.5vw, 4.2rem);
    font-weight: 900;
    line-height: 1.08;
    margin-bottom: 24px;
    letter-spacing: -0.02em;
  }
  .page-hero p {
    font-size: 1.15rem;
    color: var(--text-sec);
    max-width: 640px;
    margin: 0 auto 40px;
    line-height: 1.75;
  }

  /* Breadcrumb */
  .breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    margin-bottom: 28px;
    font-size: 0.85rem;
    color: var(--text-muted);
  }
  .breadcrumb a { color: var(--text-muted); text-decoration: none; transition: color var(--transition-fast); }
  .breadcrumb a:hover { color: var(--accent-orange); }
  .breadcrumb span { color: var(--accent-orange); }
}

/* ================================================================
   STATS BAR — Container Queries on isolated component
================================================================ */
@layer components {
  .stats-bar {
    background: rgba(255,255,255,0.05);
    border-top: 1px solid rgba(255,255,255,0.08);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    backdrop-filter: blur(10px);
    padding: 30px 5%;
    /* container-type only on this isolated component — safe */
    container-type: inline-size;
    container-name: stats-bar;
  }

  .stats-inner {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
  }

  .stat-item {
    text-align: center;
    padding: 12px;
    position: relative;
  }
  .stat-item:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0; top: 50%;
    transform: translateY(-50%);
    width: 1px; height: 55%;
    background: rgba(255,255,255,0.12);
  }

  .stat-value {
    font-size: clamp(1.7rem, 3vw, 2.5rem);
    font-weight: 900;
    line-height: 1.1;
    background: linear-gradient(135deg, var(--accent-orange), var(--accent-yellow));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }
  .stat-label { font-size: 0.82rem; color: var(--text-sec); margin-top: 5px; font-weight: 500; }

  /* Container query — fires based on .stats-bar width */
  @container stats-bar (max-width: 680px) {
    .stats-inner { grid-template-columns: repeat(2, 1fr); }
    .stat-item:nth-child(2)::after { display: none; }
  }
  @container stats-bar (max-width: 380px) {
    .stats-inner { grid-template-columns: 1fr; }
    .stat-item::after { display: none; }
  }
}

/* ================================================================
   CTA SECTION
================================================================ */
@layer components {
  .cta-section {
    position: relative;
    padding: 110px 5%;
    background: linear-gradient(135deg, var(--bg-deep) 0%, #3a1444 40%, #c04520 100%);
    overflow: hidden;
  }
  .cta-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
      radial-gradient(ellipse at 20% 50%, rgba(124,58,237,0.4) 0%, transparent 55%),
      radial-gradient(ellipse at 80% 50%, rgba(255,107,53,0.3) 0%, transparent 55%);
    pointer-events: none;
  }
  .cta-inner {
    max-width: 760px;
    margin: 0 auto;
    text-align: center;
    position: relative;
    z-index: 1;
  }
  .cta-inner h2 {
    font-size: clamp(2.4rem, 5vw, 4rem);
    font-weight: 900;
    margin-bottom: 16px;
    letter-spacing: -0.02em;
  }
  .cta-inner > p {
    font-size: 1.1rem;
    color: rgba(255,255,255,0.85);
    margin-bottom: 48px;
    line-height: 1.7;
  }
  .cta-buttons { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
}

/* ================================================================
   FOOTER — Container Queries on isolated component
================================================================ */
@layer components {
  .footer {
    background: var(--bg-darkest);
    border-top: 1px solid rgba(255,255,255,0.06);
    padding: 70px 5% 32px;
    /* container-type only on isolated footer — safe */
    container-type: inline-size;
    container-name: footer;
  }
  .footer-inner { max-width: 1200px; margin: 0 auto; }
  .footer-top {
    display: grid;
    grid-template-columns: 1.6fr 1fr 1fr 1fr;
    gap: 48px;
    padding-bottom: 56px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }
  .footer-logo {
    font-family: 'Berkshire Swash', cursive;
    font-size: 1.8rem;
    color: #fff;
    text-decoration: none;
    display: block;
    margin-bottom: 16px;
  }
  .footer-logo span {
    background: linear-gradient(135deg, var(--accent-orange), var(--accent-yellow));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }
  .footer-tagline { font-size: 0.9rem; color: var(--text-sec); line-height: 1.7; margin-bottom: 24px; }
  .footer-socials { display: flex; gap: 12px; }
  .social-link {
    width: 40px; height: 40px;
    border-radius: 10px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: background var(--transition-base), border-color var(--transition-base),
                color var(--transition-base), transform 0.2s ease;
  }
  .social-link svg { width: 18px; height: 18px; fill: currentColor; }
  .social-link:hover {
    background: rgba(255,107,53,0.15);
    border-color: rgba(255,107,53,0.4);
    color: var(--accent-orange);
    transform: translateY(-2px);
  }
  .footer-col h4 {
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.44);
    margin-bottom: 20px;
  }
  .footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 10px; }
  .footer-col ul a {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color var(--transition-fast);
    display: inline-block;
    min-height: 32px;
    line-height: 32px;
  }
  .footer-col ul a:hover { color: var(--accent-orange); }
  .footer-contact-item { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 13px; }
  .fc-icon { color: var(--accent-orange); font-size: 0.9rem; margin-top: 2px; min-width: 16px; }
  .fc-text { font-size: 0.88rem; color: rgba(255,255,255,0.7); line-height: 1.5; }
  .fc-text a { color: inherit; text-decoration: none; transition: color var(--transition-fast); }
  .fc-text a:hover { color: var(--accent-orange); }
  .footer-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 32px;
    gap: 16px;
  }
  .footer-copy { font-size: 0.83rem; color: rgba(255,255,255,0.38); }
  .footer-bl { display: flex; gap: 24px; }
  .footer-bl a {
    font-size: 0.83rem;
    color: rgba(255,255,255,0.38);
    text-decoration: none;
    transition: color var(--transition-fast);
  }
  .footer-bl a:hover { color: rgba(255,255,255,0.75); }

  /* Container queries for footer grid */
  @container footer (max-width: 900px) {
    .footer-top { grid-template-columns: 1fr 1fr; gap: 36px; }
  }
  @container footer (max-width: 520px) {
    .footer-top    { grid-template-columns: 1fr; gap: 32px; }
    .footer-bottom { flex-direction: column; text-align: center; }
  }
}

/* ================================================================
   SCROLL REVEAL ANIMATIONS
================================================================ */
@layer components {
  .reveal       { opacity: 0; transform: translateY(36px); }
  .reveal-left  { opacity: 0; transform: translateX(-44px); }
  .reveal-right { opacity: 0; transform: translateX(44px); }

  @keyframes revealFallback { to { opacity: 1; transform: none; } }
  .reveal, .reveal-left, .reveal-right {
    animation: revealFallback 0.6s ease 0.3s forwards;
  }
}

/* ================================================================
   :has() — PROGRESSIVE ENHANCEMENT (safe, non-layout-critical)
================================================================ */
@layer utilities {
  /* Active nav link highlight */
  .nav-links:has(a[aria-current="page"]) a[aria-current="page"] {
    color: var(--accent-orange);
    font-weight: 700;
  }
}

/* ================================================================
   RESPONSIVE — SHARED BREAKPOINTS
================================================================ */
@layer layout {
  /* Large desktop */
  @media (min-width: 1280px) {
    .container { max-width: 1200px; }
  }

  /* XL desktop */
  @media (min-width: 1440px) {
    .footer-inner,
    .nav-inner { max-width: 1360px; }
    .section { padding-left: 6%; padding-right: 6%; }
  }

  /* Ultrawide */
  @media (min-width: 1920px) {
    .footer-inner,
    .nav-inner { max-width: 1600px; }
    .section { max-width: 1920px; margin-left: auto; margin-right: auto; }
  }

  /* Tablet */
  @media (max-width: 1024px) {
    .stats-inner { grid-template-columns: repeat(2, 1fr); }
    .stat-item:nth-child(2)::after { display: none; }
    .footer-top { grid-template-columns: 1fr 1fr; gap: 36px; }
  }

  /* Mobile — layout rules (footer etc.) */
  @media (max-width: 768px) {
    .footer-top   { grid-template-columns: 1fr; gap: 32px; }
    .footer-bottom { flex-direction: column; text-align: center; }
  }

  /* Small mobile */
  @media (max-width: 480px) {
    .stats-inner { grid-template-columns: 1fr; }
    .stat-item::after { display: none; }
    .section { padding: 64px 5%; }
  }

  /* Fold */
  @media (max-width: 320px) {
    :root { font-size: 14px; }
  }
}

/* Nav mobile — in utilities layer so it overrides components layer */
@layer utilities {
  @media (max-width: 768px) {
    .nav-links    { display: none; }
    .nav-hamburger,
    .hamburger    { display: flex; }
  }
}

/* ================================================================
   CSS NESTING — progressive enhancement only
   Requires Chrome 112+ / Firefox 117+ / Safari 16.5+
================================================================ */
@supports (selector(&)) {
  @layer components {
    /* Navbar nested hover states */
    .navbar {
      &:has(+ .mobile-menu.open) {
        border-bottom-color: rgba(255,255,255,0.12);
      }
    }

    /* Button ripple / nested pseudo */
    .btn-primary {
      &::after {
        content: '';
        position: absolute;
        inset: 0;
        border-radius: inherit;
        background: rgba(255,255,255,0);
        transition: background 0.2s ease;
      }
      &:active::after { background: rgba(255,255,255,0.12); }
    }
  }
}
