/* ==========================================================================
   Akiri — the home page's own composition.

   Everything shared (tokens, type, buttons, chips, bubbles, cards, nav,
   footer, FAQ, pricing) is in /styles.css. This file only arranges the home
   page: the hero and its onboarding thread, the three things, the marking
   demo and "Will I pass?". Nothing here may define a colour, a size or a
   radius that is not a token from styles.css.
   ========================================================================== */

/* ── Hero ──────────────────────────────────────────────────────────────── */

.hero {
  padding-block: clamp(32px, 2rem + 3vw, 96px) 0;
}
.hero-grid {
  display: grid;
  gap: var(--s-12);
  align-items: center;
}
.hero-copy {
  display: grid;
  gap: var(--s-6);
  max-width: 34rem;
}
.hero-copy h1 {
  max-width: 12ch;
}
.hero-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3) var(--s-5);
  margin-top: var(--s-2);
}
@media (min-width: 980px) {
  /* Top-aligned, not centred: the thread grows as the visitor answers, and
     a centred column beside it would drift down under their eyes. */
  .hero-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 33rem);
    align-items: start;
    gap: var(--s-16);
  }
  .hero-copy {
    padding-top: clamp(48px, 8vh, 112px);
  }
}

/* The thread, framed as the app is: a white surface on the grey page. */
.thread-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--r-3xl);
  padding: var(--s-6) var(--s-5) var(--s-4);
}
@media (min-width: 560px) {
  .thread-card {
    padding: var(--s-8) var(--s-8) var(--s-5);
  }
}
@media (min-width: 980px) {
  /* Room reserved for the finished plan, so the card does not grow under
     the visitor's hand while they answer. */
  /* Once the visitor answers, room is reserved for the finished plan, so
     the card grows once rather than under their hand at every reply. */
  .thread-card.is-playing {
    min-height: 680px;
  }
}

.thread {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
/* A change of speaker opens a wider gap than two lines from one speaker. */
.thread > .bubble,
.thread > .bubble + .say,
.thread > .bubble + .plan {
  margin-top: var(--s-2);
}
.thread-hello {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}
.thread-hello .say {
  max-width: none;
}
.thread-live .thread {
  min-height: 1px;
}

/* Static ⇄ live. The static example shows unless the live one has been
   built (thread-ready) — and comes back if it never was (thread-failed). */
.thread-ready .thread-static {
  display: none;
}
.thread-ready .thread-live {
  display: flex !important;
  flex-direction: column;
}
.js:not(.thread-ready):not(.thread-failed) .thread-static {
  visibility: hidden;
}

.thread-answers {
  margin-top: var(--s-4);
}
.thread-answers .chips + .date-pick {
  margin-top: var(--s-3);
}
.date-pick {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
}
.date-pick input {
  min-height: var(--hit);
  padding: 0 14px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--subtle);
  box-shadow: inset 0 0 0 1px var(--line-control);
  color: var(--ink);
  font: inherit;
  font-size: var(--text-sm);
}

.thread-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-top: auto;
  padding-top: var(--s-6);
}
.thread-foot .caption {
  max-width: 28rem;
}
.thread-restart {
  flex: none;
  color: var(--ink-2);
}

/* Akiri, writing: three dots that breathe. Only ever on screen for a beat. */
.typing {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  height: 24px;
}
.typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-3);
  opacity: 0.4;
}
@media (prefers-reduced-motion: no-preference) {
  .typing span {
    animation: typing 1s ease-in-out infinite;
  }
  .typing span:nth-child(2) {
    animation-delay: 0.15s;
  }
  .typing span:nth-child(3) {
    animation-delay: 0.3s;
  }
  /* The thread's one authored motion: each new line rises into place. */
  .thread-live .is-new {
    animation: arrive 380ms var(--ease-out) both;
  }
}
@keyframes typing {
  0%,
  100% {
    opacity: 0.25;
  }
  50% {
    opacity: 0.9;
  }
}
@keyframes arrive {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* The plan the three answers make: a --subtle well inside the thread card
   (a card never holds a card). */
.plan {
  display: grid;
  gap: var(--s-1);
  margin-top: var(--s-2);
  padding: var(--s-5);
  border-radius: var(--r-lg);
  background: var(--subtle);
}
.plan-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s-2);
}
.plan .tag {
  background: var(--surface);
}
.plan-k {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--ink-3);
}
.plan-name {
  font-size: var(--text-h3);
  font-weight: 600;
  line-height: 1.3;
}
.plan-meta {
  font-size: var(--text-sm);
  color: var(--ink-3);
}
.plan-steps {
  margin-top: var(--s-3);
  padding: 0;
  list-style: none;
  counter-reset: step;
  display: grid;
  gap: var(--s-2);
  font-size: var(--text-sm);
  line-height: 1.45;
}
.plan-steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: var(--s-2);
  color: var(--ink-2);
}
.plan-steps li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.plan-steps li:first-child {
  color: var(--ink);
}
.plan-steps li:first-child::before {
  background: var(--brand);
  color: var(--on-brand);
}
.plan-lesson {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-top: var(--s-4);
  padding-top: var(--s-4);
  border-top: 1px solid var(--line);
}
.plan-lesson-t {
  font-size: var(--text-sm);
  font-weight: 600;
}
.plan-lesson-m {
  font-size: var(--text-xs);
  color: var(--ink-3);
}
.plan-lesson .btn {
  background: var(--surface);
}

/* ── Three things ──────────────────────────────────────────────────────── */

.does {
  list-style: none;
  padding: 0;
  margin-top: var(--s-12);
  display: grid;
  gap: var(--s-10);
}
@media (min-width: 860px) {
  .does {
    grid-template-columns: repeat(3, 1fr);
    column-gap: var(--s-12);
    row-gap: 0;
  }
  /* One row line across all three: titles, sentences and proofs align. */
  @supports (grid-template-rows: subgrid) {
    .does-item {
      grid-template-rows: subgrid;
    }
  }
}
.does-item {
  display: grid;
  grid-template-rows: auto auto 1fr;
  grid-row: span 3;
  gap: var(--s-3);
  align-content: start;
  padding-top: var(--s-5);
  border-top: 1px solid var(--line-2);
}
.does-item p {
  color: var(--ink-2);
  max-width: 30rem;
}
.does-proof {
  align-self: end;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3);
  margin-top: var(--s-3);
  font-size: var(--text-xs);
  color: var(--ink-3) !important;
}
.does-week {
  display: inline-flex;
  gap: 3px;
}
.does-week span {
  width: 14px;
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--line-2);
}
.does-week .on {
  background: var(--ink-3);
}
.does-week .now {
  background: var(--orb);
}
.does-src,
.does-say {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink-2);
}
.does-say {
  font-style: normal;
}
.does-more {
  margin-top: var(--s-12);
  color: var(--ink-2);
}

/* ── Marking demo ──────────────────────────────────────────────────────── */

.mk-layout {
  display: grid;
  gap: var(--s-10);
  align-items: start;
}
@media (min-width: 980px) {
  .mk-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 32rem);
    gap: var(--s-16);
  }
}
.mk-side {
  display: grid;
  gap: var(--s-8);
}
.mk-cta {
  display: grid;
  gap: var(--s-1);
  justify-items: start;
}
.mk-note {
  max-width: 30rem;
}

.mk-form {
  display: grid;
  gap: var(--s-3);
}
.mk-form[hidden] {
  display: none;
}
.mk-picker {
  margin: 0;
  padding: 0;
  border: 0;
  display: grid;
  gap: var(--s-2);
}
.mk-label {
  padding: 0;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink);
}
/* mark.js builds <label class="mk-chip"><input type=radio>…</label>.
   Painted 38px; the ::before carries it to the 44px target, as .chip does. */
.mk-chip::before {
  content: "";
  position: absolute;
  inset: -3px 0;
}
.mk-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  margin-block: 3px;
  padding: 0 16px;
  border-radius: var(--r-pill);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line-2);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
}
.mk-chip input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}
.mk-chip:hover {
  background: var(--hover);
}
.mk-chip.is-selected {
  background: var(--brand);
  color: var(--on-brand);
  box-shadow: none;
}
.mk-chip.is-focus {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}
.mk-question {
  display: grid;
  gap: var(--s-1);
  padding: var(--s-4);
  border-radius: var(--r-md);
  background: var(--surface);
}
.mk-source {
  font-size: var(--text-xs);
  color: var(--ink-3);
}
.mk-prompt {
  font-weight: 500;
}
.mk-working {
  width: 100%;
  min-height: 9rem;
  padding: var(--s-4);
  border: 0;
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line-control);
  color: var(--ink);
  font: inherit;
  font-size: var(--text-body);
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
  resize: vertical;
}
.mk-working::placeholder {
  color: var(--ink-3);
  opacity: 1;
}
.mk-working:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.mk-under {
  display: flex;
  justify-content: space-between;
  gap: var(--s-3);
  font-size: var(--text-xs);
  color: var(--ink-3);
}
.mk-count {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.mk-count.is-near {
  color: var(--bad);
}
.mk-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-4);
}
.mk-status {
  font-size: var(--text-sm);
  color: var(--ink-2);
}

/* The marked script: a white card, the memo's grammar inside it. */
.mk-script {
  display: grid;
  gap: var(--s-4);
  padding: var(--s-6);
  border-radius: var(--r-card);
  background: var(--surface);
}
@media (min-width: 560px) {
  .mk-script {
    padding: var(--s-8);
  }
}
.mk-script-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
}
.mk-script-title {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--ink-3);
}
.mk-script-q {
  font-weight: 500;
  line-height: 1.5;
}
.mk-of {
  color: var(--ink-3);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}
.mk-script-working {
  margin: 0;
  padding: var(--s-4);
  border-radius: var(--r-md);
  background: var(--subtle);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  line-height: 1.7;
  font-variant-numeric: tabular-nums;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.mk-points {
  list-style: none;
  padding: 0;
  display: grid;
}
.mk-point {
  display: grid;
  grid-template-columns: 22px 40px 1fr;
  gap: var(--s-2);
  align-items: baseline;
  padding-block: var(--s-3);
  border-bottom: 1px solid var(--line);
}
.mk-point:last-child {
  border-bottom: 0;
}
.mk-tick {
  font-weight: 700;
}
.mk-point.is-earned .mk-tick {
  color: var(--good);
}
.mk-point.is-lost .mk-tick {
  color: var(--bad);
}
.mk-code {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.mk-point-body {
  display: grid;
  gap: 2px;
}
.mk-point-text {
  font-size: var(--text-sm);
  font-weight: 500;
}
.mk-point.is-lost .mk-point-text {
  text-decoration: line-through;
  text-decoration-color: var(--bad);
  color: var(--ink-2);
}
.mk-point-reason {
  font-size: var(--text-sm);
  color: var(--ink-2);
}
.mk-ft {
  justify-self: start;
  margin-top: var(--s-1);
  padding: 2px 10px;
  border-radius: var(--r-pill);
  background: var(--honey-wash);
  color: var(--honey-text);
  font-size: 12px;
  font-weight: 600;
}
.mk-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--s-4);
  border-top: 1px solid var(--line-2);
}
.mk-total-k {
  font-weight: 600;
}
.mk-total-v {
  display: inline-flex;
  align-items: baseline;
  font-family: var(--font-display);
  font-size: var(--text-score);
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.mk-total-of {
  color: var(--ink-3);
}
.mk-looks,
.mk-why,
.mk-feedback,
.mk-message,
.mk-pending {
  font-size: var(--text-sm);
  color: var(--ink-2);
}
.mk-message + .btn {
  justify-self: start;
}

/* ── Will I pass ───────────────────────────────────────────────────────── */

.pass-grid {
  display: grid;
  gap: var(--s-10);
  align-items: center;
}
@media (min-width: 980px) {
  .pass-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 28rem);
    gap: var(--s-16);
  }
}
.pass-why {
  max-width: 30rem;
}
.pass-card {
  display: grid;
  gap: var(--s-2);
  margin: 0;
}
.pass-k {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--ink-3);
}
.pass-mark {
  margin-top: var(--s-3);
  font-family: var(--font-display);
  font-size: var(--text-figure);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}
.pass-range {
  color: var(--ink-2);
  font-size: var(--text-sm);
  max-width: 24rem;
}
/* The range, drawn: the band is the honest ± and the dot the estimate. */
.pass-scale {
  position: relative;
  height: 10px;
  margin-top: var(--s-5);
  border-radius: var(--r-pill);
  background: var(--subtle);
}
.pass-band {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--from);
  right: calc(100% - var(--to));
  border-radius: var(--r-pill);
  background: var(--honey-wash);
  box-shadow: inset 0 0 0 1px var(--honey);
}
.pass-dot {
  position: absolute;
  top: 50%;
  left: var(--at);
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 0 0 3px var(--surface);
}
.pass-ticks {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--s-4);
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* ── Pricing (home arrangement) ────────────────────────────────────────── */

.pricing .section-head {
  margin-bottom: var(--s-12);
}
.pricing .plan-cards {
  max-width: 60rem;
  margin-inline: auto;
}
.pricing .plan-card .card-head {
  flex-wrap: wrap;
}
.pricing > .wrap > .pricing-note,
.pricing .compare {
  max-width: 60rem;
  margin-inline: auto;
}
.pricing > .wrap > .pricing-note {
  margin-top: var(--s-6);
  margin-bottom: var(--s-8);
  text-align: center;
}

/* ── FAQ (home arrangement) ────────────────────────────────────────────── */

.faq-grid {
  display: grid;
  align-items: start;
  gap: var(--s-8);
}
@media (min-width: 980px) {
  .faq-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 40rem);
    gap: var(--s-16);
  }
}

/* ── Close ─────────────────────────────────────────────────────────────── */

.close-inner {
  display: grid;
  justify-items: center;
  gap: var(--s-6);
  text-align: center;
}
.close-cta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--s-3);
}
.close + .footer,
main:has(.close) + .footer {
  margin-top: 0;
}

/* The log is only a parking spot for focus between replies (script.js
   clearAnswers); it is never a destination, so it draws no ring. */
.thread:focus {
  outline: none;
}
