/* Lead-magnet LIVE-ONLY styles. Tokens + all §12 components come from app-system.css
   (linked first in index.html). This file holds only the live shell (.lm-*), the
   pre-account panels not yet promoted to §12, and a few live helpers. Keep it thin. */

html { min-height: 100%; background: var(--bg); color: var(--text); }

body {
  min-height: 100vh;
  margin: 0;
  padding: 0;
  background:
    linear-gradient(90deg, rgba(17,17,17,0.035) 1px, transparent 1px) 0 0 / 48px 48px,
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
}

button, input, textarea { font: inherit; }

button { -webkit-tap-highlight-color: transparent; }

.lm-shell {
  width: min(100%, 1120px);
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 440px);
  border-left: var(--rule-medium) solid var(--border);
  border-right: var(--rule-medium) solid var(--border);
  background: var(--bg);
}

.lm-context {
  min-height: 100vh;
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-right: var(--rule-medium) solid var(--border);
}

.lm-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: var(--label-tracking);
  text-transform: uppercase;
  font-size: 18px;
}

.lm-brand__logo {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  flex-shrink: 0;
}

.lm-brand__logo img {
  width: 26px;
  height: 26px;
  display: block;
}

.lm-context h1 {
  font-family: var(--font-display);
  font-size: clamp(56px, 8vw, 104px);
  line-height: 0.9;
  letter-spacing: var(--display-tracking);
  text-transform: uppercase;
  margin: 64px 0 20px;
}

.lm-context p {
  max-width: 56ch;
  margin: 0;
  color: var(--text-muted);
  font-size: 17px;
  line-height: 1.55;
}

.lm-proof {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: var(--rule-medium) solid var(--border);
  margin-top: 48px;
}

.lm-proof div { padding: 14px 12px 0 0; }

.lm-proof b {
  display: block;
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 1;
  text-transform: uppercase;
}

.lm-proof span {
  display: block;
  margin-top: 5px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: var(--mono-tracking);
  text-transform: uppercase;
  color: var(--text-muted);
}

.lm-panel {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  view-transition-name: lead-magnet-panel;
}

.lm-panel > .intake-screen {
  animation: none;
  overflow-anchor: none;
}

.lm-panel > .plan-view,
.lm-panel > .export-success {
  overflow-anchor: none;
  scroll-padding-block-start: var(--space-4);
}

.lm-panel .intake-actions {
  margin-top: 22px;
}

.lm-panel .tc-event-panel,
.lm-panel .mc-controls {
  animation: none;
}

@media (min-width: 821px) {
  html {
    height: 100%;
    overflow: hidden;
    scrollbar-gutter: stable;
  }

  body {
    height: 100vh;
    overflow: hidden;
  }

  .lm-shell {
    height: 100vh;
    min-height: 0;
    overflow: hidden;
  }

  .lm-context,
  .lm-panel {
    height: 100%;
    min-height: 0;
  }

  .lm-panel {
    overflow: hidden;
  }

  .lm-panel > .intake-screen,
  .lm-panel > .gen-hero,
  .lm-panel > .plan-view,
  .lm-panel > .export-success {
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: none;
  }

  .lm-panel > .intake-screen::-webkit-scrollbar,
  .lm-panel > .gen-hero::-webkit-scrollbar,
  .lm-panel > .plan-view::-webkit-scrollbar,
  .lm-panel > .export-success::-webkit-scrollbar {
    width: 0;
  }

  @supports (height: 100dvh) {
    body,
    .lm-shell {
      height: 100dvh;
    }
  }
}

::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
}

::view-transition-old(lead-magnet-panel) {
  animation: lm-panel-out 1ms linear both;
}

::view-transition-new(lead-magnet-panel) {
  animation: lm-panel-in 220ms var(--ease) both;
}

@keyframes lm-panel-out {
  to { opacity: 0; transform: translateY(-8px); }
}

@keyframes lm-panel-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.field-row {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.field-row label,
.field-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: var(--eyebrow-tracking);
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 600;
}

.field-row input,
.field-row select,
.intake-textarea {
  width: 100%;
  min-height: 48px;
  border: var(--rule-medium) solid var(--border);
  border-radius: var(--radius-1);
  background: var(--bg-elevated);
  color: var(--text);
  padding: 11px 12px;
  font-family: var(--font-mono);
  font-size: 14px;
}

.intake-textarea {
  min-height: 120px;
  line-height: 1.45;
  resize: vertical;
}

.field-row input:focus-visible,
.field-row select:focus-visible,
.intake-textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.error-text {
  color: var(--error-ink, #B5331C);
  font-size: 12px;
  line-height: 1.4;
  margin: 8px 0 0;
}

/* OCPM-216: arrival moment for the email-first unlock. A confident, on-brand
   "it's yours" beat — an oxblood check that draws itself once, a display
   headline, one line. Hard-cut, rules over shadows; the ink card below owns the
   stats so this stays emotional, not a data dump. Reduced-motion disables the
   entrance and the check draw. */
.plan-reveal {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin: 0 0 16px;
  padding: 16px 18px;
  background: var(--bg-elevated);
  border: var(--rule-medium) solid var(--text);
  border-top: 3px solid var(--accent);
  animation: plan-reveal-in 360ms var(--ease) both;
}
.plan-reveal__seal {
  width: 38px;
  height: 38px;
  flex: none;
  margin-top: 1px;
}
.plan-reveal__seal-ring {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  opacity: 0.3;
}
.plan-reveal__seal-check {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-linecap: square;
  stroke-linejoin: miter;
  stroke-dasharray: 32;
  stroke-dashoffset: 32;
  animation: plan-reveal-draw 460ms var(--ease-snap) 200ms forwards;
}
.plan-reveal__copy { min-width: 0; }
.plan-reveal__eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: var(--eyebrow-tracking);
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 5px;
}
.plan-reveal__title {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-size: 26px;
  line-height: 1;
  letter-spacing: var(--display-tracking);
  text-transform: uppercase;
  color: var(--text);
  margin: 0;
}
.plan-reveal__sub {
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-muted);
  margin: 7px 0 0;
}
@keyframes plan-reveal-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes plan-reveal-draw {
  to { stroke-dashoffset: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .plan-reveal { animation: none; }
  .plan-reveal__seal-check { animation: none; stroke-dashoffset: 0; }
}

/* OCPM-216 — share sheet. Bottom sheet on phones; centered modal at >=821px (the
   lead-magnet desktop breakpoint) so it isn't a full-width strip glued to the
   bottom edge on desktop. Self-contained keyframe enter/exit because this sheet
   is re-rendered declaratively (driven by share.open / share.closing) rather
   than rAF-toggled like the gym app's sheets — those keep the base .sheet
   transition pattern and are untouched. Route-scoped here, not in the shared
   design system, for that reason. */
/* Anchor to the viewport at ALL widths. The lead-magnet page is a normally
   scrolling document, so the base .sheet / .sheet-backdrop `position: absolute`
   (built for the gym app's fixed-height shell) would otherwise pin the sheet to
   the document bottom and let it scroll away on phones (<821px) — review #1.
   Also drive open/close purely by the keyframes below; the base transition would
   double-drive transform/opacity on dismiss (animation wins, but it's fragile). */
.sheet--modal,
.sheet-backdrop--modal { position: fixed; transition: none; }
.sheet--modal.is-open { animation: lm-sheet-rise var(--dur-sheet) var(--ease) both; }
.sheet--modal.is-closing { animation: lm-sheet-sink var(--dur-sheet) var(--ease) both; }
.sheet-backdrop--modal.is-open { animation: lm-overlay-in var(--dur-base) var(--ease) both; }
.sheet-backdrop--modal.is-closing { animation: lm-overlay-out var(--dur-base) var(--ease) both; }
@keyframes lm-sheet-rise { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes lm-sheet-sink { from { transform: translateY(0); } to { transform: translateY(100%); } }
@keyframes lm-overlay-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes lm-overlay-out { from { opacity: 1; } to { opacity: 0; } }
@media (min-width: 821px) {
  .sheet--modal {
    position: fixed;
    left: 50%;
    top: 50%;
    right: auto;
    bottom: auto;
    width: min(460px, calc(100vw - 64px));
    max-height: min(88vh, 680px);
    border: 1.5px solid var(--text);
    transform: translate(-50%, -50%);
  }
  .sheet--modal .sheet__handle { display: none; }
  .sheet--modal.is-open { animation: lm-modal-in var(--dur-base) var(--ease) both; }
  .sheet--modal.is-closing { animation: lm-modal-out var(--dur-base) var(--ease) both; }
}
@keyframes lm-modal-in {
  from { opacity: 0; transform: translate(-50%, calc(-50% + 12px)); }
  to { opacity: 1; transform: translate(-50%, -50%); }
}
@keyframes lm-modal-out {
  from { opacity: 1; transform: translate(-50%, -50%); }
  to { opacity: 0; transform: translate(-50%, calc(-50% + 8px)); }
}
@media (prefers-reduced-motion: reduce) {
  .sheet--modal.is-open,
  .sheet--modal.is-closing,
  .sheet-backdrop--modal.is-open,
  .sheet-backdrop--modal.is-closing { animation: none; }
}

.intake-option--compact {
  grid-template-columns: 1fr auto;
  padding: 12px 14px;
  min-height: 56px;
}

.intake-option__body,
.intake-option__title,
.intake-option__help {
  display: block;
}

.intake-option[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.52;
}

.intake-option[aria-disabled="true"]:hover {
  border-color: var(--border);
  transform: none;
}

.injury-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 22px;
}

.age-helper {
  font-size: 10px;
  letter-spacing: 0.06em;
  margin: -4px 0 0;
  font-weight: 500;
}

.schedule-helper {
  font-size: 11px;
  letter-spacing: 0.06em;
  margin: 0 0 auto;
}

.tc-event-panel__chips,
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 12px;
}

.tc-event__chip,
.choice-chip {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: var(--mono-tracking);
  padding: 10px 12px;
  min-height: 44px;
  cursor: pointer;
  border-radius: var(--radius-0);
}

.tc-event__chip:hover,
.choice-chip:hover { border-color: var(--text); }

.tc-event__chip.is-active,
.choice-chip.is-active {
  background: var(--accent);
  color: var(--text-on-accent);
  border-color: var(--accent);
}

.fatigue-sub { margin-top: 18px; }

.email-gate,
.export-panel,
.memory-panel {
  margin-top: 16px;
  border-top: var(--rule-medium) solid var(--border);
  padding-top: 16px;
}

.email-gate h3,
.memory-panel h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 26px;
  line-height: 1;
  letter-spacing: var(--display-tracking);
  text-transform: uppercase;
}

.email-gate p,
.memory-panel p,
.export-note {
  margin: 0 0 12px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.45;
}

/* Handoff gate now sits above the coach note (post-unlock activation order), so
   it needs a bottom gap or the oxblood CTA visually collides with the coach-note
   card directly beneath it. */
.email-gate--handoff { margin-bottom: 24px; }

/* Smooth in-place entrance for the verification code panel (email→code). The
   render() path keeps scroll anchored at the gate; this just fades/slides the
   new panel in. One-shot (gated by state.verify.codeJustOpened) so it doesn't
   replay on submit/resend re-renders. */
.email-gate--enter { animation: lm-gate-enter 280ms var(--ease) both; }
@keyframes lm-gate-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .email-gate--enter { animation: none; }
}

.consent-row {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 9px;
  align-items: start;
  margin: 8px 0 14px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.35;
}

.consent-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.export-links {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.export-link {
  min-height: 62px;
  border: var(--rule-medium) solid var(--border);
  color: var(--text);
  text-decoration: none;
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.export-link span {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  line-height: 1;
}

.export-link b {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: var(--mono-tracking);
  text-transform: uppercase;
  color: var(--text-muted);
}

.memory-panel {
  background: var(--ink-bg);
  color: var(--ink-text);
  padding: 16px;
  border: var(--rule-medium) solid var(--ink-bg);
}

.memory-panel h3 { color: var(--ink-text); }

.memory-panel p { color: var(--ink-text-muted); }

.memory-panel .btn {
  border-color: var(--ink-accent);
  background: var(--ink-accent);
  color: var(--ink-bg);
  width: 100%;
}

.memory-panel .btn:disabled {
  border-color: var(--ink-border);
  background: var(--ink-border);
  color: var(--ink-text-muted);
  cursor: not-allowed;
}

.memory-list {
  margin: 12px 0 14px;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--ink-border);
}

.memory-list li {
  padding: 9px 0;
  border-bottom: 1px solid var(--ink-border);
  font-size: 13px;
  color: var(--ink-text);
}

.access-request-card {
  margin: 14px 0;
  padding: 14px;
  border: var(--rule-medium) solid var(--ink-accent);
  background: color-mix(in srgb, var(--ink-accent) 18%, var(--ink-bg));
  box-shadow: inset 0 -4px 0 var(--ink-accent);
  animation: access-card-in 220ms var(--ease) both;
}

.access-request-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.access-request-card__mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: var(--ink-accent);
  color: var(--ink-bg);
  flex-shrink: 0;
}

.access-request-card__mark svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.access-request-card__label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: var(--eyebrow-tracking);
  text-transform: uppercase;
  color: var(--ink-accent);
  font-weight: 700;
}

.access-request-card h4 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 0.95;
  letter-spacing: var(--display-tracking);
  text-transform: uppercase;
  color: var(--ink-text);
}

.access-request-steps {
  margin: 12px 0 0;
  padding: 10px 0 0;
  border-top: 1px solid var(--ink-border);
  list-style: none;
  display: grid;
  gap: 8px;
}

.access-request-steps li {
  display: grid;
  grid-template-columns: 9px 1fr;
  gap: 10px;
  align-items: baseline;
  color: var(--ink-text);
  font-size: 13px;
}

.access-request-steps li::before {
  content: "";
  width: 7px;
  height: 7px;
  background: var(--ink-accent);
  transform: translateY(-1px);
}

@keyframes access-card-in {
  from { opacity: 0.45; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.trust-line {
  margin-top: 10px !important;
  font-family: var(--font-mono);
  font-size: 10px !important;
  letter-spacing: var(--mono-tracking);
  text-transform: uppercase;
}

.memory-copy {
  margin-top: 16px !important;
  font-size: 12px !important;
  padding-top: 14px;
  border-top: 1px solid var(--ink-border);
}

.trial-code {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--ink-border);
}

.trial-code .field-row label { color: var(--ink-text-faint); }

.trial-code input {
  background: transparent;
  border-color: var(--ink-border);
  color: var(--ink-text);
  font-family: var(--font-mono);
  font-size: 22px;
  letter-spacing: 0.12em;
  text-align: center;
}

.trial-code .error-text { color: #f4b6a7; }

@media (max-width: 820px) {
  .lm-shell {
    display: block;
    border: 0;
  }
  .lm-shell--focus .lm-context {
    display: none;
  }
  .lm-context h1, .lm-context > div > p { display: none; }
  .lm-context {
    min-height: auto;
    padding: 22px 18px;
    border-right: 0;
    border-bottom: var(--rule-medium) solid var(--border);
  }
  .lm-context h1 {
    font-size: 46px;
    margin: 30px 0 12px;
  }
  .lm-context p { font-size: 14px; }
  .lm-proof { margin-top: 24px; }
  .lm-panel,
  .intake-screen,
  .gen-hero,
  .plan-view { min-height: calc(100vh - 240px); }
  .lm-shell--focus .lm-panel,
  .lm-shell--focus .intake-screen,
  .lm-shell--focus .gen-hero,
  .lm-shell--focus .plan-view { min-height: 100vh; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
  .lm-panel { view-transition-name: none; }
}

/* OCPM-222 email-first: locked exercise teaser, build spinner, verify helpers. */
.plan-exercises-locked { position: relative; }
.plan-exercises-locked .plan-exercises {
  filter: blur(5px);
  opacity: 0.55;
  user-select: none;
  pointer-events: none;
}
.plan-exercises-locked__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  letter-spacing: var(--mono-tracking, 0.12em);
  text-transform: uppercase;
  color: var(--ink-text, #111);
  text-align: center;
}
.plan-lock { width: 22px; height: 22px; fill: var(--accent, #C8391F); }
.gen-hero__spinner {
  width: 38px;
  height: 38px;
  margin: 0 auto 20px;
  border: 3px solid var(--border, rgba(17,17,17,0.15));
  border-top-color: var(--accent, #C8391F);
  border-radius: 50%;
  animation: lm-spin 0.9s linear infinite;
}
@keyframes lm-spin { to { transform: rotate(360deg); } }
.verify-help { font-size: 12px; color: var(--ink-text-muted, #555); margin-top: 12px; line-height: 1.5; }
.link-button {
  background: none;
  border: none;
  padding: 6px 2px;
  display: inline-block;
  color: var(--accent, #C8391F);
  text-decoration: underline;
  cursor: pointer;
  font: inherit;
}
.tc-legend-hint { font-size: 12px; color: var(--text-muted, #555); margin: 0 0 12px; line-height: 1.4; }
.tc-legend-hint b { font-weight: 600; color: var(--text, #111); font-style: normal; }
