@layer base, theme, components;

@layer base {
  :root {
    --cw-navy: #162B66;
    --cw-cyan: #009FE3;
    --cw-teal: #00A88F;
    --cw-green: #16A34A;
    --cw-amber: #F59E0B;
    --cw-amber-soft: #FEF3C7;

    --bg-page: light-dark(#F8FAFC, #0B1120);
    --bg-surface: light-dark(#FFFFFF, #111827);
    --bg-subtle: light-dark(#F1F5F9, #1E293B);
    --text-main: light-dark(#0F172A, #F1F5F9);
    --text-muted: light-dark(#475569, #94A3B8);
    --border-subtle: light-dark(#E2E8F0, #1E293B);
    --accent-primary: light-dark(#0284C7, #38BDF8);

    color-scheme: light dark;
    accent-color: var(--accent-primary);
    scrollbar-color: light-dark(#94A3B8, #475569) light-dark(#F1F5F9, #0F172A);
  }

  :root:has(> head > meta[name="color-scheme"][content="dark"]) {
    color-scheme: dark;
  }

  :root:has(> head > meta[name="color-scheme"][content="light"]) {
    color-scheme: light;
  }

  html {
    scroll-behavior: smooth;
    font-family: "Plus Jakarta Sans", "Inter", system-ui, -apple-system, sans-serif;
  }

  body {
    background-color: var(--bg-page);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: clip;
  }

  :focus-visible {
    outline: 3px solid var(--cw-cyan);
    outline-offset: 2px;
  }
}

@layer theme {
  .cw-hero-gradient {
    background: linear-gradient(135deg, #FBBF24 0%, #F59E0B 48%, #0284C7 100%);
  }

  .cw-surface-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
  }

  .visually-hidden:where(:not(:focus-within, :active)) {
    position: absolute !important;
    clip-path: inset(50%) !important;
    overflow: hidden !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    border: 0 !important;
    white-space: nowrap !important;
  }

  .skip-link {
    position: fixed;
    inset-block-start: -4rem;
    inset-inline-start: 1rem;
    z-index: 100;
    padding: 0.75rem 1.25rem;
    border-radius: 0.75rem;
    background: var(--cw-navy);
    color: #FFFFFF;
    font-weight: 600;
    transition: inset-block-start 0.15s ease;
  }

  .skip-link:focus {
    inset-block-start: 1rem;
  }
}

/* Unlayered logo visibility rules (prevents Tailwind Preflight img { display: block } override) */
.cw-logo-light {
  display: none;
}

html.dark .cw-logo-dark {
  display: none;
}

html.dark .cw-logo-light {
  display: block;
}
