/* ==========================================================================
   TRAIS, trais.org
   No external fonts or trackers (keeps the site GDPR-friendly).
   ========================================================================== */

:root {
  --ink: #0a1f44;          /* TRAIS navy (logo) */
  --ink-deep: #061533;
  --ink-2: #16305c;
  --text: #27334a;
  --muted: #5d6878;
  --line: #e2e6ec;
  --paper: #fbfaf7;
  --tint: #f2f1ec;
  --accent: #0b76d8;       /* TRAIS blue (logo rungs) */
  --accent-2: #8cc8ff;     /* accent on dark backgrounds */
  --accent-text: #0a69c0;  /* accent for small text, AA on paper/tint */
  --warm: #d9a441;         /* used sparingly for highlights */

  --serif: "Iowan Old Style", "Charter", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;

  --wrap: 1160px;
  --radius: 14px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font: 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
a { color: inherit; }
h1, h2, h3 { color: var(--ink); margin: 0; font-weight: 500; overflow-wrap: break-word; text-wrap: balance; }
h2 { font-family: var(--serif); font-size: clamp(1.85rem, 3.2vw, 2.55rem); line-height: 1.14; letter-spacing: -.015em; }
h3 { font-size: 1.12rem; line-height: 1.35; font-weight: 600; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }

.wrap { width: min(var(--wrap), 100% - 40px); margin-inline: auto; }
@media (max-width: 520px) { .wrap { width: calc(100% - 32px); } }

.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.hero :focus-visible, body:not(.page-legal) .nav:not(.is-solid):not(.is-open) :focus-visible, .section--dark :focus-visible, .footer :focus-visible { outline-color: var(--accent-2); }
.agent :focus-visible { outline-color: var(--accent); }

/* ---------- Navigation ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  color: #fff;
  transition: background .35s var(--ease), box-shadow .35s var(--ease), color .35s var(--ease);
}
.nav.is-solid {
  background: rgba(251, 250, 247, .96);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  box-shadow: 0 1px 0 var(--line);
  color: var(--ink);
}
.nav__inner { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.brand { display: inline-flex; align-items: center; text-decoration: none; }
.brand__logo { display: block; height: 36px; width: auto; aspect-ratio: 758 / 222; --rung: currentColor; }
.nav.is-solid .brand__logo, .nav.is-open .brand__logo { --rung: var(--accent); }
.nav__links { display: flex; align-items: center; gap: 30px; font-size: .92rem; }
.nav__links a { text-decoration: none; opacity: .85; transition: opacity .2s; }
.nav__links a:hover { opacity: 1; }
.nav__cta { border: 1px solid currentColor; padding: 7px 16px; border-radius: 999px; opacity: 1 !important; }
.nav__toggle { display: none; background: none; border: 0; padding: 10px; color: inherit; cursor: pointer; }
.nav__toggle span { display: block; width: 22px; height: 1.5px; background: currentColor; margin: 5px 0; transition: transform .3s var(--ease); }

@media (max-width: 760px) {
  .nav__toggle { display: block; }
  .nav__links {
    position: fixed; inset: 68px 0 auto 0;
    flex-direction: column; align-items: flex-start; gap: 0;
    background: var(--paper); color: var(--ink);
    padding: 8px 20px 20px; box-shadow: 0 12px 30px rgba(10,31,68,.12);
    transform: translateY(-8px); opacity: 0; pointer-events: none; visibility: hidden;
    transition: opacity .25s, transform .25s var(--ease), visibility 0s linear .25s;
  }
  .nav__links a { padding: 12px 0; width: 100%; border-bottom: 1px solid var(--line); font-size: 1rem; }
  .nav__cta { border: 0; padding: 12px 0; border-radius: 0; }
  .nav.is-open .nav__links { opacity: 1; transform: none; pointer-events: auto; visibility: visible; transition-delay: 0s; }
  .nav.is-open { background: var(--paper); color: var(--ink); }
  .nav.is-open .nav__toggle span:first-child { transform: translateY(3.25px) rotate(45deg); }
  .nav.is-open .nav__toggle span:last-child { transform: translateY(-3.25px) rotate(-45deg); }
}

/* Legal pages: simple static nav */
.page-legal .nav { background: var(--paper); color: var(--ink); box-shadow: 0 1px 0 var(--line); }
.page-legal .brand__logo { --rung: var(--accent); }
.nav__links--static { position: static !important; opacity: 1 !important; transform: none !important; pointer-events: auto !important; flex-direction: row !important; background: none !important; box-shadow: none !important; padding: 0 !important; }
.nav__links--static a { border: 0 !important; width: auto !important; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 22px; border-radius: 999px;
  font-weight: 600; font-size: .95rem; text-decoration: none;
  transition: transform .2s var(--ease), background .2s, color .2s, border-color .2s;
}
.btn:hover { transform: translateY(-1px); }
.btn--primary { background: #fff; color: var(--ink); }
.btn--primary:hover { background: var(--accent-2); }
.btn--ghost { color: #fff; border: 1px solid rgba(255,255,255,.35); }
.btn--ghost:hover { border-color: #fff; }
.btn--light { background: #fff; color: var(--ink); margin-top: 8px; }
.btn--dark { background: var(--ink); color: #fff; margin-top: 8px; }
.btn--dark:hover { background: var(--ink-2); }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  min-height: min(100svh, 900px);
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 104px 0 36px;
  background:
    radial-gradient(1200px 600px at 80% 10%, rgba(11,118,216,.28), transparent 60%),
    radial-gradient(800px 500px at 0% 100%, rgba(217,164,65,.10), transparent 60%),
    var(--ink);
  color: #d6dde7;
}
.hero__canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .9; }
.hero__inner { position: relative; padding-bottom: 40px; }
.eyebrow { font-size: .8rem; letter-spacing: .16em; text-transform: uppercase; color: var(--accent-2); margin-bottom: 22px; }
.hero__title {
  font-family: var(--serif); color: #fff; font-weight: 400;
  font-size: clamp(3.2rem, 8vw, 6.6rem); line-height: .98; letter-spacing: -.03em;
  margin-bottom: 26px;
}
.hero__title em { color: var(--accent-2); }
.hero__lede { max-width: 640px; font-size: clamp(1.05rem, 1.6vw, 1.22rem); line-height: 1.6; }
.hero__lede strong { display: block; color: #fff; font-weight: 600; margin-bottom: 6px; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

.facts {
  position: relative; margin: 0;
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid rgba(255,255,255,.14);
}
.facts > div { padding: 18px 20px 0 0; }
.facts dt { font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; color: rgba(214,221,231,.6); margin-bottom: 4px; }
.facts dd { margin: 0; color: #fff; font-family: var(--serif); font-size: 1.25rem; }
@media (max-width: 760px) { .facts { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Sections ---------- */
/* Sections start flush at the top when jumped to; the fixed nav (68px) sits over their own top padding. */
.section { padding: max(80px, clamp(48px, 5.4vw, 82px)) 0 clamp(48px, 5.4vw, 82px); }
/* Land 1px inside the target so sub-pixel rounding never shows the previous section */
main > section[id] { scroll-margin-top: -1px; }
.section--dark { background: var(--ink); color: #c7d0dc; }
.section--dark h2, .section--dark h3 { color: #fff; }
.section--tint { background: var(--tint); }
.section__head { max-width: 820px; margin-bottom: clamp(24px, 2.8vw, 40px); }
.section__sub { font-size: 1.08rem; line-height: 1.55; color: var(--muted); margin: 10px 0 0; }
.section--dark .section__sub { color: #9aa7b8; }
.kicker { font-size: .78rem; letter-spacing: .16em; text-transform: uppercase; color: var(--accent-text); font-weight: 600; margin-bottom: 14px; }
.section--dark .kicker { color: var(--accent-2); }

/* ---------- 01 Challenge ---------- */
.pull { margin: 0; font-family: var(--serif); font-size: clamp(1.3rem, 2.2vw, 1.7rem); line-height: 1.3; color: var(--ink); padding-left: 22px; border-left: 3px solid var(--warm); }
.split { display: grid; grid-template-columns: 1fr 1.1fr; gap: clamp(32px, 6vw, 80px); align-items: start; }
.split h2 .muted { display: block; }
.prose { font-size: 1.1rem; margin: 0 0 28px; }
.prose em { font-family: var(--serif); font-size: 1.08em; color: var(--ink); }
.cards { display: grid; gap: 18px; }
.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px 26px; display: grid; grid-template-columns: 52px minmax(0, 1fr); column-gap: 20px;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}
.card:hover { transform: translateY(-2px); box-shadow: 0 18px 40px -24px rgba(10,31,68,.25); }
.card__icon { grid-row: span 2; width: 52px; height: 52px; border-radius: 12px; background: #e6f0fb; display: grid; place-items: center; }
.card__icon svg { width: 30px; fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.card h3 { margin-bottom: 6px; }
.card p { margin: 0; color: var(--muted); font-size: .98rem; line-height: 1.5; }
.gaps { list-style: none; padding: 0; margin: clamp(28px, 3.2vw, 40px) 0 0; display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.gaps li { padding: 20px 28px 0 0; color: var(--muted); font-size: .98rem; line-height: 1.5; }
.gaps li + li { padding-left: 28px; border-left: 1px solid var(--line); }
.gaps__n { display: block; font-family: var(--serif); font-size: 1.6rem; color: var(--ink); margin-bottom: 8px; }
@media (max-width: 860px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .gaps { grid-template-columns: 1fr; }
  .gaps li, .gaps li + li { padding: 22px 0; border-left: 0; border-bottom: 1px solid var(--line); }
}
@media (max-width: 520px) {
  .card { grid-template-columns: minmax(0, 1fr); padding: 22px; }
  .card__icon { grid-row: auto; margin-bottom: 16px; }
}

/* ---------- 02 Approach ---------- */
.streams { display: grid; grid-template-columns: minmax(0, 1fr) 64px minmax(0, 1fr); gap: 0; }

/* Double helix between the strands: the two strands of the project, coupled by rungs */
.helix { position: relative; overflow: hidden; pointer-events: none; }
.helix--v { -webkit-mask-image: linear-gradient(transparent, #000 18%, #000 82%, transparent); mask-image: linear-gradient(transparent, #000 18%, #000 82%, transparent); }
.helix--v .helix__svg { position: absolute; left: 50%; top: 0; width: 80px; height: auto; max-width: none; margin-left: -40px; animation: helix-v 9s linear infinite; }
.helix--h { display: none; height: 64px; margin: 6px 0; -webkit-mask-image: linear-gradient(90deg, transparent, #000 15%, #000 85%, transparent); mask-image: linear-gradient(90deg, transparent, #000 15%, #000 85%, transparent); }
.helix--h .helix__svg { position: absolute; left: 0; top: 50%; height: 80px; width: auto; max-width: none; margin-top: -40px; animation: helix-h 9s linear infinite; }
.helix__front, .helix__back, .helix__rung { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.helix__front { stroke: #d7e9ff; stroke-width: 3.2; }
.helix__back { stroke: #d7e9ff; stroke-width: 3.2; opacity: .28; }
.helix__rung { stroke: var(--accent); stroke-width: 2.6; opacity: .95; }
@keyframes helix-v { to { transform: translateY(-96px); } }
@keyframes helix-h { to { transform: translateX(-96px); } }
.stream {
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  border: 1px solid rgba(255,255,255,.1); border-radius: var(--radius);
  padding: clamp(20px, 2.2vw, 26px) clamp(22px, 2.6vw, 30px);
}
.stream__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.stream__tag { display: inline-block; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-2); border: 1px solid rgba(140,200,255,.35); padding: 4px 10px; border-radius: 999px; }
.stream__meta { font-size: .85rem; letter-spacing: .04em; color: #9aa7b8; }
.stream__rq { font-family: var(--serif); font-size: 1.12rem; line-height: 1.35; color: #fff; margin: 12px 0 0; }
.verbs { margin: 12px 0 0; }
.verbs > div { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 14px; align-items: baseline; padding: 6px 0; border-top: 1px solid rgba(255,255,255,.08); }
.verbs dt { font-family: var(--serif); font-size: 1.12rem; color: var(--accent-2); }
.verbs dd { margin: 0; font-size: .96rem; line-height: 1.5; }

.agent {
  margin-top: 14px;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: clamp(24px, 4vw, 48px); align-items: center;
  background: #fff; color: var(--text); border-radius: var(--radius);
  padding: clamp(20px, 2.2vw, 26px) clamp(22px, 2.8vw, 32px);
}
.agent .kicker { color: var(--accent-text); margin-bottom: 8px; }
.agent h3 { color: var(--ink) !important; font-family: var(--serif); font-weight: 400; font-size: clamp(1.4rem, 2.2vw, 1.75rem); margin-bottom: 8px; }
.agent p { margin: 0; color: var(--muted); font-size: .98rem; line-height: 1.5; }
.agent__loop { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; counter-reset: s; }
.agent__loop li { position: relative; display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 8px; border: 1px solid var(--line); border-radius: 999px; font-weight: 500; font-size: .94rem; color: var(--ink); background: var(--paper); counter-increment: s; }
.agent__loop li::before { content: counter(s); flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: .78rem; font-weight: 700; background: #e6f0fb; color: var(--accent); }
.agent__loop .agent__human { border-color: var(--warm); background: #fdf8ee; }
.agent__loop .agent__human::before { content: "✓"; background: var(--warm); color: #fff; }
@media (max-width: 860px) {
  .streams, .agent { grid-template-columns: minmax(0, 1fr); }
  .helix--v { display: none; }
  .helix--h { display: block; }
}
@media (max-width: 460px) {
  .verbs > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .agent__loop { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- 03 Team ---------- */
.people { list-style: none; padding: 0; margin: 0 0 clamp(24px, 3vw, 36px); display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.person { border-top: 1px solid var(--ink); padding-top: 16px; }
.person__avatar {
  width: 46px; height: 46px; border-radius: 50%; margin-bottom: 12px;
  display: grid; place-items: center;
  font-family: var(--serif); font-size: 1rem; color: #fff;
  background: linear-gradient(135deg, var(--ink-2), var(--accent));
}
.person h3 { margin-bottom: 4px; }
.person p { font-size: .95rem; line-height: 1.5; margin: 0; }
.tandem { display: grid; grid-template-columns: minmax(0, 1fr) 140px minmax(0, 1fr); align-items: center; gap: 20px; }
.site { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 22px; }
.site__place { font-size: .78rem; letter-spacing: .16em; text-transform: uppercase; color: var(--accent-text); font-weight: 600; margin-bottom: 4px; }
.site h3 { font-family: var(--serif); font-weight: 400; font-size: 1.18rem; }
.site p:last-child { margin: 0; }
.tandem__link { position: relative; }
.tandem__link svg { width: 100%; fill: var(--accent); stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 4 6; }
.tandem__link span { position: absolute; left: 50%; top: -20px; transform: translateX(-50%); font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-text); }
.funding { margin: 16px 0 0; max-width: 720px; color: var(--muted); font-size: .95rem; }
.funding strong { color: var(--ink); }
@media (max-width: 960px) { .people { grid-template-columns: repeat(2, 1fr); row-gap: 32px; } }
@media (max-width: 760px) {
  .tandem { grid-template-columns: minmax(0, 1fr); }
  .tandem__link { display: none; }
}
@media (max-width: 520px) { .people { grid-template-columns: 1fr; } }

/* ---------- 04 Prior work ---------- */
.pubs { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.pubs li { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 18px; align-items: baseline; padding: 11px 0; border-bottom: 1px solid var(--line); }
.pubs .yr { font-family: var(--serif); font-size: 1.2rem; color: var(--accent-text); }
.pubs .t { color: var(--ink); font-weight: 600; display: block; margin-bottom: 2px; }
.pubs .a { color: var(--muted); font-size: .92rem; line-height: 1.5; }
.pubs a { font-size: .88rem; color: var(--accent-text); text-decoration: none; white-space: nowrap; }
.pubs a:hover { text-decoration: underline; }
@media (max-width: 600px) { .pubs li { grid-template-columns: minmax(0, 1fr); gap: 4px; } }

/* ---------- 05 Contact ---------- */
.contact { background:
  radial-gradient(900px 500px at 100% 0%, rgba(11,118,216,.25), transparent 60%),
  var(--ink); }
/* Contact + footer fill at least one screen, so the last jump also lands flush */
.contact { min-height: calc(100svh - var(--footer-h, 168px) + 2px); display: flex; flex-direction: column; justify-content: center; }
.contact__inner { display: grid; grid-template-columns: 1.2fr 1fr; gap: clamp(32px, 6vw, 80px); align-items: center; }
.contact__card { border: 1px solid rgba(255,255,255,.14); border-radius: var(--radius); padding: clamp(28px, 4vw, 40px); background: rgba(255,255,255,.04); }
.contact__label { font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; color: #8796aa; margin-bottom: 10px; }
.contact__names { font-family: var(--serif); font-size: 1.5rem; color: #fff; line-height: 1.35; margin-bottom: 4px; }
.contact__mail { display: inline-block; color: #fff; font-size: 1.05rem; margin-bottom: 18px; text-underline-offset: 4px; text-decoration-color: rgba(140,200,255,.6); }
.contact address { font-style: normal; color: #9aa7b8; margin-bottom: 20px; }
@media (max-width: 860px) { .contact__inner { grid-template-columns: 1fr; } }

/* ---------- Footer ---------- */
.footer { background: var(--ink-deep); color: #7d8a9c; font-size: .88rem; padding: 36px 0; }
.footer__inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 32px; }
.footer__brand { display: flex; align-items: center; gap: 18px; color: #c7d0dc; }
.footer__logo { display: block; height: 28px; width: auto; aspect-ratio: 758 / 222; color: #fff; flex: none; }
.footer__links { display: flex; gap: 22px; }
.footer__links a { text-decoration: none; }
.footer__links a:hover { color: #fff; }
.footer__note { margin: 0; width: 100%; font-size: .82rem; color: #8796aa; }
.footer__copy { margin: -8px 0 0; width: 100%; }

/* ---------- Reveal on scroll ---------- */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.js .reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .helix__svg { animation: none; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------- Legal pages ---------- */
.legal { padding: 140px 0 100px; }
.legal .wrap { max-width: 760px; }
.legal h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(2.2rem, 5vw, 3.2rem); margin-bottom: 32px; }
.legal h2 { font-size: 1.3rem; margin: 36px 0 10px; }
.legal p, .legal address { max-width: 68ch; }
.legal address { font-style: normal; }

@media print {
  .js .reveal { opacity: 1; transform: none; }
  .nav, .hero__canvas { display: none; }
}
