/* Site-wide helpers that extend the design system tokens */
@import url("./colors_and_type.css");

html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  overflow-x: hidden;
}

/* Site accent color (set from App.jsx on mount) */
:root {
  --site-accent: var(--lb-green);
  --site-accent-hover: var(--lb-green-600);
  --site-accent-press: var(--lb-green-700);
  --hero-overlay: 0.55;
  --hero-tint: 16, 29, 48; /* rgb */
}

* { box-sizing: border-box; }

.shell { max-width: 1240px; margin: 0 auto; padding: 0 32px; }

.eyebrow {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--site-accent);
}

.section-title {
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.01em;
  color: var(--lb-navy);
  margin: 12px 0 20px;
  max-width: 20ch;
  text-wrap: balance;
}

.section-lead {
  font-family: var(--font-sans);
  font-size: 18px;
  line-height: 1.55;
  color: var(--lb-navy-400);
  max-width: 68ch;
  margin: 0 0 40px;
}

.btn {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  padding: 13px 22px;
  border-radius: var(--r-md);
  border: none;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: background 160ms var(--ease-standard), color 160ms var(--ease-standard), border-color 160ms var(--ease-standard), transform 160ms var(--ease-standard);
  text-decoration: none;
  display: inline-block;
  text-align: center;
}
.btn.primary { background: var(--site-accent); color: #fff; }
.btn.primary:hover { background: var(--site-accent-hover); }
.btn.ghost { background: transparent; border: 1px solid rgba(255,255,255,0.5); color: #fff; }
.btn.ghost:hover { background: rgba(255,255,255,0.08); border-color: #fff; }
.btn.navy { background: var(--lb-navy); color: #fff; }
.btn.navy:hover { background: var(--lb-navy-600); }
.btn.outline-navy { background: transparent; border: 1px solid var(--lb-navy); color: var(--lb-navy); }
.btn.outline-navy:hover { background: var(--lb-navy); color: #fff; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--lb-green-50);
  color: var(--lb-green-700);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.divider-dot { display: inline-block; width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: 0.45; margin: 0 8px; vertical-align: middle; }

/* Marquee utility */
@keyframes marqueeX {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 700ms var(--ease-out), transform 700ms var(--ease-out); }
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
}

/* ============================================================
   Mobile responsive overrides (<= 820px)
   These rules ONLY fire at mobile widths — desktop is untouched.
   Uses !important to override inline React styles.
   ============================================================ */

/* Header: hide hamburger + overlay on desktop by default (also inline-hidden in JSX as a safety net) */
.mobile-menu-btn { display: none !important; }
.mobile-nav-overlay { display: none !important; }

@media (max-width: 820px) {
  /* Shell padding + section title sizes */
  .shell { padding: 0 20px !important; }
  .section-title { font-size: 30px !important; line-height: 1.15 !important; }
  .section-lead { font-size: 16px !important; }
  .eyebrow { font-size: 11px !important; }

  /* Reduce section padding on all main sections */
  #about, #thesis, #platform, #pipeline, #case-studies,
  #team, #research, #talks, #contact, #gdl-vs-llm {
    padding: 72px 0 !important;
  }

  /* --- Header: hide desktop nav + CTA, show hamburger --- */
  .desktop-nav { display: none !important; }
  .desktop-cta { display: none !important; }
  .mobile-menu-btn {
    display: flex !important;
    margin-left: auto;
    width: 44px; height: 44px;
    align-items: center; justify-content: center;
    background: transparent; border: none; cursor: pointer;
    color: inherit; padding: 0;
  }
  .mobile-menu-btn svg { width: 26px; height: 26px; }

  .mobile-nav-overlay.open {
    display: flex !important;
    position: fixed; inset: 0;
    background: rgba(0, 20, 40, 0.97);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 90;
    flex-direction: column;
    padding: 88px 28px 40px;
    gap: 8px;
  }
  .mobile-nav-overlay a {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 600;
    color: #fff;
    text-decoration: none;
    padding: 14px 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    letter-spacing: -0.01em;
  }
  .mobile-nav-overlay .cta-mobile {
    margin-top: 24px;
    background: var(--site-accent);
    color: #fff !important;
    text-align: center;
    border-radius: var(--r-md);
    border: none;
    padding: 16px 22px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.04em;
  }

  /* --- Hero --- */
  #top .shell { padding: 100px 20px 60px !important; }
  #top h1 { line-height: 1.06 !important; }
  #top .shell > div > p { font-size: 17px !important; }
  #top .shell > div > div:last-child {
    gap: 10px 18px !important;
    font-size: 10px !important;
    margin-top: 40px !important;
  }

  /* --- About: 2-col grid → 1-col, cancel sticky, pillars 3→2 --- */
  #about .shell > div {
    grid-template-columns: 1fr !important;
    gap: 28px !important;
  }
  #about .shell > div > div:first-child {
    position: static !important;
  }
  #about .shell > div > div:last-child > div:last-child {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 12px !important;
    padding-top: 24px !important;
  }
  #about .shell > div > div:last-child > div:last-child > div > div:first-child {
    font-size: 28px !important;
  }

  /* --- Thesis: 3-col triptych → stack; swap right-borders for bottom --- */
  #thesis h2 { font-size: 30px !important; }
  #thesis .shell > div:last-child {
    grid-template-columns: 1fr !important;
  }
  #thesis .shell > div:last-child > div {
    border-right: none !important;
    border-bottom: 1px solid rgba(255,255,255,0.12) !important;
    padding: 28px 22px !important;
  }
  #thesis .shell > div:last-child > div:last-child {
    border-bottom: none !important;
  }

  /* --- Platform: 3-col → 1-col --- */
  #platform .shell > div:last-child {
    grid-template-columns: 1fr !important;
  }

  /* --- Pipeline: 4-col → 1-col; border-right → bottom --- */
  #pipeline .shell > div:nth-child(2) {
    grid-template-columns: 1fr !important;
  }
  #pipeline .shell > div:nth-child(2) > div {
    border-right: none !important;
    border-bottom: 1px solid var(--lb-gray-200) !important;
  }
  #pipeline .shell > div:nth-child(2) > div:last-child {
    border-bottom: none !important;
  }

  /* --- Case Studies: sidebar + panel → stack --- */
  #case-studies h2 { font-size: 30px !important; }
  #case-studies .shell > div:last-child {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }
  #case-studies .shell > div:last-child > div:last-child {
    padding: 28px !important;
  }

  /* --- Team: 4-col → 2-col --- */
  #team .shell > div:last-child {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }

  /* --- Research: featured 2-col → 1-col; each card stacks cover on top of text --- */
  #research .shell > div:nth-child(2) {
    grid-template-columns: 1fr !important;
  }
  #research .shell > div:nth-child(2) > a {
    grid-template-columns: 1fr !important;
    gap: 18px !important;
    padding: 20px !important;
  }
  /* Constrain the cover image so it doesn't dominate the card */
  #research .shell > div:nth-child(2) > a > div:first-child {
    width: 120px !important;
    max-width: 100% !important;
  }
  /* List rows: stack journal/title/arrow vertically */
  #research .shell > div:last-child > a {
    grid-template-columns: 1fr !important;
    gap: 6px !important;
    padding: 14px 18px !important;
  }

  /* --- Talks: 3-col → 1-col --- */
  #talks .shell > div:last-child {
    grid-template-columns: 1fr !important;
  }

  /* --- GDL vs LLM: 2-col comparison → 1-col (LLM cells then GDL alternate) --- */
  #gdl-vs-llm .shell > div:nth-child(2) {
    grid-template-columns: 1fr !important;
  }

  /* --- Contact: 2-col → 1-col; inner name/email 2-col → 1-col --- */
  #contact h2 { font-size: 32px !important; }
  #contact .shell > div {
    grid-template-columns: 1fr !important;
    gap: 40px !important;
  }
  #contact form { padding: 22px !important; }
  #contact form > div:first-child {
    grid-template-columns: 1fr !important;
  }

  /* --- Footer: stack --- */
  footer .shell {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 16px !important;
  }
}
