/* =========================================================
   Yo-Mat — Design tokens
   ========================================================= */
:root {
  --ink: #2B2620;
  --walnut: #453F37;
  --walnut-soft: #5A5347;
  --clay: #C0805F;
  --clay-dark: #A5674A;
  --cream: #F7F2EA;
  --cream-alt: #EFE7D9;
  --paper: #FCFAF6;
  --line: rgba(69, 63, 55, 0.16);
  --line-strong: rgba(69, 63, 55, 0.32);
  --error: #B0503A;

  --font-head: "Space Grotesk", "Segoe UI", Arial, sans-serif;
  --font-body: "Inter", "Segoe UI", Arial, sans-serif;

  --container: 1180px;
  --radius-sm: 10px;
  --radius-md: 18px;
  --radius-lg: 28px;

  --header-h: 76px;
}

/* =========================================================
   Reset
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 600; line-height: 1.15; margin: 0 0 0.5em; color: var(--walnut); }
p { margin: 0 0 1em; }
button { font: inherit; cursor: pointer; }
svg { display: block; }

.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;
}
.skip-link {
  position: absolute; left: 1rem; top: -3rem; background: var(--walnut); color: var(--paper);
  padding: 0.6em 1em; border-radius: var(--radius-sm); z-index: 200; transition: top 0.2s ease;
}
.skip-link:focus { top: 1rem; }

.defs-only { position: absolute; width: 0; height: 0; overflow: hidden; }

:focus-visible { outline: 2px solid var(--clay-dark); outline-offset: 3px; }

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

@media (min-width: 640px) {
  .container { padding: 0 40px; }
}

/* =========================================================
   Section rhythm & shared type
   ========================================================= */
.section { padding: 96px 0; scroll-margin-top: calc(var(--header-h) + 8px); }
.section:nth-of-type(even) { background: var(--cream-alt); }
.hero, .waitlist, .story { scroll-margin-top: calc(var(--header-h) + 8px); }

h2 { font-size: clamp(1.75rem, 1.35rem + 1.8vw, 2.75rem); max-width: 22ch; }
.section-lead {
  max-width: 60ch;
  font-size: clamp(1rem, 0.94rem + 0.3vw, 1.15rem);
  color: var(--walnut-soft);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  font-family: var(--font-head);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--clay-dark);
  margin: 0 0 1em;
}
.eyebrow-mark {
  width: 9px; height: 9px;
  border: 1.5px solid currentColor;
  border-radius: 2px;
  transform: rotate(45deg);
  flex: none;
}

/* Icons that reference the shared <symbol> defs */
.card-icon, .step-icon svg {
  width: 30px; height: 30px;
  fill: none;
  stroke: var(--clay-dark);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* =========================================================
   Buttons
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  padding: 0.85em 1.6em;
  border-radius: 999px;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.95rem;
  border: 1.5px solid transparent;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  white-space: nowrap;
}
.btn-primary { background: var(--walnut); color: var(--paper); }
.btn-primary:hover { background: var(--clay-dark); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--walnut); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--walnut); transform: translateY(-1px); }

/* =========================================================
   Header / Nav
   ========================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: rgba(247, 242, 234, 0.86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  transition: box-shadow 0.2s ease;
}
.site-header.is-scrolled { box-shadow: 0 8px 24px rgba(69, 63, 55, 0.08); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}
.brand { display: flex; align-items: center; gap: 0.6em; }
.brand-mark { flex: none; }
.brand-name {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--walnut);
  letter-spacing: -0.01em;
}

.primary-nav { display: flex; align-items: center; gap: 2.4rem; }
.primary-nav ul { display: flex; gap: 2rem; }
.nav-link {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--walnut-soft);
  position: relative;
  padding: 0.3em 0;
}
.nav-link:hover { color: var(--walnut); }
.nav-link.is-active { color: var(--walnut); }
.nav-link.is-active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 2px;
  background: var(--clay);
  border-radius: 2px;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px; height: 40px;
  background: none;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
}
.nav-toggle-bar { width: 18px; height: 2px; background: var(--walnut); margin: 0 auto; transition: transform 0.2s ease, opacity 0.2s ease; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(4) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 899px) {
  .nav-toggle { display: inline-flex; }
  .primary-nav {
    position: fixed;
    inset: var(--header-h) 0 0 0;
    background: var(--paper);
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
    padding: 1.5rem 24px 2rem;
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    overflow-y: auto;
  }
  .primary-nav.is-open { opacity: 1; transform: translateY(0); visibility: visible; pointer-events: auto; }
  .primary-nav ul { flex-direction: column; gap: 0; }
  .primary-nav ul li { border-bottom: 1px solid var(--line); }
  .nav-link { display: block; padding: 1rem 0.2rem; font-size: 1.05rem; }
  .nav-cta { margin-top: 1.5rem; align-self: flex-start; }
}

/* =========================================================
   Hero
   ========================================================= */
.hero { padding: 64px 0 96px; overflow: hidden; }
.hero-inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: 56px;
  align-items: center;
}
@media (min-width: 960px) {
  .hero-inner { grid-template-columns: 1.05fr 0.7fr; gap: 40px; }
}

h1 {
  font-size: clamp(2.2rem, 1.6rem + 2.6vw, 3.4rem);
  letter-spacing: -0.01em;
  max-width: 16ch;
}
.hero-lead {
  font-size: clamp(1.05rem, 1rem + 0.3vw, 1.2rem);
  color: var(--walnut-soft);
  max-width: 52ch;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 1rem; margin: 1.75rem 0 2.5rem; }

.hero-visual { display: flex; justify-content: center; }
.hero-mat {
  width: min(320px, 70vw);
  height: auto;
  border-radius: var(--radius-lg);
  filter: drop-shadow(0 24px 40px rgba(69,63,55,0.18));
}

/* Mat schematic (shared styling for hero + mapping section) */
.mat-fill { fill: var(--paper); }
.mat-dots { color: var(--line-strong); }
.mat-outline { fill: none; stroke: var(--walnut); stroke-width: 3; }
.guide-line { stroke: var(--line-strong); stroke-width: 1.5; stroke-dasharray: 4 6; }
.center-line { stroke: var(--line); stroke-width: 1.5; stroke-dasharray: 2 6; }
.placement-mark circle { fill: var(--cream); stroke: var(--clay-dark); stroke-width: 3; }
.placement-mark path { stroke: var(--clay-dark); stroke-width: 2; stroke-linecap: round; }
.placement-mark.knee-mark circle,
.placement-mark.foot-mark circle { stroke: var(--walnut); }
.placement-mark.knee-mark path,
.placement-mark.foot-mark path { stroke: var(--walnut); }

/* =========================================================
   Cards grids: Problem / Benefits
   ========================================================= */
.problem-grid, .benefits-grid {
  display: grid;
  gap: 1.5rem;
  margin-top: 3rem;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .problem-grid { grid-template-columns: repeat(3, 1fr); }
  .benefits-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 960px) {
  .benefits-grid { grid-template-columns: repeat(3, 1fr); }
}

.problem-card, .benefit-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 2rem 1.75rem;
}
.problem-card h3, .benefit-card h3 { font-size: 1.1rem; margin-top: 1.1rem; }
.problem-card p, .benefit-card p { color: var(--walnut-soft); font-size: 0.95rem; margin-bottom: 0; }

/* =========================================================
   How it Works
   ========================================================= */
.steps {
  display: grid;
  gap: 2.5rem;
  margin-top: 3rem;
  grid-template-columns: 1fr;
  position: relative;
}
@media (min-width: 780px) {
  .steps { grid-template-columns: repeat(3, 1fr); gap: 2rem; }
  .steps li:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 30px;
    left: calc(100% - 1rem);
    width: calc(2rem + 2px);
    border-top: 1.5px dashed var(--line-strong);
  }
}
.step { position: relative; }
.step-icon {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: var(--paper);
  border: 1.5px solid var(--line-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}
.step-number {
  display: block;
  font-family: var(--font-head);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--clay-dark);
  margin-bottom: 0.5rem;
}
.step h3 { font-size: 1.15rem; }
.step p { color: var(--walnut-soft); font-size: 0.95rem; }

/* =========================================================
   Mapping section
   ========================================================= */
.mapping-grid {
  margin-top: 3rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  align-items: center;
}
@media (min-width: 960px) {
  .mapping-grid { grid-template-columns: 0.85fr 1fr 0.85fr; gap: 2rem; }
}
.mapping-figure { display: flex; justify-content: center; }
.body-map, .mat-map { width: min(220px, 60vw); height: auto; }

.body-skeleton { fill: none; stroke: var(--line-strong); stroke-width: 3; stroke-linecap: round; }
.body-joint { fill: var(--paper); stroke: var(--walnut-soft); stroke-width: 2; }

.dimension { stroke: var(--walnut-soft); stroke-width: 1.5; opacity: 0.55; transition: opacity 0.2s ease, stroke 0.2s ease; }
.dimension text { font-family: var(--font-head); font-size: 13px; fill: var(--walnut-soft); stroke: none; font-weight: 600; }
.mapping-figure .placement-mark { opacity: 0.45; transition: opacity 0.2s ease; }

.dimension.is-active, .placement-mark.is-active { opacity: 1; }
.dimension.is-active { stroke: var(--clay-dark); }
.dimension.is-active text { fill: var(--clay-dark); }
.placement-mark.is-active circle { stroke: var(--clay-dark); stroke-width: 4; }

.mapping-legend { display: flex; flex-direction: column; gap: 0.75rem; }
.legend-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  width: 100%;
  text-align: left;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.legend-item:hover, .legend-item:focus-visible, .legend-item.is-active {
  border-color: var(--clay);
  background: var(--cream);
}
.legend-index {
  font-family: var(--font-head);
  font-weight: 700;
  color: var(--clay-dark);
  font-size: 0.85rem;
  flex: none;
  padding-top: 0.15em;
}
.legend-text { font-size: 0.92rem; color: var(--walnut-soft); }
.legend-text strong { display: block; color: var(--walnut); font-family: var(--font-head); font-size: 1rem; margin-bottom: 0.2em; }

/* =========================================================
   Founder Story
   ========================================================= */
.story-inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
  align-items: center;
}
@media (min-width: 860px) {
  .story-inner { grid-template-columns: 0.8fr 1.2fr; gap: 4rem; }
}
.story-visual {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-width: 420px;
  margin: 0 auto;
}
.story-photo {
  margin: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 8px;
  box-shadow: 0 18px 32px rgba(69, 63, 55, 0.14);
}
.story-photo img {
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: calc(var(--radius-md) - 6px);
}

@media (min-width: 860px) {
  .story-visual {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    grid-template-rows: auto auto;
    gap: 1.25rem;
    max-width: none;
  }
  .story-photo-a { grid-column: 1; grid-row: 1 / 3; }
  .story-photo-b { grid-column: 2; grid-row: 1; }
  .story-photo-c { grid-column: 2; grid-row: 2; }
  .story-photo-a img {
    aspect-ratio: auto;
    height: 100%;
  }
}
.story-copy p { color: var(--walnut-soft); max-width: 60ch; }
.story-attribution { font-family: var(--font-head); font-weight: 600; color: var(--walnut); margin-top: 1.5rem; }

/* =========================================================
   Waitlist
   ========================================================= */
.waitlist-inner { max-width: 640px; }
.waitlist-form { margin-top: 2rem; }
.hp-field { position: absolute; left: -9999px; top: auto; }
.form-row {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
@media (min-width: 560px) {
  .form-row { flex-direction: row; }
}
.form-row input {
  flex: 1;
  padding: 0.95em 1.2em;
  border-radius: 999px;
  border: 1.5px solid var(--line-strong);
  background: var(--paper);
  font: inherit;
  color: var(--ink);
}
.form-row input:focus { border-color: var(--clay-dark); outline: none; }
.form-row input[aria-invalid="true"] { border-color: var(--error); }
.form-row .btn { flex: none; }

.form-message { min-height: 1.4em; margin: 0.85rem 0 0; font-size: 0.9rem; color: var(--error); font-weight: 500; }

.waitlist-success[hidden] { display: none; }
.waitlist-success {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-top: 2rem;
  padding: 1.2rem 1.4rem;
  background: var(--paper);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-md);
}
.waitlist-success svg {
  width: 26px; height: 26px; flex: none;
  fill: none; stroke: var(--clay-dark); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.waitlist-success p { margin: 0; font-weight: 500; color: var(--walnut); }

/* =========================================================
   Footer
   ========================================================= */
.site-footer { background: var(--walnut); color: var(--cream); padding: 64px 0 32px; }
.footer-inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  padding-bottom: 40px;
  border-bottom: 1px solid rgba(247,242,234,0.16);
}
@media (min-width: 700px) {
  .footer-inner { grid-template-columns: 1.2fr 1fr 1fr; }
}
.footer-brand .brand-name { color: var(--paper); }
.footer-brand p { color: rgba(247,242,234,0.65); margin-top: 0.75rem; font-size: 0.9rem; }
.site-footer .brand-mark { filter: brightness(0) invert(1); }

.footer-nav { display: flex; flex-direction: column; gap: 0.7rem; }
.footer-nav a { color: rgba(247,242,234,0.75); font-size: 0.95rem; }
.footer-nav a:hover { color: var(--paper); }

.footer-contact { font-size: 0.95rem; }
.footer-contact-label { display: block; color: rgba(247,242,234,0.55); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.5rem; }
.footer-contact a { color: var(--paper); font-weight: 500; }
.footer-contact a:hover { color: var(--clay); }

.footer-bottom {
  padding-top: 28px;
  display: flex;
  flex-direction: column-reverse;
  gap: 1rem;
  font-size: 0.8rem;
  color: rgba(247,242,234,0.55);
}
@media (min-width: 700px) {
  .footer-bottom { flex-direction: row; justify-content: space-between; align-items: flex-end; gap: 2rem; }
}
.footer-disclaimer { max-width: 60ch; margin: 0; }
.footer-bottom > p:last-child { margin: 0; white-space: nowrap; }

/* =========================================================
   Reveal-on-scroll
   ========================================================= */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .btn, .nav-toggle-bar, .legend-item, .dimension, .placement-mark { transition: none; }
}
