/* Mame.mu — coming soon, "mass hero intro" title-card version (yellow) */

:root {
  --yellow: #ffcc00;
  --ink: #111111;
  --muted: #3b2a00;
  --bar: 9vh; /* letterbox bar height once the intro starts */
  /* Punch line sizes: by width, capped by height so short screens still fit. */
  --l1: min(clamp(2rem, 1.1rem + 4.2vw, 4.8rem), 7.5vh);
  --l2: min(clamp(1.35rem, 0.8rem + 2.6vw, 3rem), 4.6vh);
  --ease-slam: cubic-bezier(0.2, 0.9, 0.25, 1.15);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  background: var(--yellow);
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  color: var(--ink);
  font-family: Inter, system-ui, sans-serif;
  background: radial-gradient(ellipse at 50% 50%, #ffe066 0%, var(--yellow) 45%, #ffb800 100%);
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Atmosphere layers ---------- */

.fx,
.glow,
.vignette,
.grain,
.flash {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

/* Full-screen sunburst: a square larger than the viewport's diagonal, so the
   corners stay covered while it turns. */
.rays {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 0;
  width: 160vmax;
  height: 160vmax;
  margin: -80vmax 0 0 -80vmax;
  pointer-events: none;
  opacity: 0;
  background: repeating-conic-gradient(
    from 0deg at 50% 50%,
    rgba(255, 255, 255, 0) 0deg,
    rgba(255, 255, 255, 0.26) 7.5deg,
    rgba(255, 255, 255, 0) 15deg
  );
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 0%, rgba(0, 0, 0, 0.45) 35%, rgba(0, 0, 0, 0.15) 60%);
  mask-image: radial-gradient(circle at 50% 50%, #000 0%, rgba(0, 0, 0, 0.45) 35%, rgba(0, 0, 0, 0.15) 60%);
  transition: opacity 1.2s ease;
  animation: rays-spin 60s linear infinite;
}

[data-stage="intro"] .rays { opacity: 0.35; }
[data-stage="slam"] .rays { opacity: 0.6; }
[data-stage="title"] .rays,
[data-stage="cards"] .rays,
[data-stage="finale"] .rays { opacity: 1; }

.glow {
  z-index: 0;
  opacity: 0;
  background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0) 55%);
}

.fx {
  z-index: 1;
  width: 100%;
  height: 100%;
}

.vignette {
  z-index: 2;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(170, 80, 0, 0.35) 100%);
}

.grain {
  z-index: 3;
  opacity: 0.06;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 0.5s steps(4) infinite;
}

.flash {
  z-index: 20;
  opacity: 0;
  background: #fff;
}

.flash.is-on {
  animation: flash 900ms ease-out;
}

.letterbox {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 15;
  height: 0;
  background: #000;
  transition: height 1.4s var(--ease);
}

.letterbox.top { top: 0; }
.letterbox.bottom { bottom: 0; }

body:not([data-stage="gate"]) .letterbox {
  height: var(--bar);
}

/* ---------- Song progress, just above the bottom bar ---------- */

/* --p (0 to 1) is set by cinema.js every frame. */
.progress {
  --p: 0;
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--bar);
  z-index: 16;
  height: 4px;
  background: rgba(0, 0, 0, 0.22);
  opacity: 0;
  pointer-events: none;
  transition: bottom 1.4s var(--ease), opacity 600ms ease;
}

body:not([data-stage="gate"]) .progress {
  opacity: 1;
}

.progress-fill {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: linear-gradient(90deg, #8a2b00, #e14d00 55%, #ff8a00 85%, #fff2b3);
  box-shadow: 0 0 6px rgba(255, 106, 0, 0.9), 0 0 16px rgba(255, 140, 0, 0.55);
  transform: scaleX(var(--p));
  transform-origin: left;
}

/* A light sweep running along the filled part. */
.progress-fill::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 25%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.85), transparent);
  animation: progress-sheen 2.4s linear infinite;
}

/* The glowing tip; full width is 100vw, so it can follow --p with a translate. */
.progress-head {
  position: absolute;
  top: 50%;
  left: -7px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0 30%, #ffe27a 45%, rgba(255, 138, 0, 0.6) 70%, transparent 72%);
  box-shadow: 0 0 10px 3px rgba(255, 200, 60, 0.9), 0 0 26px 8px rgba(255, 106, 0, 0.55);
  transform: translate(calc(var(--p) * 100vw), -50%);
}

.progress-head::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: rgba(255, 245, 200, 0.7);
  opacity: 0;
}

.beat-a .progress-head::after { animation: progress-beat-a 380ms ease-out; }
.beat-b .progress-head::after { animation: progress-beat-b 380ms ease-out; }

/* Song over: the bar stays full and glows on its own. */
[data-stage="finale"] .progress-fill {
  animation: progress-done 2.8s ease-in-out infinite alternate;
}

@keyframes progress-sheen {
  from { transform: translateX(-100%); }
  to { transform: translateX(400%); }
}

@keyframes progress-beat-a {
  from { opacity: 1; transform: scale(1.6); }
  to { opacity: 0; transform: scale(2.6); }
}

@keyframes progress-beat-b {
  from { opacity: 1; transform: scale(1.6); }
  to { opacity: 0; transform: scale(2.6); }
}

@keyframes progress-done {
  from { box-shadow: 0 0 6px rgba(255, 106, 0, 0.9), 0 0 16px rgba(255, 140, 0, 0.55); }
  to { box-shadow: 0 0 10px rgba(255, 170, 0, 1), 0 0 30px rgba(255, 106, 0, 0.8); }
}

/* ---------- Beat pulse (every beat after the drop) ---------- */

.beat-a .glow { animation: beat-glow-a 380ms ease-out; }
.beat-b .glow { animation: beat-glow-b 380ms ease-out; }
.beat-a .title img,
.beat-a .soon span,
.beat-a .code { animation: thump-a 300ms ease-out; }
.beat-b .title img,
.beat-b .soon span,
.beat-b .code { animation: thump-b 300ms ease-out; }

/* ---------- Screen and stages ---------- */

.screen {
  position: relative;
  z-index: 5;
  overflow: hidden; /* the waiting logo is scaled up: keep it from widening the page */
  width: 100%;
  height: 100vh;
  height: 100svh;
}

.screen.is-shaking {
  animation: shake 420ms cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

.gate,
.presents,
.slam,
.title,
.card,
.release {
  position: absolute;
  left: 50%;
  margin: 0;
  text-align: center;
  pointer-events: none; /* layered on top of each other; only the gate is clickable */
}

/* Gate */
.gate {
  top: 50%;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  transition: opacity 600ms ease, transform 800ms var(--ease);
}

body:not([data-stage="gate"]) .gate {
  opacity: 0;
  transform: translate(-50%, -50%) scale(1.3);
  pointer-events: none;
}

.gate-kicker,
.gate-hint {
  margin: 0;
  font-family: Cinzel, Georgia, serif;
  font-weight: 800;
  letter-spacing: 0.4em;
  text-transform: uppercase;
}

.gate-kicker {
  font-size: 1rem;
}

.gate-hint {
  color: var(--muted);
  font-size: 0.75rem;
}

.play {
  position: relative;
  display: grid;
  place-items: center;
  width: 112px;
  height: 112px;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 10px 30px rgba(120, 60, 0, 0.35), 0 0 0 6px rgba(255, 255, 255, 0.35);
  cursor: pointer;
  transition: transform 200ms var(--ease), box-shadow 200ms ease;
}

.play:hover,
.play:focus-visible {
  transform: scale(1.06);
  box-shadow: 0 14px 40px rgba(120, 60, 0, 0.45), 0 0 0 10px rgba(255, 255, 255, 0.5);
}

.play:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 12px;
}

.play-icon {
  width: 0;
  height: 0;
  margin-left: 8px;
  border-style: solid;
  border-width: 18px 0 18px 30px;
  border-color: transparent transparent transparent var(--yellow);
}

.play-ring {
  position: absolute;
  inset: -10px;
  border: 2px solid rgba(17, 17, 17, 0.5);
  border-radius: 50%;
  animation: ring 2s ease-out infinite;
}

/* "Mame.mu presents" (each word lands on its own hit) */
.presents {
  top: 50%;
  width: 90%;
  transform: translate(-50%, -50%);
  font-family: Cinzel, Georgia, serif;
  font-weight: 800;
  font-size: clamp(1rem, 0.75rem + 1.2vw, 1.8rem);
  letter-spacing: 0.45em;
  text-transform: uppercase;
  transition: opacity 600ms ease;
}

.presents span {
  display: inline-block;
  opacity: 0;
}

.presents .is-in {
  animation: presents-in 900ms var(--ease) both;
}

.presents-word {
  color: var(--muted);
}

body:not([data-stage="intro"]) .presents {
  opacity: 0;
}

/* M · A · M · E slams */
.slam {
  top: 50%;
  display: flex;
  gap: 0.06em;
  transform: translate(-50%, -50%);
  font-family: Anton, Impact, sans-serif;
  font-size: clamp(5rem, 22vw, 16rem);
  line-height: 1;
  visibility: hidden;
}

[data-stage="slam"] .slam {
  visibility: visible;
}

.slam span {
  opacity: 0;
}

.slam span.is-in {
  animation: slam-in 380ms var(--ease-slam) both;
}

.slam span,
.line1,
.line2 {
  color: var(--ink);
  text-shadow: 0 0.06em 0.3em rgba(150, 75, 0, 0.25);
}

/* Logo title */
.title {
  top: 50%;
  z-index: 6;
  width: clamp(260px, 64vw, 780px);
  line-height: 0;
  opacity: 0;
  transform: translate(-50%, -50%) scale(1.6);
  transition:
    top 1.1s var(--ease),
    width 1.1s var(--ease),
    transform 1.1s var(--ease),
    opacity 400ms ease;
}

.title img {
  display: block;
  width: 100%;
  height: auto;
  mix-blend-mode: multiply; /* the logo file has a white background */
}

.flare {
  position: absolute;
  top: -20%;
  bottom: -20%;
  left: -30%;
  width: 30%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.9), transparent);
  transform: skewX(-18deg) translateX(-100%);
  opacity: 0;
}

[data-stage="title"] .title,
[data-stage="cards"] .title {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

[data-stage="title"] .flare {
  animation: flare 1.4s ease-in-out 0.4s both;
}

[data-stage="cards"] .title {
  top: calc(var(--bar) + clamp(2.4rem, 8vh, 5rem));
  width: clamp(170px, 28vw, 330px);
}

/* Punch-dialogue cards */
.card {
  top: 49%;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(94vw, 62rem);
  opacity: 0;
  transform: translate(-50%, -50%);
}

[data-stage="cards"] .card {
  opacity: 1;
}

.card-art {
  width: clamp(80px, 14vh, 136px);
  height: clamp(80px, 14vh, 136px);
  margin-bottom: clamp(0.4rem, 1.6vh, 1rem);
  opacity: 0;
}

.card-art .il {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.lines {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.line1,
.line2 {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 18ch;
  margin: 0;
  font-family: Anton, Impact, sans-serif;
  font-weight: 400;
  line-height: 1.04;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-wrap: balance;
}

/* Two lines reserved for each, so nothing jumps between cards or languages. */
.line1 {
  min-height: 2.15em;
  font-size: var(--l1);
}

.line2 {
  max-width: 26ch;
  min-height: 2.15em;
  margin-top: 0.35em;
  font-size: var(--l2);
  opacity: 0;
}

/* Tamil has no capitals and taller glyphs: its own face and sizes, keeping
   the same reserved heights as the Latin lines. */
.lines[lang="ta"] .line1,
.lines[lang="ta"] .line2 {
  max-width: 22ch;
  font-family: Catamaran, "Noto Sans Tamil", sans-serif;
  font-weight: 900;
  line-height: 1.3;
  letter-spacing: 0;
}

.lines[lang="ta"] .line1 {
  min-height: calc(var(--l1) * 2.15);
  font-size: calc(var(--l1) * 0.75);
}

.lines[lang="ta"] .line2 {
  max-width: 32ch;
  min-height: calc(var(--l2) * 2.15);
  font-size: calc(var(--l2) * 0.78);
}

/* Card enters: illustration, then the punch line lands, then the subtitle. */
.card.is-in .card-art {
  animation: art-in 700ms var(--ease) both;
}

.lines.is-in .line1 {
  animation: punch-in 480ms var(--ease-slam) both;
}

/* Line 2 lands on its own beat. */
.lines.show-2 .line2 {
  animation: punch-in 480ms var(--ease-slam) both;
}

/* Language switch and card exit share the same quick blur-out. */
.lines.is-out,
.card.is-out .card-art,
.card.is-out .lines {
  opacity: 0;
  transform: translateY(-14px) scale(1.04);
  filter: blur(6px);
  transition: opacity 200ms ease, transform 200ms ease, filter 200ms ease;
}

/* Bottom block: "Coming Soon", release date and 5129 (plus the countdown in the finale) */
.release {
  bottom: calc(var(--bar) + clamp(0.75rem, 3vh, 2rem));
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0;
  transform: translate(-50%, 20px);
  transition: opacity 900ms ease 600ms, transform 900ms var(--ease) 600ms;
  white-space: nowrap;
}

[data-stage="cards"] .release,
[data-stage="finale"] .release {
  opacity: 1;
  transform: translate(-50%, 0);
}

.soon {
  margin: 0;
}

.soon span {
  display: inline-block;
  padding: 0.55em 1.3em 0.55em 1.7em;
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  font-family: Cinzel, Georgia, serif;
  font-weight: 800;
  font-size: clamp(0.8rem, 0.7rem + 0.6vw, 1.2rem);
  letter-spacing: 0.4em;
  text-transform: uppercase;
}

.date {
  display: flex;
  align-items: center;
  gap: 0.8em;
  margin: 0.75rem 0 0;
  font-family: Cinzel, Georgia, serif;
  font-weight: 800;
  font-size: clamp(0.85rem, 0.75rem + 0.5vw, 1.15rem);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

/* 5129: the emphasised number, a black stamp that thumps on the beat. */
.code {
  display: inline-block;
  padding: 0.12em 0.45em 0.08em;
  border-radius: 6px;
  background: var(--ink);
  color: var(--yellow);
  font-family: Anton, Impact, sans-serif;
  font-weight: 400;
  font-size: 1.7em;
  line-height: 1.1;
  letter-spacing: 0.08em;
  box-shadow: 0 6px 18px rgba(120, 60, 0, 0.3);
  rotate: -3deg;
}

/* Finale: when the song ends, the logo grows and a countdown takes over. */
.finale {
  display: none;
  flex-direction: column;
  align-items: center;
}

[data-stage="finale"] .finale {
  display: flex;
  animation: finale-in 1.2s var(--ease) 0.6s both;
}

[data-stage="finale"] .soon {
  display: none;
}

.finale-tag {
  margin: 0;
  font-family: Anton, Impact, sans-serif;
  font-size: min(clamp(1.5rem, 1rem + 2.4vw, 2.8rem), 5.5vh);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: 0 0.06em 0.3em rgba(150, 75, 0, 0.25);
}

.countdown {
  display: flex;
  align-items: flex-start;
  gap: clamp(0.25rem, 1vw, 1rem);
  margin: 0.5rem 0 0.2rem;
}

.cd-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cd-num,
.cd-sep {
  font-family: Inter, system-ui, sans-serif;
  font-weight: 500;
  font-size: min(clamp(2.1rem, 1rem + 5vw, 5rem), 10vh);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.cd-num {
  display: inline-block;
  letter-spacing: 0.04em;
}

.cd-num.tick {
  animation: tick 450ms ease-out;
}

.cd-sep {
  opacity: 0.55;
  translate: 0 -0.06em;
}

.cd-label {
  margin-top: 0.45em;
  font-size: clamp(0.55rem, 0.5rem + 0.3vw, 0.8rem);
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

/* Bigger and centred, slower than the other logo moves for weight. */
[data-stage="finale"] .title {
  top: 36%;
  width: min(86vw, 1000px, 95vh);
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  transition-duration: 1.8s;
}

[data-stage="finale"] .title img {
  animation: breathe 4s ease-in-out 2s infinite alternate;
}

/* Corner controls, sitting in the bottom letterbox bar */
.mute,
.replay {
  position: fixed;
  z-index: 30;
  bottom: calc(var(--bar) * 0.5 - 18px);
  border: 1px solid rgba(255, 204, 0, 0.6);
  background: transparent;
  color: var(--yellow);
  cursor: pointer;
  transition: background 200ms ease;
}

.mute:hover,
.replay:hover,
.mute:focus-visible,
.replay:focus-visible {
  background: rgba(255, 204, 0, 0.18);
  outline: none;
}

.mute {
  right: 16px;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
}

.mute svg {
  display: block;
  width: 18px;
  height: 18px;
  margin: auto;
}

.mute .mute-off,
.mute[aria-pressed="true"] .mute-on {
  display: none;
}

.mute[aria-pressed="true"] .mute-off {
  display: block;
}

.replay {
  left: 16px;
  height: 36px;
  padding: 0 1rem;
  border-radius: 18px;
  font-family: Cinzel, Georgia, serif;
  font-weight: 600;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

/* No JavaScript: show the end card straight away. */
.no-js .gate,
.no-js .card-art {
  display: none;
}
.no-js .line2 {
  opacity: 1;
}
.no-js .title,
.no-js .card,
.no-js .release {
  opacity: 1;
}
.no-js .title {
  top: 18%;
  width: clamp(170px, 28vw, 330px);
  transform: translate(-50%, -50%);
}
.no-js .rays {
  opacity: 1;
}

/* Paused (tab hidden or popup open): freeze everything except the popup. */
.is-paused body > :not(.join-dialog),
.is-paused body > :not(.join-dialog) * {
  animation-play-state: paused !important;
}

/* ---------- Keyframes ---------- */

@keyframes rays-spin {
  to { transform: rotate(360deg); }
}
@keyframes grain {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-3%, 2%); }
  50% { transform: translate(2%, -3%); }
  75% { transform: translate(-2%, -1%); }
}
@keyframes flash {
  0% { opacity: 0; }
  8% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes ring {
  from { opacity: 1; transform: scale(0.9); }
  to { opacity: 0; transform: scale(1.5); }
}
@keyframes presents-in {
  0% { opacity: 0; transform: scale(1.8); filter: blur(8px); }
  60% { opacity: 1; transform: scale(0.97); filter: blur(0); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes slam-in {
  0% { opacity: 0; transform: scale(3.2) translateY(-10%); filter: blur(10px); }
  70% { opacity: 1; transform: scale(0.94); filter: blur(0); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes flare {
  0% { opacity: 0; transform: skewX(-18deg) translateX(-100%); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: skewX(-18deg) translateX(520%); }
}
@keyframes art-in {
  from { opacity: 0; transform: scale(0.6) rotate(-8deg); }
  to { opacity: 1; transform: none; }
}
@keyframes punch-in {
  0% { opacity: 0; transform: scale(1.9); filter: blur(10px); }
  70% { opacity: 1; transform: scale(0.97); filter: blur(0); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes shake {
  10%, 90% { transform: translate(-2px, 1px); }
  20%, 80% { transform: translate(5px, -3px); }
  30%, 50%, 70% { transform: translate(-8px, 4px); }
  40%, 60% { transform: translate(8px, -4px); }
}
/* Two copies of each beat animation: alternating between them restarts it. */
@keyframes beat-glow-a {
  from { opacity: 0.55; }
  to { opacity: 0; }
}
@keyframes beat-glow-b {
  from { opacity: 0.55; }
  to { opacity: 0; }
}
@keyframes finale-in {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: none; }
}
@keyframes tick {
  from { transform: scale(1.12); }
  to { transform: scale(1); }
}
@keyframes breathe {
  from { transform: scale(1); }
  to { transform: scale(1.04); }
}
@keyframes thump-a {
  from { transform: scale(1.035); }
  to { transform: scale(1); }
}
@keyframes thump-b {
  from { transform: scale(1.035); }
  to { transform: scale(1); }
}

/* ---------- Small screens ---------- */

@media (max-width: 600px) {
  :root {
    --bar: 7vh;
  }
  .gate-kicker,
  .presents {
    letter-spacing: 0.25em;
  }
  .soon span {
    letter-spacing: 0.3em;
  }
}

@media (max-height: 760px) and (min-width: 601px) {
  .card-art {
    width: 10vh;
    height: 10vh;
  }
}

@media (max-height: 560px) {
  .card-art {
    display: none;
  }
}

/* ---------- Reduced motion: no shake, sparks, zooms or spinning ---------- */

@media (prefers-reduced-motion: reduce) {
  .rays,
  .grain,
  .play-ring,
  .glow,
  .title img,
  .soon span,
  .code,
  .cd-num,
  .finale,
  .progress-fill,
  .progress-fill::after,
  .progress-head::after {
    animation: none !important;
  }
  .screen.is-shaking {
    animation: none;
  }
  .slam span.is-in,
  .presents .is-in,
  .card.is-in .card-art,
  .lines.is-in .line1,
  .lines.show-2 .line2 {
    animation-name: fade-only !important;
  }
  .lines.is-out,
  .card.is-out .card-art,
  .card.is-out .lines {
    transform: none;
    filter: none;
  }
}

@keyframes fade-only {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---------- "Join us" button and popup ---------- */

.join {
  position: fixed;
  z-index: 30;
  bottom: calc(var(--bar) * 0.5 - 20px);
  left: 50%;
  height: 40px;
  padding: 0 1.2rem;
  border: 0;
  border-radius: 20px;
  background: var(--yellow);
  color: var(--ink);
  font-family: Inter, system-ui, sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
  cursor: pointer;
  translate: -50% 0;
  box-shadow: 0 0 0 0 rgba(255, 204, 0, 0.6);
  animation: join-glow 2.4s ease-out infinite;
  transition: transform 200ms var(--ease);
}

.join:hover,
.join:focus-visible {
  transform: scale(1.05);
  outline: none;
}

.join:focus-visible {
  box-shadow: 0 0 0 3px #000, 0 0 0 5px var(--yellow);
}

.join-ta {
  font-family: Catamaran, "Noto Sans Tamil", sans-serif;
  font-weight: 700;
}

.join-dialog {
  width: min(30rem, calc(100vw - 32px));
  max-height: calc(100svh - 32px);
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: 18px;
  background: #fffaf0;
  color: var(--ink);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}

.join-dialog[open] {
  animation: dialog-in 420ms var(--ease-slam);
}

.join-dialog::backdrop {
  background: rgba(10, 6, 0, 0.6);
  backdrop-filter: blur(3px);
}

.join-dialog [hidden] {
  display: none !important;
}

.join-form,
.join-thanks {
  position: relative;
  padding: 1.6rem 1.4rem 1.4rem;
}

.join-close {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.join-close:hover,
.join-close:focus-visible {
  background: rgba(17, 17, 17, 0.08);
}

.join-title {
  margin: 0 0 1.1rem;
  font-family: Catamaran, "Noto Sans Tamil", sans-serif;
  font-weight: 900;
  font-size: 1.6rem;
  line-height: 1.2;
}

.join-title small {
  display: block;
  font-family: Anton, Impact, sans-serif;
  font-weight: 400;
  font-size: 0.95rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.join-group {
  margin: 0 0 1rem;
  padding: 0;
  border: 0;
}

.join-group legend {
  margin-bottom: 0.5rem;
  padding: 0;
  font-weight: 700;
  font-size: 0.85rem;
}

.join-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.join-choice,
.join-segment label {
  position: relative;
  cursor: pointer;
}

.join-choice input,
.join-segment input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.join-choice span {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  height: 100%;
  padding: 0.8rem 0.9rem;
  border: 2px solid rgba(17, 17, 17, 0.18);
  border-radius: 12px;
  background: #fff;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.join-choice strong {
  font-family: Anton, Impact, sans-serif;
  font-weight: 400;
  font-size: 1.15rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.join-choice small {
  font-size: 0.78rem;
  color: #5a4a20;
}

.join-choice input:checked + span {
  border-color: var(--ink);
  background: var(--yellow);
  transform: scale(1.02);
}

.join-segment {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.08);
}

.join-segment span {
  display: block;
  padding: 0.4rem 0.95rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
}

.join-segment input:checked + span {
  background: var(--ink);
  color: var(--yellow);
}

.join-choice input:focus-visible + span,
.join-segment input:focus-visible + span {
  outline: 3px solid #2f6bff;
  outline-offset: 2px;
}

.join-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.8rem;
  font-size: 0.85rem;
  font-weight: 700;
}

.join-field em {
  font-style: normal;
  font-weight: 400;
  color: #6b5a2a;
}

.join-field input,
.join-field textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 2px solid rgba(17, 17, 17, 0.18);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: 500 1rem Inter, system-ui, sans-serif;
  resize: vertical;
}

.join-field input:focus,
.join-field textarea:focus {
  border-color: var(--ink);
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 204, 0, 0.6);
}

.join-field [aria-invalid="true"] {
  border-color: #c62828;
}

.join-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.join-consent {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 0.3rem 0 0.4rem;
  font-size: 0.82rem;
  line-height: 1.4;
  cursor: pointer;
}

.join-consent input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 0.1rem 0 0;
  accent-color: var(--ink);
}

.join-error {
  margin: 0.3rem 0 0;
  color: #c62828;
  font-size: 0.8rem;
  font-weight: 500;
}

.join-form-error {
  margin-top: 0.6rem;
}

.join-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 1rem;
}

.join-cancel,
.join-send {
  height: 44px;
  padding: 0 1.3rem;
  border-radius: 22px;
  font: 700 0.9rem Inter, system-ui, sans-serif;
  cursor: pointer;
}

.join-cancel {
  border: 2px solid rgba(17, 17, 17, 0.2);
  background: transparent;
  color: var(--ink);
}

.join-send {
  border: 0;
  background: var(--ink);
  color: var(--yellow);
}

.join-send[disabled] {
  opacity: 0.6;
  cursor: progress;
}

.join-cancel:focus-visible,
.join-send:focus-visible {
  outline: 3px solid #2f6bff;
  outline-offset: 2px;
}

/* Thank you: Tamil large, English small. */
.join-thanks {
  padding: 2.4rem 1.6rem 1.8rem;
  text-align: center;
  background: radial-gradient(circle at 50% 30%, #fff3b0, #fffaf0 70%);
}

.join-thanks:not([hidden]) > * {
  animation: punch-in 520ms var(--ease-slam) both;
}

.join-thanks:not([hidden]) > :nth-child(2) { animation-delay: 160ms; }
.join-thanks:not([hidden]) > :nth-child(3) { animation-delay: 300ms; }
.join-thanks:not([hidden]) > :nth-child(4) { animation-delay: 420ms; }

.thanks-big {
  margin: 0;
  font-family: Catamaran, "Noto Sans Tamil", sans-serif;
  font-weight: 900;
  font-size: clamp(3.2rem, 2rem + 6vw, 4.8rem);
  line-height: 1.1;
}

.thanks-ta {
  margin: 0.6rem 0 0;
  font-family: Catamaran, "Noto Sans Tamil", sans-serif;
  font-weight: 700;
  font-size: 1.2rem;
  line-height: 1.45;
}

.thanks-en {
  margin: 0.7rem 0 1.4rem;
  font-size: 0.85rem;
  color: #5a4a20;
}

@keyframes join-glow {
  0% { box-shadow: 0 0 0 0 rgba(255, 204, 0, 0.6); }
  70%, 100% { box-shadow: 0 0 0 12px rgba(255, 204, 0, 0); }
}

@keyframes dialog-in {
  from { opacity: 0; transform: translateY(24px) scale(0.94); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 600px) {
  .hide-sm,
  .join-ta {
    display: none;
  }
  .join-choices {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .join,
  .join-dialog[open],
  .join-thanks > * {
    animation: none !important;
  }
}
