/* aib-system.css: AI Beginner design system, Stage 1 foundation ("Direction C").
 *
 * Self-contained and namespaced: every class starts with "aib-" so nothing here
 * can collide with the Hyperspace template (main.css), the course CSS, or the
 * inline <style> blocks on existing pages. Palette from the video brand file
 * (C:\aib-vids\src\brand.ts). Montserrat is self-hosted; no Google Fonts.
 *
 * Buttons are meant to be <a class="aib-btn">. Note for later stages: main.css
 * sets `button, .button { color: #ffffff !important }`, so a <button> element
 * with .aib-btn would lose its navy text on pages that also load main.css.
 * Use <a class="aib-btn"> (or revisit with !important) when we get there.
 */

/* ---------- Fonts ---------- */
@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/montserrat-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/montserrat-latin-600-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("../fonts/montserrat-latin-800-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url("../fonts/montserrat-latin-900-normal.woff2") format("woff2");
}

/* Metric-matched fallback: Arial resized to Montserrat's width and line metrics,
   so text painted before the web font arrives takes the same space and the swap
   does not shift the layout. Numbers measured from the shipped WOFF2 files
   (unitsPerEm 1000, hhea ascent 968, descent 251, line gap 0) against
   C:\Windows\Fonts\arial.ttf and arialbd.ttf over a mixed-text sample:
     regular: size-adjust 111.36%, ascent 968/1000/1.1136 = 86.92%, descent 22.54%
     bold:    size-adjust 111.70%, ascent 86.66%, descent 22.47% (vs the 800 weight) */
@font-face {
  font-family: "Montserrat Fallback";
  font-style: normal;
  font-weight: 100 600;
  src: local("Arial"), local("ArialMT");
  size-adjust: 111.36%;
  ascent-override: 86.92%;
  descent-override: 22.54%;
  line-gap-override: 0%;
}
@font-face {
  font-family: "Montserrat Fallback";
  font-style: normal;
  font-weight: 700 900;
  src: local("Arial Bold"), local("Arial-BoldMT");
  size-adjust: 111.70%;
  ascent-override: 86.66%;
  descent-override: 22.47%;
  line-gap-override: 0%;
}

/* ---------- Tokens ---------- */
:root {
  /* colour */
  --aib-navy: #061A3A;
  --aib-navy-deep: #030F24;
  --aib-panel: #0B2A5E;
  --aib-panel-lift: #123672;
  --aib-teal: #2BB6B0;
  --aib-teal-soft: #7FDCD6;
  --aib-gold: #F5B93A;
  --aib-muted: #A9B6CC;
  --aib-white: #FFFFFF;
  --aib-buck: #3AA6DA;
  --aib-line: rgba(127, 220, 214, 0.22);
  --aib-line-soft: rgba(255, 255, 255, 0.10);

  /* type */
  --aib-font: "Montserrat", "Montserrat Fallback", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --aib-text-sm: 0.875rem;
  --aib-text-base: 1rem;
  --aib-text-lg: 1.25rem;
  --aib-text-xl: clamp(1.75rem, 1.2rem + 2.4vw, 2.75rem);
  --aib-text-2xl: clamp(2.25rem, 1.4rem + 3.6vw, 3.75rem);

  /* radius */
  --aib-radius-sm: 8px;
  --aib-radius-md: 14px;
  --aib-radius-lg: 22px;
  --aib-radius-pill: 999px;

  /* shadow */
  --aib-shadow-sm: 0 2px 8px rgba(3, 15, 36, 0.35);
  --aib-shadow-md: 0 12px 32px rgba(3, 15, 36, 0.45);
  --aib-glow-teal: 0 0 0 1px rgba(43, 182, 176, 0.35), 0 8px 28px rgba(43, 182, 176, 0.35);
  --aib-glow-gold: 0 0 0 1px rgba(245, 185, 58, 0.35), 0 8px 28px rgba(245, 185, 58, 0.30);

  /* spacing */
  --aib-space-1: 0.25rem;
  --aib-space-2: 0.5rem;
  --aib-space-3: 0.75rem;
  --aib-space-4: 1rem;
  --aib-space-5: 1.5rem;
  --aib-space-6: 2rem;
  --aib-space-7: 3rem;
  --aib-space-8: 4.5rem;
  --aib-container: 1180px;

  /* motion */
  --aib-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --aib-dur-fast: 160ms;
  --aib-dur-enter: 520ms;
}

/* ---------- Page base (only when a page opts in with .aib-page) ---------- */
.aib-page {
  margin: 0;
  background: radial-gradient(1200px 600px at 75% -10%, rgba(58, 166, 218, 0.16), transparent 60%),
              linear-gradient(180deg, var(--aib-navy) 0%, var(--aib-navy-deep) 100%);
  background-color: var(--aib-navy);
  color: var(--aib-white);
  font-family: var(--aib-font);
  font-size: var(--aib-text-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.aib-container {
  width: 100%;
  max-width: var(--aib-container);
  margin: 0 auto;
  padding: 0 var(--aib-space-5);
  box-sizing: border-box;
}
.aib-skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--aib-teal);
  color: var(--aib-navy);
  padding: var(--aib-space-2) var(--aib-space-4);
  border-radius: var(--aib-radius-sm);
  font-weight: 800;
  z-index: 100;
}
.aib-skip:focus { left: var(--aib-space-4); top: var(--aib-space-4); }

/* Visible focus everywhere inside the system */
.aib-page a:focus-visible,
.aib-page button:focus-visible,
.aib-page input:focus-visible,
.aib-nav-toggle:focus-visible + .aib-nav-toggle-label {
  outline: 3px solid var(--aib-teal-soft);
  outline-offset: 3px;
}

/* ---------- Header ---------- */
.aib-header {
  position: relative;
  background: rgba(3, 15, 36, 0.72);
  border-bottom: 1px solid var(--aib-line-soft);
  font-family: var(--aib-font);
}
.aib-header-inner {
  display: flex;
  align-items: center;
  gap: var(--aib-space-5);
  min-height: 72px;
  flex-wrap: wrap;
}
.aib-logo {
  display: inline-flex;
  align-items: center;
  gap: var(--aib-space-3);
  color: var(--aib-white);
  text-decoration: none;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}
.aib-logo img { display: block; width: 36px; height: 38px; }
.aib-logo-accent { color: var(--aib-teal-soft); }

.aib-nav { margin-left: auto; }
.aib-nav-list {
  display: flex;
  align-items: center;
  gap: var(--aib-space-5);
  list-style: none;
  margin: 0;
  padding: 0;
}
.aib-nav a {
  color: var(--aib-muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: color var(--aib-dur-fast) var(--aib-ease);
}
.aib-nav a:hover,
.aib-nav a[aria-current="page"] { color: var(--aib-white); }
.aib-nav-login { padding-left: var(--aib-space-3); border-left: 1px solid var(--aib-line-soft); }

/* Specificity guard: a button inside the nav keeps its own text colour.
   ".aib-nav a.aib-btn" (0,2,1) beats ".aib-nav a" (0,1,1) and, coming later in
   the file, ties-and-wins against ".aib-nav a:hover" (0,2,1); the :hover form
   (0,3,1) wins outright. */
.aib-nav a.aib-btn,
.aib-nav a.aib-btn:hover,
.aib-nav a.aib-btn:focus-visible { color: var(--aib-navy); }
.aib-nav a.aib-btn--ghost,
.aib-nav a.aib-btn--ghost:hover,
.aib-nav a.aib-btn--ghost:focus-visible { color: var(--aib-white); }

/* Mobile menu: CSS-only, a real focusable checkbox drives it. */
.aib-nav-toggle {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
}
.aib-nav-toggle-label { display: none; }

@media (max-width: 900px) {
  .aib-header-inner { padding-top: var(--aib-space-3); padding-bottom: var(--aib-space-3); }
  .aib-nav-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: var(--aib-space-2);
    margin-left: auto;
    padding: var(--aib-space-2) var(--aib-space-4);
    border: 1px solid var(--aib-line);
    border-radius: var(--aib-radius-pill);
    color: var(--aib-white);
    font-weight: 600;
    cursor: pointer;
  }
  .aib-nav-toggle-label::before {
    content: "";
    width: 18px;
    height: 12px;
    background: linear-gradient(var(--aib-white) 0 2px, transparent 2px 5px, var(--aib-white) 5px 7px, transparent 7px 10px, var(--aib-white) 10px 12px);
  }
  .aib-nav { display: none; flex-basis: 100%; margin-left: 0; }
  .aib-nav-toggle:checked ~ .aib-nav { display: block; }
  .aib-nav-list {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: var(--aib-space-3) 0 var(--aib-space-4);
  }
  .aib-nav-list > li > a:not(.aib-btn) {
    display: block;
    padding: var(--aib-space-3) 0;
    border-bottom: 1px solid var(--aib-line-soft);
  }
  .aib-nav-login { padding-left: 0; border-left: 0; }
  .aib-nav-cta { padding-top: var(--aib-space-4); }
  .aib-nav-cta .aib-btn { width: 100%; justify-content: center; }
}

/* ---------- Buttons ---------- */
.aib-btn {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  gap: var(--aib-space-2);
  padding: 0.8rem 1.4rem;
  border: 2px solid var(--aib-teal);
  border-radius: var(--aib-radius-pill);
  background: var(--aib-teal);
  color: var(--aib-navy);
  font-family: var(--aib-font);
  font-weight: 800;
  font-size: 0.95rem;
  line-height: 1.2;
  text-decoration: none;
  box-shadow: var(--aib-glow-teal);
  transition: background-color var(--aib-dur-fast) var(--aib-ease),
              border-color var(--aib-dur-fast) var(--aib-ease),
              transform var(--aib-dur-fast) var(--aib-ease),
              box-shadow var(--aib-dur-fast) var(--aib-ease);
}
.aib-btn:hover {
  background: var(--aib-teal-soft);
  border-color: var(--aib-teal-soft);
  color: var(--aib-navy);
  transform: translateY(-1px);
}
.aib-btn--ghost {
  background: transparent;
  color: var(--aib-white);
  border-color: var(--aib-teal);
  box-shadow: none;
}
.aib-btn--ghost:hover {
  background: rgba(43, 182, 176, 0.14);
  border-color: var(--aib-teal-soft);
  color: var(--aib-white);
}
/* Gold is reserved for the single "Get the Full Course" action. */
.aib-btn--gold {
  background: var(--aib-gold);
  border-color: var(--aib-gold);
  color: var(--aib-navy);
  box-shadow: var(--aib-glow-gold);
}
.aib-btn--gold:hover {
  background: #F8CB66;
  border-color: #F8CB66;
  color: var(--aib-navy);
}
.aib-btn--sm { padding: 0.55rem 1.05rem; font-size: 0.875rem; }

/* ---------- Banner ---------- */
.aib-banner {
  position: relative;
  overflow: hidden;
  margin: var(--aib-space-7) 0;
  padding: var(--aib-space-7) var(--aib-space-6);
  background: linear-gradient(135deg, var(--aib-panel) 0%, var(--aib-panel-lift) 100%);
  border: 1px solid var(--aib-line);
  border-radius: var(--aib-radius-lg);
  box-shadow: var(--aib-shadow-md);
}
.aib-banner-kicker {
  margin: 0 0 var(--aib-space-3);
  color: var(--aib-teal-soft);
  font-size: var(--aib-text-sm);
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.aib-banner-title {
  margin: 0 0 var(--aib-space-4);
  font-size: var(--aib-text-2xl);
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: -0.02em;
}
.aib-highlight { color: var(--aib-gold); }
.aib-banner-text {
  max-width: 58ch;
  margin: 0 0 var(--aib-space-5);
  color: var(--aib-muted);
  font-size: var(--aib-text-lg);
}
.aib-actions { display: flex; flex-wrap: wrap; gap: var(--aib-space-3); }
.aib-banner-rule {
  width: 72px;
  height: 3px;
  margin: 0 0 var(--aib-space-4);
  background: var(--aib-teal);
  border: 0;
  border-radius: 2px;
}

/* ---------- Cards ---------- */
.aib-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--aib-space-5);
  margin: var(--aib-space-6) 0 var(--aib-space-8);
  padding: 0;
  list-style: none;
}
.aib-card {
  display: flex;
  flex-direction: column;
  gap: var(--aib-space-3);
  padding: var(--aib-space-5);
  background: var(--aib-panel);
  border: 1px solid var(--aib-line);
  border-radius: var(--aib-radius-md);
  box-shadow: var(--aib-shadow-sm);
  transition: transform var(--aib-dur-fast) var(--aib-ease), border-color var(--aib-dur-fast) var(--aib-ease);
}
.aib-card:hover { transform: translateY(-2px); border-color: rgba(127, 220, 214, 0.45); }
.aib-card-kicker {
  margin: 0;
  color: var(--aib-teal-soft);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.aib-card-title { margin: 0; font-size: 1.2rem; font-weight: 800; line-height: 1.25; }
.aib-card-text { margin: 0; color: var(--aib-muted); }
.aib-card-link {
  margin-top: auto;
  color: var(--aib-teal-soft);
  font-weight: 800;
  text-decoration: none;
}
.aib-card-link:hover { text-decoration: underline; color: var(--aib-white); }

/* ---------- Footer ---------- */
.aib-footer {
  margin-top: var(--aib-space-8);
  padding: var(--aib-space-7) 0 var(--aib-space-5);
  background: var(--aib-navy-deep);
  border-top: 1px solid var(--aib-line-soft);
  font-family: var(--aib-font);
}
.aib-footer-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--aib-space-6);
}
.aib-footer-heading {
  margin: 0 0 var(--aib-space-3);
  color: var(--aib-white);
  font-size: 0.95rem;
  font-weight: 800;
}
.aib-footer-list { list-style: none; margin: 0; padding: 0; }
.aib-footer-list li { margin: 0 0 var(--aib-space-2); }
.aib-footer a { color: var(--aib-muted); text-decoration: none; font-size: 0.925rem; }
.aib-footer a:hover { color: var(--aib-teal-soft); text-decoration: underline; }
.aib-footer-base {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--aib-space-3);
  margin-top: var(--aib-space-6);
  padding-top: var(--aib-space-4);
  border-top: 1px solid var(--aib-line-soft);
  color: var(--aib-muted);
  font-size: var(--aib-text-sm);
}
@media (max-width: 900px) { .aib-footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .aib-footer-grid { grid-template-columns: 1fr; } }

/* ---------- Motion (CSS only, entrances 600 ms or less) ---------- */
@keyframes aib-rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}
.aib-enter { animation: aib-rise var(--aib-dur-enter) var(--aib-ease) both; }
.aib-enter--2 { animation-delay: 80ms; }
.aib-enter--3 { animation-delay: 160ms; }

/* Reduced motion: no animation, no transition, no hover lift. Selectors match or
   beat the specificity of every animated rule above, so no !important is needed. */
@media (prefers-reduced-motion: reduce) {
  .aib-page *,
  .aib-page *::before,
  .aib-page *::after,
  .aib-enter,
  .aib-btn,
  .aib-card,
  .aib-nav a,
  .aib-footer a {
    animation: none;
    transition: none;
  }
  .aib-btn:hover,
  .aib-card:hover { transform: none; }
}
