/* Section 3, say it the way you'd say it (ADR 0239, HOMEPAGE-PLAN.md). A sentence types, the words
   that matter light up and fly into the record they become, and the loose words fall away. Six
   sentences, one record each; a quiet row of their names lets the reader choose. say.mjs plays it;
   without scripting the six read as a list beside the quote they begin with. */

.say {
  display: grid;
  justify-items: center;
  padding-block: var(--space-9);
  text-align: center;
}

.say h2 {
  font-size: var(--display-1);
  line-height: 1;
}

.say-stage {
  display: grid;
  justify-items: center;
  gap: var(--space-8);
  width: 100%;
  min-height: 470px;
  margin-top: var(--space-8);
}

/* ── The sentence ──────────────────────────────────────────────────────────────────────────── */
.say-sentence {
  max-width: 22ch;
  min-height: 1.2em;
  font-size: clamp(28px, 3.6vw, 48px);
  font-weight: var(--weight-semibold);
  line-height: 1.12;
  letter-spacing: -.035em;
}

.say-sentence .t {
  display: inline-block;
  white-space: pre;
  transition: opacity .5s;
}

.say-sentence .is-key {
  position: relative;
}

.say-sentence .is-key::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 -3px;
  border-radius: 6px;
  background: var(--light);
  opacity: 0;
  transition: opacity .4s;
}

.say-sentence.is-marked .is-key::after {
  opacity: .6;
}

.say-sentence.is-sorted .t:not(.is-key) {
  opacity: .16;
}

.say-sentence.is-sorted .is-key {
  opacity: 0;
}

.say-sentence.is-done .t:not(.is-key) {
  opacity: 0;
  transition-duration: 1.2s;
}

.say-caret {
  display: inline-block;
  width: 3px;
  height: .9em;
  margin-left: 3px;
  background: var(--ink);
  vertical-align: -.08em;
  animation: say-blink 1s steps(1) infinite;
}

@keyframes say-blink {
  50% { opacity: 0; }
}

/* The words on their way to the record. */
.say-fly {
  position: fixed;
  z-index: 40;
  margin: 0;
  border-radius: 6px;
  background: rgb(203 228 66 / 60%);
  color: var(--ink);
  white-space: pre;
  transform-origin: 0 0;
  pointer-events: none;
}

/* ── The record: a small sheet, prepared in Aunara's light ─────────────────────────────────── */
.say-records {
  display: grid;
  width: min(100%, 440px);
}

.say-card {
  grid-area: 1 / 1;
  padding: 22px 26px 24px;
  border-radius: 6px;
  background: var(--white);
  box-shadow: 0 1px 2px rgb(var(--forest-rgb) / 6%), 0 26px 70px -22px rgb(var(--forest-rgb) / 30%), 0 8px 20px -12px rgb(var(--forest-rgb) / 16%);
  text-align: left;
  transition: opacity .5s, translate .6s var(--ease-dawn);
}

.say-card:not(.is-active) {
  visibility: hidden;
  opacity: 0;
}

.say-stage.is-away .say-card {
  opacity: 0;
  translate: 0 12px;
}

.say-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--ink);
}

.say-card-head b {
  font-size: 24px;
  letter-spacing: -.03em;
}

.say-card-head small {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--muted);
  font-size: 13px;
}

.say-card-head small::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--light);
  box-shadow: 0 0 0 4px rgb(203 228 66 / 25%);
}

.say-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4) var(--space-5);
  margin-top: var(--space-4);
}

.say-fields dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: var(--weight-semibold);
  letter-spacing: .12em;
  text-transform: uppercase;
}

.say-fields dd {
  display: inline-block;
  margin: 0;
  font-weight: var(--weight-medium);
  font-variant-numeric: tabular-nums;
}

.say-fields .is-wide {
  grid-column: 1 / -1;
}

.say-fields .is-sum {
  display: flex;
  grid-column: 1 / -1;
  align-items: baseline;
  justify-content: space-between;
  padding-top: var(--space-3);
  border-top: 1px solid var(--line);
}

.say-fields .is-sum dd {
  font-size: 22px;
  font-weight: var(--weight-bold);
  letter-spacing: -.02em;
}

.say-stage[data-play] .say-card.is-active dd:not(.is-landed) {
  opacity: 0;
}

.say-fields dd.is-landed {
  animation: say-land .9s ease-out;
}

@keyframes say-land {
  from { background: rgb(203 228 66 / 70%); }
}

.say-bars {
  display: grid;
  gap: 9px;
  margin-top: 18px;
}

.say-bars span {
  display: grid;
  grid-template-columns: 74px 1fr auto;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.say-bars small {
  color: var(--muted);
}

.say-bars i {
  height: 10px;
  border-radius: var(--radius-pill);
  background: var(--ink);
  transform-origin: left;
  scale: var(--share) 1;
  transition: scale .9s var(--ease-dawn);
}

.say-stage[data-play] .say-card.is-active .say-bars:not(.is-landed) i {
  scale: 0 1;
}

/* ── The six, by name ──────────────────────────────────────────────────────────────────────── */
.say-picks {
  display: grid;
  gap: var(--space-2);
  margin: var(--space-7) 0 0;
  padding: 0;
  list-style: none;
}

.say-pick {
  padding: var(--space-1) 0;
  border: 0;
  border-bottom: 1.5px solid transparent;
  background: none;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  transition: color .3s, border-color .3s;
}

.say-pick .say-kind {
  color: var(--ink);
  font-weight: var(--weight-semibold);
}

/* With scripting the row shows the names; each still says its sentence to assistive technology. */
.say[data-ready] .say-picks {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-1) var(--space-5);
}

.say[data-ready] .say-says {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.say[data-ready] .say-pick .say-kind {
  color: inherit;
  font-weight: inherit;
}

.say-pick[aria-pressed="true"] {
  border-color: var(--ink);
  color: var(--ink);
}

.say-pick:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.say-note {
  margin-top: var(--space-5);
  color: var(--muted);
  font-size: var(--text-xs);
}

@media (max-width: 700px) {
  .say-stage {
    gap: var(--space-6);
    min-height: 520px;
    margin-top: var(--space-6);
  }

  .say-fields {
    grid-template-columns: minmax(0, 1fr);
  }

  .say[data-ready] .say-picks {
    gap: var(--space-1) var(--space-4);
  }
}
