/* ── 16 Memorização (#memorizacao, dark) ────────────────────────────────── */
/* The app's three phases (Reconhecer, Recitar, Escrever), each a paper card
   that turns in on its axis, cycling on its own (./memorizacao.js) until the
   visitor picks one; under the cards, the review ladder lit up to the phase.
   The verse is Salmos 119:11 (NAA, web/scripts/assets/sbb-verses.json). */
.l-memo {
  --memo-ink: #e2dacd;
  --memo-ink-2: #cdc1b2;
  --memo-ink-3: #9d9185;
  --memo-rule: #4c4238;
  --memo-accent: #d47a6d;
  background: var(--night-bg);
  color: var(--memo-ink);
  padding: clamp(96px, 13vh, 140px) clamp(28px, 7vw, 120px);
}
.l-memo .l-eb {
  color: var(--memo-accent);
}
.l-memo .l-h2 {
  color: #f2e9d8;
}
.l-memo .l-lede {
  color: var(--memo-ink-2);
  max-width: 34ch;
}
.l-memo-in {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 420px) minmax(0, 1fr);
  gap: clamp(40px, 6vw, 88px);
  align-items: center;
}

.l-memo-steps {
  display: grid;
  margin-top: 28px;
}
.l-memo-step {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  min-height: 44px;
  padding: 16px 0;
  border: 0;
  border-top: 1px solid var(--memo-rule);
  background: none;
  color: var(--memo-ink-3);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: color 0.4s;
}
.l-memo-step:last-child {
  border-bottom: 1px solid var(--memo-rule);
}
.l-memo-step:hover,
.l-memo-step[aria-pressed="true"] {
  color: #f2e9d8;
}
.l-memo-step:focus-visible {
  outline: 2px solid var(--memo-accent);
  outline-offset: 4px;
}
.l-memo-step .num {
  width: 30px;
  flex: none;
  font-family: var(--font-black);
  font-size: 32px;
  line-height: 1;
  color: #625952;
  transition: color 0.4s;
}
.l-memo-step[aria-pressed="true"] .num {
  color: var(--memo-accent);
}
.l-memo-step .tx {
  display: grid;
  gap: 4px;
}
.l-memo-step .t {
  font-family: var(--font-roman);
  font-weight: 700;
  font-size: 22px;
  line-height: 1.1;
}
.l-memo-step .d {
  font-family: var(--font-body);
  font-size: 16.5px;
  line-height: 1.4;
}
.l-memo-paid {
  margin: 20px 0 0;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gilt);
}

/* The deck: one cell, the cards on top of each other, turned in 3D. */
.l-memo-stage {
  display: grid;
  gap: 30px;
  min-width: 0;
}
.l-memo-deck {
  display: grid;
  perspective: 1800px;
  min-height: 330px;
  align-items: center;
}
.l-memo-card {
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: clamp(28px, 3.4vw, 44px) clamp(24px, 3.6vw, 48px);
  /* The app's night card on the night ground (owner, 2026-11-17: a light
     card on the black ground did not sit well): the dark theme's card, its
     ink and accent (shared/adscriptura.css, the dark block). */
  --mc-card: #29221b;
  --mc-ink: #e2dacd;
  --mc-ink-3: #9d9185;
  --mc-line: #4c4238;
  --mc-chip: #241d17;
  --mc-accent: #d47a6d;
  background: linear-gradient(rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0) 45%),
    var(--mc-card);
  color: var(--mc-ink);
  border-radius: var(--radius-card);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 1px 2px rgba(0, 0, 0, 0.5),
    0 4px 10px -2px rgba(0, 0, 0, 0.4),
    0 30px 48px -20px rgba(0, 0, 0, 0.85);
  transform-origin: 50% 50%;
  backface-visibility: hidden;
}
/* A hidden card still holds its room in the cell, so the deck keeps the
   tallest card's height and nothing under it jumps between phases. */
.l-memo-card[hidden] {
  display: flex;
  visibility: hidden;
}
.l-memo-card.in {
  animation: l-memo-in 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.l-memo-card.out {
  animation: l-memo-out 0.34s cubic-bezier(0.5, 0, 0.9, 0.5) both;
}
@keyframes l-memo-in {
  from {
    transform: rotateY(-88deg) translateZ(40px);
    opacity: 0.25;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
@keyframes l-memo-out {
  from {
    transform: none;
    opacity: 1;
  }
  to {
    transform: rotateY(88deg) translateZ(40px);
    opacity: 0.25;
  }
}
.l-memo-card .k {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mc-accent);
}
.l-memo-card .v {
  margin: 0;
  font-family: var(--font-body);
  font-size: clamp(24px, 2.3vw, 30px);
  line-height: 1.45;
}
.l-memo-card .ln {
  display: block;
}
.l-memo-card .opts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.l-memo-card .opts li {
  padding: 13px 16px;
  border: 1px solid var(--mc-line);
  border-radius: 6px;
  background: var(--mc-chip);
  font-family: var(--font-body);
  font-size: 18px;
  transition:
    background-color 0.5s,
    border-color 0.5s,
    color 0.5s;
}
/* The right answer is marked once the reader has had a moment to choose. */
.l-memo-card .opts .ok {
  border-color: #4d6d46;
  background: #20291e;
  color: #9abd92;
}
.l-memo-stage.playing .l-memo-card .opts .ok:not(.lit) {
  border-color: var(--mc-line);
  background: var(--mc-chip);
  color: inherit;
}

/* Recitar: the words that carry the verse go dim and blurred, then return. */
.l-memo-card .w {
  transition:
    opacity 0.6s,
    filter 0.6s;
}
.l-memo-card .w.go {
  opacity: 0.1;
  filter: blur(4px);
}
.l-memo-card .w.go.back {
  opacity: 1;
  filter: none;
}
.l-memo-card .grade {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  font-family: var(--font-roman);
  font-weight: 700;
  font-size: 18px;
}
.l-memo-card .grade span {
  padding: 11px 6px;
  text-align: center;
  border: 1px solid var(--mc-line);
  border-radius: 6px;
}
.l-memo-card .grade .on {
  border-color: transparent;
  background: #a8473c;
  color: #fff4ea;
  box-shadow: 0 3px 0 #7a3129;
}

/* Escrever: the verse typed into a field, with the caret. */
.l-memo-card .lbl {
  margin: 0 0 -12px;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--mc-ink-3);
}
.l-memo-card .field {
  min-height: 3.2em;
  padding: 16px 20px;
  background: var(--mc-chip);
  border: 1px solid var(--mc-line);
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: clamp(22px, 2.1vw, 27px);
  line-height: 1.45;
}
.l-memo-card .caret {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  margin-left: 2px;
  vertical-align: -0.18em;
  background: var(--mc-accent);
  animation: l-memo-caret 1s steps(1) infinite;
}
@keyframes l-memo-caret {
  50% {
    opacity: 0;
  }
}

/* The review ladder: each bar as tall as its interval, lit to the phase. */
.l-memo-ladder .k {
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--memo-ink-3);
}
.l-memo-ladder ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 6px;
  align-items: flex-end;
}
.l-memo-ladder li {
  --v: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--memo-rule);
  transition: color 0.5s;
}
.l-memo-ladder li:nth-child(4),
.l-memo-ladder li:nth-child(5) {
  --v: 2;
}
.l-memo-ladder li:nth-child(6) {
  --v: 4;
}
.l-memo-ladder li:nth-child(7) {
  --v: 7;
}
.l-memo-ladder li:nth-child(8) {
  --v: 10;
}
.l-memo-ladder li:nth-child(9) {
  --v: 14;
}
.l-memo-ladder li:nth-child(10) {
  --v: 21;
}
.l-memo-ladder li:nth-child(11) {
  --v: 30;
}
.l-memo-ladder .bar {
  width: 100%;
  height: calc(8px + var(--v) * 3px);
  border-radius: 2px 2px 0 0;
  background: currentColor;
  transform-origin: bottom;
  transition: background-color 0.5s;
}
/* Lit by step: the delay walks up the ladder, bar by bar. */
.l-memo-stage[data-phase="1"] .l-memo-ladder li:nth-child(-n + 3),
.l-memo-stage[data-phase="2"] .l-memo-ladder li:nth-child(-n + 7),
.l-memo-stage[data-phase="3"] .l-memo-ladder li {
  color: var(--memo-accent);
}
.l-memo-ladder li:nth-child(n + 4) {
  transition-delay: calc((var(--v) / 30) * 0.4s);
}
.l-memo-credit {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
  color: var(--memo-ink-3);
}

@media (prefers-reduced-motion: reduce) {
  .l-memo-card.in,
  .l-memo-card.out,
  .l-memo-card .caret {
    animation: none;
  }
  .l-memo-card .w,
  .l-memo-ladder li,
  .l-memo-step,
  .l-memo-step .num {
    transition: none;
  }
}

/* Phones: the copy and the phases first, then the card and the ladder. */
@media (max-width: 820px) {
  .l-memo {
    padding: 88px 20px;
  }
  .l-memo-in {
    grid-template-columns: 1fr;
    gap: 36px;
  }
  .l-memo-deck {
    min-height: 0;
  }
  .l-memo-card {
    gap: 16px;
  }
  .l-memo-card .opts {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .l-memo-card .grade {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .l-memo-ladder ol {
    gap: 3px;
  }
  .l-memo-ladder li {
    font-size: 10px;
  }
}
