/* I Know That Movie: shared styles.
   Look and feel follows the title image: art-deco gold and cream on near-black, ticket stubs. */

@font-face {
  font-family: "Limelight";
  src: url("../fonts/limelight-latin.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Josefin Sans";
  src: url("../fonts/josefinsans-latin.woff2") format("woff2");
  font-weight: 100 700;
  font-display: swap;
}

:root {
  --ink: #0d0b09;
  --panel: #18130e;
  --panel-raised: #221b14;
  --gold: #d4af6a;
  --gold-bright: #f0d48a;
  --gold-dim: #8a7246;
  --cream: #f3e6c8;
  --muted: #b9a888;
  --right-bg: #24492d;
  --right-line: #8fd19e;
  --wrong-bg: #4d231c;
  --wrong-line: #e08a7a;

  --display: "Limelight", "Georgia", serif;
  --body: "Josefin Sans", "Segoe UI", system-ui, sans-serif;

  color-scheme: dark;
}

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

html {
  background: var(--ink);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--cream);
  font-family: var(--body);
  font-size: 1.125rem;
  line-height: 1.5;
  background:
    radial-gradient(ellipse at 50% -10%, rgba(212, 175, 106, 0.14), transparent 60%),
    var(--ink);
}

a {
  color: var(--gold-bright);
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 400;
  color: var(--gold-bright);
  letter-spacing: 0.03em;
  line-height: 1.15;
}

/* ---------- Art-deco frame: the double gold rule used on cards and panels ---------- */

.deco-frame {
  border: 2px solid var(--gold);
  outline: 1px solid var(--gold-dim);
  outline-offset: 6px;
  background: var(--panel);
}

/* ---------- Ticket buttons ---------- */

.ticket {
  --notch: 12px;
  position: relative;
  display: block;
  padding: 1.1rem 2rem 1rem;
  color: var(--ink);
  text-decoration: none;
  text-align: center;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  border: 0;
  font: inherit;
  cursor: pointer;
  -webkit-mask:
    radial-gradient(circle at left center, transparent var(--notch), #000 calc(var(--notch) + 0.5px)) left / 51% 100% no-repeat,
    radial-gradient(circle at right center, transparent var(--notch), #000 calc(var(--notch) + 0.5px)) right / 51% 100% no-repeat;
  mask:
    radial-gradient(circle at left center, transparent var(--notch), #000 calc(var(--notch) + 0.5px)) left / 51% 100% no-repeat,
    radial-gradient(circle at right center, transparent var(--notch), #000 calc(var(--notch) + 0.5px)) right / 51% 100% no-repeat;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.ticket::before {
  content: "";
  position: absolute;
  inset: 6px calc(var(--notch) + 6px);
  border: 1px dashed rgba(13, 11, 9, 0.45);
  pointer-events: none;
}

.ticket:hover {
  transform: translateY(-2px);
  filter: brightness(1.07);
}

/* The mask would clip a normal outline, so focus is shown inside the ticket. */
.ticket:focus-visible {
  outline: none;
  filter: brightness(1.12);
}

.ticket:focus-visible::before {
  border: 2px solid var(--ink);
}

.ticket-name {
  display: block;
  font-family: var(--display);
  font-size: 1.6rem;
  line-height: 1.1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ticket-blurb {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.95rem;
  line-height: 1.35;
}

.ticket-row {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
}

/* ---------- Home page ---------- */

.home {
  max-width: 68rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.hero {
  margin: 0 auto 2.5rem;
  /* Shown no larger than the file's native width so the current 1024px image stays sharp.
     A larger image can be dropped in without changing this. */
  max-width: min(100%, 1024px);
}

.hero img {
  display: block;
  width: 100%;
  height: auto;
  box-shadow: 0 1.5rem 3rem rgba(0, 0, 0, 0.6);
}

.mode {
  padding: 1.75rem 1.5rem 2rem;
  margin: 0 0 2.5rem;
}

.mode h2 {
  margin: 0 0 0.25rem;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  text-align: center;
}

.mode-lede {
  max-width: 44rem;
  margin: 0 auto 1.75rem;
  color: var(--muted);
  text-align: center;
}

.site-footer {
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

/* ---------- Question cards (pre-show and solo) ---------- */

.card {
  width: 100%;
  padding: clamp(1.25rem, 4vmin, 3rem);
}

.card-meta {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: clamp(0.85rem, 1.6vmin + 0.4rem, 1.6rem);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: center;
}

.card-prompt {
  margin: 0 0 clamp(1rem, 3vmin, 2.5rem);
  font-family: var(--body);
  font-weight: 600;
  color: var(--cream);
  font-size: clamp(1.35rem, 3.6vmin + 0.5rem, 4.25rem);
  line-height: 1.25;
  letter-spacing: 0;
  text-align: center;
  text-wrap: balance;
}

.choices {
  display: grid;
  gap: clamp(0.6rem, 1.8vmin, 1.5rem);
  grid-template-columns: 1fr 1fr;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (max-width: 40rem) {
  .choices {
    grid-template-columns: 1fr;
  }
}

.choice {
  display: flex;
  align-items: center;
  gap: 0.75em;
  width: 100%;
  min-height: 100%;
  padding: 0.7em 1em;
  color: var(--cream);
  background: var(--panel-raised);
  border: 2px solid var(--gold-dim);
  font: inherit;
  font-size: clamp(1.1rem, 2.6vmin + 0.4rem, 3rem);
  line-height: 1.25;
  text-align: left;
  transition: opacity 0.6s ease, background-color 0.4s ease, border-color 0.4s ease;
}

.choice-letter {
  flex: none;
  display: grid;
  place-items: center;
  width: 1.8em;
  height: 1.8em;
  color: var(--ink);
  background: var(--gold);
  border-radius: 50%;
  font-family: var(--display);
  font-size: 0.8em;
}

button.choice {
  cursor: pointer;
}

button.choice:not(:disabled):hover {
  border-color: var(--gold-bright);
  background: #2c231a;
}

.choice.is-right {
  background: var(--right-bg);
  border-color: var(--right-line);
}

.choice.is-right .choice-letter {
  background: var(--right-line);
}

.choice.is-wrong {
  background: var(--wrong-bg);
  border-color: var(--wrong-line);
}

.choice.is-wrong .choice-letter {
  background: var(--wrong-line);
}

.choice.is-faded {
  opacity: 0.35;
}

.card-fact {
  min-height: 1.5em;
  margin: clamp(1rem, 3vmin, 2.25rem) 0 0;
  color: var(--gold-bright);
  font-size: clamp(1rem, 2.2vmin + 0.4rem, 2.4rem);
  text-align: center;
  text-wrap: balance;
}

/* ---------- Pre-show ---------- */

.preshow {
  overflow: hidden;
}

.stage {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: clamp(1rem, 5vmin, 4rem);
}

.preshow .card {
  max-width: 90rem;
  opacity: 0;
  transform: scale(0.985);
  transition: opacity 0.9s ease, transform 0.9s ease;
}

.preshow .card.is-visible {
  opacity: 1;
  transform: none;
}

.preshow .card-fact {
  opacity: 0;
  transition: opacity 0.8s ease 0.3s;
}

.preshow .card.is-revealed .card-fact {
  opacity: 1;
}

.timer {
  height: 4px;
  margin: clamp(1rem, 3vmin, 2rem) auto 0;
  max-width: 40rem;
  background: rgba(212, 175, 106, 0.18);
  overflow: hidden;
  transition: opacity 0.5s ease;
}

.timer-fill {
  height: 100%;
  background: var(--gold);
  transform-origin: left center;
  transition: transform 0.25s linear;
}

.card.is-revealed .timer {
  opacity: 0;
}

.stage-message {
  max-width: 40rem;
  color: var(--muted);
  font-size: clamp(1.1rem, 2.5vmin, 2rem);
  text-align: center;
}

/* Controls sit at the top and fade away while nobody is touching the mouse or keyboard. */
.controls {
  position: fixed;
  inset: 0 0 auto;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(180deg, rgba(13, 11, 9, 0.9), transparent);
  transition: opacity 0.6s ease;
}

body.is-idle .controls,
body.is-idle .preshow-footer {
  opacity: 0;
  pointer-events: none;
}

/* Pinned to the bottom of the pre-show; it hides with the controls so the TV shows only the card. */
.preshow-footer {
  position: fixed;
  inset: auto 0 0;
  z-index: 2;
  padding: 0.5rem 1rem;
  background: linear-gradient(0deg, rgba(13, 11, 9, 0.9), transparent);
  transition: opacity 0.6s ease;
}

.site-footer p {
  margin: 0.25rem 0;
}

.solo-page .site-footer {
  margin-top: 2rem;
}

/* ---------- Text pages (privacy) ---------- */

.prose .mode {
  max-width: 48rem;
  margin: 0 auto 2rem;
  padding: 2rem 2.25rem;
}

.prose h1 {
  margin: 0 0 1rem;
  font-size: clamp(2rem, 5vw, 2.8rem);
}

.prose h2 {
  margin: 1.75rem 0 0.5rem;
  font-size: 1.5rem;
}

.prose li {
  margin-bottom: 0.5rem;
}

body.is-idle {
  cursor: none;
}

.controls-title {
  margin: 0 auto 0 0;
  text-decoration: none;
  font-family: var(--display);
  color: var(--gold-bright);
  letter-spacing: 0.05em;
}

.control {
  padding: 0.45rem 0.9rem;
  color: var(--gold-bright);
  background: rgba(24, 19, 14, 0.85);
  border: 1px solid var(--gold-dim);
  font: inherit;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
}

.control:hover {
  border-color: var(--gold-bright);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  z-index: 3;
  padding: 0.6rem 1.1rem;
  color: var(--ink);
  background: var(--gold-bright);
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.toast.is-shown {
  opacity: 1;
}

/* The occasional support card: a QR code big enough to scan from across the room. */
.preshow .support-card {
  max-width: 64rem;
  text-align: center;
}

.support-heading {
  margin: 0 0 0.4em;
  font-size: clamp(2rem, 6vmin, 5.5rem);
}

.support-text {
  max-width: 34em;
  margin: 0 auto clamp(1rem, 3vmin, 2.5rem);
  font-size: clamp(1.15rem, 3vmin, 2.8rem);
  line-height: 1.3;
  text-wrap: balance;
}

.support-qr {
  width: clamp(10rem, 34vmin, 30rem);
  margin: 0 auto;
  padding: 0.5rem;
  background: #fff;
  border: 2px solid var(--gold);
}

.support-qr svg {
  display: block;
  width: 100%;
  height: auto;
}

.support-address {
  margin: clamp(0.75rem, 2vmin, 1.5rem) 0 0;
  color: var(--gold-bright);
  font-size: clamp(1rem, 2.4vmin, 2.2rem);
  letter-spacing: 0.04em;
}

.result-support {
  margin: 1rem 0 0;
  color: var(--muted);
}

/* ---------- Solo ---------- */

.solo-page {
  max-width: 64rem;
  margin: 0 auto;
  padding: 1rem 1rem 3rem;
}

.solo-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
  margin: 0 0 1.5rem;
}

.solo-bar .controls-title {
  font-size: 1.25rem;
}

.scoreline {
  color: var(--muted);
  font-size: 1rem;
}

.scoreline strong {
  color: var(--gold-bright);
  font-weight: 700;
}

.solo-page .card {
  min-height: 0;
}

.solo-page .card-prompt {
  font-size: clamp(1.35rem, 2.6vw + 0.6rem, 2.6rem);
}

.solo-page .choice {
  font-size: clamp(1.05rem, 1.4vw + 0.6rem, 1.6rem);
}

.solo-page .card-fact {
  font-size: clamp(1rem, 1vw + 0.6rem, 1.35rem);
}

.solo-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.75rem;
}

.solo-actions .ticket {
  min-width: 14rem;
}

.solo-actions .ticket-name {
  font-size: 1.25rem;
}

.result {
  padding: 2rem 1.5rem;
  text-align: center;
}

.result h2 {
  margin: 0 0 0.5rem;
  font-size: clamp(2rem, 5vw, 3.25rem);
}

.result-score {
  margin: 0;
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
}

.result-best {
  margin: 0.5rem 0 0;
  color: var(--muted);
}

.picker h1 {
  margin: 0.5rem 0 0.25rem;
  font-size: clamp(2rem, 5vw, 3rem);
  text-align: center;
}

.picker .mode-lede {
  margin-bottom: 2rem;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
