:root {
  --paper: #d8d2c6;
  --paper-deep: #cfc7b8;
  --ink: #161616;
  --muted: #5c564c;
  --stamp: #8d322c;
  --stamp-deep: #6f241f;
  --under: #9a3d34;
  --cream: #f3ece0;
  --cream-2: #ebe3d4;
  --news: #e4ddd0;
  --ui: #1c1a17;
  --ui-line: #3a342c;
  --bar: #11100e;
  --focus: #c45a48;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 600px at 50% -10%, #2a261f, transparent 55%),
    #141210;
  color: #f4efe6;
  font-family: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", sans-serif;
}

a { color: #e7b3a6; }
a:hover { color: #ffd7cc; }

.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

.page-bar {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.1rem 1.25rem 0.4rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 0.8rem;
}

.back { justify-self: start; }
.page-titles { justify-self: center; text-align: center; }
.source { justify-self: end; text-align: right; }

.back, .source {
  font-size: 0.86rem;
  text-decoration: none;
  color: #d7cbb8;
}

.page-titles { flex: 1; min-width: 12rem; }
.kicker {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #b9a890;
}
.page-titles h1 {
  margin: 0.15rem 0 0;
  font-size: 1.45rem;
  letter-spacing: 0.08em;
}

main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
}

.lede {
  color: #d8ccb8;
  line-height: 1.7;
  max-width: 46rem;
  margin: 0.6rem 0 1.25rem;
}

.player {
  background: var(--bar);
  border: 1px solid var(--ui-line);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.stage {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #d5cfc4;
  cursor: pointer;
  isolation: isolate;
}

.newsprint, .fiber, .grain, .layer {
  position: absolute;
  inset: 0;
}

.newsprint { width: 100%; height: 100%; display: block; }

.fiber {
  pointer-events: none;
  background:
    repeating-linear-gradient(90deg, transparent 0 46px, rgba(80, 70, 55, 0.05) 46px 47px),
    repeating-linear-gradient(0deg, transparent 0 11px, rgba(90, 80, 65, 0.04) 11px 12px);
  mix-blend-mode: multiply;
  opacity: 0.55;
}

.grain {
  pointer-events: none;
  opacity: 0.18;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.55'/></svg>");
  mix-blend-mode: multiply;
}

.brand {
  position: absolute;
  z-index: 8;
  top: 3.2%;
  left: 2.4%;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--ink);
  font-weight: 700;
  font-size: clamp(0.7rem, 1.5vw, 0.95rem);
  letter-spacing: 0.04em;
}

.avatar {
  width: 1.55em;
  height: 1.55em;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #f7f1e6;
  border: 1.5px solid #1a1a1a;
  box-shadow: 2px 2px 0 #8d322c;
  font-size: 0.78em;
}

.layer {
  z-index: 3;
  opacity: 0;
  pointer-events: none;
  display: grid;
  place-items: center;
}

.layer.is-on { opacity: 1; }
.layer.is-exit { z-index: 6; }

.layer[data-scene="beige"] {
  background: #d5cfc4;
  z-index: 4;
}

.caption {
  position: absolute;
  z-index: 9;
  left: 8%;
  right: 8%;
  bottom: 3.6%;
  margin: 0 auto;
  text-align: center;
  color: var(--ink);
  font-size: clamp(0.72rem, 1.7vw, 1.05rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.2rem 0.6rem;
  max-width: 80%;
}

.torn {
  position: relative;
}

.paper {
  position: relative;
  z-index: 3;
}

.paper-wide {
  width: min(78%, 820px);
}

.paper-shadow,
.paper-face,
.stack-extra {
  filter: url(#tear);
}

.paper-shadow {
  position: absolute;
  inset: 12px -8px -14px 10px;
  background: var(--under);
  pointer-events: none;
}

.paper-face {
  position: absolute;
  inset: 0;
  background: var(--cream);
  pointer-events: none;
}

.stack-extra {
  position: absolute;
  inset: -10px 18px 18px -14px;
  background: #ddd3c3;
  transform: rotate(-4deg);
  pointer-events: none;
}

.stack-extra.alt {
  inset: -8px -12px 16px 16px;
  background: #cfc3b0;
  transform: rotate(5deg);
}

.paper-stack {
  width: min(38%, 380px);
}

.left-stack { transform: rotate(-2.5deg); }
.right-stack { transform: rotate(2.8deg); }

.torn-body {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 1.6rem 1.8rem 1.5rem;
  color: var(--ink);
  text-align: center;
  min-height: clamp(8.5rem, 28vw, 13.5rem);
}

.stamp {
  display: inline-block;
  background: var(--stamp);
  color: #f7efe4;
  font-weight: 900;
  font-size: clamp(0.95rem, 2.4vw, 1.7rem);
  letter-spacing: 0.12em;
  padding: 0.22em 0.55em 0.18em;
  transform: rotate(-2.4deg);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.12);
}

.torn-body h2 {
  margin: 0;
  font-size: clamp(1.15rem, 3.3vw, 2.35rem);
  font-weight: 900;
  letter-spacing: 0.04em;
}

.torn-body h2 .comma { font-weight: 700; }

[data-type] { display: inline-block; }

.burst {
  position: absolute;
  z-index: 4;
  color: var(--stamp);
  font-weight: 900;
  pointer-events: none;
}

.burst-left { left: 6%; top: 38%; }
.burst-right { right: 6%; top: 30%; text-align: right; }

.quote {
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  line-height: 0.7;
  font-family: Georgia, serif;
}

.rays {
  display: block;
  width: clamp(42px, 7vw, 78px);
  height: clamp(42px, 7vw, 78px);
  background:
    conic-gradient(from 0deg, var(--stamp) 0 8deg, transparent 8deg 30deg) center/100% 100%;
  -webkit-mask: radial-gradient(circle, transparent 38%, #000 39%);
  mask: radial-gradient(circle, transparent 38%, #000 39%);
  margin-bottom: 0.3rem;
}

.asterisk {
  display: block;
  font-size: clamp(1.4rem, 3vw, 2.2rem);
  margin-bottom: 0.2rem;
}

.snake {
  position: absolute;
  inset: 8% 4% 16% 4%;
  width: auto;
  height: auto;
}

.snake-dots {
  fill: none;
  stroke: var(--stamp);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 0.1 16;
  opacity: 0.9;
}

.snake-line {
  fill: none;
  stroke: var(--stamp);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 640;
  stroke-dashoffset: 640;
}

.layer.is-on .snake-line {
  animation: draw 1.1s ease forwards;
}

@keyframes draw { to { stroke-dashoffset: 0; } }

.steps {
  position: absolute;
  inset: 8% 4% 16% 4%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.steps li {
  position: absolute;
  left: var(--x);
  top: var(--y);
  transform: translate(-50%, -50%) scale(0.86);
  opacity: 0;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: max-content;
  z-index: 2;
}

.layer.is-on .steps li {
  animation: pop 0.45s cubic-bezier(0.2, 1.4, 0.3, 1) forwards;
}
.steps li:nth-child(1) { animation-delay: 0.15s; }
.steps li:nth-child(2) { animation-delay: 0.32s; }
.steps li:nth-child(3) { animation-delay: 0.48s; }
.steps li:nth-child(4) { animation-delay: 0.64s; }
.steps li:nth-child(5) { animation-delay: 0.8s; }
.steps li:nth-child(6) { animation-delay: 0.96s; }

@keyframes pop {
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.num {
  width: 2.1em;
  height: 2.1em;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--stamp);
  color: #f7efe4;
  font-weight: 900;
  font-size: clamp(0.7rem, 1.6vw, 1rem);
  box-shadow: 0 0 0 5px var(--cream);
}

.steps .label {
  color: var(--ink);
  font-weight: 900;
  font-size: clamp(0.78rem, 1.8vw, 1.15rem);
  background: rgba(243, 236, 224, 0.82);
  padding: 0.12em 0.4em;
  border-radius: 4px;
  white-space: nowrap;
}

.layer[data-scene="static-first"] {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.6rem, 2vw, 1.4rem);
  padding: 8% 6% 12%;
}

.stack-body {
  min-height: clamp(8.5rem, 24vw, 12.5rem);
  padding: 1.3rem 1.2rem 1.4rem;
}

.stack-body h3 {
  margin: 0;
  font-size: clamp(1.1rem, 3vw, 2rem);
  font-weight: 900;
}

.red-head {
  display: inline-block;
  background: var(--stamp);
  color: #f7efe4;
  padding: 0.12em 0.35em 0.08em;
  transform: rotate(-2deg);
}

.stack-body p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-weight: 700;
  font-size: clamp(0.75rem, 1.6vw, 1rem);
}

.mark {
  position: absolute;
  left: 10%;
  bottom: 14%;
  font-size: clamp(1.4rem, 3.4vw, 2.4rem);
  font-weight: 900;
}

.x-mark { color: var(--stamp); }
.check-mark { color: #2f6b3a; left: auto; right: 12%; }

.big-arrow {
  color: var(--stamp);
  font-size: clamp(2rem, 5vw, 3.4rem);
  text-shadow: 3px 3px 0 var(--cream);
}

.strips {
  list-style: none;
  margin: 0;
  padding: 0;
  width: min(70%, 640px);
  display: grid;
  gap: 0.7rem;
}

.strips li {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-height: clamp(2.6rem, 7vw, 3.6rem);
  padding: 0.45rem 1.3rem 0.45rem 0.85rem;
  color: var(--ink);
  font-weight: 900;
  font-size: clamp(1rem, 2.5vw, 1.55rem);
  background: transparent;
  white-space: nowrap;
  isolation: isolate;
  transform: translateX(-12px);
  opacity: 0;
}

.strip-face {
  position: absolute;
  inset: 0;
  background: var(--cream);
  filter: url(#tear-sm);
  box-shadow: -12px 7px 0 var(--under);
  z-index: 0;
  pointer-events: none;
}

.strips li > :not(.strip-face) {
  position: relative;
  z-index: 1;
}

.layer.is-on .strips li {
  animation: slidein 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
.strips li:nth-child(1) { animation-delay: 0.08s; }
.strips li:nth-child(2) { animation-delay: 0.2s; width: 96%; justify-self: end; }
.strips li:nth-child(3) { animation-delay: 0.32s; }
.strips li:nth-child(4) { animation-delay: 0.44s; width: 94%; justify-self: end; }

@keyframes slidein {
  to { opacity: 1; transform: translateX(0); }
}

.controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem 0.8rem;
  background: #161411;
  color: #ebe4d6;
  font-size: 0.82rem;
  flex-wrap: wrap;
}

.play, .replay {
  appearance: none;
  border: 0;
  background: var(--stamp);
  color: #fff8f2;
  font: inherit;
  font-weight: 700;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  cursor: pointer;
}

.play[aria-pressed="false"] { background: #3d3830; }

#scrub {
  flex: 1;
  min-width: 140px;
  accent-color: var(--focus);
}

.meter {
  display: flex;
  gap: 0.75rem;
  color: #cbbba3;
  font-variant-numeric: tabular-nums;
}

.loop {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  color: #d8ccb8;
}

.notes {
  margin-top: 1.6rem;
  background: #1c1915;
  border: 1px solid #3a342c;
  border-radius: 16px;
  padding: 1.15rem 1.25rem 1.3rem;
}

.notes h2 { margin: 0 0 0.5rem; font-size: 1.05rem; }
.notes p { margin: 0 0 0.8rem; color: #d8ccb8; line-height: 1.7; }
.notes ol {
  margin: 0;
  padding-left: 1.2rem;
  color: #ece4d6;
  line-height: 1.75;
}

.page-foot {
  max-width: 1080px;
  margin: 0 auto 2rem;
  padding: 0 1.25rem;
  color: #b9a890;
  font-size: 0.85rem;
}

@media (max-width: 720px) {
  .page-bar {
    grid-template-columns: 1fr;
    justify-items: start;
    padding-top: 0.75rem;
  }
  .page-titles, .source { justify-self: start; text-align: left; }
  .lede { font-size: 0.92rem; margin-bottom: 0.8rem; }
  .burst { display: none; }
  .meter span:nth-child(2) { display: none; }
  .paper-stack { width: 44%; }
  .strips { width: 86%; }
  .brand-name { font-size: 0.78rem; }
  .steps .label { font-size: 0.62rem; }
}

@media (prefers-reduced-motion: reduce) {
  .layer.is-on .snake-line,
  .layer.is-on .steps li,
  .layer.is-on .strips li {
    animation: none;
    opacity: 1;
    stroke-dashoffset: 0;
  }
  .layer.is-on .steps li {
    transform: translate(-50%, -50%);
  }
  .layer.is-on .strips li {
    transform: none;
  }
}
