/* ===================================================================
   Winnemac Labs — stylesheet
   =================================================================== */

/* ── Custom properties ─────────────────────────────────────────── */
:root {
  --bg:       #F5F4F0;
  --bg-2:     #EDECEA;
  --bg-3:     #E4E2DE;
  --text:     #18181A;
  --text-2:   #5A5856;
  --text-3:   #9A9896;
  --accent:   #05386B;
  --accent-2: #0a4a8a;
  --green:    #2E7D52;
  --green-2:  #3DA068;
  --rule:     rgba(5, 56, 107, 0.18);
  --rule-2:   rgba(24, 24, 26, 0.1);

  --font-display: 'Outfit', sans-serif;
  --font-mono:    'Space Mono', monospace;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-io:  cubic-bezier(0.65, 0, 0.35, 1);
  --spring:   cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Reset ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }
/* Smooth scrolling enabled only after load — prevents animated scroll
   restoration when the browser jumps back to the user's previous position
   on reload. The class is added by main.js after DOMContentLoaded. */
html.smooth-scroll { scroll-behavior: smooth; }

body {
  font-family: var(--font-display);
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  /* Hide content until the YAML loaders fill in the placeholders.
     main.js adds the .content-ready class once initSiteCopy() finishes. */
  opacity: 0;
  transition: opacity 0.25s ease-out;
}

body.content-ready {
  opacity: 1;
}

img, canvas, svg { display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea { font-family: inherit; }

/* ── Navigation ─────────────────────────────────────────────────── */
#nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  transition: background 0.4s var(--ease-io), border-color 0.4s var(--ease-io);
  border-bottom: 1px solid transparent;
}

#nav.scrolled {
  background: rgba(245, 244, 240, 0.88);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-color: var(--rule-2);
}

.nav-inner {
  padding: 0 2rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo { display: flex; align-items: center; }

.nav-logo-img { height: 40px; width: auto; }

.nav-links { display: flex; align-items: center; gap: 2rem; }

.nav-links a {
  font-size: 0.875rem;
  color: var(--text-2);
  letter-spacing: 0.01em;
  transition: color 0.2s;
}

.nav-links a:hover { color: var(--text); }

.nav-cta {
  padding: 0.45rem 1.1rem !important;
  background: var(--accent) !important;
  color: var(--bg) !important;
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.85rem !important;
  transition: opacity 0.2s, transform 0.2s var(--spring) !important;
}

.nav-cta:hover { opacity: 0.88 !important; transform: scale(0.97) !important; color: var(--bg) !important; }

.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  width: 24px;
  padding: 4px 0;
}

.nav-hamburger span {
  width: 100%; height: 1.5px;
  background: var(--text);
  transition: transform 0.3s var(--ease-io), opacity 0.3s;
  transform-origin: center;
}

.nav-hamburger.open span:first-child { transform: translateY(3.25px) rotate(45deg); }
.nav-hamburger.open span:last-child  { transform: translateY(-3.25px) rotate(-45deg); }

.mobile-menu {
  position: fixed;
  top: 64px; left: 0; right: 0;
  background: rgba(245, 244, 240, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 99;
  display: flex; flex-direction: column;
  padding: 1.5rem 2rem 2rem;
  gap: 0.25rem;
  border-bottom: 1px solid var(--rule-2);
  transform: translateY(-120%);
  opacity: 0;
  transition: transform 0.35s var(--ease-out), opacity 0.35s;
  pointer-events: none;
}

.mobile-menu.open { transform: translateY(0); opacity: 1; pointer-events: auto; }

.mobile-link {
  padding: 0.75rem 0;
  font-size: 1.1rem;
  color: var(--text-2);
  border-bottom: 1px solid var(--rule-2);
  transition: color 0.2s;
}

.mobile-link:last-child { border-bottom: none; }
.mobile-link:hover { color: var(--text); }
.mobile-link-cta { margin-top: 0.5rem; color: var(--accent) !important; font-weight: 500; }

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.7rem 1.5rem;
  background: var(--accent);
  color: var(--bg);
  font-family: var(--font-display);
  font-weight: 600; font-size: 0.9rem;
  border-radius: 7px; letter-spacing: -0.01em;
  transition: opacity 0.2s, transform 0.2s var(--spring);
}

.btn-primary:hover { opacity: 0.88; transform: scale(0.97); }

.btn-ghost {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.7rem 1.5rem;
  border: 1px solid var(--rule);
  color: var(--text-2);
  font-family: var(--font-display);
  font-size: 0.9rem; border-radius: 7px; letter-spacing: -0.01em;
  transition: border-color 0.2s, color 0.2s;
}

.btn-ghost:hover { border-color: var(--accent); color: var(--text); }

/* ── Section shared ──────────────────────────────────────────────── */
section { padding: 7rem 2rem; max-width: 1280px; margin: 0 auto; }

.section-tag {
  font-family: var(--font-mono);
  font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 1rem;
}

.section-headline {
  font-size: clamp(2.2rem, 4vw, 3.6rem);
  font-weight: 700; letter-spacing: -0.04em; line-height: 1.05;
  color: var(--text);
}

.section-header { margin-bottom: 4rem; }

/* ── Hero ────────────────────────────────────────────────────────── */
#hero {
  position: relative;
  min-height: 90dvh;
  max-width: 100%;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  padding: 0;
}

/* No full-bleed gradient needed */
#hero::before { display: none; }

.hero-viz {
  position: absolute;
  top: 8rem; right: 4%;
  width: 52%; height: calc(100% - 8rem);
  display: flex;
  flex-direction: column;
  /* Ensure the whole block area receives hover, not just the canvas pixels */
  background: transparent;
}

/* Hit zone for hover detection — narrower than the full container so the
   tooltip only appears when the cursor is roughly over the visualization */
.hero-viz::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 20%;
  right: 20%;
  z-index: 4;
}

#heroCanvas {
  display: block;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
}

#ecgCanvas {
  display: block;
  width: 60%;
  height: 60px;
  flex-shrink: 0;
  margin-bottom: 4rem;
  align-self: center;
  margin-top: -10px;
}

/* Tooltip explaining the BCG + ECG visualization, shown on hover */
.viz-tooltip {
  position: absolute;
  bottom: 11rem;
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  max-width: 265px;
  text-align: center;
  padding: 0.4rem 0.85rem;
  background: rgba(245, 244, 240, 0.7);
  border: none;
  border-radius: 6px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
  font-family: var(--font-mono);
  font-size: 0.63rem;
  line-height: 1.4;
  letter-spacing: 0.04em;
  color: var(--text-3);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s var(--ease-out), transform 0.25s var(--ease-out);
  z-index: 5;
}

/* Only show tooltip on hover for devices with a pointer (not touch) */
@media (hover: hover) {
  .hero-viz:hover .viz-tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}
/* Touch devices: controlled by JS class toggle */
.viz-tooltip.tooltip-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.hero-content {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 12rem 2rem 5rem;
  display: flex;
  align-items: center;
  min-height: 90dvh;
}

.hero-text { max-width: 440px; }

.hero-eyebrow {
  display: flex; align-items: center; gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-3); margin-bottom: 1.5rem;
}

.dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green-2);
  box-shadow: 0 0 8px var(--green-2);
  animation: pulse 2.4s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.7); }
}

.hero-headline {
  font-size: clamp(3rem, 5.5vw, 5.2rem);
  font-weight: 700; letter-spacing: -0.04em; line-height: 1.0;
  color: var(--text); margin-bottom: 1.5rem;
}

.hero-body {
  font-size: clamp(0.9rem, 1.1vw, 1.05rem);
  line-height: 1.65; color: var(--text-2);
  max-width: 44ch; margin-bottom: 2.5rem;
}

.hero-actions { display: flex; gap: 1rem; flex-wrap: wrap; }

.hero-actions-mobile { display: none; }

/* Mobile-only duplicate of the hero body, shown below the viz */
.hero-body-mobile { display: none; }

/* Showcase UI — tagline + dots anchored below the 3D canvas */
.hero-showcase-ui {
  position: absolute;
  bottom: 5rem; right: 12%;
  display: flex; flex-direction: column; align-items: center; gap: 1rem;
  z-index: 2;
}

.showcase-tagline {
  font-family: var(--font-mono);
  font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-2);
  transition: opacity 0.4s, transform 0.4s var(--ease-out);
}

.showcase-tagline.fade { opacity: 0; transform: translateY(6px); }

.showcase-dots { display: flex; gap: 0.5rem; }

.showcase-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-3);
  transition: background 0.3s, transform 0.3s var(--spring);
}

.showcase-dot.active { background: var(--accent); transform: scale(1.4); }

/* Scroll hint */
.hero-scroll-hint {
  position: absolute;
  bottom: -3rem; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
  z-index: 2;
}

.hero-scroll-hint span {
  font-family: var(--font-mono);
  font-size: 0.6rem; letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--text-3);
}

.scroll-line {
  width: 1px; height: 40px;
  background: linear-gradient(to bottom, var(--text-3), transparent);
  animation: scrollLine 1.8s ease-in-out infinite;
}

@keyframes scrollLine {
  0%   { transform: scaleY(0); transform-origin: top; opacity: 1; }
  50%  { transform: scaleY(1); transform-origin: top; opacity: 1; }
  51%  { transform: scaleY(1); transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; opacity: 0.3; }
}

/* ── Exploded View ───────────────────────────────────────────────── */
#exploded-section {
  max-width: 100%;
  padding: 0;
  height: 300vh;
}

.exploded-sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  /* Use small viewport height on mobile so the sticky doesn't resize when
     the iOS address bar collapses/expands (which causes flicker). */
  height: 100svh;
  overflow: hidden;
  background: var(--bg);
}

#explodedCanvas {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
}

/* CSS2DRenderer div mounts here */
#hotspotLayer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Callout labels — anchored to left/right margins with leader lines */
.callout-label {
  position: absolute;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s var(--ease-out);
  width: 320px;
  z-index: 4;
}

/* Below 1100px the camera stops panning right (model returns to centered),
   so the right-side callouts have nowhere to go — hide them entirely. */
@media (max-width: 1100px) {
  .callout-label, .callout-line { display: none !important; }
}

.callout-left { transform: translateY(-50%); }
.callout-right { transform: translateY(-50%); text-align: left; }

/* Vertical connecting line spanning the stacked callouts */
.callout-line {
  position: absolute;
  width: 1px;
  background: var(--text-3);
  opacity: 0;
  transition: opacity 0.5s var(--ease-out);
  z-index: 3;
}


.callout-title {
  font-family: var(--font-mono);
  font-size: 0.71rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent); display: block; margin-bottom: 0.2rem;
  font-weight: 700;
}

.callout-desc {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--text);
  font-weight: 500;
  letter-spacing: 0.01em;
  margin: 0;
}

/* Thin horizontal accent line above each callout — acts as a kicker
   marking the start of the entry */
.callout-label::before {
  content: '';
  position: absolute;
  left: 0;
  top: -1.25rem;
  width: 2.25rem;
  height: 1px;
  background: rgba(60, 58, 54, 0.2);
}

/* Header overlay */
.exploded-header {
  position: absolute;
  left: 5%; bottom: 10%; max-width: 380px;
  z-index: 2;
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

.exploded-header .section-tag { margin-bottom: 0.75rem; }

.exploded-header h2 {
  font-size: clamp(1.8rem, 3vw, 2.8rem);
  font-weight: 700; letter-spacing: -0.04em; line-height: 1.08;
  margin-bottom: 0.75rem;
}

.exploded-header p {
  font-size: 0.875rem; line-height: 1.6; color: var(--text-2);
}

.exploded-header.hidden { opacity: 0; transform: translateY(20px); }

/* Progress indicator */
.exploded-progress-wrap {
  position: absolute;
  right: 3%; top: 50%; transform: translateY(-50%);
  z-index: 2;
}

.exploded-progress {
  width: 2px; height: 80px;
  background: var(--rule-2);
  border-radius: 2px;
  overflow: hidden;
}

.exploded-progress-fill {
  width: 100%; height: 0%;
  background: var(--accent);
  border-radius: 2px;
  transition: height 0.1s linear;
}

/* ── Capabilities ────────────────────────────────────────────────── */
#capabilities { border-top: 1px solid var(--rule-2); padding-top: 4rem; padding-bottom: 4rem; scroll-margin-top: 64px; }

.capabilities-layout {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(0, 1.4fr);
  gap: 3rem;
  align-items: start;
}

.capabilities-left {
  position: sticky;
  top: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  padding-top: 3rem;
}

.capabilities-left .section-header { margin-bottom: 0; }

.capabilities-model-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  margin-top: -50px;
}

.capabilities-right { min-width: 0; }

#capabilitiesCanvas {
  width: 100%;
  height: 100%;
}

.cap-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  background: var(--rule-2);
  border: 1px solid var(--rule-2);
  border-radius: 12px;
  overflow: hidden;
}

.cap-card {
  background: var(--bg);
  padding: 2.2rem;
  display: flex; flex-direction: column; gap: 0.9rem;
  grid-column: span 4;
  transition: background 0.15s ease-out;
}

.cap-card--large { grid-column: span 1; }


.cap-icon {
  width: 56px; height: 56px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  padding: 8px;
}

.cap-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  /* Tint black SVGs to accent #05386B */
  filter: invert(13%) sepia(82%) saturate(2280%) hue-rotate(199deg) brightness(96%) contrast(98%);
}

.cap-card h3 {
  font-size: 1.27rem; font-weight: 600; letter-spacing: -0.025em;
  color: var(--text); line-height: 1.25;
}

.cap-card p {
  font-size: 1.01rem; line-height: 1.65; color: var(--text-2); flex: 1;
}

.cap-tags {
  display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: auto;
}

.cap-tags span {
  font-family: var(--font-mono);
  font-size: 0.71rem; letter-spacing: 0.05em;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--rule);
  border-radius: 4px; color: var(--text-3);
}

.cap-dots { display: none; }

/* ── Process ─────────────────────────────────────────────────────── */
#process { border-top: 1px solid var(--rule-2); }

.process-track {
  display: flex; flex-direction: column;
  border: 1px solid var(--rule-2);
  border-radius: 12px;
  overflow: hidden;
}

.process-step {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 2rem;
  padding: 2.5rem;
  border-bottom: 1px solid var(--rule-2);
  transition: background 0.3s;
  align-items: start;
}

.process-step:last-child { border-bottom: none; }
.process-step:hover { background: var(--bg-2); }

.process-num {
  font-family: var(--font-mono);
  font-size: 0.68rem; letter-spacing: 0.1em;
  color: var(--accent); padding-top: 0.2rem;
  flex-shrink: 0;
}

.process-body h3 {
  font-size: 1.05rem; font-weight: 600; letter-spacing: -0.025em;
  margin-bottom: 0.5rem; color: var(--text);
}

.process-body p {
  font-size: 0.875rem; line-height: 1.65; color: var(--text-2);
}

/* ── Team ────────────────────────────────────────────────────────── */
/* ── Collaborators ──────────────────────────────────────────────── */
#collaborators {
  border-top: 1px solid var(--rule-2);
  background: var(--bg);
  padding: 6rem 2rem 7rem;
  max-width: 100%;
  scroll-margin-top: 64px;
}

.collab-inner {
  max-width: 1280px;
  margin: 0 auto;
  position: relative;
}

/* Large light headline above the org grid */
#collaborators .section-header {
  text-align: center;
}

#collaborators .section-headline {
  font-size: clamp(2rem, 6.5vw, 5.75rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  color: rgba(60, 58, 54, 0.18);
  position: relative;
  display: inline-block;
}

/* Centered accent line below the headline */
#collaborators .section-headline::after {
  content: '';
  display: block;
  width: 3rem;
  height: 2px;
  background: rgba(60, 58, 54, 0.18);
  margin: 2rem auto 0;
  border-radius: 1px;
}

.collab-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 2rem;
  text-align: center;
}

.collab-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  /* Fixed width so tiles form a neat grid; 4 per row at desktop widths */
  width: calc((100% - 4.5rem) / 4);
  padding: 1.5rem 1rem;
  border: 1px solid rgba(60, 58, 54, 0.12);
  border-radius: 10px;
}

.collab-logo {
  height: 40px;
  width: auto;
  object-fit: contain;
  filter: grayscale(1) opacity(0.55);
  transition: filter 0.3s;
}

.collab-tile:hover .collab-logo {
  filter: grayscale(0) opacity(1);
}

/* Text fallback when no logo is available — styled large like a logo wall */
.collab-name {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 2.2vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: var(--text);
  transition: color 0.3s;
}

/* ── Team ──────────────────────────────────────────────────────── */
#team {
  border-top: 1px solid var(--rule-2);
  background: var(--bg-2);
  max-width: 100%;
  padding: 7rem 2rem;
  scroll-margin-top: 64px;
}

.team-inner {
  max-width: 1280px;
  margin: 0 auto;
}

#team .team-card { background: var(--bg); }

.team-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  background: var(--rule-2);
  border: 1px solid var(--rule-2);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.team-card {
  background: var(--bg);
  padding: 2.5rem;
  display: flex; flex-direction: column; gap: 1.25rem;
  transition: background 0.3s;
}

.team-header {
  display: flex; align-items: center; gap: 1rem;
}

.team-name h3 { margin-bottom: 0.2rem; }

.team-card:hover { background: var(--bg-2); }

.team-avatar {
  flex-shrink: 0;
  width: 56px; height: 56px;
  border-radius: 12px;
  border: 1px solid var(--rule);
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-3);
  overflow: hidden;
}

.team-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.team-avatar-initials {
  font-family: var(--font-mono);
  font-size: 0.92rem; font-weight: 700;
  color: var(--accent); letter-spacing: 0.05em;
}

.team-name h3, .team-body h3 {
  font-size: 1.15rem; font-weight: 600; letter-spacing: -0.02em;
}

.team-role {
  font-family: var(--font-mono);
  font-size: 0.71rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 0.75rem;
}

.team-body p {
  font-size: 0.92rem; line-height: 1.6; color: var(--text-2); margin-bottom: 1rem;
}

.team-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; }

.team-tags span {
  font-family: var(--font-mono);
  font-size: 0.67rem; letter-spacing: 0.04em;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--rule);
  border-radius: 3px; color: var(--text-3);
}


/* ── Contact ─────────────────────────────────────────────────────── */
#contact {
  border-top: 1px solid var(--rule-2);
  max-width: 100%;
  padding: 7rem 2rem;
  background: var(--bg);
}

.contact-grid {
  max-width: 1280px; margin: 0 auto;
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 6rem; align-items: start;
}

.contact-body {
  font-size: 1rem; line-height: 1.7; color: var(--text-2);
  margin-top: 1.5rem; margin-bottom: 1.5rem; max-width: 40ch;
}

.contact-email {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.875rem; color: var(--accent);
  border-bottom: 1px solid rgba(5, 56, 107, 0.3);
  padding-bottom: 0.2rem; margin-bottom: 2rem;
  transition: border-color 0.2s;
}

.contact-email:hover { border-color: var(--accent); }

.contact-programs { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.program-badge {
  font-family: var(--font-mono);
  font-size: 0.6rem; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--rule); border-radius: 4px; color: var(--text-3);
}

.contact-form { display: flex; flex-direction: column; gap: 1.5rem; }

.form-row { display: flex; flex-direction: column; gap: 0.4rem; }

.form-row label {
  font-family: var(--font-mono);
  font-size: 0.65rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-3);
}

.form-row input,
.form-row textarea {
  background: var(--bg-2);
  border: 1px solid var(--rule-2);
  border-radius: 7px;
  padding: 0.75rem 1rem;
  font-size: 0.9rem; color: var(--text);
  outline: none; transition: border-color 0.2s; resize: none;
}

.form-row input:focus,
.form-row textarea:focus { border-color: var(--accent); }

.form-row input::placeholder,
.form-row textarea::placeholder { color: var(--text-3); }

.btn-submit { width: 100%; justify-content: center; }

.form-success {
  display: none; text-align: center;
  font-size: 0.875rem; color: var(--green-2);
  padding: 0.75rem;
  border: 1px solid rgba(61, 160, 104, 0.3);
  border-radius: 7px;
}

.form-success.visible { display: block; }

.form-error {
  text-align: center;
  font-size: 0.875rem; color: var(--red-2, #c0392b);
}
.form-error:empty { display: none; }

.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px; height: 1px;
  overflow: hidden;
}

/* ── Footer ──────────────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--rule-2);
  padding: 2rem; background: var(--bg);
}

.footer-inner {
  max-width: 1280px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 2rem;
}

.footer-left { display: flex; align-items: center; gap: 2rem; }

.footer-logo-img { height: 27px; width: auto; }

.footer-address {
  font-family: var(--font-mono);
  font-size: 0.65rem; letter-spacing: 0.04em; color: var(--text-3);
}

.footer-right { display: flex; align-items: center; gap: 2rem; }

.footer-right a { font-size: 0.8rem; color: var(--text-2); transition: color 0.2s; }
.footer-right a:hover { color: var(--accent); }

.footer-copy {
  font-family: var(--font-mono);
  font-size: 0.62rem; color: var(--text-3); letter-spacing: 0.04em;
}

/* ── Scroll-reveal ───────────────────────────────────────────────── */
.reveal {
  opacity: 0; transform: translateY(24px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}

.reveal.in-view { opacity: 1; transform: none; }

.reveal-group > * {
  opacity: 0; transform: translateY(20px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

.reveal-group.in-view > *:nth-child(1) { opacity: 1; transform: none; transition-delay: 0s; }
.reveal-group.in-view > *:nth-child(2) { opacity: 1; transform: none; transition-delay: 0.07s; }
.reveal-group.in-view > *:nth-child(3) { opacity: 1; transform: none; transition-delay: 0.14s; }
.reveal-group.in-view > *:nth-child(4) { opacity: 1; transform: none; transition-delay: 0.21s; }
.reveal-group.in-view > *:nth-child(5) { opacity: 1; transform: none; transition-delay: 0.28s; }
.reveal-group.in-view > *:nth-child(6) { opacity: 1; transform: none; transition-delay: 0.35s; }

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .cap-card--large  { grid-column: span 1; }
  .cap-card         { grid-column: span 1; }
  .cap-card--accent { grid-column: span 1; }
  .team-grid        { grid-template-columns: 1fr; }
}

@media (max-width: 1024px) {
  section { padding: 4rem 1.25rem; }

  .nav-links    { display: none; }
  .nav-hamburger { display: flex; }
  .nav-logo-img { height: 32px; }

  /* ── Hero ── */
  /* On mobile: headline (in .hero-content) → viz → body (the duplicate).
     The original .hero-body inside .hero-content is hidden; the
     .hero-body-mobile sibling shows below the viz. */
  #hero {
    min-height: auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 0;
  }
  .hero-content .hero-body { display: none; }
  .hero-viz     { order: 2; margin-bottom: 0; }
  .hero-body-mobile {
    order: 3;
    display: block;
    padding: 0 1.25rem 0;
    margin-top: -2rem;
    font-size: 0.95rem;
    line-height: 1.65;
    color: var(--text-2);
  }
  .hero-actions-mobile { display: none; }
  .hero-text .hero-actions { display: none; }
  .hero-viz {
    order: 2;
    position: relative;
    top: auto; right: auto;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    height: 414px;
    display: block;
    margin-bottom: 0;
  }
  #heroCanvas {
    display: block;
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 342px;
  }
  #ecgCanvas {
    display: block;
    position: absolute;
    bottom: 60px;
    left: 15%;
    width: 70%;
    height: 50px;
    margin: 0;
  }
  .viz-legend {
    /* Sits in the gap between the 3D canvas (top 342px) and the ECG (bottom 60px+50px) */
    bottom: 115px;
    top: auto;
  }
  .hero-content {
    order: 1;
    position: relative;
    padding: 6rem 1.25rem 0.5rem;
    min-height: auto;
    display: block;
  }
  .hero-headline { font-size: clamp(2.4rem, 9vw, 3.4rem); }
  .hero-headline br { display: none; }
  .hero-headline br::after { content: ' '; }
  .hero-body { font-size: 0.95rem; margin-bottom: 1.75rem; }

  /* ── Capabilities ── */
  #capabilities { padding-top: 1.5rem; }
  .capabilities-layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .capabilities-left {
    position: relative;
    top: auto;
    align-items: center;
    text-align: center;
    padding: 1rem 0 0;
    gap: 0;
  }
  .capabilities-model-wrap {
    width: 72%;
    max-width: 274px;
    margin: 0;
    aspect-ratio: 1;
    margin-top: -2rem;
    margin-bottom: -2.5rem;
  }
  .section-headline br { display: none; }

  .cap-grid {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    background: none;
    border-radius: 0;
    border: none;
    gap: 0.75rem;
    padding-bottom: 1rem;
    /* Hide scrollbar but keep scrolling */
    scrollbar-width: none;
  }
  .cap-grid::-webkit-scrollbar { display: none; }
  .cap-card,
  .cap-card--large {
    grid-column: span 1;
    flex: 0 0 90%;
    scroll-snap-align: center;
    scroll-snap-stop: always;
    border: 1px solid var(--rule-2);
    border-radius: 10px;
    padding: 1.25rem;
    gap: 0.6rem;
  }
  /* Icon + title side by side on mobile */
  .cap-card {
    display: grid;
    grid-template-columns: 44px 1fr;
    grid-template-rows: auto auto auto;
    column-gap: 0.75rem;
    row-gap: 0.6rem;
  }
  .cap-icon {
    width: 44px; height: 44px; padding: 6px;
    grid-row: 1; grid-column: 1;
    align-self: center;
  }
  .cap-card h3 {
    font-size: 1.1rem;
    grid-row: 1; grid-column: 2;
    align-self: center;
  }
  .cap-card p {
    font-size: 0.88rem; line-height: 1.55;
    grid-column: 1 / -1;
  }
  .cap-tags { grid-column: 1 / -1; }
  .cap-tags { gap: 0.3rem; }
  .cap-tags span { font-size: 0.63rem; padding: 0.2rem 0.45rem; }

  /* Dot indicators for horizontal swipe */
  .cap-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 0 0;
  }
  .cap-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--rule-2);
    border: none;
    padding: 0;
    cursor: pointer;
    transition: background 0.2s;
  }
  .cap-dot.active {
    background: var(--accent);
  }

  /* ── Exploded view ── */
  #exploded-section { height: 275vh; }

  .exploded-header {
    left: 1.5rem;
    right: 1.5rem;
    bottom: 12%;
    max-width: none;
    text-align: center;
    transition: none;
  }
  .exploded-header h2 { font-size: 1.75rem; }
  .exploded-header p { font-size: 0.8rem; }

  .callout-label, .callout-line { display: none !important; }

  .exploded-progress-wrap { right: 1.25rem; }

  /* ── Team ── */
  #collaborators { padding: 3.5rem 1.25rem 4rem; }
  .collab-grid { gap: 1rem; }
  .collab-tile { width: calc((100% - 1rem) / 2); padding: 1.25rem 0.75rem; }

  #team { padding: 4rem 1.25rem; }
  .team-card { gap: 1rem; padding: 1.75rem 1.5rem; }

  /* ── Contact ── */
  .contact-grid { grid-template-columns: 1fr; gap: 2.5rem; }
  #contact { padding: 4rem 1.25rem; }

  /* ── Footer ── */
  .footer-inner  { flex-direction: column; align-items: flex-start; gap: 1rem; }
  .footer-left   { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
  .footer-right  { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
}

/* ── Tablet hero (in-between widths): two-column layout overriding the
   stacked mobile layout. Text on the left, viz on the right. */
@media (min-width: 600px) and (max-width: 1024px) {
  #hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    padding: 5rem 2rem 3rem;
    gap: 2rem;
  }
  .hero-content {
    grid-column: 1;
    padding: 0;
  }
  .hero-content .hero-body { display: block; }   /* show inline body again */
  .hero-body-mobile { display: none; }            /* hide the mobile duplicate */
  .hero-text .hero-actions { display: flex; }
  .hero-headline {
    font-size: clamp(2.6rem, 5.5vw, 4rem);
  }
  .hero-headline br { display: inline; }          /* allow original line breaks */
  .hero-body { font-size: 1rem; max-width: none; margin-bottom: 1.75rem; }

  .hero-viz {
    grid-column: 2;
    position: relative;
    top: auto; right: auto;
    width: 100%;
    max-width: none;
    margin: 0;
    height: 360px;
  }
  #heroCanvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 290px;
  }
  #ecgCanvas {
    position: absolute;
    bottom: 30px;
    left: 15%;
    width: 70%;
    height: 45px;
    margin: 0;
  }
  .viz-legend {
    bottom: 90px;
    top: auto;
  }
  .viz-tooltip {
    bottom: auto;
    top: 100px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
