/* ---------------------------------
   Variables
--------------------------------- */
:root {
  --paper: #f8f2e8;
  --paper-deep: #efe7d8;
  --paper-shadow: #d8cdbb;
  --ink: #25211d;
  --ink-soft: #655e55;
  --red: #8a3438;
  --red-dark: #67272b;
  --blue-pen: #355c7d;
  --line: #d8ccba;
  --white: #fffdf8;

  --font-serif: Georgia, "Times New Roman", Times, serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;

  --gutter: clamp(1rem, 5vw, 3.5rem);
  --section-space: clamp(4.5rem, 12vw, 9rem);
  --max-width: 68rem;
  --reading-width: 43rem;
  --fast: 180ms;
  --normal: 500ms;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------------------------------
   Base
--------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--paper-deep);
}

body {
  margin: 0;
  min-width: 20rem;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--paper-deep);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

::selection {
  color: var(--white);
  background: var(--red);
}

:focus-visible {
  outline: 3px solid var(--blue-pen);
  outline-offset: 5px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.7rem 1rem;
  color: var(--white);
  background: var(--ink);
  border-radius: 0.35rem;
  font-weight: 700;
  transform: translateY(-160%);
  transition: transform var(--fast) ease;
}

.skip-link:focus {
  transform: translateY(0);
}

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

.overline {
  margin: 0;
  color: var(--red);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

/* ---------------------------------
   Opening card and game
--------------------------------- */
.intro {
  display: grid;
  min-height: 100vh;
  min-height: 100svh;
  padding: max(1rem, env(safe-area-inset-top)) var(--gutter)
    max(1rem, env(safe-area-inset-bottom));
  place-items: center;
  background:
    linear-gradient(rgb(255 255 255 / 0.15), rgb(255 255 255 / 0.15)),
    var(--paper-deep);
}

.intro__card {
  position: relative;
  width: min(100%, 45rem);
  padding: clamp(1.5rem, 5vw, 3.75rem);
  overflow: hidden;
  border: 1px solid rgb(99 79 53 / 0.16);
  border-radius: 0.4rem;
  background: var(--paper);
  box-shadow: 0 1.5rem 5rem rgb(71 56 36 / 0.12);
}

.intro__card::before {
  content: "30";
  position: absolute;
  top: -0.35em;
  right: -0.05em;
  color: rgb(138 52 56 / 0.055);
  font-family: var(--font-serif);
  font-size: clamp(9rem, 32vw, 16rem);
  line-height: 1;
  pointer-events: none;
}

.intro h1 {
  position: relative;
  margin: clamp(1.6rem, 6vw, 3.5rem) 0 1rem;
  font-family: var(--font-serif);
  font-size: clamp(3rem, 11vw, 6.7rem);
  font-weight: 400;
  letter-spacing: -0.065em;
  line-height: 0.86;
}

.intro h1 em {
  color: var(--red);
  font-weight: 400;
}

.intro__lead {
  position: relative;
  margin: 1.6rem 0 0;
  color: var(--ink-soft);
  font-size: clamp(1rem, 2.2vw, 1.15rem);
}

.annoyance-meter {
  margin-top: clamp(1.7rem, 5vw, 2.5rem);
}

.annoyance-meter__topline {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 700;
}

.annoyance-meter__track {
  height: 0.5rem;
  margin-top: 0.55rem;
  overflow: hidden;
  border-radius: 999px;
  background: #ded3c3;
}

.annoyance-meter__track span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--red);
  transform: scaleX(var(--annoyance-progress, 0));
  transform-origin: left;
  transition: transform 300ms var(--ease);
}

.annoyance-meter__roast {
  min-height: 1.4em;
  margin: 0.55rem 0 0;
  color: var(--blue-pen);
  font-family: var(--font-serif);
  font-size: 0.78rem;
  font-style: italic;
}

.game {
  position: relative;
  margin-top: clamp(2rem, 6vw, 3rem);
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.game[hidden] {
  display: none;
}

.game__topline {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1rem;
}

.game__topline p {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 750;
  letter-spacing: 0.03em;
}

.game__hint {
  color: var(--ink-soft);
  font-weight: 500 !important;
}

.game__arena {
  position: relative;
  height: clamp(9.5rem, 28vw, 12rem);
  margin-top: 0.75rem;
  overflow: hidden;
  border: 1px dashed #c8b9a4;
  border-radius: 0.55rem;
  background: rgb(255 253 248 / 0.58);
}

.runaway-button {
  position: absolute;
  top: 50%;
  left: 50%;
  display: inline-grid;
  min-width: 10.5rem;
  min-height: 3.15rem;
  padding: 0.8rem 1.15rem;
  place-items: center;
  border: 0;
  border-radius: 999px;
  color: var(--white);
  background: var(--red);
  box-shadow: 0 0.35rem 0 var(--red-dark);
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.025em;
  text-align: center;
  text-decoration: none;
  touch-action: manipulation;
  transform: translate(-50%, -55%);
  transition:
    top 320ms var(--ease),
    left 320ms var(--ease),
    transform var(--fast) ease,
    box-shadow var(--fast) ease,
    background var(--fast) ease;
  user-select: none;
}

.runaway-button:active {
  box-shadow: 0 0.12rem 0 var(--red-dark);
  transform: translate(-50%, -46%);
}

.runaway-button.has-moved {
  transform: none;
}

.runaway-button.has-moved:active {
  transform: translateY(0.2rem);
}

.runaway-button.is-faking {
  cursor: wait;
  pointer-events: none;
  animation: fake-opening 420ms ease-in-out infinite alternate;
}

@keyframes fake-opening {
  from {
    background: var(--red);
    box-shadow: 0 0.35rem 0 var(--red-dark);
  }
  to {
    background: var(--blue-pen);
    box-shadow: 0 0.15rem 0 #243f57;
  }
}

@media (hover: hover) {
  .runaway-button.is-catchable:hover {
    background: var(--red-dark);
    transform: translateY(-0.12rem);
  }
}

.game__status {
  min-height: 1.5em;
  margin: 0.75rem 0 0;
  color: var(--blue-pen);
  font-family: var(--font-serif);
  font-size: 0.88rem;
  font-style: italic;
}

/* The unnecessary second layer of anniversary security. */
.verification[hidden] {
  display: none;
}

.verification {
  margin-top: clamp(2rem, 6vw, 3rem);
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.verification__eyebrow {
  margin: 0 0 0.6rem;
  color: var(--red);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.verification h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(1.85rem, 6vw, 3rem);
  font-weight: 400;
  letter-spacing: -0.035em;
  line-height: 1.05;
}

.verification__intro {
  margin: 0.7rem 0 1.5rem;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.hold-challenge {
  margin-top: 1.5rem;
}

.hold-challenge__button {
  width: 100%;
  min-height: 4rem;
  padding: 1rem;
  border: 0;
  border-radius: 0.35rem;
  color: var(--white);
  background: var(--red);
  box-shadow: 0 0.25rem 0 var(--red-dark);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  transition:
    background var(--fast) ease,
    box-shadow var(--fast) ease,
    transform var(--fast) ease;
}

.hold-challenge__button:hover:not(:disabled) {
  background: var(--red-dark);
  transform: translateY(-1px);
}

.hold-challenge__button:active:not(:disabled),
.hold-challenge__button.is-holding {
  background: var(--blue-pen);
  box-shadow: 0 0.1rem 0 #243f57;
  transform: translateY(0.15rem);
}

.hold-challenge__button:disabled {
  cursor: wait;
  opacity: 0.75;
}

.hold-challenge__track {
  height: 0.7rem;
  margin-top: 0.85rem;
  overflow: hidden;
  border: 1px solid #c6b8a4;
  border-radius: 999px;
  background: rgb(255 253 248 / 0.7);
}

.hold-challenge__track span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--blue-pen);
  transform: scaleX(var(--hold-progress, 0));
  transform-origin: left;
}

.hold-challenge__status {
  min-height: 2.8em;
  margin: 0.85rem 0 0;
  color: var(--blue-pen);
  font-family: var(--font-serif);
  font-size: 0.86rem;
  font-style: italic;
  line-height: 1.4;
}

.hold-challenge__help {
  margin: 0.35rem 0 0;
  color: var(--ink-soft);
  font-size: 0.68rem;
}

.intro__fineprint {
  margin: 1.4rem 0 0;
  color: #7c7469;
  font-size: 0.68rem;
  text-align: center;
}

/* ---------------------------------
   Revealed card
--------------------------------- */
.js .gift {
  display: none;
}

.js .footer {
  display: none;
}

.js .gift.is-open {
  display: block;
  animation: show-card 650ms var(--ease) both;
}

.js .footer.is-open {
  display: block;
}

@keyframes show-card {
  from {
    opacity: 0;
    transform: translateY(1.5rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card-heading {
  padding: var(--section-space) var(--gutter) clamp(3rem, 8vw, 6rem);
  text-align: center;
  background: var(--white);
}

.card-heading__victory {
  margin: 0 0 2.5rem;
  color: var(--blue-pen);
  font-family: var(--font-serif);
  font-size: 0.95rem;
  font-style: italic;
}

.card-heading h2 {
  margin: 1rem 0;
  font-family: var(--font-serif);
  font-size: clamp(3rem, 10vw, 7rem);
  font-weight: 400;
  letter-spacing: -0.06em;
  line-height: 0.9;
}

.card-heading > p:last-child {
  width: min(100%, 34rem);
  margin: 1.5rem auto 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

/* ---------------------------------
   Vertical photo
--------------------------------- */
.photo-section {
  padding: clamp(3.5rem, 10vw, 7rem) var(--gutter);
  background: var(--ink);
}

.photo {
  width: min(100%, 35rem);
  margin: 0 auto;
}

.photo__frame {
  position: relative;
  display: grid;
  min-height: min(115vw, 44rem);
  padding: clamp(0.55rem, 2vw, 0.9rem);
  place-items: center;
  overflow: hidden;
  background: #e8dfd1;
  box-shadow: 0 1.25rem 4rem rgb(0 0 0 / 0.3);
}

.photo__frame img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: auto;
  max-height: 78rem;
  object-fit: contain;
  object-position: center;
  background: #d8cec0;
}

.photo__placeholder {
  display: none;
  margin: 0;
  color: var(--ink-soft);
  font-family: var(--font-serif);
  font-style: italic;
  text-align: center;
}

.photo.is-missing img {
  display: none;
}

.photo.is-missing .photo__placeholder {
  display: block;
}

.photo figcaption {
  margin-top: 1rem;
  color: #cfc4b4;
  font-family: var(--font-serif);
  font-size: clamp(0.95rem, 2vw, 1.08rem);
  font-style: italic;
  text-align: center;
}

/* ---------------------------------
   Message
--------------------------------- */
.message {
  padding: var(--section-space) var(--gutter);
  background: var(--paper-deep);
}

.message__paper {
  position: relative;
  width: min(100%, var(--reading-width));
  margin: 0 auto;
  padding: clamp(1.5rem, 6vw, 4.5rem);
  border: 1px solid rgb(88 70 46 / 0.15);
  background: var(--paper);
  box-shadow: 0 1.5rem 4rem rgb(76 60 39 / 0.1);
}

.message__paper::before {
  content: "";
  position: absolute;
  top: 1.2rem;
  bottom: 1.2rem;
  left: clamp(0.65rem, 2.5vw, 1.3rem);
  width: 2px;
  background: rgb(138 52 56 / 0.22);
}

.message h2 {
  margin: 0 0 0.75em;
  font-family: var(--font-serif);
  font-size: clamp(2.4rem, 8vw, 4.7rem);
  font-weight: 400;
  letter-spacing: -0.05em;
  line-height: 1;
}

.message__body {
  color: #332e29;
  font-family: var(--font-serif);
  font-size: clamp(1.08rem, 2.4vw, 1.3rem);
  line-height: 1.72;
}

.message__body > p {
  margin: 0 0 1.35em;
}

.message__asides {
  margin: -0.2rem 0 1.8rem clamp(0rem, 5vw, 2.5rem);
  padding-left: 1rem;
  border-left: 2px solid rgb(53 92 125 / 0.35);
  color: var(--blue-pen);
  font-size: 0.9em;
  font-style: italic;
}

.message__asides p {
  margin: 0.35rem 0;
}

.message__joke {
  margin-block: 2.2rem !important;
  padding: 1.2rem 0;
  border-block: 1px solid var(--line);
  color: var(--red-dark);
  font-size: 1.05em;
  line-height: 1.55;
}

.message__signoff {
  margin-top: 2.5rem !important;
}

.message__signoff span {
  color: var(--blue-pen);
  font-size: clamp(2.2rem, 7vw, 3.4rem);
  font-style: italic;
}

/* ---------------------------------
   Years, replay and footer
--------------------------------- */
.years {
  padding: var(--section-space) var(--gutter);
  color: var(--white);
  background: var(--red-dark);
  text-align: center;
}

.years p {
  margin: 0;
}

.years p:first-child {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.8rem, 4vw, 2rem);
  font-family: var(--font-serif);
  font-size: clamp(2.8rem, 10vw, 6.5rem);
  letter-spacing: -0.045em;
  line-height: 1;
}

.years span {
  color: #d9b9a7;
  font-size: 0.55em;
}

.years p:last-child {
  margin-top: 1rem;
  color: #eadfd4;
  font-family: var(--font-serif);
  font-style: italic;
}

.again {
  padding: clamp(3rem, 8vw, 5rem) var(--gutter);
  background: var(--white);
  text-align: center;
}

.again__link {
  display: inline-block;
  min-height: 2.75rem;
  padding: 0.65rem 0.5rem;
  border-bottom: 1px solid var(--ink);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
}

.footer {
  padding: 2.5rem var(--gutter);
  color: #d6cec2;
  background: var(--ink);
  text-align: center;
}

.footer p {
  margin: 0;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
}

.footer p:last-child {
  margin-top: 0.5rem;
  color: var(--white);
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-style: italic;
  letter-spacing: 0;
}

@media (min-width: 48rem) {
  .intro__card {
    transform: rotate(-0.35deg);
  }

  .photo__frame {
    min-height: 42rem;
  }
}

/* ---------------------------------
   Reduced motion
--------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
