/* ============================================================
   BioStack.life — Shared design system
   Governing parent: BioStack HQ visual language
   Layer: Industrial Life Sciences precision + commercial confidence
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
  /* ---- BioStack.life venture palette (blue-teal system) ----
     Burgundy is reserved for the BioStack HQ parent group and is
     intentionally absent here. */
  --venture-primary:       #429BAF;   /* BioStack Life Blue — brand, primary CTAs, active states */
  --venture-primary-dark:  #17667C;   /* Deep Marine — hover, strong links, stronger controls */
  --venture-primary-light: #DDEFF2;   /* Glacier Mist — soft fills, tags, quiet backgrounds */
  --venture-dark:          #0B2D3A;   /* Ocean Ink — dark sections, footer, video overlay */
  --venture-accent:        #C97945;   /* Mineral Copper — sparse signal / directional cues (5–10%) */
  --venture-accent-light:  #F1D5C3;   /* Soft Copper — subtle highlight fills only */
  --venture-analogous:     #27756F;   /* Deep Verdigris — maps, supply-chain, secondary data signals */
  --venture-primary-tint:  #8CCBD7;   /* lighter blue for eyebrows/accents on dark sections */

  /* Foundation */
  --paper:        #F6F5F1;   /* Warm Clinical Paper — main background */
  --paper-2:      #EFEDE6;   /* recessed panels */
  --paper-3:      #E7E4DB;   /* deeper recess */
  --ink:          #172126;   /* Graphite — primary body text */
  --ink-2:        #47555B;   /* secondary type */
  --ink-3:        #7C878C;   /* muted / captions */

  /* Semantic signal aliases (kept so existing selectors stay coherent) */
  --mineral:      var(--venture-primary-dark);  /* secondary scientific signal → Deep Marine */
  --teal:         var(--venture-analogous);     /* sparse signal → Deep Verdigris */

  --line:         rgba(23,33,38,0.12);
  --line-2:       rgba(23,33,38,0.22);
  --line-soft:    rgba(23,33,38,0.06);

  /* Ink on dark (Ocean Ink foundation) */
  --dark:         #0B2D3A;   /* Ocean Ink */
  --dark-2:       #123A49;   /* raised dark panel */
  --paper-on-dark:#EAF1F2;
  --line-on-dark: rgba(234,241,242,0.16);

  /* ---- Backwards-compatible accent aliases ----
     Previously burgundy; now repointed to BioStack Life Blue so every
     existing var(--burgundy*) usage renders in the venture primary. */
  --burgundy:     var(--venture-primary);
  --burgundy-2:   var(--venture-primary-dark);

  /* Type */
  --display: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  --body:    "Inter", "Helvetica Neue", Arial, sans-serif;
  --mono:    "Space Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Scale / rhythm */
  --maxw: 1280px;
  --gutter: clamp(20px, 5vw, 64px);
  --section-y: clamp(72px, 10vw, 148px);

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

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, video, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
h1,h2,h3,h4 { margin: 0; font-weight: 500; }
p { margin: 0; }
::selection { background: var(--burgundy); color: var(--paper); }

/* ---------- Layout primitives ---------- */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding-inline: var(--gutter); }
.section { padding-block: var(--section-y); position: relative; }
.section--tight { padding-block: clamp(56px, 7vw, 96px); }

/* Eyebrow / headline block */
.eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--burgundy);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 22px;
}
.eyebrow::before {
  content: "";
  width: 26px; height: 1px;
  background: var(--burgundy);
  display: inline-block;
}
.eyebrow--muted { color: var(--ink-3); }
.eyebrow--muted::before { background: var(--ink-3); }

.headline {
  font-family: var(--display);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: -0.02em;
  font-size: clamp(2rem, 4.6vw, 3.9rem);
  max-width: 20ch;
}
.headline--wide { max-width: 26ch; }
.lede {
  font-size: clamp(1.05rem, 1.6vw, 1.28rem);
  line-height: 1.5;
  color: var(--ink-2);
  max-width: 58ch;
  margin-top: 22px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 24px;
  font-family: var(--body);
  font-size: 15px; font-weight: 500;
  letter-spacing: 0.005em;
  border: 1px solid transparent;
  border-radius: 2px;
  transition: background .4s var(--ease), color .4s var(--ease), border-color .4s var(--ease), transform .4s var(--ease);
  will-change: transform;
}
.btn .arw { transition: transform .4s var(--ease); }
.btn:hover .arw { transform: translateX(4px); }
.btn--primary { background: var(--burgundy); color: var(--paper); }
.btn--primary:hover { background: var(--venture-primary-dark); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn--ghost:hover { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.btn--on-dark { background: var(--paper); color: var(--ink); }
.btn--on-dark:hover { background: var(--burgundy); color: var(--paper); }
.btn--ghost-dark { background: transparent; color: var(--paper-on-dark); border-color: var(--line-on-dark); }
.btn--ghost-dark:hover { border-color: var(--paper-on-dark); background: rgba(234,241,242,0.08); }

.textlink {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 500;
  color: var(--ink);
  border-bottom: 1px solid var(--line-2);
  padding-bottom: 2px;
  transition: color .35s var(--ease), border-color .35s var(--ease);
}
.textlink .arw { transition: transform .35s var(--ease); }
.textlink:hover { color: var(--burgundy); border-color: var(--burgundy); }
.textlink:hover .arw { transform: translateX(4px); }

/* ---------- Header ---------- */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  transition: background .5s var(--ease), border-color .5s var(--ease), backdrop-filter .5s var(--ease);
  border-bottom: 1px solid transparent;
}
.site-header.is-solid {
  background: rgba(234,241,242,0.86);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom-color: var(--line);
}
.site-header.on-hero:not(.is-solid) { color: var(--paper-on-dark); }
.site-header.on-hero:not(.is-solid) .brand__mark path { fill: var(--paper-on-dark); }
.site-header.on-hero:not(.is-solid) .navlink { color: rgba(234,241,242,0.82); }
.site-header.on-hero:not(.is-solid) .navlink:hover { color: #fff; }
.site-header.on-hero:not(.is-solid) .icon-btn { background: var(--paper); color: var(--ink); border-color: transparent; }
.header-inner {
  display: flex; align-items: center; gap: 24px;
  height: 74px;
}
.brand { display: inline-flex; align-items: center; gap: 11px; flex-shrink: 0; }
.brand__mark { width: 26px; height: 26px; }
.brand__mark path, .brand__mark circle { transition: fill .5s var(--ease), stroke .5s var(--ease); }
.brand__word {
  font-family: var(--display);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.01em;
}
.brand__word b { color: var(--burgundy); font-weight: 600; }
.site-header.on-hero:not(.is-solid) .brand__word { color: var(--paper-on-dark); }
.site-header.on-hero:not(.is-solid) .brand__word b { color: var(--venture-primary-tint); }

.nav { display: flex; align-items: center; gap: 18px; margin-left: auto; }
.navlink {
  font-size: 13.5px; font-weight: 450;
  color: var(--ink-2);
  transition: color .3s var(--ease);
  position: relative;
  white-space: nowrap;
}
.navlink:hover { color: var(--burgundy); }
.nav-actions { display: flex; align-items: center; gap: 8px; margin-left: 4px; }
.icon-btn {
  width: 42px; height: 42px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: 999px;
  color: var(--ink);
  transition: background .3s var(--ease), color .3s var(--ease), border-color .3s var(--ease), transform .3s var(--ease);
}
.icon-btn:hover { background: var(--venture-primary-dark); color: var(--paper); border-color: var(--venture-primary-dark); transform: translateY(-1px); }

.nav-cta {
  font-size: 14px; font-weight: 500;
  padding: 11px 18px;
  background: var(--burgundy); color: var(--paper);
  border-radius: 2px;
  white-space: nowrap;
  transition: background .35s var(--ease);
}
.nav-cta:hover { background: var(--venture-primary-dark); }
.site-header.on-hero:not(.is-solid) .nav-cta { background: var(--paper); color: var(--ink); }
.site-header.on-hero:not(.is-solid) .nav-cta:hover { background: var(--burgundy); color: var(--paper); }

.burger { display: none; }

/* Compact navigation — tablet landscape and below */
@media (max-width: 1280px) {
  .nav { display: none; }
  .header-inner { height: 64px; }
  .burger {
    display: inline-flex; align-items: center; justify-content: center;
    width: 46px; height: 46px; margin-left: auto;
    border: 1px solid transparent; border-radius: 999px; background: transparent;
    color: inherit;
    transition: background .3s var(--ease), color .3s var(--ease), transform .3s var(--ease);
  }
  .burger:hover { background: rgba(23,33,38,0.08); transform: translateY(-1px); }
  .site-header.on-hero:not(.is-solid) .burger { color: var(--paper-on-dark); }
  .site-header.on-hero:not(.is-solid) .burger:hover { background: rgba(234,241,242,0.12); }
  .burger__lines { width: 21px; display: grid; gap: 6px; }
  .burger__line { display: block; height: 1.5px; border-radius: 999px; background: currentColor; }
  .burger__line:last-child { width: 13px; justify-self: end; }
}

.mobile-panel {
  position: fixed; inset: 0; z-index: 200;
  background: var(--paper);
  transform: translateY(-100%);
  transition: transform .5s var(--ease);
  display: flex; flex-direction: column;
  padding: 20px var(--gutter) 40px;
  visibility: hidden;
}
.mobile-panel.open { transform: translateY(0); visibility: visible; }
.mobile-panel__top { display: flex; align-items: center; height: 44px; }
.mobile-panel__close {
  margin-left: auto; width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: 999px; background: transparent; color: var(--ink);
  transition: background .3s var(--ease), transform .3s var(--ease);
}
.mobile-panel__close:hover { background: var(--venture-primary-light); transform: rotate(4deg); }
.mobile-nav { display: flex; flex-direction: column; margin-top: 24px; }
.mobile-nav a {
  font-family: var(--display);
  font-size: clamp(1.6rem, 7vw, 2.2rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
}
.mobile-nav a span { font-family: var(--mono); font-size: 11px; color: var(--ink-3); letter-spacing: .1em; }
.mobile-panel__cta { margin-top: auto; padding-top: 28px; }
.mobile-panel__cta .btn { width: 100%; justify-content: center; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--dark);
  color: var(--paper-on-dark);
  padding-block: clamp(56px, 7vw, 88px);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 48px;
  align-items: start;
}
.footer-prop {
  font-family: var(--display);
  font-size: clamp(1.3rem, 2.4vw, 1.8rem);
  font-weight: 500; line-height: 1.15; letter-spacing: -0.02em;
  max-width: 20ch; margin-top: 20px;
}
.footer-col h4 {
  font-family: var(--mono); font-size: 11px; letter-spacing: .18em;
  text-transform: uppercase; color: rgba(234,241,242,0.5);
  margin-bottom: 16px;
}
.footer-col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 11px; }
.footer-col a, .footer-col button {
  color: rgba(234,241,242,0.82); font-size: 14.5px; background: none; border: none; padding: 0; text-align: left;
  transition: color .3s var(--ease);
}
.footer-col a:hover, .footer-col button:hover { color: #fff; }
.footer-brand { display: inline-flex; align-items: center; gap: 10px; }
.footer-brand .brand__word { color: var(--paper-on-dark); font-size: 17px; }
.footer-brand .brand__word b { color: var(--venture-primary-tint); }
.footer-bottom {
  display: flex; flex-wrap: wrap; gap: 16px 28px; align-items: center;
  margin-top: 56px; padding-top: 26px;
  border-top: 1px solid var(--line-on-dark);
  font-size: 12.5px; color: rgba(234,241,242,0.5);
}
.footer-bottom .eco { margin-right: auto; letter-spacing: .02em; }
.footer-bottom a { color: rgba(234,241,242,0.6); transition: color .3s; }
.footer-bottom a:hover { color: #fff; }

@media (max-width: 820px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 40px 32px; }
  .footer-brand-col { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
  .footer-grid { grid-template-columns: 1fr; }
}

/* ---------- Reveal on scroll ---------- */
/* Only hide reveals when JS is active (html.js). Without JS, content shows. */
.js .reveal { opacity: 0; transform: translateY(22px); transition: opacity .9s var(--ease-out), transform .9s var(--ease-out); }
.reveal { opacity: 1; transform: none; }
.js .reveal.in { opacity: 1; transform: none; }
.js .reveal[data-d="1"] { transition-delay: .08s; }
.js .reveal[data-d="2"] { transition-delay: .16s; }
.js .reveal[data-d="3"] { transition-delay: .24s; }
.js .reveal[data-d="4"] { transition-delay: .32s; }
@media (prefers-reduced-motion: reduce) { .js .reveal { opacity: 1 !important; transform: none !important; } }

/* ---------- Search overlay ---------- */
.search-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(20,17,15,0.55);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: 0; visibility: hidden; transition: opacity .35s var(--ease);
}
.search-overlay.open { opacity: 1; visibility: visible; }
.search-panel {
  position: absolute; top: 0; left: 0; right: 0;
  background: var(--paper); padding: 28px var(--gutter) 40px;
  transform: translateY(-24px); transition: transform .45s var(--ease);
  box-shadow: 0 24px 60px rgba(20,17,15,0.18);
}
.search-overlay.open .search-panel { transform: none; }
.search-head { display: flex; align-items: center; gap: 16px; max-width: var(--maxw); margin: 0 auto; }
.search-head .s-eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-3); }
.search-field { display: flex; align-items: center; gap: 14px; max-width: var(--maxw); margin: 18px auto 0; border-bottom: 2px solid var(--ink); padding-bottom: 14px; }
.search-field input {
  flex: 1; border: none; background: none; outline: none;
  font-family: var(--display); font-size: clamp(1.3rem, 3.4vw, 2.2rem); font-weight: 500;
  letter-spacing: -0.02em; color: var(--ink);
}
.search-field input::placeholder { color: var(--ink-3); }
.search-close { margin-left: auto; width: 42px; height: 42px; border: 1px solid var(--line-2); border-radius: 2px; background: none; display: inline-flex; align-items:center; justify-content:center; }
.search-meta { max-width: var(--maxw); margin: 22px auto 0; display: flex; flex-wrap: wrap; gap: 10px; }
.search-chip {
  font-size: 13px; padding: 8px 14px; border: 1px solid var(--line-2); border-radius: 2px;
  background: none; color: var(--ink-2); transition: all .3s var(--ease);
}
.search-chip:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.search-scope { max-width: var(--maxw); margin: 20px auto 0; font-size: 13px; color: var(--ink-3); font-family: var(--mono); letter-spacing: .04em; }

/* Utility */
.sr-only { position: absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip: rect(0,0,0,0); white-space: nowrap; border:0; }
.no-scroll { overflow: hidden; }
:focus-visible { outline: 2px solid var(--burgundy); outline-offset: 3px; }

/* ---------- Briefing modal ---------- */
.brief-modal {
  position: fixed; inset: 0; z-index: 320;
  background: rgba(20,17,15,0.55);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: 0; visibility: hidden; transition: opacity .35s var(--ease);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.brief-modal.open { opacity: 1; visibility: visible; }
.brief-modal__panel {
  background: var(--paper); max-width: 640px; width: 100%;
  padding: clamp(28px, 4vw, 48px); position: relative;
  transform: translateY(20px) scale(0.98); transition: transform .45s var(--ease);
  max-height: 84vh; overflow-y: auto; border-radius: 3px;
  box-shadow: 0 40px 90px rgba(20,17,15,0.3);
}
.brief-modal.open .brief-modal__panel { transform: none; }
.brief-modal__close {
  position: absolute; top: 20px; right: 20px; width: 42px; height: 42px;
  border: 1px solid var(--line-2); border-radius: 2px; background: none;
  display: inline-flex; align-items: center; justify-content: center; color: var(--ink);
  transition: background .3s, color .3s;
}
.brief-modal__close:hover { background: var(--ink); color: var(--paper); }
.brief-modal__type { font-family: var(--mono); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--burgundy); }
.brief-modal__title { font-family: var(--display); font-size: clamp(1.5rem, 3vw, 2.1rem); font-weight: 500; letter-spacing: -0.02em; line-height: 1.1; margin: 16px 0 10px; max-width: 24ch; }
.brief-modal__date { font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.brief-modal__body { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 24px; }
.brief-modal__body p { margin-bottom: 16px; color: var(--ink-2); font-size: 15.5px; line-height: 1.6; }
