:root {
  --night: #12161a;
  --lamp: #f4e6c8;
  --ink: #221c16;
  --paper: #f4e6c8;
  --glaze: #6e8f7a;
  --wine: #6e2c2c;
  --mist: #e7dcc8;
  --serif: "Instrument Serif", "Iowan Old Style", Palatino, serif;
  --sans: Figtree, "Avenir Next", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--night);
  color: var(--mist);
}

body {
  min-height: 100dvh;
  font-family: var(--sans);
  font-weight: 400;
  line-height: 1.45;
}

.lamp {
  position: fixed;
  inset: -10vh 0 auto;
  height: 78vh;
  background: radial-gradient(ellipse at 50% 0%, rgba(244, 230, 200, 0.34), transparent 62%);
  pointer-events: none;
}

.table {
  position: fixed;
  left: 50%;
  bottom: -22vh;
  width: 160vw;
  height: 46vh;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse, #1b2420 0%, transparent 68%);
  pointer-events: none;
}

.top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  padding: calc(18px + env(safe-area-inset-top)) 20px 0;
}

.plates {
  display: flex;
  justify-content: center;
}

.plates button {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.plates button::before {
  content: "";
  display: block;
  width: 12px;
  height: 12px;
  margin: 12px auto;
  border-radius: 50%;
  border: 1.5px solid rgba(110, 143, 122, 0.85);
}

.plates button[aria-current="true"]::before {
  background: var(--wine);
  border-color: var(--wine);
}

.plates button.seen:not([aria-current="true"])::before {
  background: var(--glaze);
  border-color: var(--glaze);
}

main {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: auto;
  padding: calc(64px + env(safe-area-inset-top)) 24px calc(28px + env(safe-area-inset-bottom));
}

.plate {
  width: min(100%, 28rem);
  margin: auto;
  text-align: left;
}

.cover {
  text-align: center;
}

.cover h1 {
  margin: 0 0 18px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.15rem, 7.4vw, 3.3rem);
  line-height: 1;
  color: var(--lamp);
}

.mark {
  margin: 0;
  color: var(--lamp);
}

.mark svg {
  width: min(64vw, 250px);
  height: auto;
  display: block;
  margin: 0 auto;
}

.mark path {
  fill: none;
  stroke: currentColor;
  stroke-width: 7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cover .date {
  margin: 26px 0 0;
  font-size: 1rem;
  letter-spacing: 0.01em;
}

.eight {
  display: inline-block;
  transform: rotate(90deg);
  font-family: var(--serif);
  font-size: 1.35em;
  line-height: 0;
  margin: 0 0.12em 0 0.02em;
  vertical-align: -0.05em;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.paper {
  background: var(--paper);
  color: var(--ink);
  padding: clamp(28px, 6vw, 48px);
  border-radius: 2px 18px 4px 14px;
}

.paper h1 {
  margin: 0 0 18px;
  font-family: var(--serif);
  font-size: clamp(2.4rem, 8vw, 3.4rem);
  font-weight: 400;
  line-height: 1;
}

.paper p {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.35rem, 4.4vw, 1.7rem);
  line-height: 1.35;
  max-width: 22ch;
}

.frame {
  width: min(38vw, 148px);
  aspect-ratio: 4 / 5;
  margin: 0 0 18px;
  border: 8px solid var(--glaze);
  background: #24302b;
  color: var(--glaze);
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  transform: rotate(-1.5deg);
}

.note .frame { margin-left: 8px; }

.empty {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 22px;
}

.ring {
  width: min(64vw, 240px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 14px solid rgba(110, 143, 122, 0.9);
  box-shadow: inset 0 0 0 1px rgba(244, 230, 200, 0.12);
  display: grid;
  place-items: center;
}

.ring span {
  font-family: var(--serif);
  font-size: 2.4rem;
  color: var(--lamp);
}

.empty p {
  margin: 0;
  max-width: 24ch;
  font-size: 1.02rem;
}

.next {
  display: inline-flex;
  align-items: flex-end;
  gap: 10px;
  margin-top: 36px;
  padding: 12px 2px 0;
  border: 0;
  border-bottom: 1px solid currentColor;
  background: transparent;
  color: inherit;
  font: 500 1rem/1 var(--sans);
  cursor: pointer;
}

.cover .next {
  position: relative;
  border-bottom: 0;
  padding-bottom: 0;
}

.cover .next .label {
  border-bottom: 1px solid currentColor;
  padding-bottom: 8px;
}

.cover .next svg {
  position: absolute;
  left: calc(100% + 8px);
  bottom: 2px;
  width: 36px;
  height: 40px;
  color: var(--lamp);
}

.cover .next svg path {
  fill: none;
  stroke: currentColor;
  stroke-width: 8;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

@media (prefers-reduced-motion: no-preference) {
  .cover .next:hover svg path,
  .cover .next:focus-visible svg path {
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1.35s ease;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cover .next svg path { stroke-dashoffset: 0; }
  .reel { animation: none; }
}

.cover .next { color: var(--lamp); }

button:focus-visible {
  outline: 2px solid var(--lamp);
  outline-offset: 4px;
}

@media (prefers-reduced-motion: no-preference) {
  .lamp { animation: lamp 1.6s ease both; }
  .plate { animation: rise 0.45s ease both; }
}

@keyframes lamp {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.film {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.strip {
  position: absolute;
  top: -14%;
  width: 118px;
  height: 128%;
  overflow: hidden;
  opacity: 0.3;
}

.strip.s0 { left: 3vw; }
.strip.s1 { right: 4vw; }
.strip.s2 { left: 16vw; }

.reel {
  animation: crawl calc(var(--n) * 2.4s) steps(var(--n)) infinite;
}

.strip.s1 .reel {
  animation-duration: calc(var(--n) * 2.9s);
  animation-direction: reverse;
}

.strip.s2 .reel {
  animation-duration: calc(var(--n) * 3.3s);
  animation-delay: -8s;
}

.cell {
  height: 168px;
  padding: 8px 16px 10px;
  background-color: transparent;
  background-image:
    linear-gradient(#0c0b0a, #0c0b0a),
    radial-gradient(circle, transparent 3.5px, #0c0b0a 4px),
    radial-gradient(circle, transparent 3.5px, #0c0b0a 4px);
  background-size: calc(100% - 28px) 100%, 11px 28px, 11px 28px;
  background-position: center, left 2px top 6px, right 2px top 6px;
  background-repeat: no-repeat, repeat-y, repeat-y;
}

.cell img {
  display: block;
  width: 100%;
  height: 150px;
  object-fit: cover;
  object-position: center 22%;
}

@keyframes crawl {
  to { transform: translateY(-50%); }
}

@media (max-width: 760px) {
  .strip { width: 86px; opacity: 0.22; }
  .strip.s0 { left: -26px; }
  .strip.s1 { right: -26px; }
  .strip.s2 { display: none; }
  .cell { height: 136px; padding: 6px 13px 8px; }
  .cell img { height: 122px; }
}

@media (min-width: 800px) {
  .paper p { max-width: 28ch; }
  .frame { width: 180px; }
}
