:root {
  --ink: #0b0f17;
  --ink-2: #121826;
  --silver: #d9dde3;
  --silver-hi: #ffffff;
  --silver-lo: #8a929e;
  --muted: #9aa3b0;
  --ok: #7fd49a;
  --err: #ff8a80;
  --band-pad: clamp(8px, 1.25vh, 16px);   /* equal top/bottom padding for title and logo bands */

  /* Brushed-silver bands (title + logos) for the Silver Jubilee theme */
  --plate: linear-gradient(180deg, #f7f8fa 0%, #dde1e6 38%, #c3c8cf 52%, #d9dde2 70%, #eef0f3 100%);
  --brush: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0 2px, rgba(0, 0, 0, 0.025) 2px 3px);
  --engrave: #14213d;
  --engrave-soft: #3b4863;

  --army: #3d4a2c;
  --airforce: #2c5a8a;
  --navy: #13284a;
}

* { box-sizing: border-box; margin: 0; }

html, body { height: 100%; }

body {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--ink);
  color: var(--silver);
  font-family: Inter, system-ui, sans-serif;
  /* Tablet kiosk: no double-tap zoom, text selection or long-press menus. */
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* ---- Title ---- */
.masthead {
  padding: calc(var(--band-pad) + env(safe-area-inset-top)) 24px var(--band-pad);
  text-align: center;
  position: relative;
  z-index: 1;
  background: var(--brush), var(--plate);
  border-bottom: 1px solid #8a929e;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}

.org {
  font-family: Cinzel, Georgia, serif;
  font-weight: 600;
  font-size: clamp(1rem, 2vw, 1.5rem);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--engrave-soft);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
  margin-bottom: 8px;
}

h1 {
  font-family: Cinzel, Georgia, serif;
  font-weight: 900;
  font-size: clamp(2rem, 4.4vw, 3.6rem);
  letter-spacing: 0.04em;
  line-height: 1.1;
  text-transform: uppercase;
  color: var(--engrave);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.85), 0 -1px 0 rgba(0, 0, 0, 0.15);   /* engraved */
}

/* ---- Photo collage (drawn by collage.js) ---- */
.stage {
  position: relative;
  min-height: 0;
  /* Dark stage with a faint dot texture that shows through the gutters. */
  background:
    radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1.6px) 0 0 / 14px 14px,
    radial-gradient(ellipse at center, #141b2a 0%, var(--ink) 75%);
}

.collage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* ---- Centre play button ---- */
.trigger {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.trigger__wrap {
  --size: clamp(240px, 46vmin, 500px);   /* collage.js sets the exact size from the stage */
  position: relative;
  display: grid;
  place-items: center;
  width: var(--size);
  height: var(--size);
  flex-shrink: 0;
}

.trigger__wrap > span {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

/* Breathing light behind the button */
.trigger__glow {
  inset: -16%;
  background: radial-gradient(circle, transparent 48%, rgba(214, 226, 255, 0.22) 56%, transparent 72%);   /* halo around the rim only, not over the photo */
  animation: breathe 3.2s ease-in-out infinite;
}

/* Slow outward ripples */
.trigger__ripple {
  inset: 0;
  border: 2px solid rgba(255, 255, 255, 0.5);
  animation: ripple 3.2s cubic-bezier(0.2, 0.6, 0.3, 1) infinite;
}
.trigger__ripple--late { animation-delay: 1.6s; }

/* Faint track with a bright silver-gold comet sweeping round it */
.trigger__ring {
  inset: -14px;
  background: conic-gradient(from 0deg,
    rgba(255, 255, 255, 0.12) 0 55%,
    rgba(255, 255, 255, 0.35) 68%,
    #ffffff 80%,
    #f1dca6 85%,
    rgba(255, 255, 255, 0.12) 93%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
  animation: spin 3.6s linear infinite;
}

/* One-shot burst when pressed */
.trigger__shock {
  inset: 0;
  border: 3px solid #ffffff;
  opacity: 0;
}
.trigger.is-firing .trigger__shock { animation: shock 0.9s cubic-bezier(0.1, 0.7, 0.3, 1); }
.trigger.is-firing .trigger__btn { animation: flash 0.6s ease-out; }

.trigger__btn {
  pointer-events: auto;
  position: absolute;            /* pinned to the wrap's square so it can never stretch */
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.9);
  padding: 0;
  cursor: pointer;
  color: var(--silver-hi);
  /* Clear glass: the photo shows through, only the rim is shaded like a lens edge. */
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.04) 62%, rgba(11, 15, 23, 0.28) 100%),
    var(--photo, none) center / cover;
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.3),
    inset 0 0 28px rgba(255, 255, 255, 0.12),
    inset 0 2px 0 rgba(255, 255, 255, 0.35);
  transition: transform 160ms ease-out, border-color 200ms ease-out, color 200ms ease-out;
  -webkit-tap-highlight-color: transparent;
}

/* Glass sheen across the top */
.trigger__btn::before {
  content: "";
  position: absolute;
  inset: 3% 12% 50%;
  border-radius: 50% 50% 45% 45% / 70% 70% 30% 30%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.trigger__icon {
  height: 84%;
  width: auto;
  aspect-ratio: 29 / 33;
  transform: translateX(9%);     /* optical centring: the triangle's mass sits left */
  fill: currentColor;
  stroke: currentColor;          /* same-colour stroke rounds the corners */
  stroke-width: 3;
  stroke-linejoin: round;
  opacity: 0.55;                 /* see-through so the photo stays visible behind it */
  filter: drop-shadow(0 0 16px rgba(255, 255, 255, 0.5)) drop-shadow(0 3px 8px rgba(0, 0, 0, 0.35));
}

.trigger__btn:active { transform: scale(0.95); }
.trigger__btn:focus-visible { outline: 3px solid var(--silver-hi); outline-offset: 20px; }

.trigger__btn[data-state="sending"] { cursor: progress; }
.trigger__wrap:has([data-state="sending"]) .trigger__ring { animation-duration: 0.8s; }
.trigger__btn[data-state="error"] { border-color: var(--err); color: var(--err); }

.trigger__label {
  position: absolute;
  top: calc(100% + 34px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  padding: 6px 20px;
  border-radius: 999px;
  background: rgba(11, 15, 23, 0.75);
  font-family: Cinzel, Georgia, serif;
  font-weight: 600;
  font-size: clamp(1.1rem, 2.6vmin, 1.6rem);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--silver-hi);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8);
}

.trigger__status {
  position: absolute;
  top: calc(100% + 90px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  padding: 4px 14px;
  border-radius: 999px;
  background: rgba(11, 15, 23, 0.8);
  font-size: 1rem;
  color: var(--silver);
}
.trigger__status:empty { display: none; }
.trigger__status[data-tone="ok"] { color: var(--ok); }
.trigger__status[data-tone="err"] { color: var(--err); }

@keyframes spin    { to { transform: rotate(1turn); } }
@keyframes breathe { 0%, 100% { opacity: 0.55; transform: scale(0.96); } 50% { opacity: 1; transform: scale(1.04); } }
@keyframes ripple  { 0% { transform: scale(1); opacity: 0.6; } 100% { transform: scale(1.3); opacity: 0; } }
@keyframes shock   { 0% { transform: scale(1); opacity: 1; } 100% { transform: scale(2.2); opacity: 0; } }
@keyframes flash   {
  0%   { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.9), inset 0 0 120px rgba(255, 255, 255, 0.6); }
  100% { box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3), inset 0 0 28px rgba(255, 255, 255, 0.12); }
}

/* ---- "The screening begins" title card ---- */
.curtain {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 2.5vh, 28px);
  padding: 24px;
  text-align: center;
  background: radial-gradient(ellipse at center, #1a2233 0%, #05070b 70%);
  animation: curtain-in 0.8s ease-out both;
}
.curtain[hidden] { display: none; }
.curtain.is-leaving { animation: curtain-out 0.8s ease-in both; }

.curtain__eyebrow {
  font-family: Cinzel, Georgia, serif;
  font-weight: 600;
  font-size: clamp(1rem, 2vw, 1.5rem);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
  animation: rise 1s ease-out 0.2s both;
}

.curtain__title {
  font-family: Cinzel, Georgia, serif;
  font-weight: 900;
  font-size: clamp(2.6rem, 7vw, 5.8rem);
  line-height: 1.1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: linear-gradient(100deg, #8a929e 20%, #ffffff 42%, #f1dca6 50%, #ffffff 58%, #8a929e 80%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: rise 1s ease-out 0.35s both, sheen 3s ease-in-out 1s infinite;
}

.curtain__rule {
  height: 2px;
  width: min(40vw, 480px);
  background: linear-gradient(90deg, transparent, #f1dca6, #ffffff, #f1dca6, transparent);
  animation: grow 1.2s ease-out 0.6s both;
}

@keyframes curtain-in  { from { opacity: 0; } to { opacity: 1; } }
@keyframes curtain-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes rise  { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes sheen { from { background-position: 100% 0; } to { background-position: 0% 0; } }
@keyframes grow  { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ---- Logos ---- */
.emblems {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: clamp(36px, 7vw, 96px);
  padding: var(--band-pad) 24px calc(var(--band-pad) + env(safe-area-inset-bottom));
  position: relative;
  z-index: 1;
  background: var(--brush), var(--plate);
  border-top: 1px solid #8a929e;
  box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.45);
}

.emblems img,
.emblem-fallback {
  height: clamp(90px, 12.5vh, 160px);
  width: auto;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.3));
}

.emblem-fallback {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--engrave-soft);
  font-family: Cinzel, Georgia, serif;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  color: var(--engrave);
}

/* ---- Tablet landscape (~800-1024px tall): keep the title and logos compact ---- */
@media (orientation: landscape) and (max-height: 900px) {
  .org { margin-bottom: 4px; }
  h1 { font-size: clamp(1.8rem, 3.6vw, 3rem); }
}

@media (prefers-reduced-motion: reduce) {
  .trigger__glow, .trigger__ripple, .trigger__ring, .trigger__shock, .trigger__btn,
  .curtain, .curtain * { animation: none !important; transition: none; }
  .trigger__ripple { opacity: 0; }
}
