/* /why-do-i-forget-what-i-read/ : fading page illustration, 60-second recall
   check, diagnosis cards. Builds on site.css, article.css and tools.css. */

/* ---------- Fading page ---------- */

.fd { margin-top: 2em; }
/* Desktop: page on the left; day, caption, legend and timeline centered beside it.
   Phones: one column, and the page is cropped to its first three paragraphs. */
.fd-stage {
    display: grid;
    grid-template-columns: minmax(0, 330px) minmax(0, 1fr);
    grid-template-rows: 1fr auto auto auto auto 1fr;
    grid-template-areas: "page ." "page day" "page cap" "page legend" "page track" "page .";
    column-gap: clamp(28px, 5vw, 52px);
}
.fd-page {
    grid-area: page; display: block; width: 100%; height: auto;
    background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: 16px;
}
.fd-chapter { fill: var(--text-3); font: 600 11px var(--font); letter-spacing: 0.14em; }
.fd-heading { fill: #e5e5ea; }
.fd-folio { fill: var(--text-3); font: 500 12px var(--font); }
.fd-line rect { fill: #c7c7cc; }
.fd-rl rect { transition: fill 0.7s var(--ease); }
.fd-rl.is-on.fd-rl-1 rect { fill: var(--violet); }
.fd-rl.is-on.fd-rl-2 rect { fill: var(--orange); }
.fd-rl.is-on.fd-rl-3 rect { fill: var(--cyan); }
.fd-mark { opacity: 0; transform-box: fill-box; transform-origin: center; transform: scale(0.4); transition: opacity 0.5s var(--ease), transform 0.5s var(--ease); }
.fd-rl-1 .fd-mark { fill: var(--violet); }
.fd-rl-2 .fd-mark { fill: var(--orange); }
.fd-rl-3 .fd-mark { fill: var(--cyan); }
.fd-mark.is-on { opacity: 1; transform: scale(1); }

.prose .fd-day { grid-area: day; margin: 0; font-size: clamp(30px, 4vw, 40px); font-weight: 700; letter-spacing: -0.035em; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--text); }
/* The hidden sizer holds the longest caption, so the box never changes height. */
.fd-caps { grid-area: cap; display: grid; margin-top: 10px; }
.fd-caps > * { grid-area: 1 / 1; }
.prose .fd-caption { margin: 0; font-size: 17px; line-height: 1.55; color: var(--text-2); }
.prose .fd-sizer { visibility: hidden; }

.prose .fd-legend { grid-area: legend; list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 8px; font-size: 14px; line-height: 1.3; color: var(--text-3); }
.prose .fd-legend li + li { margin-top: 0; }
.fd-legend li { display: flex; align-items: center; gap: 10px; }
.fd-key { width: 26px; height: 7px; border-radius: 4px; background: #c7c7cc; flex: none; }
.fd-key--recalled { background: linear-gradient(90deg, var(--violet), var(--orange), var(--cyan)); }

/* Timeline: the stop labels are centered under the thumb positions
   (thumb is 20px wide, so the label row is inset by 10px). */
.fd-track { grid-area: track; margin-top: 26px; padding: 0 12px; }
.fd-range { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; cursor: pointer; display: block; margin: 0; }
.fd-range::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: var(--spectrum); opacity: 0.9; }
.fd-range::-moz-range-track { height: 4px; border-radius: 2px; background: var(--spectrum); }
.fd-range::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -8px; border-radius: 50%; background: var(--text); border: 4px solid var(--surface); }
.fd-range::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--text); border: 4px solid var(--surface); }
.fd-range:focus-visible { outline: none; }
.fd-range:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--blue); outline-offset: 2px; }
.fd-range:focus-visible::-moz-range-thumb { outline: 2px solid var(--blue); outline-offset: 2px; }
.fd-stops { position: relative; height: 28px; margin: 2px 10px 0; }
.fd-stops button {
    position: absolute; top: 0; left: calc(var(--at) * 100% / 3); transform: translateX(-50%);
    font-size: 13px; font-weight: 600; line-height: 1.2; color: var(--text-3); padding: 5px 6px; border-radius: 8px; white-space: nowrap;
    font-variant-numeric: tabular-nums; transition: color 0.2s ease;
}
.fd-stops button:hover, .fd-stops button.is-at { color: var(--text); }
.fd-stops button:focus-visible { outline: 2px solid var(--blue); outline-offset: 0; }

.fd .anim-foot { margin-top: 20px; }
.fd .anim-ctrl { min-width: 106px; justify-content: center; }   /* Pause / Play / Replay swap without nudging anything */

/* ---------- 60-second recall check ---------- */

.tt-field { border: 0; padding: 0; margin: 0 0 18px; display: flex; flex-direction: column; gap: 8px; }
.tt-field label, .tt-field legend { font-size: 14px; font-weight: 600; color: var(--text-2); padding: 0; }
.tt-field legend { margin-bottom: 8px; }
.tt-seg { grid-template-columns: repeat(4, 1fr); }
.tt-seg label { font-weight: 600; }
.tt-return { margin-bottom: 18px; padding: 14px 16px; border-radius: 14px; background: rgba(123, 108, 246, 0.1); border: 1px solid rgba(123, 108, 246, 0.35); font-size: 15px; color: var(--text); }
.tt-prompt { font-size: 18px; letter-spacing: -0.01em; }
.tt-prompt b { color: var(--text); }

.tt-timer { display: flex; align-items: center; gap: 12px; margin: 16px 0 18px; }
.tt-timer i { flex: 1; height: 3px; border-radius: 2px; background: var(--line-strong); position: relative; overflow: hidden; }
.tt-timer i::after { content: ''; position: absolute; inset: 0; background: var(--spectrum); transform-origin: left; transform: scaleX(var(--p, 0)); transition: transform 1s linear; }
.tt-timer span { font-size: 14px; font-weight: 600; color: var(--text-3); font-variant-numeric: tabular-nums; min-width: 2.6em; text-align: right; }
.tt-timer.is-done span { color: var(--text-2); }
.tt-ideas { display: grid; gap: 10px; }

.tt-panel:focus { outline: none; }
.tt-head { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.3; color: var(--text); }
.tt-head i { font-style: italic; }
.tt-echo { display: grid; gap: 8px; margin: 14px 0 4px !important; }
.tt-echo li { padding: 10px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-size: 15px; color: var(--text); }
.tt-echo li.is-empty { color: var(--text-3); border-style: dashed; background: transparent; }
.tt-verdict { margin-top: 14px; font-size: 16px; line-height: 1.6; color: var(--text-2); }
.tt-verdict q { color: var(--text); }
.tt-next-label { margin-top: 20px; font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.tt-next { counter-reset: tt; display: grid; gap: 12px; margin-top: 10px !important; }
.tt-next > li { counter-increment: tt; position: relative; padding-left: 34px; font-size: 15px; line-height: 1.55; color: var(--text-2); }
.tt-next > li::before { content: counter(tt); position: absolute; left: 0; top: 1px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--text); color: #000; }
.tt-next b { color: var(--text); font-weight: 600; }
.tt-next a { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(86, 166, 238, 0.4); }
.tt-qs { display: grid; gap: 8px; margin-top: 10px !important; }
.tt-qs li { padding: 10px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-size: 15px; line-height: 1.5; color: var(--text); }
.tt-qs li:nth-child(2) { --c: var(--orange); }
.tt-qs li:nth-child(3) { --c: var(--cyan); }

/* ---------- Diagnosis cards ---------- */

.dx { display: grid; gap: 14px; margin-top: 1.4em !important; }
.dx-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 26px 24px; scroll-margin-top: 90px; }
.prose .dx-card h3 { margin-top: 0; display: flex; align-items: center; gap: 12px; font-size: 21px; line-height: 1.25; }
.dx-num { width: 30px; height: 30px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 14px; font-weight: 700; color: var(--c); border: 1.5px solid var(--c); }
.prose .dx-card p { margin: 0; padding-left: 42px; }
.prose .dx-card .dx-fix { padding: 12px 16px 13px 18px; }
.prose .dx-card .dx-sym { margin-top: 6px; font-size: 17px; line-height: 1.5; font-style: italic; color: var(--text); }
.prose .dx-card .dx-why { margin-top: 12px; font-size: 16px; line-height: 1.6; color: #c2c2c8; }
.prose .dx-card .dx-fix { margin: 16px 0 0 42px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-size: 16px; line-height: 1.55; color: var(--text); }
.dx-fix b { display: block; margin-bottom: 2px; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--c); }
.dx-card:target { border-color: var(--c); }

/* ---------- Close, recall, return ---------- */

.prose .crr { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.prose .crr li + li { margin-top: 0; }
.crr li { padding: 20px 20px 22px 22px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); font-size: 16px; line-height: 1.5; color: var(--text-2); }
.crr b { display: block; color: var(--c); font-size: 20px; letter-spacing: -0.02em; margin-bottom: 6px; }

/* ---------- Where Prismo fits ---------- */

.fp { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 330px); gap: 32px; align-items: center; }
.prose .fp-text p + p { margin-top: 1.1em; }
.fp .app-card { width: 100%; }

@media (max-width: 760px) {
    .fd-stage { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-template-areas: "day" "cap" "page" "legend" "track"; }
    .fd-page { max-width: 290px; margin: 14px auto 0; aspect-ratio: 400 / 308; }
    .prose .fd-day { font-size: 28px; }
    .fd-caps { margin-top: 6px; }
    .prose .fd-caption { font-size: 15.5px; line-height: 1.5; }
    .prose .fd-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; margin-top: 12px; font-size: 13px; }
    .fd-key { width: 20px; height: 6px; }
    .fd-legend li { gap: 8px; }
    .fd-track { margin-top: 12px; }
    .fd .anim-foot { margin-top: 10px; flex-wrap: nowrap; }
    .fd .anim-caption { flex: 1 1 0; min-width: 0; font-size: 13px; }
    .prose .crr { grid-template-columns: 1fr; gap: 8px; }
    .crr li { display: grid; grid-template-columns: 4.6em 1fr; gap: 12px; align-items: baseline; padding: 14px 16px 15px 18px; border-radius: 16px; font-size: 15.5px; }
    .crr b { font-size: 17px; margin: 0; }
    .fp { grid-template-columns: minmax(0, 1fr); gap: 20px; }
}

@media (max-width: 640px) {
    .tt-seg { grid-template-columns: 1fr 1fr; }
    .dx { gap: 12px; }
    .dx-card { padding: 18px 18px 18px; }
    .prose .dx-card h3 { font-size: 19px; align-items: flex-start; }
    .dx-num { width: 26px; height: 26px; font-size: 13px; margin-top: -1px; }
    .prose .dx-card p:not(.dx-fix) { padding-left: 0; }
    .prose .dx-card .dx-sym { margin-top: 10px; font-size: 16px; }
    .prose .dx-card .dx-why { font-size: 15.5px; }
    .prose .dx-card .dx-fix { margin-left: 0; font-size: 15.5px; }
}

@media (prefers-reduced-motion: reduce) {
    .fd-rl rect, .fd-mark, .tt-timer i::after { transition: none; }
    .tt-timer i { display: none; }
}
