/* ---------- Hero ---------- */
.hero {
  padding: 88px 0 72px;
  text-align: center;
}
.hero h1 {
  margin: 0 auto;
  max-width: 15ch;
  font-family: var(--display);
  font-size: clamp(3.2rem, 6.2vw, 5.1rem);
  line-height: 1.04;
  letter-spacing: -0.025em;
  font-weight: 500;
  hyphens: manual;
  text-wrap: balance;
  opacity: 0;
  transform: translateY(12px);
  animation: hero-in 0.6s ease forwards;
}
.hero h1 em {
  font-style: normal;
  background: linear-gradient(transparent 64%, var(--accent) 64%, var(--accent) 90%, transparent 90%);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.hero-lead {
  margin: 24px auto 0;
  max-width: 44rem;
  color: var(--muted);
  font-size: 1.12rem;
  line-height: 1.65;
  text-wrap: pretty;
  opacity: 0;
  animation: rise-in 0.6s ease 0.1s forwards;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 30px;
  opacity: 0;
  animation: rise-in 0.6s ease 0.15s forwards;
}
.hero-note {
  margin: 14px auto 0;
  color: var(--muted);
  font-size: 0.94rem;
  opacity: 0;
  animation: rise-in 0.6s ease 0.2s forwards;
}

/* Product shots sit as framed windows on a tinted stage; the hero canvas fades out at its sides. */
.canvas-preview,
.canvas-feature__media,
.protocol-pair__media,
.view-tabs__media,
.tile__media {
  --stage-pad: clamp(8px, 1.6vw, 20px);
  padding: var(--stage-pad);
  background:
    radial-gradient(90% 70% at 50% 0%, var(--accent-soft), rgba(244, 251, 214, 0) 70%),
    linear-gradient(180deg, #edf2f7, var(--bg));
}
.canvas-preview picture,
.canvas-feature__media picture,
.protocol-pair__media picture,
.view-tabs__media picture,
.tile__media picture {
  display: block;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  box-shadow: 0 1px 2px rgba(23, 25, 31, 0.06), 0 28px 60px -28px rgba(23, 25, 31, 0.3);
}
.canvas-preview {
  margin: 56px auto 0;
  width: min(1320px, 100%);
  border: 1px solid var(--border);
  border-radius: 18px;
  opacity: 0;
  transform: translateY(18px);
  animation: rise-in 0.7s ease 0.25s forwards;
}
.canvas-preview .shot {
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
}
.shot {
  display: block;
  width: 100%;
  height: auto;
  background: var(--bg-muted);
}

/* ---------- Shared section chrome ---------- */
.section {
  padding: 84px 0;
}
.section h2 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.9rem, 3.4vw, 2.8rem);
  letter-spacing: -0.03em;
  line-height: 1.12;
  max-width: 26ch;
  text-wrap: balance;
}
.section-lead {
  margin: 14px 0 0;
  color: var(--muted);
  max-width: 40rem;
  font-size: 1.04rem;
  line-height: 1.6;
}
.section-head {
  margin-bottom: 44px;
}
.section-head.center {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.section-head.center h2 { max-width: 22ch; }
.section-head--split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px 64px;
  align-items: end;
}
.section-head--split .section-lead { margin: 0; }

/* Visible by default. home.js arms only the blocks still below the fold, so a page whose
   script never runs shows everything. */
.reveal {
  transition: opacity 0.7s ease, transform 0.7s ease;
  transition-delay: calc(var(--stagger, 0) * 90ms);
}
.reveal.is-armed {
  opacity: 0;
  transform: translateY(22px);
}

/* ---------- 2. The problem ---------- */
.section--problem { padding-top: 40px; }
.problem-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 32px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.problem-card {
  padding-top: 20px;
  border-top: 2px solid var(--text);
}
.problem-card h3 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.35rem, 2vw, 1.6rem);
  letter-spacing: -0.02em;
  line-height: 1.15;
  text-wrap: balance;
}
.problem-card p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.6;
}

/* ---------- 3. The graph is the plan (full-bleed) ---------- */
.section--canvas {
  border-block: 1px solid var(--border);
  background-color: var(--bg-elevated);
  background-image: radial-gradient(rgba(23, 25, 31, 0.11) 1px, transparent 1px);
  background-size: 22px 22px;
}
.canvas-feature {
  margin: 0;
}
.canvas-feature__media {
  position: relative;
  width: min(1440px, calc(100% - 32px));
  margin-inline: auto;
  border: 1px solid var(--border);
  border-radius: 18px;
}
/* Pins are placed in percent of the window, so their box matches the picture inside the stage padding. */
.callout-pins {
  position: absolute;
  inset: var(--stage-pad);
  margin: 0;
  padding: 0;
  list-style: none;
}
.callout-pins li,
.callout-list__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--obsidian);
  color: var(--accent);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1;
}
.callout-pins li {
  position: absolute;
  transform: translate(-50%, -50%);
  border: 2px solid #fff;
  box-shadow: 0 0 0 4px rgba(184, 240, 0, 0.55);
}
.callout-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 28px;
  margin: 36px 0 0;
  padding: 0;
  list-style: none;
}
.callout-list h3 {
  margin: 14px 0 0;
  font-size: 1.04rem;
  font-weight: 600;
}
.callout-list p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

/* ---------- 4. Protocols (library page and the activity that links it) ---------- */
/* Columns follow the shots' aspect ratios (760x520 and 520x520), so both windows sit at one height;
   the subgrid keeps the headings on one line across the pair. */
.protocol-pair {
  display: grid;
  grid-template-columns: minmax(0, 1.46fr) minmax(0, 1fr);
  grid-template-rows: auto auto auto;
  gap: 0 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.protocol-pair__item {
  display: grid;
  grid-row: span 3;
  grid-template-rows: subgrid;
}
.protocol-pair__media {
  display: grid;
  align-content: center;
  border: 1px solid var(--border);
  border-radius: 18px;
}
.protocol-pair h3 {
  margin: 20px 0 0;
  font-size: 1.1rem;
  font-weight: 600;
}
.protocol-pair p {
  margin: 6px 0 0;
  max-width: 34rem;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

/* ---------- 5. One plan, every view (tabs) ---------- */
.view-tabs {
  max-width: 1120px;
  margin-inline: auto;
  display: grid;
  gap: 48px;
}
.view-tabs.is-enhanced { gap: 28px; }
.view-tabs__list {
  display: inline-flex;
  justify-self: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--bg-elevated);
}
.view-tabs__tab {
  min-width: 96px;
  min-height: 44px;
  padding: 9px 18px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.94rem;
  cursor: pointer;
}
.view-tabs__tab:hover { background: var(--accent-soft); color: var(--text); }
/* The underline carries the selected state; lime on white alone is too faint to read. */
.view-tabs__tab[aria-selected="true"] {
  background: var(--accent);
  color: var(--accent-contrast);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}
.view-tabs__panel {
  display: grid;
  gap: 20px;
  border-radius: var(--radius);
}
.view-tabs__panel:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 6px;
}
.view-tabs__copy {
  text-align: center;
}
.view-tabs__title {
  margin: 0;
  font-family: var(--display);
  font-size: 1.6rem;
  letter-spacing: -0.02em;
}
.view-tabs.is-enhanced .view-tabs__title {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
.view-tabs__copy p {
  margin: 8px auto 0;
  max-width: 40rem;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}
.view-tabs.is-enhanced .view-tabs__copy p { margin-top: 0; }
.view-tabs__media {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 18px;
}

/* ---------- 6. Next to the plan (tiles) ---------- */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.tile {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  overflow: hidden;
}
.tile__copy {
  padding: 24px 24px 20px;
}
.tile h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}
.tile p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}
/* Tile shots are panes cut from a page, so the window runs off the bottom of the tile. */
.tile__media {
  margin-top: auto;
  padding-bottom: 0;
  border-top: 1px solid var(--border);
}
.tile__media picture {
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
}
/* An odd last tile takes the full row: copy beside the shot instead of above it. */
.tile--wide {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
}
.tile--wide .tile__copy {
  align-self: center;
  padding: 32px;
}
.tile--wide .tile__media {
  padding-top: calc(var(--stage-pad) * 2);
  border-top: 0;
  border-left: 1px solid var(--border);
}

/* ---------- 7. Final CTA ---------- */
.cta-band {
  padding: 0 0 96px;
}
.cta-band__inner {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  padding: 72px 32px;
  text-align: center;
  background: var(--obsidian);
  color: #fff;
}
.cta-band__inner::after {
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  content: "";
  pointer-events: none;
}
.cta-band h2 {
  position: relative;
  z-index: 1;
  margin: 0 auto;
  font-family: var(--display);
  font-size: clamp(1.9rem, 3vw, 2.6rem);
  max-width: 16ch;
  letter-spacing: -0.03em;
}
.cta-band p {
  position: relative;
  z-index: 1;
  margin: 12px auto 0;
  color: #b9bfcb;
  max-width: 36rem;
}
.cta-band .btn-primary {
  position: relative;
  z-index: 1;
  margin-top: 28px;
}
.cta-band :focus-visible { outline-color: var(--accent); }

/* ---------- Signup dialog ---------- */
.demo-modal {
  width: min(760px, calc(100% - 32px));
  max-height: calc(100vh - 32px);
  margin: auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: var(--shadow);
  overflow: auto;
}
.demo-modal::backdrop { background: rgba(15, 23, 42, 0.45); }
.demo-modal__inner { padding: 28px; }
.demo-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}
.demo-modal__header h2 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.9rem, 3.4vw, 2.8rem);
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.demo-modal__header p {
  margin: 10px 0 0;
  color: var(--muted);
  max-width: 40rem;
}
.demo-modal__header h2:focus { outline: none; }
.demo-modal__close { flex: 0 0 auto; }
.demo-modal .success {
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid rgba(184, 240, 0, 0.6);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--text);
  font-size: 0.95rem;
}
.form-note {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.85rem;
}
.required-mark {
  margin-left: 4px;
  color: var(--accent-ink);
  font-size: 0.74rem;
  font-weight: 600;
  white-space: nowrap;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-grid .full { grid-column: 1 / -1; }
.form-grid label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 500;
}
.form-grid input,
.form-grid select,
.form-grid textarea {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
}
.form-grid input:focus-visible,
.form-grid select:focus-visible,
.form-grid textarea:focus-visible {
  border-color: var(--accent-ink);
}
.form-grid textarea { resize: vertical; min-height: 110px; }
.form-grid .help {
  margin: 6px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}
/* :is() is forgiving, so a browser without :user-invalid still applies the aria-invalid match. */
.form-grid :is([aria-invalid="true"], :user-invalid) {
  border-color: #b91c1c;
  border-width: 2px;
  padding: 9px 11px;
}
.form-grid .errorList {
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
  color: #b91c1c;
  font-size: 0.85rem;
  font-weight: 500;
}
.form-grid .errorList li {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}
/* A drawn mark beside the text so the error never rests on red alone. */
.form-grid .errorList li::before {
  content: "";
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  margin-top: 2px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 8v4M12 16h.01'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 8v4M12 16h.01'/%3E%3C/svg%3E") center / contain no-repeat;
}
.form-grid .char-count {
  margin: 6px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.consent-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.92rem;
  color: var(--muted);
}
.consent-row input { width: auto; margin-top: 3px; accent-color: var(--accent-ink); }
.consent-row a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.form-actions { margin-top: 18px; }

main:focus { outline: none; }

@keyframes hero-in {
  to { opacity: 1; transform: none; }
}
@keyframes rise-in {
  to { opacity: 1; transform: none; }
}

@media (max-width: 1000px) {
  .callout-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .form-grid { grid-template-columns: 1fr; }
  .problem-grid { grid-template-columns: 1fr; gap: 28px; }
  .section-head--split { grid-template-columns: 1fr; }
  .tile-grid { grid-template-columns: 1fr; }
  .tile--wide { display: flex; }
  .tile--wide .tile__copy { padding: 24px 24px 20px; }
  .tile--wide .tile__media { padding-top: var(--stage-pad); border-top: 1px solid var(--border); border-left: 0; }
  .protocol-pair { grid-template-columns: 1fr; grid-template-rows: none; gap: 40px; }
  .protocol-pair__item { display: block; }
}

@media (max-width: 560px) {
  .hero { padding: 56px 0 48px; }
  .hero h1 {
    max-width: 12ch;
    font-size: clamp(2.4rem, 11vw, 3.4rem);
  }
  .hero-lead { font-size: 1rem; }
  .hero-actions { gap: 8px; margin-top: 24px; }
  .hero-actions .btn-lg { padding: 12px 14px; font-size: 0.92rem; }
  .canvas-preview { margin-top: 36px; }
  .section { padding: 64px 0; }
  .section--problem { padding-top: 24px; }
  .section-head { margin-bottom: 28px; }
  .section h2 { font-size: clamp(1.9rem, 9vw, 2.4rem); }
  .section-lead { font-size: 0.96rem; }
  .canvas-feature__media { width: calc(100% - 20px); }
  .callout-pins li { width: 22px; height: 22px; font-size: 0.72rem; border-width: 1px; box-shadow: 0 0 0 2px rgba(184, 240, 0, 0.55); }
  .callout-list { grid-template-columns: 1fr; gap: 16px; margin-top: 28px; }
  .callout-list li { display: grid; grid-template-columns: 30px 1fr; column-gap: 12px; }
  .callout-list h3 { margin: 4px 0 0; }
  .callout-list p { grid-column: 2; }
  .view-tabs__list { width: 100%; }
  .view-tabs__tab { flex: 1 1 0; min-width: 0; padding: 9px 8px; }
  .cta-band { padding-bottom: 64px; }
  .cta-band__inner { padding: 52px 22px; }
  .demo-modal__inner { padding: 20px; }
  .demo-modal__header { gap: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .hero h1,
  .hero-lead,
  .hero-actions,
  .hero-note,
  .canvas-preview {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
  .reveal { transition: none; }
}
