/* "Two A's" scroll story for "Grade the Trace, Not the Guess" (resource layout). */

/* While the story is live, the hero image box hosts the stage, which shows the same photo. */
html.tf-active .resource-hero-image-wrap > img {
  visibility: hidden;
}

.tf-spacer {
  width: 100%;
  pointer-events: none;
}

/* The stage is fixed and full screen while the story plays, then docks into the hero box. */
.tf-stage {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  z-index: 100000; /* above the fixed site nav (z-index 99999) */
  background: #0b0c0e;
  color: #fff;
  overflow: hidden;
  touch-action: pan-y;
  font-family: 'IBM Plex Sans', sans-serif;
}
.tf-stage.is-docked {
  position: absolute;
  inset: 0;
  width: auto;
  height: auto;
  z-index: 1;
}
.tf-stage.is-docked .tf-chrome {
  display: none;
}

.tf-photo,
.tf-shade {
  position: absolute;
  inset: 0;
}
.tf-photo {
  background-size: cover;
  background-position: center;
}
.tf-shade {
  background: #0b0c0e;
  opacity: 0.86;
}

.tf-chrome {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.tf-kicker {
  position: absolute;
  top: 26px;
  left: 32px;
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: #9aa1ad;
  opacity: 0;
}

/* ── The board: two columns, one per student ── */
.tf-board {
  position: absolute;
  left: 50%;
  top: max(64px, 8vh);
  width: min(1040px, calc(100% - 48px));
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: clamp(16px, 4.5vw, 72px);
  translate: -50% 0;
  transform-origin: top center;
  transition: scale 0.55s ease;
  opacity: 0;
}
.tf-col {
  min-width: 0;
}
.tf-who {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #d5d9e0;
}

/* The essay: identical paper cards, so the reader cannot tell them apart. */
.tf-essay {
  position: relative;
  padding: clamp(14px, 1.8vw, 24px) clamp(14px, 1.8vw, 26px) clamp(16px, 2vw, 26px);
  background: #f3f0e8;
  color: #1d1d1f;
  border-radius: 3px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}
.tf-essay-kind {
  margin: 0;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #6f6f73;
}
.tf-essay-title {
  margin: 8px 0 14px;
  padding-right: 64px;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(14px, 1.45vw, 20px);
  font-weight: 600;
  line-height: 1.25;
}
.tf-essay i {
  display: block;
  height: 6px;
  margin-top: 8px;
  border-radius: 3px;
  background: #d6d2c8;
}
.tf-essay i.tf-short {
  width: 62%;
}
.tf-stamp {
  position: absolute;
  top: clamp(10px, 1.4vw, 18px);
  right: clamp(12px, 1.6vw, 22px);
  display: grid;
  place-items: center;
  width: clamp(40px, 4.2vw, 58px);
  height: clamp(40px, 4.2vw, 58px);
  border: 3px solid #b3261e;
  border-radius: 50%;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(22px, 2.4vw, 34px);
  font-weight: 700;
  line-height: 1;
  padding-bottom: 0.06em; /* Playfair capitals sit low in their line box */
  color: #b3261e;
  opacity: 0;
}

/* The trace panel. */
.tf-trace,
.tf-exam {
  margin-top: 14px;
  padding: 12px 14px 12px;
  background: rgba(14, 15, 18, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  opacity: 0;
}
.tf-panel-label {
  margin: 0 0 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #8b93a1;
}
.tf-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.tf-mask {
  fill: none;
  stroke: #fff;
  stroke-width: 18;
  stroke-dasharray: 1 1;
  stroke-dashoffset: 1;
}
.tf-tire {
  fill: none;
  stroke: #e8e4da;
  stroke-width: 1.1;
  stroke-linecap: round;
}
.tf-tread {
  fill: none;
  stroke: #e8e4da;
  stroke-width: 5;
  stroke-dasharray: 0.8 2.6;
  opacity: 0.16;
}
.tf-spur path {
  fill: none;
  stroke: #e8e4da;
  stroke-width: 1.3;
  stroke-dasharray: 1 1;
  stroke-dashoffset: 1;
  opacity: 0.8;
  transition: stroke-dashoffset 0.5s ease;
}
.tf-spur.is-on path {
  stroke-dashoffset: 0;
}
.tf-peer {
  fill: none;
  stroke: #8b93a1;
  stroke-width: 1.2;
  opacity: 0;
  transition: opacity 0.4s ease 0.3s;
}
.tf-spur.is-on .tf-peer {
  opacity: 1;
}
.tf-dot {
  fill: #fff;
  stroke: #0e0f12;
  stroke-width: 1.6;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  transform: scale(0.2);
  transition: opacity 0.25s ease, transform 0.35s cubic-bezier(0.3, 1.6, 0.5, 1);
}
.tf-dot.is-on {
  opacity: 1;
  transform: scale(1);
}
/* The other student's posts: identical, evenly spaced, unconnected. */
.tf-dot-flat {
  fill: #c9d6e3;
}
.tf-note {
  opacity: 0;
  transition: opacity 0.4s ease;
}
.tf-note.is-on {
  opacity: 1;
}
.tf-note text {
  font-size: 10px;
  fill: #d5d9e0;
  text-anchor: middle;
}
.tf-note line {
  stroke: #8b93a1;
  stroke-width: 0.8;
  stroke-dasharray: 2 2;
}
.tf-weeks {
  display: flex;
  justify-content: space-between;
  margin: 2px 0 0;
  font-size: 10px;
  letter-spacing: 0.06em;
  color: #6b7280;
}
.tf-stats {
  margin: 8px 0 0;
  font-size: 12px;
  color: #aeb4bf;
}
.tf-stats b {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-weight: 500;
  color: #fff;
}
.is-guess .tf-stats b:not(:first-child) {
  color: #e8a33d;
}

/* The exam panel. */
.tf-row {
  display: grid;
  grid-template-columns: 9.4em 1fr 2.4em;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  font-size: 12px;
  color: #aeb4bf;
}
.tf-row b {
  position: relative;
  height: 10px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 2px;
  overflow: hidden;
}
.tf-row i {
  position: absolute;
  inset: 0;
  background: #e8e4da;
  transform-origin: left;
  transform: scaleX(0);
}
.tf-row:first-child i {
  background: #8b93a1;
}
.tf-gapband {
  position: absolute;
  top: 0;
  bottom: 0;
  background: repeating-linear-gradient(135deg, rgba(232, 163, 61, 0.85) 0 3px, transparent 3px 6px);
  opacity: 0;
}
.tf-row em {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-style: normal;
  text-align: right;
  color: #fff;
}
.tf-gap {
  margin: 8px 0 0;
  font-size: 12px;
  font-weight: 600;
  color: #c4cad4;
  opacity: 0;
}
.tf-gap.is-wide {
  color: #e8a33d;
}
.tf-illustrative {
  grid-column: 1 / -1;
  margin: 10px 0 0;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-align: right;
  color: #6b7280;
  opacity: 0;
}

/* ── Captions: one at a time, near the bottom ── */
.tf-captions {
  position: absolute;
  left: 50%;
  bottom: max(9%, 84px); /* clear of the scroll hint */
  width: min(88%, 800px);
  height: 6em;
  translate: -50% 0;
  font-size: clamp(17px, 1.6vw, 23px);
}
.tf-caption {
  position: absolute;
  inset: auto 0 0;
  margin: 0;
  text-align: center;
  font-family: 'Playfair Display', Georgia, serif;
  line-height: 1.4;
  color: #f1f2f4;
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.9);
  opacity: 0;
  will-change: transform, opacity;
}
.tf-caption em {
  font-style: italic;
}

/* ── Title over the photo ── */
.tf-title {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(86%, 980px);
  text-align: center;
  opacity: 0;
  translate: -50% -50%; /* centering via `translate` so JS can animate `transform` freely */
}
.tf-title::before {
  content: '';
  position: absolute;
  inset: -45% -18%;
  background: radial-gradient(ellipse at center, rgba(11, 12, 14, 0.82) 30%, transparent 70%);
  z-index: -1;
}
.tf-headline {
  margin: 0;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(32px, 5vw, 72px);
  font-weight: 600;
  line-height: 1.06;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.tf-sub {
  margin: 0.9em 0 0;
  font-size: clamp(14px, 1.45vw, 21px);
  font-weight: 300;
  color: #dfe3e8;
}

.tf-hint {
  position: absolute;
  left: 50%;
  bottom: 3%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  opacity: 0;
  translate: -50% 0;
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: #8b93a1;
}
.tf-hint i {
  width: 1px;
  height: 30px;
  background: linear-gradient(to bottom, #8b93a1, transparent);
  animation: tf-drip 1.8s ease-in-out infinite;
  transform-origin: top;
}
@keyframes tf-drip {
  0% { transform: scaleY(0); opacity: 0; }
  40% { transform: scaleY(1); opacity: 1; }
  100% { transform: scaleY(1); opacity: 0; }
}

.tf-skip,
.tf-replay {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 13px;
  letter-spacing: 0.04em;
  padding: 8px 16px;
  color: #e6e9ef;
  background: rgba(11, 12, 14, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.tf-skip:hover,
.tf-skip:focus-visible,
.tf-replay:hover,
.tf-replay:focus-visible {
  background: rgba(11, 12, 14, 0.8);
  border-color: rgba(255, 255, 255, 0.5);
  outline: none;
}
.tf-skip {
  position: absolute;
  top: 22px;
  right: 28px;
  pointer-events: auto;
}
/* Shown only once the stage has docked into the hero. */
.tf-replay {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: none;
}
.tf-stage.is-docked .tf-replay {
  display: block;
}

/* Folding wrappers. Always open on larger screens; on phones they open beat by beat (below). */
.tf-fold {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.55s ease, margin 0.55s ease;
}
.tf-fold > div {
  min-height: 0;
  overflow: hidden;
}
.tf-measuring,
.tf-measuring .tf-fold,
.tf-measuring .tf-essay,
.tf-measuring .tf-stats,
.tf-measuring .tf-stamp {
  transition: none !important;
}

/* ── Phones: one student above the other, full width, revealed beat by beat ──
   Opening: two full essays. Trace beat: each essay folds into a slim strip and its trace opens.
   Exam beat: the score bars open. The screen only ever holds what the current beat needs. */
@media (max-width: 700px) {
  .tf-kicker { top: 18px; left: 16px; }
  .tf-skip { right: 14px; top: 12px; }
  .tf-board {
    top: 58px;
    width: calc(100% - 32px);
    grid-template-columns: 1fr;
    row-gap: 18px;
  }
  .tf-who { font-size: 10px; letter-spacing: 0.18em; margin-bottom: 6px; }

  .tf-essay { padding: 14px 16px 16px; transition: padding 0.55s ease; }
  .tf-essay-kind { font-size: 9px; }
  .tf-essay-title { font-size: 16px; padding-right: 52px; margin: 6px 0 10px; }
  .tf-essay i { height: 5px; margin-top: 6px; }
  .tf-stamp {
    top: 12px;
    right: 12px;
    width: 42px;
    height: 42px;
    font-size: 24px;
    border-width: 2px;
    transition: top 0.55s ease, width 0.55s ease, height 0.55s ease, font-size 0.55s ease;
  }
  .tf-board.is-tracing .tf-essay { padding: 9px 16px; }
  .tf-board.is-tracing .tf-fold-essay { grid-template-rows: 0fr; }
  .tf-board.is-tracing .tf-stamp { top: 3px; width: 28px; height: 28px; font-size: 16px; }

  .tf-trace, .tf-exam { margin-top: 0; padding: 10px 12px; }
  .tf-fold-trace, .tf-fold-exam { margin-top: 8px; }
  .tf-board:not(.is-tracing) .tf-fold-trace,
  .tf-board:not(.is-examining) .tf-fold-exam { grid-template-rows: 0fr; margin-top: 0; }
  /* By the exam the reader has seen the traces: each folds to its one-line summary beside the scores. */
  .tf-board.is-examining .tf-fold-graph { grid-template-rows: 0fr; }
  .tf-board.is-examining .tf-stats { margin-top: 2px; }

  .tf-panel-label { font-size: 9px; }
  .tf-note text { font-size: 13px; }
  .tf-weeks { font-size: 9px; }
  .tf-stats { margin-top: 6px; font-size: 11px; transition: margin 0.55s ease; }
  .tf-row { grid-template-columns: 8.4em 1fr 2em; gap: 8px; font-size: 11px; margin-top: 4px; }
  .tf-row b { height: 8px; }
  .tf-gap { margin-top: 6px; font-size: 11px; }
  .tf-illustrative { margin-top: 0; }
  .tf-captions { width: calc(100% - 32px); bottom: max(9%, 80px); height: 8em; font-size: 17px; }
}

/* Shown on the black cover while the story script loads. */
.tf-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  color: #8b93a1;
}
.tf-loading i {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-top-color: rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  animation: tf-spin 1s linear infinite;
}
.tf-loading span {
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
}
.tf-loading-skip {
  margin-top: 8px;
  font-size: 12px;
  color: #cfd5df;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.tf-loading-skip:hover,
.tf-loading-skip:focus-visible {
  color: #fff;
}
@keyframes tf-spin {
  to { transform: rotate(360deg); }
}
