@import url("guide-card-shape.css");

/* The reread sequence uses neutral surfaces of three fixed values. */
#reread {
  --scene-ground: #0f0f0f;
  --scene-ink: #f4f4f4;
  --scene-body: #bcbcbc;
}

#reread .reread-stage { min-inline-size: 0; }

#reread .scene-heading {
  display: block;
  padding-bottom: 0;
  border: 0;
}

#reread .scene-heading h2 { font-size: clamp(30px, 2.92vw, 44px); }
#reread .scene-heading p {
  font-size: 16.5px;
  line-height: 1.58;
  max-width: 620px;
  margin-top: 14px;
  text-wrap: pretty;
}

#reread .scene-figure { margin-top: 30px; }
#reread .scene-figure figcaption {
  margin-top: 22px;
  padding-top: 0;
  border: 0;
}

.reread-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(14px, 1.55vw, 23px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.reread-card {
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  aspect-ratio: 372 / 254;
  inline-size: 100%;
  min-inline-size: 0;
  min-block-size: 254px;
  padding: 22px clamp(16px, 2vw, 26px) 24px;
  border-radius: var(--guide-card-static-radius);
  background-color: #1c1c1c;
}

.reread-card:nth-child(2) { background-color: #181818; }
.reread-card:nth-child(3) { background-color: #141414; }

.reread-fact { display: contents; }
.reread-status {
  color: #a4a4a4;
  font-size: 13px;
  font-weight: 530;
  line-height: 1.5;
  letter-spacing: -.012em;
}

.reread-value {
  inline-size: fit-content;
  display: flex;
  grid-row: 3;
  align-items: baseline;
  gap: 4px;
  margin-bottom: 8px;
  color: #dedede;
  font-size: 28px;
  font-variant-numeric: tabular-nums;
  transform-origin: left bottom;
  line-height: 1.15;
  letter-spacing: -.045em;
}

.reread-value strong { font-weight: 620; }
.reread-unit { font-size: .59em; font-weight: 520; }

.reread-copy {
  grid-row: 4;
  min-block-size: calc(1.35 * 17px + 5px + 3 * 22.4px);
}

.reread-copy h3 {
  margin: 0 0 5px;
  color: #f3f3f3;
  font-size: 17px;
  font-weight: 640;
  line-height: 1.35;
  letter-spacing: -.029em;
}

.reread-copy p {
  color: #bcbcbc;
  font-size: 14px;
  line-height: 1.6;
  letter-spacing: -.01em;
  overflow-wrap: break-word;
  text-wrap: pretty;
}

@media (741px <= width <= 860px) {
  .reread-copy { min-block-size: calc(1.35 * 17px + 5px + 4 * 22.4px); }
}

@media (max-width: 740px) {
  #reread .scene-heading h2 { font-size: clamp(28px, 7.7vw, 34px); }
  #reread .scene-heading p { margin-top: 12px; font-size: 16px; }
  #reread .scene-figure { margin-top: 24px; }
  #reread .scene-figure figcaption { margin-top: 20px; }
  .reread-cards { grid-template-columns: minmax(0, 1fr); gap: 13px; }

  .reread-card {
    grid-template: auto / minmax(78px, 28%) minmax(0, 1fr);
    align-content: end;
    align-items: end;
    gap: 12px;
    aspect-ratio: auto;
    min-block-size: 130px;
    padding: 22px 16px 16px;
  }

  .reread-fact { display: block; align-self: start; }
  .reread-status { font-size: 12px; }
  .reread-value { margin: 16px 0 0; font-size: 25px; }
  .reread-copy { grid-row: auto; min-block-size: 0; }
  .reread-copy h3 { font-size: 16px; }
}

/* The saved and re-read figures refer to the very same decision. */
.reread-card:nth-child(n + 2) .reread-value { color: var(--product-accent); }

@media screen and (prefers-reduced-motion: no-preference) {
  #reread[data-pinned] {
    display: block;
    align-content: start;
    padding: 0;
    --reread-distance: clamp(360px, 65svh, 640px);
    min-block-size: calc(100svh - var(--guide-bar) + var(--reread-distance));
  }
  #reread[data-pinned] .reread-stage {
    display: grid;
    align-content: center;
    position: sticky;
    top: var(--guide-bar);
    min-block-size: calc(100svh - var(--guide-bar));
  }
  #reread[data-scrub] .reread-value {
    color: color-mix(in srgb, #a9a9a9, var(--figure-ink, #f4f4f4) var(--ink));
    transform: translateY(calc(10px * (1 - var(--revealed)) - 3px * var(--focus))) scale(calc(1 + .23 * var(--focus)));
    opacity: var(--revealed);
  }
  .reread-card:nth-child(n + 2) { --figure-ink: var(--product-accent); }
}

/* An inset one-pixel rim keeps the matte face and the type in their original positions. */
.reread-card {
  position: relative;
  --edge-light: #bdbdbd;
  --edge-strength: 0%;
}
.reread-card:nth-child(n + 2) { --edge-light: var(--product-accent); }
.reread-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  pointer-events: none;
  background: linear-gradient(155deg,
    color-mix(in srgb, #727272, var(--edge-light) var(--edge-strength)) 0%,
    color-mix(in srgb, #545454, var(--edge-light) calc(var(--edge-strength) * .65)) 25%,
    #3b3b3b 50%, #2b2b2b 77%, #232323 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
}
@media screen and (prefers-reduced-motion: no-preference) {
  #reread[data-scrub] .reread-card {
    --edge-strength: calc(var(--focus, 0) * 72%);
  }
}

/* Scroll transfers the open area from one card to its neighbour. The deck never jumps in height. */
@media screen and (prefers-reduced-motion: no-preference) {
  #reread[data-deck] .reread-cards {
    --lip: 40px;
    --expansion: clamp(183px, 15vw, 208px);
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    max-width: 415px;
    margin-inline: auto;
  }
  #reread[data-deck] .reread-card {
    --focus: 0;
    display: block;
    justify-self: center;
    width: calc(84% + 16% * var(--focus));
    height: calc(var(--lip) + var(--expansion) * var(--focus));
    min-height: 0;
    min-block-size: 0;
    aspect-ratio: auto;
    border-radius: calc(var(--guide-card-open-radius) + 4px * (1 - var(--focus)));
    padding: 0;
    overflow: hidden;
    background-image:
      radial-gradient(ellipse at 28% -28%, rgb(255 255 255 / .052), transparent 64%),
      radial-gradient(ellipse at 56% 126%, rgb(255 255 255 / .075), transparent 56%);
    /* 2026-12-02: a quieter top bevel and a soft reflection along the lower edge. */
    border-block-start-color: #4a4c48;
    box-shadow: inset 0 -1px 0 rgb(226 230 224 / .15), 0 5px 14px -8px rgb(0 0 0 / .65);
  }
  #reread[data-deck] .reread-fact { display: contents; }
  #reread[data-deck] .reread-status {
    position: absolute;
    inset: 0 auto auto 20px;
    line-height: var(--lip);
    transform: translateY(calc(6px * var(--focus)));
  }
  #reread[data-deck] .reread-value {
    position: absolute;
    top: 0;
    right: 20px;
    display: flex;
    align-items: baseline;
    gap: 3px;
    margin: 0;
    min-height: var(--lip);
    font-size: 20px;
    line-height: var(--lip);
    transform-origin: right top;
    transform: translateY(calc(15px * var(--focus))) scale(calc(.78 + 1.12 * var(--focus)));
  }
  #reread[data-deck] .reread-copy {
    position: absolute;
    inset: auto 22px 21px;
    min-block-size: 0;
    opacity: clamp(0, calc((var(--focus) - .42) * 1.95), 1);
    transform: translateY(calc((1 - var(--focus)) * 13px));
  }
  #reread[data-deck] .reread-copy h3 { margin-bottom: 5px; font-size: 17px; }
  #reread[data-deck] .reread-copy p { font-size: 14px; line-height: 1.6; }
  #reread[data-deck] .reread-card:first-child { --focus: 1; }
  #reread[data-deck] .deck-step {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    border: 0;
    border-radius: inherit;
    padding: 0;
    background: transparent;
    cursor: pointer;
  }
  #reread[data-deck] .deck-step:focus-visible { outline: 2px solid #e3eee6; outline-offset: -3px; }
  #reread[data-deck] .deck-step[aria-current] { cursor: default; }
  @media (min-width: 881px) {
    #reread[data-deck] .scene-inner {
      display: grid;
      grid-template-columns: minmax(0, 1fr) minmax(310px, .96fr);
      align-items: center;
      gap: clamp(48px, 7vw, 104px);
      max-width: 990px;
    }
    #reread[data-deck] .scene-heading h2 { text-wrap: balance; }
    #reread[data-deck] .scene-figure { margin: 0; }
  }
}
.reread-card .deck-step[hidden] { display: none; }
