/* ================================
   SouthEastern Signal - main.css
   Base styles, theme tokens,
   layout, typography, header/footer,
   and global responsiveness.
=================================== */

/* -------- Design Tokens (M3 Dark Scheme) -------- */
/* Seed color: #e53935 · Neutrals: cool-toned brand override */
:root {
  /* M3 Color Roles — Primary */
  --md-sys-color-primary: #e53935;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-hover: #c9302f;

  /* M3 Color Roles — Secondary (tonal buttons / subtle accents) */
  --md-sys-color-secondary-container: rgba(255, 255, 255, 0.04);
  --md-sys-color-on-secondary-container: #a0a6b4;

  /* M3 Color Roles — Surface system */
  --md-sys-color-surface: #050608;
  --md-sys-color-on-surface: #f5f5f7;
  --md-sys-color-on-surface-variant: #a0a6b4;
  --md-sys-color-surface-container-lowest: #07090d;
  --md-sys-color-surface-container-low: #0c0e14;
  --md-sys-color-surface-container: #101318;
  --md-sys-color-surface-container-high: #151821;
  --md-sys-color-surface-container-highest: #1a1d27;

  /* M3 Color Roles — Outline */
  --md-sys-color-outline: #9099a8;
  --md-sys-color-outline-variant: #262a33;

  /* Legacy aliases (backward compat during migration) */
  --color-bg: var(--md-sys-color-surface);
  --color-bg-elevated: var(--md-sys-color-surface-container);
  --color-bg-subtle: var(--md-sys-color-surface-container-high);
  --color-border-subtle: var(--md-sys-color-outline-variant);
  --color-text: var(--md-sys-color-on-surface);
  --color-text-muted: var(--md-sys-color-on-surface-variant);
  --color-text-soft: var(--md-sys-color-outline);
  --color-accent: var(--md-sys-color-primary);
  --color-accent-soft: #ff6b5a;
  --color-accent-hover: var(--md-sys-color-primary-hover);
  --color-nav-bg: rgba(5, 6, 8, 0.96);
  --color-footer-bg: var(--md-sys-color-surface-container-lowest);

  /* M3 Shape Scale */
  --md-sys-shape-corner-extra-small: 4px;
  --md-sys-shape-corner-small: 8px;
  --md-sys-shape-corner-medium: 12px;
  --md-sys-shape-corner-large: 16px;
  --md-sys-shape-corner-extra-large: 28px;
  --md-sys-shape-corner-full: 999px;

  /* Legacy radius aliases → M3 shape scale */
  --radius-sm: var(--md-sys-shape-corner-extra-small);
  --radius-md: var(--md-sys-shape-corner-medium);
  --radius-lg: var(--md-sys-shape-corner-large);
  --radius-xl: var(--md-sys-shape-corner-extra-large);

  /* Typography */
  --font-sans: "Inter", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;

  /* Spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 40px;
  --space-8: 56px;
  --space-9: 72px;

  /* Layout widths */
  --max-width: 1160px;

  /* Breakpoints (for reference, used in media queries) */
  /* 480px, 640px, 768px, 1024px, 1280px, 1440px */
}

/* -------- Skip-to-content link (accessibility + Core Web Vitals) -------- */

.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  z-index: 10000;
  padding: 10px 18px;
  background: var(--color-accent, #e53935);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 0 0 var(--radius-md, 10px) 0;
  text-decoration: none;
  transition: top 0.1s ease;
}

.skip-link:focus {
  top: 0;
  outline: 3px solid #fff;
  outline-offset: 2px;
}

/* -------- CSS Reset (lightweight) -------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background: radial-gradient(circle at top left, #161925 0, #050608 55%)
    fixed;
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

button,
input,
textarea,
select {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Visible focus ring for keyboard users (accessibility + CWV INP) */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: 3px;
}

/* Remove focus ring for mouse users only */
:focus:not(:focus-visible) {
  outline: none;
}

/* Remove default list padding */
ul,
ol {
  margin: 0;
  padding: 0;
}

/* -------- Base Typography -------- */

/* M3 Type Scale — Headlines (h1–h2) weight 400, Titles (h3–h6) weight 500 */
h1,
h2 {
  margin: 0 0 var(--space-3);
  font-weight: 400;
  color: var(--color-text);
}

h3,
h4,
h5,
h6 {
  margin: 0 0 var(--space-3);
  font-weight: 500;
  color: var(--color-text);
}

p {
  margin: 0 0 var(--space-3);
  color: var(--color-text-muted);
}

strong {
  font-weight: 600;
}

/* Global container helper */
.page-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-7) var(--space-4) var(--space-8);
}

/* Adjust top padding on large screens when header overlaps */
@media (min-width: 768px) {
  .page-content {
    padding-top: var(--space-8);
  }
}

/* -------- Site Header / Nav -------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(20px);
  background: linear-gradient(
    to bottom,
    rgba(5, 6, 8, 0.96),
    rgba(5, 6, 8, 0.92)
  );
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.nav-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 18px;
}

/* Logo — M3 Label Large tracking */
.nav-logo {
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.92rem;
  color: var(--color-text);
  padding: 6px 10px;
  border-radius: var(--md-sys-shape-corner-full);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: radial-gradient(circle at top left, #25293a 0, #11131a 55%);
}

/* Desktop nav links */
.nav-links {
  margin-left: 28px;
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.nav-links a {
  position: relative;
  padding: 4px 0;
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -3px;
  width: 0;
  height: 2px;
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--color-accent);
  transition: width 0.16s ease;
}

.nav-links a:hover {
  color: var(--color-text);
}

.nav-links a:hover::after {
  width: 100%;
}

/* Active nav link utility (optional add via PHP later) */
.nav-links a.is-active {
  color: var(--color-text);
}

.nav-links a.is-active::after {
  width: 100%;
}

/* Desktop CTA — M3 Filled button */
.nav-cta {
  position: relative;
  margin-left: auto;
  padding: 8px 16px;
  border-radius: var(--md-sys-shape-corner-full);
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--md-sys-color-primary);
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  overflow: hidden;
  transition: background 0.16s ease;
}

/* M3 state layer */
.nav-cta::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: currentColor;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.nav-cta:hover {
  background: var(--md-sys-color-primary-hover);
}

.nav-cta:hover::before {
  opacity: 0.08;
}

/* Mobile menu toggle (hamburger) */
.mobile-menu-toggle {
  margin-left: auto;
  background: transparent;
  border: none;
  padding: 8px;
  display: none;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
}

.mobile-line {
  width: 20px;
  height: 2px;
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--color-text);
}

/* Mobile menu drawer */
.mobile-menu {
  display: none;
  flex-direction: column;
  padding: 10px 16px 16px;
  background: #050608;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.mobile-menu a {
  padding: 8px 0;
  font-size: 0.95rem;
  color: var(--color-text-muted);
}

.mobile-menu a:hover {
  color: var(--color-text);
}

.mobile-menu .mobile-cta {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--color-accent);
  color: #fff;
  font-weight: 600;
  text-align: center;
}

/* JS will toggle .mobile-menu--open on .mobile-menu */
.mobile-menu.mobile-menu--open {
  display: flex;
}

/* -------- Footer -------- */

.site-footer {
  margin-top: var(--space-8);
  padding: var(--space-6) var(--space-4) var(--space-4);
  background: var(--color-footer-bg);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.footer-container {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr));
  gap: 32px;
}

.footer-col {
  font-size: 0.85rem;
}

/* M3 Title Medium */
.footer-title {
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 8px;
}

.footer-text {
  font-size: 0.88rem;
  color: var(--color-text-muted);
}

/* M3 Label Medium */
.footer-heading {
  font-size: 0.85rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-soft);
  margin-bottom: 10px;
}

.footer-col a {
  display: block;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}

.footer-col a:hover {
  color: var(--color-text);
}

.footer-bottom {
  max-width: var(--max-width);
  margin: 16px auto 0;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.78rem;
  color: var(--color-text-soft);
}

/* -------- Responsive Tweaks -------- */

/* <= 1024px */
@media (max-width: 1024px) {
  .nav-links {
    display: none;
  }

  .nav-cta {
    display: none;
  }

  .mobile-menu-toggle {
    display: inline-flex;
  }

  .footer-container {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* <= 640px */
@media (max-width: 640px) {
  .page-content {
    padding: var(--space-6) var(--space-4) var(--space-7);
  }

  .footer-container {
    grid-template-columns: minmax(0, 1fr);
  }

  .footer-col {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 12px;
  }

  .footer-col:first-child {
    border-top: none;
    padding-top: 0;
  }
}
