/* Upstart Education — Design System
   Direction B: Infrastructure. Dark navy backbone, electric cyan accent.
   Tokens map cleanly to Tailwind for Next.js handoff.
*/

/* === Tokens ============================================================ */
:root {
  /* Brand */
  --navy:        #03122f;
  --navy-2:      #071a3d;  /* lifted surface */
  --navy-3:      #0a2348;  /* card surface */
  --navy-4:      #0e2c5a;  /* card hover */
  --bone:        #f5f7fb;
  --bone-2:      #dfe5f0;
  --cyan:        #4be1ff;
  --cyan-2:      #2bc4e0;
  --cyan-dim:    rgba(75, 225, 255, 0.12);
  --magenta:     #d72fa9;   /* used sparingly, ties to in-app */
  --violet:      #6f4ad9;

  /* Ink / surfaces */
  --fg:          var(--bone);
  --fg-soft:     rgba(245, 247, 251, 0.7);
  --fg-dim:      rgba(245, 247, 251, 0.45);
  --fg-mute:     rgba(245, 247, 251, 0.25);
  --hair:        rgba(245, 247, 251, 0.1);
  --hair-strong: rgba(245, 247, 251, 0.18);
  --hair-dark:   rgba(3, 18, 47, 0.08);

  /* Severity (security tiers) */
  --sev-1: #ff5b6e;  /* Highest — Tier 1 */
  --sev-2: #ff9d4d;  /* Tier 2 */
  --sev-3: #4be1ff;  /* Tier 3 */
  --sev-4: #7af2a4;  /* Tier 4 */

  /* Type */
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body:    'Inter Tight', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, monospace;

  /* Layout */
  --maxw:        1280px;
  --pad-x:       64px;
  --pad-x-sm:    24px;
  --radius:      4px;
  --radius-md:   8px;
  --radius-lg:   14px;

  /* Motion */
  --t-fast:      120ms;
  --t-base:      180ms;
  --t-slow:      320ms;
  --ease:        cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* === Base ============================================================== */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--navy);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--cyan); color: var(--navy); }

a { color: inherit; text-decoration: none; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* === Layout helpers ==================================================== */
.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding-left: var(--pad-x);
  padding-right: var(--pad-x);
}
@media (max-width: 768px) {
  .container { padding-left: var(--pad-x-sm); padding-right: var(--pad-x-sm); }
}

.section { padding: 112px 0; position: relative; }
.section--sm { padding: 72px 0; }
.section--lg { padding: 160px 0; }
.section--top { padding-top: 0; }

.section-divider { border-top: 1px solid var(--hair); }

/* === Type ============================================================= */
h1, h2, h3, h4, h5 { margin: 0; font-family: var(--font-display); font-weight: 500; letter-spacing: -0.02em; }
h1 { font-size: clamp(48px, 6.5vw, 88px); line-height: 1.0; letter-spacing: -0.028em; }
h2 { font-size: clamp(36px, 4.5vw, 56px); line-height: 1.04; letter-spacing: -0.025em; }
h3 { font-size: clamp(24px, 2.4vw, 32px); line-height: 1.15; letter-spacing: -0.015em; }
h4 { font-size: 20px; line-height: 1.25; letter-spacing: -0.01em; }
p  { margin: 0; }
.lede { font-size: clamp(17px, 1.4vw, 20px); line-height: 1.5; color: var(--fg-soft); max-width: 64ch; }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cyan);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before {
  content: '';
  width: 6px; height: 6px; background: var(--cyan); border-radius: 99px;
  box-shadow: 0 0 12px var(--cyan);
}
.mono { font-family: var(--font-mono); }
.kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-dim);
}
.balance { text-wrap: balance; }
.pretty  { text-wrap: pretty; }

/* === Buttons ========================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 22px;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--t-base) var(--ease);
  text-decoration: none;
  white-space: nowrap;
}
.btn--primary { background: var(--cyan); color: var(--navy); }
.btn--primary:hover { background: var(--bone); transform: translateY(-1px); }
.btn--ghost { background: transparent; color: var(--fg); border-color: var(--hair-strong); }
.btn--ghost:hover { background: rgba(255,255,255,0.04); border-color: var(--cyan); }
.btn--sm { padding: 10px 16px; font-size: 11px; }
.btn--lg { padding: 16px 26px; font-size: 13px; }

/* === Header =========================================================== */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(3, 18, 47, 0.85);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--hair);
}
.site-header__inner {
  max-width: var(--maxw); margin: 0 auto;
  padding: 14px var(--pad-x);
  display: flex; align-items: center; justify-content: space-between;
  gap: 32px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand__mark { display: block; image-rendering: -webkit-optimize-contrast; image-rendering: crisp-edges; }
.brand__name {
  font-family: var(--font-display); font-size: 19px; font-weight: 600;
  letter-spacing: -0.01em;
}
.brand__suffix {
  font-family: var(--font-mono); font-size: 11px; color: var(--fg-dim);
  letter-spacing: 0.12em; padding-top: 4px;
}
.site-nav { display: flex; gap: 28px; align-items: center; }
.site-nav > * { display: inline-flex; align-items: center; line-height: 1; }
.site-nav a, .site-nav .nav-item {
  font-family: var(--font-mono); font-size: 12px; color: var(--fg-soft);
  letter-spacing: 0.04em; cursor: pointer;
  transition: color var(--t-fast) var(--ease);
}
.site-nav a:hover, .site-nav .nav-item:hover { color: var(--cyan); }
.site-nav a.active { color: var(--cyan); }
.site-header__cta { display: flex; align-items: center; gap: 18px; }
.site-header__signin { font-family: var(--font-mono); font-size: 12px; color: var(--fg-soft); cursor: pointer; }
.site-header__signin:hover { color: var(--cyan); }

/* Product dropdown */
.dropdown { position: relative; }
.dropdown__panel {
  position: absolute; top: calc(100% + 12px); left: -16px;
  background: var(--navy-2); border: 1px solid var(--hair-strong);
  border-radius: var(--radius-md); padding: 8px; min-width: 280px;
  opacity: 0; transform: translateY(-4px); pointer-events: none;
  transition: all var(--t-base) var(--ease);
  box-shadow: 0 20px 60px -20px rgba(0,0,0,0.6);
}
/* Invisible bridge spanning the 12px gap between trigger and panel,
   so hovering down through the gap doesn't drop .dropdown:hover. */
.dropdown__panel::before {
  content: ''; position: absolute;
  top: -12px; left: 0; right: 0; height: 12px;
}
.dropdown:hover .dropdown__panel,
.dropdown:focus-within .dropdown__panel { opacity: 1; transform: translateY(0); pointer-events: auto; }
.dropdown__item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border-radius: var(--radius); cursor: pointer; transition: background var(--t-fast);
  text-transform: none; letter-spacing: 0;
}
.dropdown__item:hover { background: var(--navy-3); }
.dropdown__item-text { font-family: var(--font-body); font-size: 14px; color: var(--fg); font-weight: 500; }
.dropdown__item-desc { font-family: var(--font-body); font-size: 12px; color: var(--fg-dim); margin-top: 2px; }

/* Coming-soon badge */
.cs-badge {
  font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.1em;
  padding: 2px 6px; border-radius: 3px;
  background: rgba(255, 157, 77, 0.15); color: #ffb872;
  text-transform: uppercase; font-weight: 600;
}

/* === Footer =========================================================== */
.site-footer {
  background: var(--navy);
  border-top: 1px solid var(--hair);
  padding: 80px 0 32px;
  margin-top: 80px;
}
.site-footer__grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 64px;
}
@media (max-width: 768px) {
  .site-footer__grid { grid-template-columns: 1fr 1fr; }
}
.site-footer__col h5 {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--fg-dim); font-weight: 500;
  margin-bottom: 18px;
}
.site-footer__col ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.site-footer__col a { font-size: 14px; color: var(--fg-soft); transition: color var(--t-fast); }
.site-footer__col a:hover { color: var(--cyan); }
.site-footer__brand-blurb {
  font-size: 13px; color: var(--fg-dim); margin-top: 16px; line-height: 1.55; max-width: 32ch;
}
.site-footer__trust {
  display: flex; flex-wrap: wrap; gap: 16px; align-items: center;
  padding: 24px 0; border-top: 1px solid var(--hair);
  font-family: var(--font-mono); font-size: 11px; color: var(--fg-dim);
  letter-spacing: 0.08em;
}
.site-footer__trust > span:first-child { color: var(--cyan); }
.site-footer__legal {
  padding-top: 24px; border-top: 1px solid var(--hair);
  display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  font-family: var(--font-mono); font-size: 11px; color: var(--fg-dim);
}

/* === Cards ============================================================ */
.card {
  background: var(--navy-2);
  border: 1px solid var(--hair);
  border-radius: var(--radius-md);
  padding: 28px;
  transition: border-color var(--t-base), background var(--t-base), transform var(--t-base);
}
.card--hover:hover {
  border-color: var(--hair-strong);
  background: var(--navy-3);
  transform: translateY(-2px);
}
.card__label {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.16em;
  color: var(--cyan); text-transform: uppercase; margin-bottom: 16px;
  display: inline-block;
}
.card__title { font-family: var(--font-display); font-size: 22px; font-weight: 500; letter-spacing: -0.015em; margin-bottom: 10px; }
.card__body { font-size: 14px; color: var(--fg-soft); line-height: 1.55; }
.card__cta { margin-top: 20px; display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 11px; color: var(--cyan); letter-spacing: 0.06em; text-transform: uppercase;
  transition: gap var(--t-fast);
}
.card__cta:hover { gap: 10px; }

/* === Grids & Tables =================================================== */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
@media (max-width: 980px) {
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .grid-3, .grid-2, .grid-4 { grid-template-columns: 1fr; }
}

.table-clean {
  width: 100%;
  border-collapse: separate; border-spacing: 0;
  font-size: 14px;
}
.table-clean th {
  text-align: left; font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg-dim);
  padding: 12px 16px; border-bottom: 1px solid var(--hair-strong); font-weight: 500;
}
.table-clean td {
  padding: 18px 16px;
  border-bottom: 1px solid var(--hair);
  vertical-align: top;
  line-height: 1.5;
}
.table-clean tr:last-child td { border-bottom: none; }
.table-clean td strong { color: var(--cyan); font-weight: 600; }

/* === Grid backdrop ==================================================== */
.grid-bg {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(245,247,251,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(245,247,251,0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
}
.glow {
  position: absolute; pointer-events: none;
  background: radial-gradient(circle, rgba(75,225,255,0.18) 0%, transparent 60%);
  filter: blur(40px);
}

/* === Placeholder frames (swappable screenshots) ====================== */
.device {
  background: var(--navy-2);
  border: 1px solid var(--hair-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,0.6);
}
.device__chrome {
  height: 32px; padding: 0 14px;
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid var(--hair);
  display: flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 10px; color: var(--fg-dim); letter-spacing: 0.04em;
}
.device__dot { width: 8px; height: 8px; border-radius: 99px; background: rgba(255,255,255,0.12); }
.device__url { margin-left: auto; }
.device__body { background: #0a1e44; position: relative; min-height: 280px; }
.placeholder {
  width: 100%; height: 100%; min-height: 280px;
  background:
    repeating-linear-gradient(135deg,
      rgba(255,255,255,0.04) 0,
      rgba(255,255,255,0.04) 1px,
      rgba(255,255,255,0.02) 1px,
      rgba(255,255,255,0.02) 12px);
  display: flex; align-items: center; justify-content: center;
  color: var(--fg-dim); font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.04em; text-align: center; padding: 24px;
}
.placeholder__label { font-size: 9px; opacity: 0.55; margin-bottom: 10px; letter-spacing: 0.12em; }

/* === Scroll reveal ==================================================== */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 600ms var(--ease), transform 600ms var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }

/* === Section header =================================================== */
.section-head { margin-bottom: 56px; max-width: 720px; }
.section-head h2 { margin-top: 14px; margin-bottom: 18px; }
.section-head p  { color: var(--fg-soft); }

/* === Misc ============================================================= */
.kbd {
  font-family: var(--font-mono); font-size: 11px;
  padding: 2px 6px; border: 1px solid var(--hair-strong);
  border-bottom-width: 2px; border-radius: 4px;
  color: var(--fg);
  background: rgba(255,255,255,0.03);
}
.tag {
  display: inline-flex; align-items: center;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em;
  padding: 4px 8px; border-radius: 3px; text-transform: uppercase;
  border: 1px solid var(--hair-strong); color: var(--fg-soft);
}
.tag--cyan { background: var(--cyan-dim); border-color: rgba(75,225,255,0.35); color: var(--cyan); }
.tag--success { background: rgba(122,242,164,0.1); border-color: rgba(122,242,164,0.35); color: #7af2a4; }
.tag--warn    { background: rgba(255,157,77,0.1); border-color: rgba(255,157,77,0.35); color: #ffb872; }

/* ============================================================ */
/* === MOBILE — everything below is scoped to ≤768px ========== */
/* ============================================================ */

/* Hamburger toggle — hidden by default, shown on mobile */
.site-header__toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--hair-strong);
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  color: var(--fg);
  align-items: center;
  justify-content: center;
}
.site-header__toggle:hover { border-color: var(--cyan); color: var(--cyan); }
.site-header__toggle__bars { display: flex; flex-direction: column; gap: 4px; width: 18px; }
.site-header__toggle__bars span {
  display: block; height: 2px; background: currentColor; border-radius: 1px;
  transition: transform var(--t-fast) var(--ease), opacity var(--t-fast) var(--ease);
}
.site-header__toggle[aria-expanded="true"] .site-header__toggle__bars span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.site-header__toggle[aria-expanded="true"] .site-header__toggle__bars span:nth-child(2) { opacity: 0; }
.site-header__toggle[aria-expanded="true"] .site-header__toggle__bars span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

@media (max-width: 768px) {
  /* Global safety net — prevent horizontal scroll from any stray wide element */
  html, body { overflow-x: hidden; }

  /* Tighter header */
  .site-header__inner { gap: 12px; padding: 12px var(--pad-x-sm); }
  .brand__suffix { display: none; }
  .brand__name { font-size: 17px; }

  /* Show hamburger, hide nav + CTA pill by default */
  .site-header__toggle { display: inline-flex; }
  .site-header__cta { display: none; }

  /* Collapse nav into a full-width off-canvas panel */
  .site-nav {
    display: none;
    position: fixed; left: 0; right: 0; top: 60px;
    height: calc(100vh - 60px);
    height: calc(100dvh - 60px);  /* mobile-browser dynamic viewport */
    background: var(--navy);
    border-top: 1px solid var(--hair);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 16px var(--pad-x-sm) 32px;
    z-index: 49;
    overflow-y: auto;
  }
  .site-nav.is-open { display: flex; }
  .site-nav > * { display: block; }
  .site-nav a, .site-nav .nav-item {
    display: block;
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 500;
    letter-spacing: -0.01em;
    color: var(--fg);
    padding: 16px 0;
    border-bottom: 1px solid var(--hair);
    text-transform: none;
  }

  /* Dropdown — inline expand inside the mobile panel */
  .dropdown { width: 100%; }
  .dropdown__panel {
    position: static;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 4px 0 12px 0;
    min-width: 0;
    opacity: 1;
    transform: none;
    pointer-events: auto;
    transition: none;
  }
  .dropdown__panel::before { display: none; }
  .dropdown__item { padding: 12px 8px; }
  .dropdown__item-text { font-size: 15px; }
  .dropdown__item-desc { font-size: 12px; }

  /* In-panel demo button — replaces the desktop pill so users have a CTA */
  .site-nav__demo {
    display: block; margin-top: 20px;
    background: var(--cyan); color: var(--navy);
    border-radius: var(--radius);
    padding: 14px 18px;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 12px; font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  /* Section rhythm — desktop's 112px / 72px / 160px is too much on mobile */
  .section { padding: 56px 0; }
  .section--sm { padding: 40px 0; }
  .section--lg { padding: 80px 0; }

  /* Hero terminal — let it shrink instead of overflow.
     Allow horizontal scroll inside it as a graceful fallback. */
  .hero__term,
  [class*="hero__term"] {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Home-page hero device mocks (.hero__shots) — fixed at 480/540px wide
     for desktop. Scale them down proportionally so they fit phone viewports
     without redoing the inner positioning. We use .hero__shots.reveal.is-in
     to outrank the scroll-reveal rule which resets transform: none after
     the entry animation finishes. */
  .hero__shots,
  .hero__shots.reveal,
  .hero__shots.reveal.is-in {
    transform: scale(0.62);
    transform-origin: top left;
    height: 360px;            /* 580 * 0.62 ≈ 360, keeps section flow correct */
    margin-bottom: 0;
  }
  .hero__shot--back  { top: 60px; left: 0; right: auto; }
  .hero__shot--front { top: 200px; left: 0; }

  /* Any tables (security tier matrix, etc.) — scroll horizontally inside their card */
  .tier-table, .comparison-table, .role-table, table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }

  /* Footer: 2-col already exists at 768px; tighten gaps */
  .site-footer { padding: 56px 0 24px; margin-top: 56px; }
  .site-footer__grid { gap: 32px; margin-bottom: 40px; }
  .site-footer__legal { flex-direction: column; gap: 12px; }

  /* Closing-CTA section (About + Chat + Reports) */
  .closing { padding: 64px 0; }
  .closing__ctas { flex-direction: column; align-items: stretch; }
  .closing__ctas .btn { width: 100%; justify-content: center; }
}

@media (max-width: 480px) {
  /* Even tighter on small phones */
  .site-header__inner { padding: 10px var(--pad-x-sm); }
  .brand__name { font-size: 16px; }
  .section { padding: 48px 0; }
  .section--sm { padding: 32px 0; }
}
