/* ==========================================================================
   Dea's 22nd — 5SOS Birthday Board
   Mobile-first. Breakpoints: phone <768 · tablet 768–1099 · desktop ≥1100
   ========================================================================== */

:root {
  --poster-pink: #F4326A;
  --ink: #251D1F;
  --black: #000000;
  --hot-pink: #FF69B4;
  --nova-pink: #FF1493;
  --silver: #C0C0C0;
  --teal-felt: #007373;
  --starlight-blue: #5DC0FA;
  --galactic-purple: #663399;
  --neon-green: #39FF14;
  --white: #FFFFFF;
  --shade: rgba(37, 29, 31, .72);

  --f-poster: 'Archivo', 'Arial Black', sans-serif;
  --f-title: 'Shrikhand', Georgia, serif;
  --f-hand: 'Caveat', 'Comic Sans MS', cursive;
  --f-type: 'Special Elite', 'Courier New', monospace;
  --f-ui: 'Inter', system-ui, sans-serif;

  --board-fallback: #7A0A2E;   /* crimson shown until the video loads */

  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --header-h: 76px;
  /* visible height of the board scroller */
  --view-h: calc(100vh - var(--header-h) - env(safe-area-inset-top));
}
@supports (height: 100dvh) {
  :root { --view-h: calc(100dvh - var(--header-h) - env(safe-area-inset-top)); }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  background: var(--black);
  color: var(--ink);
  font-family: var(--f-type);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
::selection { background: var(--hot-pink); color: var(--ink); }

a { color: var(--hot-pink); }
a:hover { color: var(--silver); }

button { -webkit-appearance: none; appearance: none; }
:focus-visible { outline: 3px solid var(--hot-pink); outline-offset: 3px; }

svg.s { overflow: visible; }

/* ---------- Shell ---------- */
.shell {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---------- Header ---------- */
.topbar {
  position: relative;
  flex: none;
  height: calc(var(--header-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(16px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--poster-pink);
  border-bottom: 2px dashed var(--ink);
}

.counter {
  margin-left: auto;
  flex: none;
  opacity: 0;
  transition: opacity .5s ease .8s;
}
.is-board .counter { opacity: 1; }
.counter-marks { display: flex; align-items: center; justify-content: flex-end; }
.grp { position: relative; display: inline-flex; gap: 3px; margin-left: 6px; }
.bar {
  display: block; width: 2px; height: 14px; border-radius: 1px;
  background: rgba(37, 29, 31, .25);
  transition: background-color .3s ease;
}
.bar.on { background: var(--ink); }
.strike {
  position: absolute; left: -3px; top: 6px;
  width: 20px; height: 2px; border-radius: 1px;
  transform: rotate(-28deg);
  background: rgba(255, 255, 255, .4);
  transition: background-color .3s ease;
}
.strike.on { background: var(--white); }
.counter-label { margin-top: 5px; font-size: 11px; text-align: right; color: var(--ink); white-space: nowrap; }

/* ---------- Title (one element; FLIP-animated from intro → header) ---------- */
.title {
  position: relative;
  z-index: 12;
  margin: 0;
  flex: 0 1 256px;
  min-width: 0;
  pointer-events: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  line-height: .95;
  font-family: var(--f-poster);
  font-weight: 900;
  font-size: 13px;
  color: var(--ink);
}
.w { margin: .04em .1em; transform-origin: 0 0; will-change: transform; }
.w-happy { font-weight: 900; font-stretch: 125%; }
.w-22 {
  padding: 0 .14em;
  font-size: 1.55em;
  font-weight: 900;
  font-stretch: 125%;
  background: var(--ink);
  color: var(--silver);
}
.w-22 .nd { font-size: .5em; vertical-align: .75em; }
.w-birthday { font-weight: 800; font-style: italic; }
.w-dea {
  padding: 0 .18em;
  font-weight: 900;
  font-stretch: 125%;
  background: var(--ink);
  color: var(--poster-pink);
}

.is-intro .title {
  position: fixed;
  top: 27vh;
  top: 27dvh;
  left: 0;
  right: 0;
  margin: 0 auto;
  width: min(350px, 100vw - 40px);
  font-size: min(56px, 14.5vw, 6.6dvh);
  justify-content: center;
  text-align: center;
}

/* ---------- Intro ---------- */
.intro {
  position: fixed;
  inset: 0;
  z-index: 10;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
  background: var(--poster-pink);
  transition: opacity .6s ease .3s;
}
.intro:focus-visible { outline-offset: -6px; }
.is-board .intro { opacity: 0; pointer-events: none; }

.intro-stars { position: absolute; inset: 0; }
.is { position: absolute; display: block; opacity: .22; }
.is svg { display: block; width: 100%; height: 100%; animation: tw 2.6s ease-in-out infinite; }

.intro-kicker {
  position: absolute;
  top: calc(64px + env(safe-area-inset-top));
  left: 0; right: 0;
  padding: 0 16px;
  text-align: center;
  font-family: var(--f-poster);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .24em;
}
/* phone: the two parts stack on separate lines */
.kicker-line { display: block; }
.kicker-line + .kicker-sep + .kicker-line { margin-top: 7px; }
.kicker-sep { display: none; }
@media (max-width: 767px) {
  .intro-kicker { font-size: 11px; letter-spacing: .14em; line-height: 1.4; }
}
@media (min-width: 768px) {
  .kicker-line { display: inline; }
  .kicker-line + .kicker-sep + .kicker-line { margin-top: 0; }
  .kicker-sep { display: inline; }
}
.intro-tally {
  position: absolute;
  bottom: calc(178px + env(safe-area-inset-bottom));
  left: 0; right: 0;
  text-align: center;
  font-size: 22px;
  letter-spacing: .06em;
}
.intro-hint {
  position: absolute;
  bottom: calc(72px + env(safe-area-inset-bottom));
  left: 0; right: 0;
  text-align: center;
  font-size: 14px;
}

/* ---------- Board ---------- */
.scroller {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  outline: none;
}
.scroller { background: var(--board-fallback); }
.board {
  position: relative;
  min-height: 100%;
  overflow: clip;              /* clip (not hidden) so the sticky video layer still sticks */
  background: var(--board-fallback);
}

/* Video background + Calum photos. Sticky, one scroller-view tall, so it stays
   put while the notes scroll over it instead of stretching down the whole board. */
.board-media {
  position: sticky;
  /* sticky offsets are measured inside the scroller's padding; cancel it so the
     video sits flush under the header once you scroll */
  top: calc(-1 * var(--scroll-pad-top, 0px));
  z-index: 0;
  height: var(--view-h);
  margin-bottom: calc(-1 * var(--view-h));
  overflow: hidden;
  pointer-events: none;
}
.board-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.calum { position: absolute; inset: 0; }
.calum img {
  position: absolute;
  top: 0;
  left: 50%;
  height: 100%;
  width: auto;
  max-width: none;
  translate: -50% 0;
  scale: 1.06;
  opacity: 0;
  mix-blend-mode: luminosity;  /* tints each photo with the gradient behind it */
  filter: contrast(1.08) brightness(1.12);
  -webkit-mask-image: radial-gradient(ellipse 50% 50% at 50% 45%, #000 55%, transparent 100%);
  mask-image: radial-gradient(ellipse 50% 50% at 50% 45%, #000 55%, transparent 100%);
  transition: opacity 1.4s ease, scale 7.5s ease-out;
}
.calum img.on { opacity: .8; scale: 1; }

.board-stars { position: absolute; inset: 0; pointer-events: none; }
.bs {
  position: absolute;
  opacity: .9;
  stroke: #141014;
  stroke-width: 1;
  stroke-linejoin: round;
}
.only-wide { display: none; }

.grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 26px 18px;
  padding: 30px 18px calc(56px + env(safe-area-inset-bottom));
  align-items: start;
}

/* ---------- Notes (board) ---------- */
.note {
  --z: 1;
  position: relative;
  display: block;
  width: 100%;
  min-height: 118px;
  margin: 0;
  padding: 16px 14px;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: var(--fg);
  background: var(--bg);
  border: var(--border, 0);
  border-radius: 6px;
  box-shadow: 0 6px 10px rgba(0, 0, 0, .35);
  opacity: 0;
  transform: translateY(-28px) scale(1.12) rotate(calc(var(--rot) * 2));
  transition:
    transform .5s cubic-bezier(.2, .9, .3, 1.25) var(--d),
    opacity .35s ease var(--d),
    translate .45s var(--spring),
    scale .45s var(--spring);
}
.is-board .note { opacity: 1; transform: rotate(var(--rot)); }
@media (hover: hover) {
  .note:hover { z-index: 3; translate: 0 -6px; scale: 1.045; }
}
.note:active { scale: .985; }

.pin {
  position: absolute;
  top: -12px;
  left: 50%;
  width: 24px;
  height: 24px;
  margin-left: -12px;
  fill: var(--pin);
  stroke: #141014;
  stroke-width: 1.2;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 1px rgba(0, 0, 0, .4));
}

.t { display: block; }
.sub { display: block; margin-top: 6px; font-family: var(--f-type); font-size: 11px; line-height: 1.35; }

/* kinds — title sizes scale by --z (1 on the board, 1.45 when open) */
.k-card { border-radius: 6px; }
.k-card .t { font-family: var(--f-title); font-size: calc(19px * var(--z)); line-height: 1.15; }

.k-sticky { border-radius: 1px; }
.k-sticky .t { font-family: var(--f-hand); font-weight: 700; font-size: calc(26px * var(--z)); line-height: 1.05; }

.k-polaroid { border-radius: 2px; padding: 10px 10px 14px; min-height: 0; }
.k-polaroid .t { font-family: var(--f-hand); font-weight: 700; font-size: calc(20px * var(--z)); line-height: 1.1; }

.k-ticket { border-radius: 4px; padding: 14px; --border: 2px dashed rgba(20, 16, 20, .5); }
.k-ticket.is-dark { --border: 2px dashed rgba(255, 105, 180, .7); }
.k-ticket .t { font-family: var(--f-type); font-size: calc(18px * var(--z)); letter-spacing: .08em; text-transform: uppercase; line-height: 1.2; }

.k-envelope { border-radius: 3px; padding: 0 14px 14px; }
.k-envelope .t { font-family: var(--f-title); font-size: calc(20px * var(--z)); line-height: 1.1; }
.env-line { display: block; width: 100%; height: 26px; margin-bottom: 10px; fill: none; stroke: var(--line); stroke-width: 1.5; }

.k-tally { border-radius: 2px; }
.k-tally .t { font-family: var(--f-type); font-size: calc(20px * var(--z)); letter-spacing: .04em; line-height: 1.3; color: var(--galactic-purple); word-break: break-word; }

/* polaroid photo box */
.photo {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 118px;
  margin-bottom: 8px;
  padding: 8px;
  overflow: hidden;
  background: #D6D6DC;
  color: #3A3A40;
  font-family: var(--f-type);
  font-size: 11px;
  text-align: center;
}
.photo img, .photo video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* ---------- "from Symon" — notes that carry a personal message ---------- */
.from-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--f-ui);
  font-weight: 600;
  font-size: 9.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  line-height: 1;
  white-space: nowrap;
  color: var(--ink);
}
.from-tag svg { width: 11px; height: 11px; flex: none; fill: var(--nova-pink); stroke: var(--ink); stroke-width: 1.4; stroke-linejoin: round; }

/* board: a little sticker hanging off the note's bottom-right corner */
.from-badge {
  position: absolute;
  right: -8px;
  bottom: -17px;
  z-index: 2;
  padding: 5px 8px 5px 6px;
  border-radius: 999px;
  background: var(--white);
  border: 1.5px solid var(--ink);
  box-shadow: 0 3px 6px rgba(0, 0, 0, .35);
  rotate: 5deg;
  pointer-events: none;
}
.note.has-msg { box-shadow: 0 6px 10px rgba(0, 0, 0, .35), 0 0 0 3px rgba(255, 255, 255, .85), 0 0 22px 4px rgba(255, 105, 180, .55); }

/* open note: the message sits on a paper slip, highlighted */
.from {
  position: relative;
  margin-top: 18px;
  padding: 14px 16px 16px;
  background: #FFFDF6;
  color: var(--ink);
  border-radius: 3px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .28);
  rotate: -.8deg;
}
.from::before {          /* tape */
  content: '';
  position: absolute;
  top: -9px;
  left: 50%;
  width: 64px;
  height: 18px;
  margin-left: -32px;
  background: rgba(255, 105, 180, .55);
  rotate: -3deg;
}
.from .msg { margin: 10px 0 0; color: var(--ink); }
.from .msg + .msg { margin-top: 12px; }
.msg mark {
  color: inherit;
  padding: 0 .12em;
  background: linear-gradient(transparent 50%, rgba(255, 105, 180, .5) 50%, rgba(255, 105, 180, .5) 92%, transparent 92%);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.bob.k-strip .from { margin: 16px 2px 4px; }

/* Admit-one strip */
.k-strip {
  grid-column: 1 / -1;
  min-height: 0;
  padding: 0;
  border-radius: 4px;
}
.strip { display: flex; align-items: stretch; min-height: 96px; }
.strip-stub {
  flex: none;
  width: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 2px dashed var(--ink);
}
.strip-stub span {
  display: block;
  transform: rotate(-90deg);
  font-family: var(--f-poster);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: .12em;
  white-space: nowrap;
}
.strip-main { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; padding: 12px 14px; }
.strip-admit { display: block; font-family: var(--f-poster); font-weight: 900; font-stretch: 125%; font-size: 26px; line-height: 1; letter-spacing: .01em; }
.strip-line { display: block; margin-top: 6px; font-family: var(--f-poster); font-weight: 600; font-size: 10px; letter-spacing: .08em; line-height: 1.4; }
.strip-end {
  flex: none;
  width: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-left: 2px dashed var(--ink);
}
.strip-end svg { width: 22px; height: 22px; fill: var(--ink); }

/* ---------- Open note overlay ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  padding: 28px 24px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.shade {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  cursor: pointer;
  background: var(--shade);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.confetti { position: fixed; inset: 0; z-index: 3; overflow: hidden; pointer-events: none; }
.cf { position: absolute; left: 50%; top: 50%; opacity: 0; fill: currentColor; }
.cf svg { display: block; width: 100%; height: 100%; }

.fly {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 340px;
  margin: auto;
  transform-origin: 50% 50%;
}
.fly.is-strip { max-width: 300px; }

.bob {
  --z: 1.45;
  position: relative;
  perspective: 900px;
  padding: 30px 24px 22px;
  color: var(--fg);
  background: var(--bg);
  border: var(--border, 0);
  box-shadow: 0 24px 50px rgba(0, 0, 0, .5);
  animation: bob 5.2s ease-in-out infinite;
  outline: none;
}
.bob.k-envelope { padding: 84px 24px 22px; }
.bob .pin { top: -16px; width: 32px; height: 32px; margin-left: -16px; z-index: 3; filter: drop-shadow(0 3px 2px rgba(0, 0, 0, .4)); }
.bob .sub { margin-top: 8px; font-size: 12px; line-height: 1.4; }
.bob .photo { height: 230px; margin-bottom: 12px; padding: 12px; font-size: 13px; }

.flap {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 72px;
  z-index: 2;
  transform-origin: 50% 0;
  background-color: var(--bg);
  background-image: linear-gradient(rgba(0, 0, 0, .16), rgba(0, 0, 0, .16));
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}
.flap.is-open { transform: rotateX(180deg); }

.msg { margin: 16px 0 0; font-family: var(--f-type); font-size: 15px; line-height: 1.6; white-space: pre-line; }
.fact { margin: 12px 0 0; font-family: var(--f-ui); font-size: 12px; line-height: 1.5; font-style: italic; }

.embed {
  margin-top: 16px;
  height: 352px;
  border-radius: 12px;
  background: rgba(57, 255, 20, .08);
  overflow: hidden;
}
.embed iframe { display: block; width: 100%; height: 100%; border: 0; border-radius: 12px; }

.play {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--poster-pink);
  color: var(--ink);
  font-family: var(--f-ui);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
}
.play:hover { color: var(--ink); filter: brightness(1.08); }
.play svg { width: 16px; height: 16px; fill: var(--ink); }

.hint {
  display: block;
  min-height: 44px;
  margin: 6px 0 -12px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  font-family: var(--f-ui);
  font-size: 11px;
  text-align: left;
}

/* opened Admit-one strip */
.bob.k-strip {
  padding: 18px 12px 16px;
  border-radius: 3px;
  background: var(--ink);
  color: var(--silver);
}
.open-admit { text-align: center; font-family: var(--f-poster); font-weight: 900; font-stretch: 125%; font-size: 22px; line-height: 1; color: var(--poster-pink); }
.open-strip-line { margin: 6px 0 12px; text-align: center; font-family: var(--f-poster); font-weight: 600; font-size: 9px; letter-spacing: .1em; color: var(--silver); }
.poster { display: block; width: 100%; height: auto; aspect-ratio: 840 / 1188; border-radius: 2px; }
.bob.k-strip .hint { margin-bottom: -10px; text-align: center; width: 100%; }

/* ---------- Keyframes ---------- */
@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-.7deg); }
  50% { transform: translateY(-8px) rotate(.7deg); }
}
@keyframes tw {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .3; transform: scale(.65); }
}

/* ---------- Tablet & desktop ---------- */
@media (min-width: 768px) {
  :root { --header-h: 96px; }
  body { background: var(--black); }

  .topbar { padding-left: 48px; padding-right: 48px; }
  .title { flex-basis: 560px; font-size: 24px; }

  .is-intro .title {
    top: 33vh;
    top: 33dvh;
    width: min(1100px, 100vw - 80px);
    font-size: min(100px, 7.4vw, 10dvh);
  }
  .intro-tally { bottom: calc(204px + env(safe-area-inset-bottom)); font-size: 30px; }
  .intro-hint { bottom: calc(96px + env(safe-area-inset-bottom)); font-size: 16px; }

  .only-phone { display: none; }
  .only-wide { display: block; }

  .scroller {
    --scroll-pad-top: 28px;
    padding: var(--scroll-pad-top) 24px 48px;
    background: var(--black);
  }
  .board {
    max-width: 1180px;
    margin: 0 auto;
    border: 14px solid var(--silver);
    border-radius: 10px;
    min-height: 0;
    box-shadow: 0 0 70px rgba(244, 50, 106, .45);
  }
  .board-stars { overflow: hidden; border-radius: 0; }
  .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 34px 24px;
    padding: 38px 28px 44px;
  }

  .fly { max-width: 460px; }
  .fly.is-strip { max-width: 420px; }
}
@media (min-width: 940px) {
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 1100px) {
  .scroller { --scroll-pad-top: 36px; padding: var(--scroll-pad-top) 48px 56px; }
  .grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 36px 28px;
    padding: 42px 36px 48px;
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .note, .intro, .counter, .bar, .strike { transition: none !important; }
  .is svg, .bob { animation: none !important; }
  .calum img { transition: none; scale: 1; }
  .note:hover, .note:active { translate: none; scale: none; }
}
