/* ==========================================================================
   Applied Labs — Letta-inspired design system
   Vanilla CSS. Tokens in :root, then reset, layout, components, motion.
   ========================================================================== */

:root {
  /* Canvas & ink */
  --bg: #fbfbf9;          /* warm near-white canvas */
  --bg-grid: rgba(142, 142, 142, 0.16); /* Letta-style hairline grid */
  --card: #ffffff;
  --ink: #1d1d29;         /* primary text / display */
  --ink-muted: #6b6b76;   /* secondary text */
  --ink-faint: #9a9aa3;   /* eyebrows, captions */
  --hairline: #e7e7e1;    /* 1px borders/dividers */
  --hairline-strong: #d8d8d0;

  /* Brand accents (from logo) */
  --accent: #00aeef;      /* Applied Labs cyan */
  --accent-ink: #0090c8;  /* cyan hover/active */

  /* Typography */
  --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  /* Scale & rhythm */
  --maxw: 1080px;
  --gutter: clamp(1.25rem, 5vw, 3rem);
  --radius: 14px;
  --radius-sm: 8px;

  /* Motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* --------------------------------------------------------------------------
   Reset
   -------------------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

* { margin: 0; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Signature Letta technical grid — fixed, behind everything */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(to right, var(--bg-grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--bg-grid) 1px, transparent 1px);
  background-size: clamp(120px, 18vw, 220px) clamp(120px, 18vw, 220px);
  /* gentle vignette so the grid fades toward the edges */
  -webkit-mask-image: radial-gradient(ellipse 120% 90% at 50% 30%, #000 55%, transparent 100%);
          mask-image: radial-gradient(ellipse 120% 90% at 50% 30%, #000 55%, transparent 100%);
}

img, svg { display: block; max-width: 100%; }

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

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}

/* --------------------------------------------------------------------------
   Layout primitives
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  padding-block: clamp(3.5rem, 8vw, 6.5rem);
  border-top: 1px solid var(--hairline);
}
.section:first-of-type { border-top: 0; }

/* Eyebrow — uppercase mono label */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 1.25rem;
}
.eyebrow::before {
  content: "";
  width: 1.75rem;
  height: 1px;
  background: var(--hairline-strong);
}

.lede { color: var(--ink-muted); max-width: 46ch; }

/* --------------------------------------------------------------------------
   Header / nav
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--hairline);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 68px;
}
.brand { display: flex; align-items: center; gap: 0.65rem; }
.brand img { height: 30px; width: auto; }
.nav { display: flex; align-items: center; flex-wrap: wrap; gap: 2rem; }
.nav a {
  font-size: 0.92rem;
  color: var(--ink-muted);
  transition: color 0.2s var(--ease);
}
.nav a:hover { color: var(--ink); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--bg);
  transition: transform 0.2s var(--ease), background 0.2s var(--ease), color 0.2s var(--ease);
}
.btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; transform: translateY(-1px); }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  width: 40px; height: 40px;
  align-items: center; justify-content: center;
  background: transparent; border: 1px solid var(--hairline);
  border-radius: var(--radius-sm); cursor: pointer;
}
.nav-toggle span { display: block; width: 18px; height: 1.5px; background: var(--ink); transition: transform 0.25s var(--ease), opacity 0.2s var(--ease); }

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */
.hero { padding-block: clamp(4rem, 12vw, 8rem) clamp(3rem, 8vw, 5.5rem); }
.hero__title {
  font-size: clamp(2.75rem, 8vw, 5.75rem);
  letter-spacing: -0.03em;
  margin-bottom: 1.5rem;
}
.hero__title .muted { color: var(--ink-muted); }
.hero__title .accent { color: var(--accent); }
.hero__lede {
  font-size: clamp(1.1rem, 1rem + 0.6vw, 1.4rem);
  color: var(--ink-muted);
  max-width: 52ch;
}
.hero__meta {
  margin-top: 2.5rem;
  display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink-faint);
  letter-spacing: 0.04em;
}
.hero__meta span { display: inline-flex; align-items: center; gap: 0.5em; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
/* Hero action row (e.g. the 404 "back home" button) */
.hero__actions { margin-top: 2.5rem; }

/* --------------------------------------------------------------------------
   Journey: Project Batting Cleanup -> Echo
   -------------------------------------------------------------------------- */
.journey {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  gap: clamp(1rem, 3vw, 2rem);
  margin-top: 2.5rem;
}
.node {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.75rem;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s var(--ease);
}
.node:hover { transform: translateY(-3px); box-shadow: 0 18px 40px -24px rgba(29, 29, 41, 0.35); }
.node__tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.node__title { font-size: 1.6rem; }
.node__desc { color: var(--ink-muted); font-size: 0.96rem; }
.node__link {
  margin-top: auto;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--accent-ink);
  display: inline-flex; align-items: center; gap: 0.4em;
}
.node__link:hover { color: var(--accent); }
.node--now { border-color: color-mix(in srgb, var(--accent) 45%, var(--hairline)); }
.node--now .node__tag { color: var(--accent-ink); }

.journey__arrow {
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  color: var(--ink-faint);
  font-size: 1.5rem;
}

/* --------------------------------------------------------------------------
   Generic feature cards (mission / approach / partnership)
   -------------------------------------------------------------------------- */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: clamp(1rem, 3vw, 1.75rem);
}
.card {
  padding: clamp(1.75rem, 4vw, 2.5rem);
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
}
.card h3 { font-size: 1.5rem; margin-bottom: 0.75rem; }
.card p { color: var(--ink-muted); }

.statement {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.6rem, 1.2rem + 2vw, 2.75rem);
  letter-spacing: -0.02em;
  line-height: 1.1;
  max-width: 18ch;
}
.statement .accent { color: var(--accent); }
.statement + .lede { margin-top: 1.25rem; }

.partnership { text-align: center; }
.partnership .eyebrow { justify-content: center; }
.partnership p { font-size: clamp(1.1rem, 1rem + 0.6vw, 1.45rem); max-width: 60ch; margin-inline: auto; color: var(--ink); }
.inline-link {
  color: var(--ink);
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.inline-link:hover { color: var(--accent-ink); border-color: var(--accent); }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--hairline);
  padding-block: clamp(2.5rem, 6vw, 4rem);
}
.site-footer__grid {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  color: var(--ink-muted);
}
.site-footer__links { display: flex; flex-wrap: wrap; gap: 1.25rem; }
.site-footer a { color: var(--ink-muted); transition: color 0.2s var(--ease); }
.site-footer a:hover { color: var(--accent); }
.site-footer .accent-link { color: var(--ink); }

/* --------------------------------------------------------------------------
   Scroll-reveal motion
   -------------------------------------------------------------------------- */
/* Reveal only hides when JS is active (html.js) so content is never
   invisible if the script fails to load (crawlers, CSP, network errors). */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  }
  .js .reveal.is-visible { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 760px) {
  /* The collapsible mobile nav (toggle + hidden panel) is JS-driven, so it
     only engages when html.js is present. Without JS the toggle stays hidden
     and the nav links render inline and reachable. */
  .js .nav-toggle { display: flex; }
  .js .nav {
    position: absolute;
    top: 68px; left: 0; right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 1.25rem;
    padding: 1.5rem var(--gutter) 2rem;
    background: var(--bg);
    border-bottom: 1px solid var(--hairline);
    transform: translateY(-12px);
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition: transform 0.25s var(--ease), opacity 0.25s var(--ease), visibility 0.25s var(--ease);
  }
  .js .nav.is-open { transform: none; opacity: 1; pointer-events: auto; visibility: visible; }
  .nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

  .journey { grid-template-columns: 1fr; }
  .journey__arrow { transform: rotate(90deg); padding-block: 0.25rem; }
}
