/* Paleta y tipos tomados de elmistermazatlan.com */
:root {
  --chrome: #080604;
  --bg: #110e0b;
  --card: #1a1612;
  --card-hi: #221d17;
  --text: #f2f0ea;
  --text-soft: #b9b2a3;
  --gold: #f2c653;
  --gold-btn: #e9bc4f;
  --gold-light: #fde7a2;
  --gold-mid: #a97e2c;
  --gold-deep: #6b4300;
  --gold-line: rgba(233, 188, 79, 0.4);
  --gold-faint: rgba(233, 188, 79, 0.16);
  --red: #e3262f;
  --ink: #181109;
  --display: "Bebas Neue", "Arial Narrow", Impact, sans-serif;
  --heading: "Rubik", system-ui, sans-serif;
  --text-font: "Nunito Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 18px;
  --notch: 11px;
  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(48rem 26rem at 50% 0, rgba(242, 198, 83, 0.09), transparent 70%),
    var(--bg);
  color: var(--text);
  font: 400 1rem/1.55 var(--text-font);
}

[hidden] {
  display: none !important;
}

img {
  max-width: 100%;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

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

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

/* ---------- Encabezado: solo el logo, al centro ---------- */

.masthead {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 64px;
  padding: 8px 16px;
  background: var(--chrome);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.masthead::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 2px;
  background: linear-gradient(to right, transparent, var(--red) 50%, transparent);
}

.logo {
  margin: 0;
  font-size: inherit;
  font-weight: inherit;
  line-height: 1;
}

.logo a {
  display: block;
  color: inherit;
  text-decoration: none;
  border-radius: 12px;
}

.masthead.has-logo {
  align-items: flex-start;
  height: 64px;
  margin-bottom: 44px;
}

.masthead.has-logo .logo {
  position: relative;
  z-index: 2;
}

.logo-img {
  display: block;
  width: auto;
  height: clamp(84px, 24vw, 104px);
  max-width: min(320px, 72vw);
  object-fit: contain;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.55));
}

.wordmark {
  display: block;
  font-family: var(--display);
  font-size: clamp(2rem, 8vw, 2.6rem);
  line-height: 1;
  letter-spacing: 0.04em;
  color: var(--gold);
  text-align: center;
  text-shadow:
    0 1px 0 var(--gold-mid),
    0 2px 0 var(--gold-deep),
    0 3px 2px rgba(0, 0, 0, 0.55);
}

/* ---------- Resultados ---------- */

.results {
  display: grid;
  gap: clamp(36px, 8vw, 60px);
  padding: clamp(28px, 7vw, 48px) 16px 80px;
}

.masthead.has-logo + .results {
  padding-top: clamp(8px, 3vw, 20px);
}

/* Cada resultado es un boleto: borde dorado, esquinas y línea de corte. */
.ticket {
  position: relative;
  width: 100%;
  max-width: 580px;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid var(--gold-line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--card-hi), var(--card) 40%);
  box-shadow:
    0 0 0 1px rgba(233, 188, 79, 0.1),
    0 34px 60px -24px rgba(0, 0, 0, 0.8);
}

.ticket-corners {
  position: absolute;
  inset: 12px;
  z-index: 1;
  pointer-events: none;
  opacity: 0.8;
  --c: var(--gold);
  background:
    linear-gradient(var(--c), var(--c)) top left / 16px 2px no-repeat,
    linear-gradient(var(--c), var(--c)) top left / 2px 16px no-repeat,
    linear-gradient(var(--c), var(--c)) top right / 16px 2px no-repeat,
    linear-gradient(var(--c), var(--c)) top right / 2px 16px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom left / 16px 2px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom left / 2px 16px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom right / 16px 2px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom right / 2px 16px no-repeat;
}

.ticket-head {
  position: relative;
  padding: clamp(30px, 8vw, 40px) clamp(28px, 8vw, 44px) clamp(22px, 6vw, 30px);
  text-align: center;
  background: radial-gradient(120% 90% at 50% 0, rgba(242, 198, 83, 0.12), transparent 65%);
}

/* Muescas a los lados de la línea de corte */
.ticket-head::before,
.ticket-head::after {
  content: "";
  position: absolute;
  bottom: calc(var(--notch) * -1);
  width: calc(var(--notch) * 2);
  height: calc(var(--notch) * 2);
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--gold-line);
  z-index: 2;
}

.ticket-head::before {
  left: calc(var(--notch) * -1 - 1px);
}

.ticket-head::after {
  right: calc(var(--notch) * -1 - 1px);
}

.ticket-title {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.5rem, 11.5vw, 4.25rem);
  line-height: 0.92;
  letter-spacing: 0.035em;
  text-transform: uppercase;
  color: var(--gold);
  text-shadow:
    0 1px 0 var(--gold-mid),
    0 2px 0 var(--gold-deep),
    0 3px 2px rgba(0, 0, 0, 0.55),
    0 0 28px rgba(242, 198, 83, 0.28);
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.ticket-body {
  position: relative;
  padding: clamp(22px, 6vw, 30px) clamp(16px, 5vw, 26px) clamp(20px, 5.5vw, 28px);
}

.ticket-body::before {
  content: "";
  position: absolute;
  top: 0;
  left: calc(var(--notch) + 10px);
  right: calc(var(--notch) + 10px);
  height: 1px;
  background: repeating-linear-gradient(90deg, var(--gold-line) 0 7px, transparent 7px 14px);
}

.ticket.no-head .ticket-body {
  padding-top: clamp(30px, 8vw, 40px);
}

.ticket.no-head .ticket-body::before,
.ticket.no-body .ticket-head::before,
.ticket.no-body .ticket-head::after {
  display: none;
}

.ticket.no-body .ticket-head {
  padding-bottom: clamp(30px, 8vw, 40px);
}

/* ---------- Imágenes ---------- */

.shot {
  position: relative;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(233, 188, 79, 0.32);
  border-radius: 12px;
  background: #0c0a08;
}

.shot-open {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}

.shot-open:focus-visible {
  outline-offset: -4px;
}

.shot img {
  display: block;
  width: 100%;
  height: auto;
}

.shot-main img {
  max-height: 78vh;
  object-fit: contain;
}

.shot-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(10px, 3vw, 14px);
}

.shot-main + .shot-pair {
  margin-top: clamp(10px, 3vw, 14px);
}

.shot-pair .shot img {
  aspect-ratio: 1;
  object-fit: cover;
}

.shot-pair.is-single {
  grid-template-columns: 1fr;
}

.shot-pair.is-single .shot img {
  aspect-ratio: auto;
}

.empty-note {
  margin: 0;
  text-align: center;
  color: var(--text-soft);
  font-size: 1.05rem;
}

/* Un solo momento de entrada: los boletos se "despachan" al cargar. */
@media (prefers-reduced-motion: no-preference) {
  .site .results > .ticket {
    animation: ticket-in 650ms cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  .site .results > .ticket:nth-child(2) {
    animation-delay: 90ms;
  }

  .site .results > .ticket:nth-child(n + 3) {
    animation-delay: 180ms;
  }

  @keyframes ticket-in {
    from {
      opacity: 0;
      transform: translateY(18px);
    }
  }
}

/* ---------- Visor de imagen ---------- */

.viewer {
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(8, 6, 4, 0.95);
  color: var(--text);
}

.viewer[open] {
  display: grid;
  place-items: center;
}

.viewer::backdrop {
  background: transparent;
}

.viewer-bar {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: 16px;
  margin: 0;
}

.viewer-img {
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 120px);
  object-fit: contain;
  border-radius: 10px;
}

@media (prefers-reduced-motion: no-preference) {
  .viewer[open] .viewer-img {
    animation: viewer-in 220ms cubic-bezier(0.16, 1, 0.3, 1);
  }

  @keyframes viewer-in {
    from {
      opacity: 0;
      transform: scale(0.96);
    }
  }
}

/* ---------- Botones y campos (login y panel) ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-family: var(--text-font);
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.1;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.55;
  cursor: progress;
}

.btn-primary {
  background: var(--gold-btn);
  color: var(--ink);
}

.btn-primary:hover {
  background: var(--gold);
}

.btn-ghost {
  background: transparent;
  color: var(--gold);
  border-color: var(--gold-line);
}

.btn-ghost:hover {
  background: var(--gold-faint);
}

.btn-danger {
  background: transparent;
  color: #ff8a8f;
  border-color: rgba(227, 38, 47, 0.55);
}

.btn-danger:hover {
  background: rgba(227, 38, 47, 0.14);
}

.btn-sm {
  min-height: 36px;
  padding: 6px 13px;
  font-size: 0.875rem;
}

.btn-block {
  width: 100%;
  margin-top: 20px;
}

.gate .ticket-title {
  font-size: clamp(2.3rem, 10vw, 3.4rem);
}

.gate-note {
  margin: 0 0 4px;
  color: var(--text-soft);
  text-align: center;
}

.field {
  display: grid;
  gap: 6px;
  margin-top: 16px;
  font-family: var(--heading);
  font-weight: 500;
  font-size: 0.92rem;
  color: var(--text);
}

.field input {
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--gold-line);
  border-radius: 10px;
  background: #0d0b08;
  color: var(--text);
  font-family: var(--text-font);
  font-size: 1rem;
}

.field input:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}

.form-error {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(227, 38, 47, 0.14);
  border: 1px solid rgba(227, 38, 47, 0.5);
  color: #ffb3b6;
  font-weight: 600;
}

.noscript {
  padding: 24px 16px;
  text-align: center;
}
