/* Memory. Same paper, same ink, one accent, and no colour that scolds.
   Green never appears, red never appears, and nothing counts days in a row. */

.mem-ring {
  width: 2rem;
  height: 2rem;
  flex: 0 0 auto;
  transform: rotate(-90deg);
  overflow: visible;
}
.mem-ring .track {
  fill: none;
  stroke: var(--rule);
  stroke-width: 3;
}
.mem-ring .fill {
  fill: none;
  stroke: var(--gold);
  stroke-width: 3;
  stroke-linecap: round;
  transition: stroke-dashoffset .5s var(--ease);
}

/* ------------------------------------------------------------------ panel */

.mem-quote {
  font: 1.02rem/1.7 var(--serif);
  color: var(--ink);
  margin: 0 0 1.2rem;
}
.mem-state {
  display: flex;
  align-items: center;
  gap: .7rem;
  margin: 0 0 1.2rem;
  color: var(--ink-2);
}
.mem-count {
  margin-top: 1.6rem;
  font-size: .78rem;
  color: var(--ink-3);
  letter-spacing: .02em;
}

/* ---------------------------------------------------------------- library */

.mem-summary-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.4rem;
}
.mem-summary-row h3 { margin: 0 0 .2rem; }
.mem-summary-row p { margin: 0; }

.mem-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.mem-row {
  display: flex;
  align-items: flex-start;
  gap: .9rem;
  padding: 1.1rem 0;
  border-top: 1px solid var(--rule-soft);
}
.mem-row-body { flex: 1 1 auto; min-width: 0; }
.mem-row-ref {
  margin: 0 0 .2rem;
  font: 600 .74rem/1.2 var(--ui);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--gold);
}
.mem-row-text {
  margin: 0 0 .35rem;
  font: 1rem/1.6 var(--serif);
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.mem-row-meta {
  margin: 0;
  font-size: .78rem;
  color: var(--ink-3);
}
.mem-row-tools {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  flex: 0 0 auto;
}

.mem-mini {
  appearance: none;
  background: none;
  border: 1px solid var(--rule);
  border-radius: 2em;
  color: var(--ink-2);
  font: 500 .74rem/1 var(--ui);
  letter-spacing: .04em;
  padding: .5em 1em;
  cursor: pointer;
  white-space: nowrap;
}
.mem-mini:hover { border-color: var(--gold-soft); color: var(--ink); }
.mem-mini.quiet { border-color: transparent; color: var(--ink-3); }
.mem-mini.quiet:hover { border-color: var(--rule); }
.mem-mini[aria-pressed="true"] {
  border-color: var(--gold);
  color: var(--gold);
}

/* ---------------------------------------------------------------- session */

.mem-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.6rem;
}
.mem-head > div:nth-child(2) { flex: 1 1 auto; }
.mem-head .day-line { margin-bottom: .3rem; }
.mem-ref {
  margin: 0;
  font: 400 clamp(1.4rem, 3.6vw, 1.9rem)/1.2 var(--serif);
  letter-spacing: -.01em;
}
.mem-head-tools {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.mem-cue-note {
  margin: 0 0 1.2rem;
  padding: .8rem 1rem;
  border-left: 2px solid var(--gold-soft);
  background: var(--paper-2);
  border-radius: 0 .5rem .5rem 0;
  font-size: .84rem;
  color: var(--ink-2);
}

.mem-modes {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
  margin-bottom: 1.4rem;
}
.mem-mode {
  appearance: none;
  background: none;
  border: 1px solid var(--rule);
  border-radius: 2em;
  color: var(--ink-2);
  font: 600 .76rem/1 var(--ui);
  letter-spacing: .04em;
  padding: .65em 1.1em;
  cursor: pointer;
}
.mem-mode[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.mem-mode[disabled] { opacity: .4; cursor: default; }

.mem-hint {
  margin: 0 0 1rem;
  font-size: .82rem;
  color: var(--ink-3);
}

.mem-line {
  font: 1.15rem/2.1 var(--serif);
  color: var(--ink);
  margin: 0 0 .7rem;
}

.mem-word {
  appearance: none;
  font: inherit;
  color: var(--ink-2);
  background: none;
  border: 0;
  border-bottom: 1px solid var(--rule);
  border-radius: .2em;
  padding: 0 .18em;
  margin: 0 .06em;
  cursor: pointer;
  transition: color .2s var(--ease), border-color .2s var(--ease);
}
.mem-word:hover { color: var(--ink); border-bottom-color: var(--gold-soft); }
.mem-word.blank { letter-spacing: .12em; }
.mem-word.shown {
  color: var(--ink);
  background: none;
  border-bottom-color: transparent;
  cursor: default;
}

.mem-drill textarea {
  width: 100%;
  padding: 1rem 1.1rem;
  border: 1px solid var(--rule);
  border-radius: .7rem;
  background: var(--field);
  color: var(--ink);
  font: 1.02rem/1.8 var(--serif);
  resize: vertical;
  margin-bottom: 1rem;
}
.mem-drill textarea:focus { border-color: var(--gold-soft); outline: none; }

.mem-result { margin-top: 1.6rem; }
.mem-score {
  display: flex;
  align-items: baseline;
  gap: .6rem;
  margin: 0 0 1rem;
}
.mem-score .mem-ring { align-self: center; }
.mem-score .v {
  font: 400 2.2rem/1 var(--serif);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.mem-score .l { font-size: .8rem; color: var(--ink-3); }

.mem-marked {
  font: 1.05rem/1.9 var(--serif);
  color: var(--ink);
  margin: 0 0 1rem;
}
/* A missed word is marked by weight and an underline as well as by tint, and
   the same information is read out in .mem-note. Never colour alone. */
.mem-wrong {
  color: var(--clay);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-style: wavy;
  text-underline-offset: .22em;
}
.mem-missed {
  color: var(--clay);
  font-weight: 600;
  border-bottom: 1px dashed var(--clay);
}

.mem-note {
  margin: 0;
  font-size: .82rem;
  color: var(--ink-3);
  line-height: 1.6;
}

.mem-ratings {
  margin-top: 2rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--rule-soft);
}
.mem-ask {
  margin: 0 0 .9rem;
  font: 500 .72rem/1 var(--ui);
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.mem-rating-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: .5rem;
  margin-bottom: 1rem;
}
.mem-rating {
  appearance: none;
  text-align: left;
  background: var(--field);
  border: 1px solid var(--rule);
  border-radius: .7rem;
  padding: .85rem 1rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: .18rem;
  transition: border-color .16s var(--ease), transform .16s var(--ease);
}
.mem-rating:hover { border-color: var(--gold-soft); transform: translateY(-1px); }
.mem-rating.suggested { border-color: var(--gold); }
.mem-rating .k {
  font: 600 .92rem/1.2 var(--ui);
  color: var(--ink);
}
.mem-rating .d { font-size: .76rem; color: var(--ink-3); }
.mem-rating .w {
  font-size: .74rem;
  color: var(--gold);
  letter-spacing: .04em;
  font-variant-numeric: tabular-nums;
}

.mem-recap {
  list-style: none;
  margin: 0 0 1.2rem;
  padding: 0;
}
.mem-recap li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .5rem 0;
  border-bottom: 1px solid var(--rule-soft);
}
.mem-recap-ref { font: 1rem/1.4 var(--serif); color: var(--ink); }
.mem-recap-when { font-size: .8rem; color: var(--ink-3); white-space: nowrap; }
.mem-close {
  font: 1.15rem/1.7 var(--serif);
  color: var(--ink);
  margin: 0 0 1.4rem;
}

/* ------------------------------------------------- recite over the scene */

/* The backdrop is already fixed behind everything, so this only widens the
   column, lifts the type and lets the lines arrive one at a time. */
.mem-session.recite {
  max-width: none;
  min-height: 68vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  padding-block: 3rem;
}
.mem-session.recite .mem-line {
  font-size: clamp(1.3rem, 3.4vw, 2rem);
  line-height: 1.9;
  text-shadow: 0 2px 30px rgba(0, 0, 0, .6);
  animation: mem-line-in 1.1s var(--ease) both;
  animation-delay: calc(var(--i, 0) * .5s);
}
.mem-session.recite .mem-modes,
.mem-session.recite .mem-rating-row,
.mem-session.recite .actions { justify-content: center; }
.mem-session.recite .mem-hint { opacity: .75; }
.mem-session.recite .mem-head { justify-content: center; text-align: left; }
.mem-session.recite .mem-head > div:nth-child(2) { flex: 0 1 auto; }
.mem-session.recite .mem-rating-row { display: flex; flex-wrap: wrap; }
.mem-session.recite .mem-rating { text-align: left; min-width: 9rem; }
.mem-session.recite .mem-marked { font-size: 1.2rem; }
@keyframes mem-line-in {
  from { opacity: 0; transform: translateY(.7rem); filter: blur(3px); }
  to { opacity: 1; transform: none; filter: none; }
}

@media (prefers-reduced-motion: reduce) {
  .mem-session.recite .mem-line { animation-duration: .01ms; animation-delay: 0s; }
  .mem-ring .fill { transition: none; }
  .mem-rating:hover { transform: none; }
}

@media (max-width: 600px) {
  .mem-row { flex-wrap: wrap; }
  .mem-row-tools { flex-direction: row; width: 100%; }
  .mem-head { flex-wrap: wrap; }
  .mem-head-tools { width: 100%; justify-content: flex-start; }
}
