@import url("https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600&family=Fraunces:opsz,wght@9..144,600;9..144,800&display=swap");

/* Ribbon Cutting: one daylight canvas. The DOM only carries the counter, the sound button, the corners, the hint and the subtitle. */
:root {
  --font: "Geist", system-ui, -apple-system, sans-serif;
  --ink: #2a2118;
  --cream: rgba(255, 248, 233, 0.94);
  --gold: #c79a35;
  --gold-hi: #f1d27c;
  --red: #a3121f;
  --ti: env(safe-area-inset-top, 0px);
}
*,*::before,*::after { box-sizing: border-box; }
html, body {
  -webkit-tap-highlight-color: transparent; height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body { font-family: var(--font); color: var(--ink); touch-action: none; background: #a9d3ea; }
canvas#scene {
  display: block; position: fixed; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: none; outline: none;
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none;
}
canvas#scene:focus-visible { outline: 3px dashed rgba(163, 18, 31, 0.85); outline-offset: -6px; }

.bar {
  position: fixed; z-index: 6; left: 50%; top: calc(max(12px, var(--ti)) + 44px); transform: translateX(-50%);
  display: flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
}
.count, .bar .opt-share.opt-share {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; margin: 0; padding: 0 15px; border-radius: 999px;
  font-family: var(--font); font-size: 0.8rem; font-weight: 600; letter-spacing: 0.01em; opacity: 1;
  color: var(--ink); background: var(--cream); border: 1px solid rgba(199, 154, 53, 0.75);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset, 0 6px 16px rgba(60, 40, 10, 0.22);
}
.count__t { font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(42, 33, 24, 0.7); }
.count b { font-variant-numeric: tabular-nums; font-size: 0.95rem; color: var(--red); min-width: 1ch; text-align: right; }
.count.is-bump b { animation: bump 0.5s cubic-bezier(.2, 1.6, .4, 1); display: inline-block; }
@keyframes bump { 0% { transform: scale(1); } 35% { transform: scale(1.5); } 100% { transform: scale(1); } }
.bar .opt-share.opt-share { cursor: pointer; padding: 0 14px; }
.bar .opt-share.opt-share:hover { background: #fff; text-decoration: none; }
.bar .opt-share.opt-share:active { transform: scale(0.96); }
.share-host { display: inline-flex; }
.share-host:empty { display: none; }

.sound-btn {
  appearance: none; position: fixed; z-index: 12; cursor: pointer; padding: 0;
  top: max(12px, var(--ti)); right: max(12px, env(safe-area-inset-right));
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  color: var(--ink); background: var(--cream); border: 1px solid rgba(199, 154, 53, 0.75);
  box-shadow: 0 6px 16px rgba(60, 40, 10, 0.22); transition: transform 0.12s ease, opacity 0.15s ease;
}
.sound-btn:active { transform: scale(0.94); }
.sound-btn[aria-pressed="false"] { opacity: 0.6; }
.sound-btn[aria-pressed="false"] .sound-btn__wave { opacity: 0; }
.sound-btn:focus-visible, .frame__corner a:focus-visible { outline: 2px dashed rgba(163, 18, 31, 0.9); outline-offset: 2px; }

.frame { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
.frame__corner {
  position: absolute; font-size: clamp(0.58rem, 1.2vw, 0.7rem); font-weight: 600; letter-spacing: 0.22em; text-transform: uppercase;
  color: rgba(42, 33, 24, 0.66); white-space: nowrap; font-family: var(--font); text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
}
.frame__corner--tl { top: calc(max(12px, var(--ti)) + 13px); left: max(18px, env(safe-area-inset-left)); }
.frame__corner--tr { top: calc(max(12px, var(--ti)) + 13px); right: calc(max(12px, env(safe-area-inset-right)) + 54px); }
.frame__corner--bl { bottom: max(18px, env(safe-area-inset-bottom)); left: max(18px, env(safe-area-inset-left)); color: rgba(255, 255, 255, 0.82); text-shadow: 0 1px 6px rgba(20, 40, 10, 0.7); }
.frame__corner a { color: inherit; text-decoration: none; pointer-events: auto; border-bottom: 1px solid transparent; transition: color .14s, border-color .14s; }
.frame__corner a:hover { border-bottom-color: rgba(255, 255, 255, 0.7); }

.hint {
  position: fixed; top: calc(max(12px, var(--ti)) + 92px); left: 50%; transform: translateX(-50%);
  width: max-content; max-width: min(92vw, 560px); margin: 0; padding: 5px 13px; border-radius: 999px; text-align: center; z-index: 9; pointer-events: none;
  font-size: 0.64rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; line-height: 1.5;
  color: #2a2118; background: rgba(255, 248, 233, 0.88); border: 1px solid rgba(199, 154, 53, 0.55); box-shadow: 0 4px 12px rgba(60, 40, 10, 0.16); transition: opacity .8s;
}
.hint.is-hidden { opacity: 0; }

/* the dignitary's words, like a caption under a film */
.sub {
  position: fixed; z-index: 8; left: 50%; transform: translateX(-50%); width: min(92vw, 640px);
  bottom: calc(max(18px, env(safe-area-inset-bottom)) + 62px); pointer-events: none;
  padding: 9px 14px 11px; border-radius: 12px; text-align: center;
  background: rgba(24, 18, 12, 0.82); color: #fff6e2; box-shadow: 0 10px 24px rgba(30, 20, 5, 0.35);
  border: 1px solid rgba(241, 210, 124, 0.35);
}
.sub[hidden] { display: none; }
.sub__who { display: block; font-size: 0.56rem; font-weight: 600; letter-spacing: 0.24em; text-transform: uppercase; color: var(--gold-hi); margin-bottom: 3px; }
.sub__t { display: block; font-size: clamp(0.82rem, 2.9vw, 1rem); line-height: 1.42; font-weight: 500; text-wrap: balance; }

.opt-tipjar.opt-tipjar { top: auto; bottom: max(14px, env(safe-area-inset-bottom)); transform: none; }
.opt-fs.opt-fs { top: auto; bottom: max(14px, env(safe-area-inset-bottom)); right: calc(max(14px, env(safe-area-inset-right)) + 54px); transform: none; }
.opt-tipjar.opt-tipjar.tj-nudge { animation: none; }

@media (max-width: 380px) { .count { padding: 0 12px; font-size: 0.74rem; } .count__t { letter-spacing: 0.1em; } }
@media (max-width: 345px) { .count__t { font-size: 0.6rem; } }
@media (min-width: 900px) { .bar { top: max(12px, var(--ti)); } .hint { top: calc(max(12px, var(--ti)) + 54px); } }
/* a phone on its side is short: the counter goes back up between the corner labels */
@media (orientation: landscape) and (max-height: 500px) and (min-width: 760px) {
  .bar { top: max(10px, var(--ti)); }
  .hint { top: calc(max(10px, var(--ti)) + 44px); }
  .sub { bottom: calc(max(10px, env(safe-area-inset-bottom)) + 8px); width: min(70vw, 600px); padding: 6px 12px 8px; }
  .sub__t { font-size: 0.8rem; line-height: 1.32; }
}
@media (prefers-reduced-motion: reduce) { .sound-btn, .hint { transition: none; } .count.is-bump b { animation: none; } }
