/* Hộp diêm — the invitation is one matchbox printed flat in three inks:
   safety red, black and the unprinted paper. The only texture is the 1–2px
   misregistration between the red and black plates, and the striker's grit.
   One woodtype-like condensed face (Anybody) and one text face (Be Vietnam Pro). */

@font-face {
  font-family: Anybody;
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 50% 150%;
  font-display: swap;
  src: url("../fonts/anybody-vietnamese.woff2") format("woff2");
  unicode-range:
    U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1,
    U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329,
    U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: Anybody;
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 50% 150%;
  font-display: swap;
  src: url("../fonts/anybody-latin-ext.woff2") format("woff2");
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
    U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: Anybody;
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 50% 150%;
  font-display: swap;
  src: url("../fonts/anybody-latin.woff2") format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/be-vietnam-pro-500-vietnamese.woff2") format("woff2");
  unicode-range:
    U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1,
    U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329,
    U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/be-vietnam-pro-500-latin-ext.woff2") format("woff2");
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
    U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/be-vietnam-pro-500-latin.woff2") format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/be-vietnam-pro-700-vietnamese.woff2") format("woff2");
  unicode-range:
    U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1,
    U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329,
    U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/be-vietnam-pro-700-latin-ext.woff2") format("woff2");
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
    U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/be-vietnam-pro-700-latin.woff2") format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* the three inks */
  --paper: #eeeae1;
  --red: #c8231b;
  --black: #17110e;
  /* the striker is its own surface: brown card under black grit */
  --striker: #4a2418;
  --grit: #2a120b;
  --grit-light: #74402c;

  --display: Anybody, "Arial Narrow", sans-serif;
  --text: "Be Vietnam Pro", "Helvetica Neue", sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  /* misregistration: the black plate always lands 1.5px right, 1px low.
     Paper type knocked out of red shows that black keyline as a ghost;
     a black shape printed into red leaves a paper sliver on its top-left. */
  --ghost: 1.5px 1px 0 var(--black);
  --trap: -1.5px -1px 0 var(--paper);

  --gutter: 12px;
  --label-pad: 18px;
  --names-size: 84px;
  --striker-h: 56px;

  color-scheme: light;
  accent-color: var(--red);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-color: var(--red) var(--paper);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--black);
  font-family: var(--text);
  font-size: 1.0625rem;
  font-weight: 500;
  line-height: 1.5;
  caret-color: var(--red);
}

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

:focus-visible {
  outline: 3px solid var(--black);
  outline-offset: 3px;
}

h1,
p,
figure {
  margin: 0;
}

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

[hidden] {
  display: none !important;
}

.defs {
  position: absolute;
}

/* ---------- the stage: the box laid on the paper ---------- */
.stage {
  display: grid;
  justify-items: center;
  align-items: start;
  min-height: 100svh;
  padding: var(--gutter) var(--gutter) 48px;
}

.box {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 480px;
}

/* ---------- the sleeve: red label, black edge set off register ---------- */
.sleeve {
  position: relative;
  z-index: 2;
  padding: 1px 3px 3px 1px;
  background: var(--black);
}

.label {
  padding: 9px;
  background: var(--red);
  color: var(--paper);
}

.label-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "names names"
    "row matches"
    "band band"
    "foot foot";
  gap: 16px 12px;
  padding: var(--label-pad);
  border: 2px solid var(--paper);
}

/* ---------- names ---------- */
.names-wrap {
  grid-area: names;
  position: relative;
  font-family: var(--display);
  font-size: var(--names-size);
  font-stretch: 68%;
  font-weight: 900;
  line-height: 1.06;
  text-transform: uppercase;
}

.names {
  display: grid;
  justify-items: start;
  padding-top: 0.1em;
  font: inherit;
  text-wrap: balance;
}

.name,
.name-line {
  white-space: nowrap;
}

.names:not(.names--lit) .name {
  text-shadow: var(--ghost);
}

.amp {
  margin-right: 0.08em;
  color: var(--black);
  font-stretch: 100%;
}

/* lit: the flame's paper becomes a highlight band under each name */
.names--lit {
  position: absolute;
  inset: 0;
  margin: 0;
  color: var(--red);
  clip-path: inset(0 0 0 0);
}

.names--lit .lit {
  padding: 0 0.07em;
  margin-left: -0.07em;
  background: var(--paper);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  box-shadow: var(--ghost);
}

/* ---------- the row: price badge, facts, the couple ---------- */
.label-row {
  grid-area: row;
  display: grid;
  justify-items: start;
  align-content: center;
  gap: 12px;
}

.badge {
  display: grid;
  place-content: center;
  justify-items: center;
  width: 104px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--black);
  box-shadow: var(--trap);
  color: var(--paper);
  text-align: center;
  transform: rotate(-8deg);
}

.badge-eyebrow {
  max-width: 84px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
}

.badge-day {
  font-family: var(--display);
  font-size: 2.125rem;
  font-stretch: 78%;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.badge-year {
  font-family: var(--display);
  font-size: 1.125rem;
  font-stretch: 100%;
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.facts {
  display: grid;
  align-self: center;
  font-family: var(--display);
  font-stretch: 75%;
  font-weight: 900;
  line-height: 1.05;
  text-transform: uppercase;
}

.fact-weekday {
  font-size: 1.5rem;
}

.fact-time {
  color: var(--black);
  font-size: 2.5rem;
  font-variant-numeric: tabular-nums;
}

.matches {
  grid-area: matches;
  align-self: center;
  width: 138px;
  height: auto;
  overflow: visible;
}

.matches rect {
  fill: var(--paper);
  stroke: var(--black);
  stroke-width: 3;
}

.matches .head {
  fill: var(--black);
  stroke: var(--paper);
  stroke-width: 3;
}

.flame-body {
  fill: var(--paper);
  stroke: var(--black);
  stroke-width: 3.5;
  stroke-linejoin: round;
}

.flame-heart {
  fill: var(--red);
}

.couple-flame {
  transform-box: fill-box;
  transform-origin: 50% 92%;
}

/* ---------- countdown: a black band printed across the label ---------- */
.countdown-band {
  grid-area: band;
  display: grid;
  gap: 4px;
  padding: 12px 14px 10px;
  margin-inline: calc(var(--label-pad) * -1 + 6px);
  background: var(--black);
  box-shadow: var(--trap);
  color: var(--paper);
}

.countdown-label {
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.countdown {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.cd {
  display: grid;
  justify-items: start;
}

.cd b {
  display: flex;
  font-family: var(--display);
  font-size: 2rem;
  font-stretch: 100%;
  font-weight: 900;
  line-height: 1;
}

/* Anybody's figures are proportional: each digit gets its own fixed cell */
.cd .d {
  display: inline-block;
  width: 0.66em;
  text-align: center;
}

.cd small {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.label-foot {
  grid-area: foot;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.series {
  font-variant-numeric: tabular-nums;
}

/* ---------- the striker: brown card with black and rust grit ---------- */
.striker {
  position: relative;
  height: var(--striker-h);
  margin-top: 3px;
  background-color: var(--striker);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='46' height='38'%3E%3Cg fill='%232a120b'%3E%3Crect x='3' y='4' width='2' height='2'/%3E%3Crect x='17' y='9' width='3' height='2'/%3E%3Crect x='31' y='2' width='2' height='3'/%3E%3Crect x='40' y='15' width='2' height='2'/%3E%3Crect x='9' y='20' width='3' height='3'/%3E%3Crect x='25' y='25' width='2' height='2'/%3E%3Crect x='36' y='31' width='3' height='2'/%3E%3Crect x='14' y='33' width='2' height='2'/%3E%3C/g%3E%3Cg fill='%2374402c'%3E%3Crect x='11' y='4' width='2' height='2'/%3E%3Crect x='27' y='14' width='2' height='2'/%3E%3Crect x='3' y='28' width='2' height='2'/%3E%3Crect x='42' y='24' width='2' height='3'/%3E%3Crect x='21' y='34' width='2' height='2'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 46px 38px;
}

/* ---------- the drawer: black tray, the photo inside, a paper pull tab ---------- */
.drawer {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: 1fr auto;
  margin-inline: 10px;
  background: var(--black);
  padding: 0 6px 6px;
}

.tray {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 0;
  overflow: hidden;
}

.tray-photo {
  flex: none;
  margin-top: 6px;
}

/* the tray seen from above: a paper inner wall, then the photo inside it */
.tray-photo {
  padding: 10px;
  background: var(--paper);
  box-shadow: inset 0 0 0 2px var(--black);
}

.tray-photo img {
  border: 2px solid var(--black);
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: 50% 12%;
  background: var(--red);
}

.tongue {
  display: grid;
  gap: 4px;
  padding: 12px 14px 14px;
  margin-top: 6px;
  background: var(--paper);
  text-align: center;
}

.envelope-title {
  font-family: var(--display);
  font-size: 1.75rem;
  font-stretch: 75%;
  font-weight: 900;
  line-height: 1.1;
  text-transform: uppercase;
  text-wrap: balance;
}

.guest {
  font-size: 1.0625rem;
}

.guest b {
  color: var(--red);
  font-weight: 700;
}

.tongue-facts {
  display: grid;
  gap: 2px;
  margin: 6px 0 0;
}

.tongue-facts dd {
  margin: 0;
}

.tongue-when {
  color: var(--red);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.tongue-venue {
  font-family: var(--display);
  font-size: 1.375rem;
  font-stretch: 75%;
  font-weight: 900;
  line-height: 1.1;
  text-transform: uppercase;
}

.tongue-room {
  font-size: 0.9375rem;
}

/* the shut box must fit a phone screen: when and where wait for the open box */
@media (max-width: 899px) {
  .locked .tongue-facts {
    display: none;
  }

  .locked .label-inner {
    row-gap: 10px;
    padding-block: 14px;
  }

  /* longer English and French copy still leaves the pull tab on screen */
  .locked .matches {
    width: 118px;
  }

  .locked .envelope-title {
    font-size: 1.375rem;
  }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.pull {
  margin-top: 8px;
}

.pull-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 10px 18px;
  border: 0;
  border-radius: 0;
  background: var(--black);
  color: var(--paper);
  cursor: pointer;
  font: 700 1rem / 1.3 var(--text);
  text-align: left;
  text-wrap: balance;
}

.pull-btn:hover {
  background: var(--red);
}

.pull-icon {
  flex: none;
  width: 22px;
  height: 22px;
}

/* ---------- the RSVP tab and the music switch ---------- */
.flag {
  position: fixed;
  right: 16px;
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 0 20px 0 14px;
  background: var(--black);
  color: var(--paper);
  font: 700 1rem / 1.2 var(--text);
  text-decoration: none;
  transition:
    transform 0.5s var(--ease-out),
    opacity 0.3s;
}

.flag-head {
  width: 14px;
  height: 18px;
  border: 2px solid var(--paper);
  border-radius: 50%;
  background: var(--red);
}

.flag:hover {
  background: var(--red);
}

.flag:hover .flag-head {
  background: var(--black);
}

.flag--docked {
  position: absolute;
  top: 6px;
  right: 6px;
  bottom: 6px;
  min-height: 44px;
  padding-right: 16px;
  box-shadow: none;
}

.flag.is-away {
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px);
}

.cue {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.9375rem;
}

.locked .cue {
  display: none;
}

.music {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 20;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: var(--black);
  color: var(--paper);
  cursor: pointer;
}

.music[aria-pressed="true"] {
  background: var(--red);
}

.icon {
  width: 22px;
  height: 22px;
}

/* ---------- the narrowest phones: the facts drop under the badge ---------- */
@media (max-width: 379px) {
  .label-row {
    gap: 10px;
  }

  .badge {
    width: 92px;
  }

  .badge-day {
    font-size: 1.875rem;
  }

  .facts {
    display: flex;
    gap: 0.3em;
    align-items: baseline;
  }

  .fact-weekday {
    font-size: 1.25rem;
    white-space: nowrap;
  }

  .fact-time {
    font-size: 1.5rem;
  }

  .matches {
    width: 108px;
  }
}

/* ---------- desktop: the box lies across the table, the drawer slides right ---------- */
@media (min-width: 900px) {
  :root {
    --gutter: 40px;
    --label-pad: 36px;
    --names-size: 96px;
    --striker-h: 72px;
  }

  .stage {
    align-items: center;
    padding-bottom: var(--gutter);
  }

  .box {
    flex-direction: row;
    align-items: center;
    width: auto;
    max-width: none;
  }

  /* the shut box fills most of the screen height */
  .sleeve {
    display: flex;
    flex-direction: column;
    width: clamp(600px, 52vw, 760px);
    min-height: min(85svh, 880px);
  }

  .label {
    display: flex;
    flex: 1;
  }

  .label-inner {
    flex: 1;
    align-content: space-between;
  }

  .label-row {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 18px;
  }

  .label-inner {
    grid-template-areas:
      "names matches"
      "row matches"
      "band band"
      "foot foot";
    gap: 22px 24px;
  }

  .badge {
    width: 150px;
  }

  .badge-day {
    font-size: 2.5rem;
  }

  .matches {
    align-self: center;
    width: 190px;
  }

  .countdown-band {
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 24px;
    padding: 14px 22px;
  }

  .countdown-label {
    max-width: 9em;
    font-size: 0.875rem;
  }

  .cd b {
    font-size: 3.25rem;
  }

  .drawer {
    grid-template-rows: none;
    grid-template-columns: 1fr auto;
    align-self: stretch;
    margin: 28px 0;
    padding: 6px 6px 6px 0;
  }

  .tray {
    flex-direction: row;
    justify-content: flex-end;
    min-width: 0;
  }

  .tray-photo {
    width: 340px;
    height: 100%;
    margin: 0;
  }

  .tray-photo img {
    height: 100%;
    aspect-ratio: auto;
  }

  .tongue {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 220px;
    margin: 0 0 0 6px;
    padding: 28px 20px 20px;
    text-align: left;
  }

  .envelope-title {
    font-size: 2.25rem;
    line-height: 1.04;
  }

  .tongue .cue,
  .pull {
    justify-content: flex-start;
    margin-top: auto;
  }

  .tongue-facts {
    padding-top: 14px;
    border-top: 3px solid var(--black);
  }

  .pull-btn {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .pull-icon {
    transform: rotate(-90deg);
  }

  .flag {
    right: 28px;
    bottom: 28px;
  }

  .music {
    top: 20px;
    right: 20px;
  }
}

/* the names take focus once the box opens; the heading itself needs no ring */
.names[tabindex="-1"]:focus {
  outline: none;
}
