/* ==========================================================================
   LEPTIR — Components
   ========================================================================== */

/* ---- Masthead ----------------------------------------------------------- */
.masthead {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  padding-block: 1.35rem;
  transition: padding 300ms var(--ease), background-color 300ms var(--ease),
    border-color 300ms var(--ease), backdrop-filter 300ms var(--ease);
  border-bottom: 1px solid transparent;
}
.masthead[data-compact="true"] {
  padding-block: 0.7rem;
  background: color-mix(in srgb, var(--ink) 82%, transparent);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  border-bottom-color: var(--line-soft);
}

.masthead__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: var(--step--1);
  font-weight: 560;
  letter-spacing: 0.16em;
  text-decoration: none;
  color: var(--bone);
}
.wordmark svg { width: 20px; height: 20px; overflow: visible; }
.wordmark:hover .mark__wing { opacity: 1; }

.nav { display: flex; align-items: center; gap: clamp(1rem, 2.4vw, 2.1rem); }
.nav__link {
  font-size: var(--step--1);
  color: var(--ash);
  text-decoration: none;
  padding-block: 0.35rem;
  position: relative;
  transition: color 200ms var(--ease);
}
.nav__link:hover { color: var(--bone); }
.nav__link[aria-current="page"] { color: var(--bone); }
.nav__link[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 1px;
  background: var(--accent);
}

.nav__aside { display: flex; align-items: center; gap: var(--sp-2); }

/* Theme control */
.theme-switch {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
}
.theme-switch button {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border: 0; border-radius: 999px;
  background: transparent;
  color: var(--ash-dim);
  cursor: pointer;
  transition: color 200ms var(--ease), background-color 200ms var(--ease);
}
.theme-switch button:hover { color: var(--bone); }
.theme-switch button[aria-pressed="true"] {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
}
.theme-switch svg { width: 14px; height: 14px; }

/* Mobile menu trigger */
.burger {
  display: none;
  width: 42px; height: 42px;
  align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--bone);
}
.burger span {
  display: block; width: 17px; height: 1.5px;
  background: currentColor;
  position: relative;
  transition: transform 260ms var(--ease), background-color 200ms var(--ease);
}
.burger span::before,
.burger span::after {
  content: ""; position: absolute; left: 0;
  width: 17px; height: 1.5px; background: currentColor;
  transition: transform 260ms var(--ease);
}
.burger span::before { top: -5.5px; }
.burger span::after  { top: 5.5px; }
.burger[aria-expanded="true"] span { background: transparent; }
.burger[aria-expanded="true"] span::before { transform: translateY(5.5px) rotate(45deg); }
.burger[aria-expanded="true"] span::after  { transform: translateY(-5.5px) rotate(-45deg); }

/* Mobile drawer */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 99;
  background: var(--ink);
  padding: 6.5rem var(--gutter) var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  transform: translateY(-8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 260ms var(--ease), transform 260ms var(--ease), visibility 260ms;
  overflow-y: auto;
}
.drawer[data-open="true"] { opacity: 1; transform: none; visibility: visible; }
.drawer a {
  font-size: var(--step-1);
  text-decoration: none;
  color: var(--bone);
  padding-block: 0.6rem;
  border-bottom: 1px solid var(--line-soft);
}
.drawer a:last-of-type { border-bottom: 0; }
body[data-locked="true"] { overflow: hidden; }

/* ---- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.85rem 1.5rem;
  font-size: var(--step--1);
  font-weight: 520;
  letter-spacing: 0;
  border-radius: 999px;
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 220ms var(--ease), border-color 220ms var(--ease),
    color 220ms var(--ease), transform 220ms var(--ease);
}
.btn:active { transform: translateY(1px); }

.btn--solid { background: var(--accent); color: var(--on-accent); }
.btn--solid:hover { background: var(--accent-hi); }

.btn--ghost { border-color: var(--line); color: var(--bone); background: transparent; }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }

.btn--quiet { padding-inline: 0; color: var(--ash); background: none; }
.btn--quiet:hover { color: var(--accent); }

.actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); }

/* Inline text link with a drawn underline */
.tlink {
  color: var(--bone);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  padding-bottom: 1px;
  transition: border-color 200ms var(--ease), color 200ms var(--ease);
}
.tlink:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* ---- Hero --------------------------------------------------------------- */
.hero {
  position: relative;
  min-height: min(100svh, 900px);
  display: flex;
  align-items: center;
  padding-top: 7rem;
  padding-bottom: clamp(6rem, 12vh, 9rem);
  overflow: hidden;
  isolation: isolate;
}

.field {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}
.field__layer {
  position: absolute;
  inset: -8%;
  will-change: transform;
}
.field__canvas { width: 100%; height: 100%; }

/* Layer 1 — atmospheric warm field */
.field__atmos {
  background:
    radial-gradient(58% 62% at 62% 46%, var(--glow-core) 0%, transparent 62%),
    radial-gradient(90% 90% at 20% 88%, var(--glow-far) 0%, transparent 68%);
}
/* Layer 5 — foreground grain veil */
.field__veil {
  background:
    radial-gradient(78% 78% at 50% 48%, transparent 42%, var(--ink) 100%);
  opacity: 0.9;
}

.hero__copy { max-width: 47rem; position: relative; }
.hero h1 { margin-bottom: var(--sp-3); font-weight: 450; max-width: 15ch; }
.hero__sub {
  font-size: var(--step-1);
  color: var(--ash);
  max-width: 40ch;
  font-weight: 380;
  line-height: 1.44;
  margin-bottom: var(--sp-4);
}
.hero .actions { margin-bottom: var(--sp-5); }
.hero .meta { border-top: 1px solid var(--line-soft); padding-top: var(--sp-2); max-width: 56ch; }

/* ---- Page head (interior pages) ----------------------------------------- */
.pagehead {
  padding-top: clamp(8rem, 16vw, 12rem);
  padding-bottom: clamp(3rem, 7vw, 6rem);
  position: relative;
  overflow: hidden;
}
.pagehead::before {
  content: "";
  position: absolute;
  inset: -40% 0 auto -10%;
  height: 130%;
  background: radial-gradient(46% 52% at 26% 52%, var(--glow-far) 0%, transparent 70%);
  pointer-events: none;
}
.pagehead__inner { position: relative; }
.pagehead h1 { max-width: 20ch; margin-bottom: var(--sp-3); font-weight: 450; }

.crumbs { font-size: var(--step--2); color: var(--ash-dim); margin-bottom: var(--sp-3); }
.crumbs a { color: var(--ash); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }

/* ---- Contrast: clinic vs person ----------------------------------------- */
.contrast {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: start;
}
.chain { list-style: none; margin: 0; padding: 0; }
.chain li {
  padding: 0.85rem 0 0.85rem 1.9rem;
  border-bottom: 1px solid var(--line-soft);
  position: relative;
  font-size: var(--step-0);
  color: var(--ash);
  margin: 0;
}
.chain li::before {
  content: "";
  position: absolute;
  left: 0.32rem; top: 1.55rem;
  width: 6px; height: 6px;
  border-radius: 999px;
  background: var(--ash-dim);
}
.chain li::after {
  content: "";
  position: absolute;
  left: 0.6rem; top: 2.15rem; bottom: -0.35rem;
  width: 1px;
  background: var(--line);
}
.chain li:last-child { border-bottom: 0; }
.chain li:last-child::after { display: none; }
.chain--live li { color: var(--bone); }
.chain--live li::before { background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent); }
.chain__title { font-size: var(--step--1); color: var(--ash-dim); margin-bottom: var(--sp-2); }

/* ---- Ecosystem ---------------------------------------------------------- */
.eco { border-top: 1px solid var(--line-soft); }
.eco__item {
  display: grid;
  grid-template-columns: 3.75rem minmax(0, 1fr) minmax(0, 1.15fr) 10rem;
  gap: var(--sp-3);
  align-items: center;
  padding-block: clamp(1.4rem, 3vw, 2.3rem);
  border-bottom: 1px solid var(--line-soft);
  text-decoration: none;
  position: relative;
  transition: background-color 300ms var(--ease);
}
.eco__item::after {
  content: "";
  position: absolute;
  left: 0; bottom: -1px; height: 1px; width: 0;
  background: var(--accent);
  transition: width 500ms var(--ease);
}
.eco__item:hover::after,
.eco__item:focus-visible::after { width: 100%; }
.eco__glyph { width: 40px; height: 40px; color: var(--accent); opacity: 0.85; }
.eco__name { font-size: var(--step-1); color: var(--bone); font-weight: 450; letter-spacing: var(--tracking-snug); }
.eco__say { color: var(--ash); font-size: var(--step-0); }
.eco__state { font-size: var(--step--2); color: var(--ash-dim); text-align: right; }

/* ---- EP3 ---------------------------------------------------------------- */
.ep3 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; border-top: 1px solid var(--line-soft); }
.ep3__cell {
  padding: clamp(1.75rem, 3.5vw, 3rem) clamp(1.25rem, 2vw, 2rem) clamp(2rem, 4vw, 3.5rem) 0;
  border-right: 1px solid var(--line-soft);
  position: relative;
}
.ep3__cell:last-child { border-right: 0; }
.ep3__cell::before {
  content: "";
  position: absolute;
  top: -1px; left: 0; height: 1px; width: 0;
  background: var(--accent);
  transition: width 700ms var(--ease);
}
.ep3__cell.is-lit::before { width: 100%; }
.ep3__word {
  font-size: var(--step-1);
  font-weight: 450;
  margin-bottom: 0.4rem;
  color: var(--bone);
  letter-spacing: var(--tracking-snug);
}
.ep3__line { color: var(--accent); font-size: var(--step--1); margin-bottom: var(--sp-2); }
.ep3__body { color: var(--ash); font-size: var(--step--1); line-height: 1.62; margin: 0; }

/* ---- Panels & product surface ------------------------------------------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: var(--radius-lg);
  padding: clamp(1.25rem, 3vw, 2.25rem);
}

.showcase {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: center;
}

/* Replaceable product visual — swap .mock for a real screenshot */
.mock {
  position: relative;
  border: 1px solid var(--panel-line);
  border-radius: 22px;
  background:
    radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--accent) 9%, transparent) 0%, transparent 58%),
    var(--ink-raise);
  padding: 1.1rem;
  aspect-ratio: 10 / 13;
  max-width: 340px;
  margin-inline: auto;
  overflow: hidden;
  box-shadow: 0 40px 90px -50px var(--glow-core);
}
.mock__bar { height: 4px; width: 34%; border-radius: 999px; background: var(--line); margin: 0 auto 1.2rem; }
.mock__title { font-size: var(--step--1); color: var(--ash); margin-bottom: 0.15rem; }
.mock__read { font-size: 2.6rem; font-weight: 400; letter-spacing: var(--tracking-tight); margin-bottom: 1rem; line-height: 1; }
.mock__read span { font-size: 1rem; color: var(--ash); letter-spacing: 0; }
.mock__plot { width: 100%; height: 92px; margin-bottom: 1.1rem; }
.mock__rows { display: grid; gap: 0.55rem; }
.mock__row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: var(--step--2); color: var(--ash);
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}
.mock__row b { color: var(--bone); font-weight: 480; }
.mock__note {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 0.5rem;
  text-align: center;
  font-size: 0.6875rem;
  color: var(--ash-dim);
  background: color-mix(in srgb, var(--ink) 80%, transparent);
  border-top: 1px solid var(--line-soft);
}

/* ---- Steps (genuine sequences only) ------------------------------------- */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-3); }
.step { border-top: 1px solid var(--line); padding-top: var(--sp-2); }
.step__n { font-size: var(--step--2); color: var(--accent); font-variant-numeric: tabular-nums; }
.step h3 { font-size: var(--step-0); margin: 0.35rem 0 0.3rem; }
.step p { font-size: var(--step--1); color: var(--ash); margin: 0; }

/* ---- Flow (data → intelligence → insight) -------------------------------- */
.flow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }
.flow__node {
  padding: var(--sp-4) var(--sp-3) var(--sp-4) 0;
  border-top: 2px solid var(--line);
  position: relative;
}
.flow__node:nth-child(1) { border-top-color: var(--ash-dim); }
.flow__node:nth-child(2) { border-top-color: var(--accent); }
.flow__node:nth-child(3) { border-top-color: var(--signal); }
.flow__node h3 { font-size: var(--step-0); margin-bottom: 0.4rem; }
.flow__node p { font-size: var(--step--1); color: var(--ash); margin: 0; }

/* ---- Roadmap ------------------------------------------------------------ */
.road { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(1.25rem, 3vw, 3rem); }
.road__stage { position: relative; padding-top: var(--sp-3); border-top: 1px solid var(--line); }
.road__when { font-size: var(--step--2); color: var(--accent); margin-bottom: var(--sp-2); }
.road__stage--future .road__when { color: var(--ash-dim); }
.road__list { list-style: none; margin: 0; padding: 0; }
.road__list li { color: var(--ash); font-size: var(--step-0); padding-block: 0.3rem; }
.road__list li:first-child { color: var(--bone); }

/* ---- People ------------------------------------------------------------- */
.people { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(1.5rem, 4vw, 3.5rem); }
.person { border-top: 1px solid var(--line); padding-top: var(--sp-3); }
.person__role { font-size: var(--step--2); color: var(--accent); margin-bottom: 0.35rem; }
.person h3 { margin-bottom: 0.4rem; }
.person p { color: var(--ash); font-size: var(--step--1); }

/* ---- Insights ----------------------------------------------------------- */
.article-list { border-top: 1px solid var(--line-soft); }
.article-row {
  display: grid;
  grid-template-columns: 8rem minmax(0, 1fr) 7rem;
  gap: var(--sp-3);
  padding-block: var(--sp-3);
  border-bottom: 1px solid var(--line-soft);
  align-items: baseline;
  text-decoration: none;
}
.article-row:hover .article-row__title { color: var(--accent); }
.article-row__title { font-size: var(--step-1); color: var(--bone); transition: color 200ms var(--ease); }
.article-row__cat, .article-row__date { font-size: var(--step--2); color: var(--ash-dim); }

.empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(2rem, 6vw, 4rem);
  text-align: center;
}
.empty h3 { margin-bottom: var(--sp-2); }
.empty p { margin-inline: auto; color: var(--ash); }

/* ---- Forms -------------------------------------------------------------- */
.form { max-width: 34rem; display: grid; gap: var(--sp-3); }
.field-row { display: grid; gap: 0.4rem; }
.field-row label { font-size: var(--step--1); color: var(--ash); }
.field-row input,
.field-row textarea,
.field-row select {
  font: inherit;
  font-size: var(--step--1);
  color: var(--bone);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.8rem 0.9rem;
  width: 100%;
  transition: border-color 200ms var(--ease);
}
.field-row input:focus,
.field-row textarea:focus,
.field-row select:focus { border-color: var(--accent); }
.field-row textarea { min-height: 8rem; resize: vertical; }
.field-hint { font-size: var(--step--2); color: var(--ash-dim); }
.field-error { font-size: var(--step--2); color: #E8705A; min-height: 1.1em; }
[data-theme="light"] .field-error { color: #B32E14; }
.field-row input[aria-invalid="true"],
.field-row textarea[aria-invalid="true"] { border-color: #E8705A; }

.form__status {
  font-size: var(--step--1);
  border-left: 2px solid var(--accent);
  padding: 0.75rem 1rem;
  background: var(--panel);
  color: var(--bone);
}
.form__status[hidden] { display: none; }

/* ---- Cookie notice ------------------------------------------------------ */
.cookiebar {
  position: fixed;
  left: var(--gutter); right: var(--gutter); bottom: 1.25rem;
  z-index: 120;
  max-width: 46rem;
  background: var(--ink-raise);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.35rem;
  display: none;
  gap: var(--sp-3);
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  box-shadow: 0 30px 70px -40px rgba(0,0,0,0.9);
}
.cookiebar[data-show="true"] { display: flex; }
.cookiebar p { font-size: var(--step--1); color: var(--ash); margin: 0; max-width: 42ch; }
.cookiebar .actions .btn { padding-block: 0.6rem; }

/* ---- Footer ------------------------------------------------------------- */
.footer {
  border-top: 1px solid var(--line-soft);
  padding-block: var(--sp-6) var(--sp-4);
}
.footer__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr));
  gap: clamp(1.5rem, 4vw, 3rem);
  margin-bottom: var(--sp-5);
}
.footer__claim { color: var(--ash); font-size: var(--step--1); max-width: 26ch; margin-top: var(--sp-2); }
.footer h4 { font-size: var(--step--2); color: var(--ash-dim); margin-bottom: var(--sp-2); font-weight: 460; letter-spacing: var(--tracking-wide); }
.footer ul { list-style: none; margin: 0; padding: 0; }
.footer li { margin-bottom: 0.5rem; }
.footer a { font-size: var(--step--1); color: var(--ash); text-decoration: none; }
.footer a:hover { color: var(--accent); }
.footer__base {
  display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4);
  justify-content: space-between;
  border-top: 1px solid var(--line-soft);
  padding-top: var(--sp-3);
  font-size: var(--step--2);
  color: var(--ash-dim);
}

/* ---- 404 ---------------------------------------------------------------- */
.lost { min-height: 70svh; display: grid; align-content: center; }
.lost h1 { margin-bottom: var(--sp-3); }
