/* ==========================================================================
   Biomedical Lab — main.css
   Design tokens, reset, typography, layout primitives, header, footer.
   No frameworks. No external requests. Fluid type via clamp().
   ========================================================================== */

:root{
  /* ---- Color: clinical teal + biotech green, warm paper neutrals ---- */
  --ink:            #0B1A18;
  --ink-soft:       #33453f;
  --paper:          #F7F4EC;
  --paper-raised:   #FFFFFF;
  --sand:           #EFE8D6;
  --line:           rgba(11,26,24,0.12);
  --line-strong:    rgba(11,26,24,0.22);

  --teal-900:       #073430;
  --teal-800:       #0B4842;
  --teal-700:       #0F615A;
  --teal-600:       #147A70;
  --teal-500:       #1B9186;
  --teal-100:       #DDEFEA;

  --green-600:      #4B9A3B;
  --green-500:      #63B24E;
  --green-100:      #E4F3DD;

  --amber-500:      #C77F1F;

  --focus:          #1B9186;

  /* semantic */
  --color-bg:        var(--paper);
  --color-surface:    var(--paper-raised);
  --color-text:       var(--ink);
  --color-text-soft:  var(--ink-soft);
  --color-brand:      var(--teal-700);
  --color-brand-dark: var(--teal-900);
  --color-accent:     var(--green-500);

  /* ---- Type ---- */
  --font-display: 'Fraunces', 'Iowan Old Style', 'Palatino Linotype', Georgia, 'Times New Roman', serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  --step--1: clamp(0.83rem, 0.8rem + 0.15vw, 0.92rem);
  --step-0:  clamp(1rem, 0.96rem + 0.2vw, 1.125rem);
  --step-1:  clamp(1.2rem, 1.13rem + 0.35vw, 1.4rem);
  --step-2:  clamp(1.44rem, 1.32rem + 0.6vw, 1.8rem);
  --step-3:  clamp(1.8rem, 1.58rem + 1.1vw, 2.4rem);
  --step-4:  clamp(2.3rem, 1.9rem + 2vw, 3.4rem);
  --step-5:  clamp(2.9rem, 2.2rem + 3.4vw, 4.6rem);

  /* ---- Space ---- */
  --space-3xs: 0.25rem;
  --space-2xs: 0.5rem;
  --space-xs:  0.75rem;
  --space-sm:  1rem;
  --space-md:  1.5rem;
  --space-lg:  2.5rem;
  --space-xl:  4rem;
  --space-2xl: 6rem;
  --space-3xl: 9rem;

  --radius-sm: 10px;
  --radius-md: 18px;
  --radius-lg: 28px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(7,52,48,0.06), 0 1px 1px rgba(7,52,48,0.04);
  --shadow-md: 0 12px 32px -12px rgba(7,52,48,0.22);
  --shadow-lg: 0 30px 70px -20px rgba(7,52,48,0.30);

  --container: 1220px;
  --header-h: 84px;

  --ease-out: cubic-bezier(.16,.84,.44,1);
  --ease-in-out: cubic-bezier(.65,0,.35,1);
  --dur-fast: 180ms;
  --dur-med: 420ms;
  --dur-slow: 800ms;
}

@media (prefers-color-scheme: dark){
  :root{ color-scheme: light; }
}

/* ---- Reset ---- */
*, *::before, *::after{ box-sizing: border-box; }
* { margin: 0; }
html{ -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
html, body{ height: 100%; }
body{
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, picture, svg, video{ display: block; max-width: 100%; height: auto; }
input, button, textarea, select{ font: inherit; color: inherit; }
button{ cursor: pointer; }
a{ color: inherit; text-decoration: none; }
ul, ol{ list-style: none; padding: 0; }
h1, h2, h3, h4{ font-family: var(--font-display); line-height: 1.12; letter-spacing: -0.01em; font-weight: 600; }
h1{ font-size: var(--step-5); }
h2{ font-size: var(--step-4); }
h3{ font-size: var(--step-2); }
h4{ font-size: var(--step-1); }
p{ max-width: 62ch; }
table{ border-collapse: collapse; }

@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior: auto; }
  *, *::before, *::after{
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

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

/* ---- Skip link ---- */
.skip-link{
  position: fixed;
  top: -60px; left: var(--space-sm);
  z-index: 1000;
  background: var(--color-brand-dark);
  color: #fff;
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-sm);
  transition: top var(--dur-fast) var(--ease-out);
}
.skip-link:focus{ top: var(--space-sm); }

/* ---- Layout primitives ---- */
.container{
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 4vw, 2.5rem);
}
.section{ padding-block: var(--space-2xl); position: relative; }
.section--tight{ padding-block: var(--space-xl); }
.section--brand{ background: var(--color-brand-dark); color: #fff; }
.section--sand{ background: var(--sand); }
.section--surface{ background: var(--color-surface); }

.eyebrow{
  display: inline-flex; align-items: center; gap: var(--space-2xs);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: var(--step--1);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-brand);
}
.section--brand .eyebrow{ color: var(--green-500); }
.eyebrow::before{
  content: "";
  width: 22px; height: 2px;
  background: currentColor;
  display: inline-block;
}

.section-head{
  max-width: 46rem;
  margin-bottom: var(--space-xl);
}
.section-head p{ color: var(--color-text-soft); margin-top: var(--space-sm); font-size: var(--step-1); }

.visually-hidden{
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---- Buttons ---- */
.btn{
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2xs);
  padding: 0.9em 1.6em;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: var(--step--1);
  letter-spacing: 0.01em;
  border: 1.5px solid transparent;
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
  white-space: nowrap;
}
.btn:active{ transform: translateY(1px) scale(0.99); }
.btn-primary{
  background: var(--color-accent);
  color: var(--teal-900);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover{ background: var(--green-600); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.btn-outline{
  background: transparent;
  border-color: currentColor;
  color: inherit;
}
.btn-outline:hover{ background: rgba(255,255,255,0.08); transform: translateY(-2px); }
.section:not(.section--brand) .btn-outline{ border-color: var(--line-strong); }
.section:not(.section--brand) .btn-outline:hover{ background: var(--teal-100); border-color: var(--color-brand); }
.btn-ghost{
  background: transparent;
  color: var(--color-brand);
  padding-inline: 0.4em;
}
.btn-ghost:hover{ color: var(--teal-900); }
.btn svg{ width: 1.15em; height: 1.15em; flex-shrink: 0; }

/* ==========================================================================
   Header
   ========================================================================== */
.site-header{
  position: sticky; top: 0; z-index: 200;
  height: var(--header-h);
  display: flex; align-items: center;
  background: rgba(247,244,236,0.82);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: transform var(--dur-med) var(--ease-in-out), border-color var(--dur-med), background var(--dur-med);
}
.site-header.is-scrolled{
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
}
.site-header.is-hidden{ transform: translateY(-100%); }

.site-header .container{ display: flex; align-items: center; justify-content: space-between; gap: var(--space-md); }

.brand{ display: flex; align-items: center; gap: 0.6rem; }
.brand img{ height: 40px; width: auto; }
.brand-word{ font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; color: var(--color-brand-dark); }

.main-nav{ display: none; }
@media (min-width: 900px){
  .main-nav{ display: flex; align-items: center; gap: var(--space-lg); }
  .main-nav__list{ display: flex; gap: var(--space-md); }
  .main-nav__list a{
    position: relative;
    font-weight: 600; font-size: var(--step--1);
    color: var(--color-text-soft);
    padding: 0.4rem 0.1rem;
  }
  .main-nav__list a::after{
    content: ""; position: absolute; left: 0; bottom: -2px;
    width: 0; height: 2px; background: var(--color-accent);
    transition: width var(--dur-fast) var(--ease-out);
  }
  .main-nav__list a:hover::after, .main-nav__list a[aria-current="page"]::after{ width: 100%; }
  .main-nav__list a[aria-current="page"]{ color: var(--color-brand-dark); }
}

.header-actions{ display: flex; align-items: center; gap: var(--space-sm); }
.header-actions .btn{ display: none; }
@media (min-width: 700px){ .header-actions .btn{ display: inline-flex; } }

.nav-toggle{
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  background: transparent; border: none;
}
@media (min-width: 900px){ .nav-toggle{ display: none; } }
.nav-toggle span{
  display: block; width: 22px; height: 2px; background: var(--color-brand-dark);
  position: relative;
  transition: transform var(--dur-fast) var(--ease-in-out), opacity var(--dur-fast);
}
.nav-toggle span::before, .nav-toggle span::after{
  content: ""; position: absolute; left: 0; width: 22px; height: 2px; background: var(--color-brand-dark);
  transition: transform var(--dur-fast) var(--ease-in-out), top var(--dur-fast);
}
.nav-toggle span::before{ top: -7px; }
.nav-toggle span::after{ top: 7px; }
.nav-toggle[aria-expanded="true"] span{ background: transparent; }
.nav-toggle[aria-expanded="true"] span::before{ top: 0; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] span::after{ top: 0; transform: rotate(-45deg); }

.mobile-nav{
  position: fixed; inset: var(--header-h) 0 0 0;
  background: var(--paper);
  z-index: 190;
  transform: translateY(-8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-med) var(--ease-out), transform var(--dur-med) var(--ease-out);
  overflow-y: auto;
}
.mobile-nav.is-open{ opacity: 1; transform: translateY(0); pointer-events: auto; }
.mobile-nav__list{ display: flex; flex-direction: column; padding: var(--space-lg) clamp(1.25rem, 4vw, 2.5rem); gap: var(--space-2xs); }
.mobile-nav__list a{
  display: block; padding: var(--space-sm) 0;
  font-family: var(--font-display); font-size: var(--step-2); font-weight: 600;
  border-bottom: 1px solid var(--line);
  color: var(--color-brand-dark);
}
.mobile-nav__foot{ padding: var(--space-md) clamp(1.25rem, 4vw, 2.5rem); display: flex; flex-direction: column; gap: var(--space-sm); }
@media (min-width: 900px){ .mobile-nav{ display: none; } }

.scroll-progress{
  position: fixed; top: 0; left: 0; height: 3px; width: 0%;
  background: linear-gradient(90deg, var(--teal-600), var(--green-500));
  z-index: 300;
  transition: width 80ms linear;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer{
  background: var(--teal-900);
  color: rgba(255,255,255,0.86);
  padding-block: var(--space-2xl) var(--space-lg);
}
.footer-grid{
  display: grid; gap: var(--space-xl);
  grid-template-columns: 1.3fr 1fr 1fr;
}
@media (max-width: 800px){ .footer-grid{ grid-template-columns: 1fr; gap: var(--space-lg); } }
.footer-brand img{ display: block; height: 56px; width: auto; margin-bottom: var(--space-sm); }
.footer-brand p{ color: rgba(255,255,255,0.66); max-width: 34ch; }
.footer-col h4{ font-size: var(--step-0); color: #fff; margin-bottom: var(--space-sm); }
.footer-col ul{ display: flex; flex-direction: column; gap: var(--space-2xs); }
.footer-col a{ color: rgba(255,255,255,0.72); transition: color var(--dur-fast); }
.footer-col a:hover{ color: var(--green-500); }
.footer-social{ display: flex; gap: var(--space-sm); margin-top: var(--space-sm); }
.footer-social a{
  width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255,255,255,0.22); border-radius: 50%;
  transition: background var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast);
}
.footer-social a:hover{ background: var(--green-500); border-color: var(--green-500); transform: translateY(-2px); color: var(--teal-900); }
.footer-social svg{ width: 18px; height: 18px; }
.footer-bottom{
  margin-top: var(--space-xl);
  padding-top: var(--space-md);
  border-top: 1px solid rgba(255,255,255,0.14);
  display: flex; flex-wrap: wrap; gap: var(--space-sm);
  align-items: center; justify-content: space-between;
  font-size: var(--step--1);
  color: rgba(255,255,255,0.6);
}
.footer-bottom nav{ display: flex; gap: var(--space-md); flex-wrap: wrap; }
.footer-bottom a{ color: rgba(255,255,255,0.6); }
.footer-bottom a:hover{ color: #fff; }
.footer-credit a{ color: var(--green-500); font-weight: 600; }

/* ---- Reveal-on-scroll base state ----
   Scoped to .js-ready (added by main.js on load) so content stays visible
   by default and is only hidden-then-animated when JS actually runs.
   Without this, any JS failure (file:// CORS on ES modules, a blocked
   script, JS disabled) leaves every [data-reveal] element at opacity:0
   forever. */
.js-ready [data-reveal]{
  opacity: 0;
  transform: translateY(22px);
  transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}
.js-ready [data-reveal].is-revealed{ opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce){
  .js-ready [data-reveal]{ opacity: 1; transform: none; transition: none; }
}
