/* ── 02 · Contents: a pink envelope + a table of contents with dotted leaders ── */
#contents {
  padding-top: clamp(84px, 11vh, 140px);
  padding-bottom: clamp(70px, 10vh, 130px);
  overflow-x: clip;
}
#contents .ct__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
  grid-template-rows: auto 1fr;
  column-gap: clamp(28px, 4vw, 72px);
  align-items: start;
}

#contents .ct__title {
  grid-column: 1 / -1; grid-row: 1;
  position: relative; z-index: 3;
  margin: 0 0 clamp(14px, 2.4vh, 28px) -0.04em;
  letter-spacing: .03em;
  justify-self: start;
}

/* ── the table of contents ───────────────────────────────────────────── */
#contents .ct__toc { grid-column: 1; grid-row: 2; position: relative; z-index: 4; max-width: 560px; }
#contents .ct__heads {
  display: flex; justify-content: space-between; align-items: baseline;
  margin: 0 0 .25em;
  font-family: var(--font-display); font-weight: 800; color: var(--pink);
  font-size: clamp(24px, 2vw, 32px); line-height: 1;
}
#contents .ct__heads span { display: inline-block; }
#contents .ct__heads span:first-child { rotate: -2deg; }
#contents .ct__heads span:last-child { rotate: 2deg; }

#contents .ct__list { counter-reset: none; }
#contents .ct__row {
  display: flex; align-items: baseline; gap: .4em;
  padding: .1em 0;
  text-decoration: none; color: var(--ink);
  font-size: clamp(18px, 1.5vw, 23px); line-height: 1.38; letter-spacing: .075em;
  outline-offset: 2px;
}
#contents .ct__t { display: inline-block; white-space: nowrap; }
#contents .ct__tx { display: inline-block; transition: transform .45s var(--ease-bounce), color .25s; }
#contents .ct__dots {
  flex: 1 1 auto; min-width: 1.5em; height: .3em;
  background: radial-gradient(circle at 50% 50%, currentColor 1.15px, transparent 1.7px) 0 100% / 7px 4px repeat-x;
  opacity: .62;
  transition: color .25s, opacity .25s;
}
#contents .ct__p { display: inline-block; min-width: 3.4em; text-align: right; font-variant-numeric: tabular-nums; }
#contents .ct__pn { display: inline-block; transition: color .25s; transform-origin: 50% 60%; }
#contents .ct__row:hover .ct__tx,
#contents .ct__row:focus-visible .ct__tx { color: var(--pink-deep); transform: translateX(7px); }
#contents .ct__row:hover .ct__dots,
#contents .ct__row:focus-visible .ct__dots { color: var(--pink); opacity: 1; }
#contents .ct__row:hover .ct__pn,
#contents .ct__row:focus-visible .ct__pn { color: var(--pink-deep); }

#contents .ct__hint {
  display: flex; align-items: center; gap: 8px;
  margin: clamp(12px, 2vh, 22px) 0 0;
  font-size: 18px; color: var(--ink-soft); rotate: -1.5deg; transform-origin: 0 50%;
}
#contents .ct__hint-dd { width: 18px; height: 18px; }
#contents .ct__hint-touch { display: none; }
@media (hover: none), (max-width: 899px) {
  #contents .ct__hint-desk { display: none; }
  #contents .ct__hint-touch { display: inline; }
}

/* floating polaroid preview */
#contents .ct__peek {
  position: absolute; left: 0; top: 0; z-index: 30;
  width: clamp(170px, 14vw, 220px);
  pointer-events: none;
  opacity: 0; visibility: hidden;
}
#contents .ct__peek-card {
  position: relative;
  background: var(--card);
  padding: 10px 10px 40px;
  box-shadow: var(--shadow-lift);
  rotate: -3deg;
}
#contents .ct__peek-tape { left: 50%; top: -12px; width: 78px; height: 24px; translate: -50% 0; rotate: 4deg; }
#contents .ct__peek-win {
  position: relative; aspect-ratio: 4 / 4.6; overflow: hidden;
  background:
    radial-gradient(70% 60% at 50% 55%, rgba(244, 197, 213, .35), transparent 75%),
    var(--paper-2);
}
#contents .ct__peek-win img {
  position: absolute; inset: 7%; width: 86%; height: 86%;
  object-fit: contain; opacity: 0;
  filter: drop-shadow(0 6px 8px rgba(58, 42, 42, .18));
}
#contents .ct__peek-cap {
  position: absolute; left: 0; right: 0; bottom: 8px; margin: 0;
  text-align: center; font-family: var(--font-hand); font-size: 19px; line-height: 1; color: var(--ink);
  white-space: nowrap;
}
#contents .ct__peek-cap i { font-style: normal; color: var(--pink); }

/* ── the envelope ─────────────────────────────────────────────────────── */
#contents .ct__stage {
  grid-column: 2; grid-row: 1 / 3;
  align-self: center;
  position: relative; z-index: 2;
  --ew: clamp(360px, 37vw, 580px);
  padding: calc(var(--ew) * .22) 0 calc(var(--ew) * .06);
  margin-top: clamp(40px, 9vh, 110px);
  display: grid; justify-items: center;
}
#contents .ct__env-wrap { position: relative; width: var(--ew); }
#contents .ct__env {
  --u: calc(var(--ew) / 100);
  position: relative; width: 100%; aspect-ratio: 400 / 260;
  rotate: -9deg;
}
#contents .ct__env-back {
  position: absolute; inset: 0; z-index: 1; border-radius: 4px;
  background:
    linear-gradient(180deg, rgba(150, 50, 90, .22), rgba(150, 50, 90, 0) 38%),
    linear-gradient(170deg, #e9a2bb, #e396b2);
  box-shadow: 0 2px 3px rgba(58, 42, 42, .08), 0 26px 40px -16px rgba(120, 50, 70, .38), 0 60px 80px -40px rgba(58, 42, 42, .28);
}
#contents .ct__flap {
  position: absolute; left: 0; top: 0; z-index: 2;
  width: 100%; height: 61.5%;
  transform-origin: 50% 0;
  transform-style: preserve-3d;
  transform: perspective(1400px) rotateX(180deg);
  pointer-events: none;
}
#contents .ct__flap-face {
  position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
#contents .ct__flap-face--out path:first-child { fill: url(#ct-flap-out); }
#contents .ct__flap-face--in { transform: rotateX(180deg); }
#contents .ct__flap-face--in path { fill: url(#ct-flap-in); }
#contents .ct__flap-edge { fill: none; stroke: rgba(255, 255, 255, .55); stroke-width: 2; vector-effect: non-scaling-stroke; }
#contents .ct__seal {
  position: absolute; left: 50%; top: 68%; width: calc(var(--u) * 9); height: calc(var(--u) * 9);
  translate: -50% -50%; rotate: -8deg;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  filter: drop-shadow(0 1px 1px rgba(120, 40, 70, .35));
  color: var(--pink-deep);
}

#contents .ct__pocket {
  position: absolute; inset: 0; z-index: 4; width: 100%; height: 100%; overflow: visible;
  filter: drop-shadow(0 -2px 3px rgba(120, 50, 70, .14));
}
#contents .ct__pocket-fold { fill: none; stroke: rgba(255, 255, 255, .5); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
#contents .ct__pocket-lip { fill: none; stroke: rgba(255, 255, 255, .7); stroke-width: 1.6; vector-effect: non-scaling-stroke; }

/* the things inside */
#contents .ct__item { position: absolute; }
#contents .ct__item--note { z-index: 6; left: calc(var(--u) * 1); top: calc(var(--u) * -12); width: calc(var(--u) * 76); height: calc(var(--u) * 54); }
#contents .ct__item--photo { z-index: 7; left: calc(var(--u) * 62); top: calc(var(--u) * -6); width: calc(var(--u) * 37); }
#contents .ct__note {
  position: absolute; inset: 0;
  background: linear-gradient(160deg, #fffdf9, #fbf5ee);
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(58, 42, 42, .1), 0 10px 20px -8px rgba(58, 42, 42, .28);
  rotate: -4deg;
}
#contents .ct__note::after { /* faint ruled paper */
  content: ''; position: absolute; inset: 10% 6% 12%;
  background: repeating-linear-gradient(180deg, transparent 0 calc(var(--u) * 6.2 - 1px), rgba(159, 199, 230, .28) calc(var(--u) * 6.2 - 1px) calc(var(--u) * 6.2));
  pointer-events: none;
}
#contents .ct__note-text {
  position: absolute; z-index: 1; left: calc(var(--u) * 4); top: calc(var(--u) * 9); width: calc(var(--u) * 56);
  margin: 0; text-align: center;
  font-family: var(--font-hand); font-size: calc(var(--u) * 4.9); line-height: 1.22; color: var(--ink);
  rotate: -7deg;
}
#contents .ct__line { display: block; white-space: nowrap; }
#contents .ct__arrow {
  position: absolute; z-index: 1; left: calc(var(--u) * 24); top: calc(var(--u) * 29); width: calc(var(--u) * 30);
  overflow: visible; fill: none; stroke: var(--ink); stroke-width: 2.4px; stroke-linecap: round; stroke-linejoin: round;
  rotate: -4deg;
}
#contents .ct__arrow path { vector-effect: non-scaling-stroke; }
#contents .ct__photo {
  position: relative; margin: 0;
  rotate: 12deg;
  filter: drop-shadow(0 14px 16px rgba(58, 42, 42, .3)) drop-shadow(0 2px 2px rgba(58, 42, 42, .18));
  cursor: zoom-in;
}
#contents .ct__photo img { width: 100%; height: auto; display: block; }

#contents .ct__puff { position: absolute; width: 26px; height: 26px; left: 50%; top: 40%; z-index: 12; pointer-events: none; }

/* doodles */
#contents .ct__dd { position: absolute; pointer-events: none; z-index: 5; }
#contents .ct__dd--1 { width: 34px; height: 34px; left: -2.4%; top: -2%; }
#contents .ct__dd--2 { width: 30px; height: 30px; right: 2%; top: 20%; }
#contents .ct__dd--3 { width: 22px; height: 22px; left: 50%; bottom: 6%; }
#contents .ct__dd--4 { width: 28px; height: 28px; left: 63%; top: 3%; }

/* ── phones & small tablets: envelope above the list ──────────────────── */
@media (max-width: 899px) {
  #contents .ct__grid { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; }
  #contents .ct__title { grid-column: 1; grid-row: 1; margin-bottom: 0; }
  #contents .ct__stage { grid-column: 1; grid-row: 2; margin-top: 0; --ew: min(74vw, 420px); padding: calc(var(--ew) * .2) 0 calc(var(--ew) * .12); }
  #contents .ct__toc { grid-column: 1; grid-row: 3; max-width: none; }
  #contents .ct__row { font-size: 18px; letter-spacing: .06em; padding: .16em 0; }
  #contents .ct__peek { display: none; }
  #contents .ct__dd--1 { left: auto; right: 4%; top: 1%; }
  #contents .ct__dd--2 { right: -2%; top: 24%; }
  #contents .ct__dd--4 { left: 4%; top: 22%; }
  #contents .ct__dd--3 { display: none; }
}
