/* =========================
   COLORES Y BASE
   ========================= */

:root {
  color-scheme: dark;

  --bg: #10110e;
  --surface: #191c16;
  --surface-dark: #141710;
  --text: #f3f0e7;
  --muted: #92958a;
  --gold: #d1aa63;
  --line: #30332b;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

button {
  padding: 12px 17px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    color 180ms ease;
}

button:hover:not(:disabled) {
  border-color: var(--gold);
  background: rgba(209, 170, 99, 0.07);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
model-viewer:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
}

[hidden] {
  display: none !important;
}

img {
  max-width: 100%;
}

main {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
}

section[id],
aside[id] {
  scroll-margin-top: 24px;
}

h1,
h2,
h3,
p {
  overflow-wrap: break-word;
}

h1 {
  margin: 27px 0;
  font-size: clamp(48px, 4.6vw, 78px);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: -3px;
}

h2 {
  font-size: 29px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -1px;
}

em {
  color: var(--gold);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
}

.eyebrow {
  color: var(--gold);
  font-size: 9px;
  line-height: 1.7;
  letter-spacing: 2px;
}

.muted {
  max-width: 280px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}

.fine {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.8;
}

.primary {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  margin-top: 20px;
  padding: 17px 22px;
  border: 1px solid var(--gold);
  border-radius: 4px;
  background: var(--gold);
  color: #141710;
  font-size: 12px;
  cursor: pointer;
  transition:
    background-color 180ms ease,
    border-color 180ms ease;
}

.primary:hover:not(:disabled) {
  border-color: #e5c184;
  background: #e0b976;
}

/* =========================
   CABECERA
   ========================= */

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 100px;
  padding: 20px 5%;
  border-bottom: 1px solid var(--line);
}

.brand {
  flex-shrink: 0;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 1px;
}

.brand > span {
  margin-right: 10px;
  color: var(--gold);
  font-size: 25px;
}

.brand small {
  display: block;
  padding: 7px 0 0 44px;
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 3px;
}

nav {
  display: flex;
  align-items: center;
  gap: 32px;
  color: #c4c6bb;
  font-size: 13px;
}

nav a {
  padding: 8px 0;
  transition: color 180ms ease;
}

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

#account {
  flex-shrink: 0;
  white-space: nowrap;
}

/* =========================
   FRANJA DEL MERCADO
   ========================= */

.ticker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 48px;
  padding: 15px 5%;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 1px;
}

.ticker > span {
  min-width: 0;
}

.ticker > span:first-child {
  flex-shrink: 0;
  color: var(--gold);
}

.ticker > span:nth-child(2),
.ticker > span:last-child {
  flex-shrink: 0;
}

#ticker {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* =========================
   PORTADA
   ========================= */

.hero {
  display: grid;
  grid-template-columns:
    minmax(0, 1fr)
    minmax(0, 1.05fr)
    minmax(0, 0.85fr);
  align-items: center;
  gap: 28px;
  min-height: 640px;
  padding: 60px 5% 50px;
}

.hero > * {
  min-width: 0;
}

.intro {
  position: relative;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 40px;
  margin-top: 35px;
  font-size: 23px;
}

.hero-meta small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 1px;
}

/* =========================
   ESCENARIO DEL VASO 3D
   ========================= */

.stage {
  position: relative;
  display: block;
  align-self: stretch;
  min-width: 0;
  min-height: 560px;
  overflow: hidden;
  isolation: isolate;
  perspective: none;

  background:
    radial-gradient(
      ellipse at 50% 55%,
      rgba(209, 170, 99, 0.14),
      transparent 67%
    );
}

/*
  El visor ocupa el escenario, excepto la zona inferior
  reservada para los controles.
*/
#beer-model {
  position: absolute;
  top: 12px;
  left: 10px;
  z-index: 1;

  display: block;
  width: calc(100% - 20px);
  height: calc(100% - 76px);
  min-width: 0;
  margin: 0;

  border: 0;
  background: transparent;
  pointer-events: auto;
  touch-action: pan-y;
  cursor: grab;
}

#beer-model:active {
  cursor: grabbing;
}

/* Imagen de presentación, si se usa dentro del visor */
.beer-poster {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Imagen estática usada como respaldo por app.js */
.stage > img {
  position: absolute;
  top: 12px;
  left: 10px;
  z-index: 1;

  display: block;
  width: calc(100% - 20px);
  max-width: none;
  height: calc(100% - 76px);
  margin: 0;
  object-fit: contain;
}

/* Decoración: no debe interceptar el mouse */
.vertical {
  position: absolute;
  top: 50%;
  right: 0;
  z-index: 2;
  margin: 0;
  transform: translateY(-50%);

  color: var(--muted);
  font-size: 8px;
  letter-spacing: 3px;
  writing-mode: vertical-rl;

  pointer-events: none;
  user-select: none;
}

.orbit {
  position: absolute;
  top: 25%;
  left: 10%;
  z-index: 0;
  width: 80%;
  height: 45%;
  border: 1px solid rgba(209, 170, 99, 0.12);
  border-radius: 50%;

  pointer-events: none;
}

/* Controles fuera del área de arrastre */
.stage-footer {
  position: absolute;
  right: 10px;
  bottom: 10px;
  left: 10px;
  z-index: 3;

  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  min-height: 36px;
  width: auto;

  font-size: 8px;
  letter-spacing: 2px;

  pointer-events: none;
}

.stage-footer > span {
  min-width: 0;
}

.stage-footer button,
.stage-footer input {
  pointer-events: auto;
}

.stage-footer button {
  padding: 9px 11px;
  font-size: 10px;
  letter-spacing: 0;
}

.stage-footer input[type="range"] {
  width: 100%;
  accent-color: var(--gold);
}

/* =========================
   PANEL DEL MERCADO
   ========================= */

#market {
  align-self: center;
  min-width: 0;
  padding: 25px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #181b14;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-head .eyebrow {
  min-width: 0;
}

.live {
  flex-shrink: 0;
  color: #b4ce86;
  font-size: 8px;
  white-space: nowrap;
}

.market-labels {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);

  color: var(--muted);
  font-size: 8px;
  letter-spacing: 1px;
}

.market-labels > span:last-child {
  text-align: right;
}

.price-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.price-row > div:first-child {
  min-width: 0;
}

.price-row strong {
  display: block;
  font-size: 13px;
  font-weight: 500;
}

.price-row small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 10px;
}

.quote {
  flex-shrink: 0;
  color: var(--gold);
  font-size: 17px;
  text-align: right;
  white-space: nowrap;
}

#market-status {
  margin-bottom: 0;
  font-size: 12px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

#simulate {
  width: 100%;
  margin-top: 12px;
}

/* =========================
   CATÁLOGO Y CARRUSEL
   ========================= */

#beers {
  padding: 45px 5%;
  border-top: 1px solid var(--line);
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 30px;
}

.section-head > div:first-child {
  min-width: 0;
}

.section-head > div:last-child {
  display: flex;
  flex-shrink: 0;
  gap: 8px;
}

.section-head h2 {
  margin: 15px 0 0;
  font-size: 38px;
}

#previous,
#next {
  min-width: 44px;
  min-height: 44px;
}

.beer-cards {
  display: flex;
  align-items: stretch;
  gap: 20px;

  overflow-x: auto;
  padding: 6px 0 16px;

  scroll-snap-type: x proximity;
  scroll-padding-inline: 0;
  overscroll-behavior-x: contain;

  scrollbar-width: thin;
  scrollbar-color: #716344 var(--surface);
}

.beer-cards::-webkit-scrollbar {
  height: 6px;
}

.beer-cards::-webkit-scrollbar-track {
  background: var(--surface);
}

.beer-cards::-webkit-scrollbar-thumb {
  border-radius: 10px;
  background: #716344;
}

.beer-card {
  flex: 0 0 calc((100% - 60px) / 4);
  display: flex;
  flex-direction: column;
  min-width: 215px;
  padding: 25px;

  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);

  scroll-snap-align: start;

  transition:
    border-color 200ms ease,
    background-color 200ms ease;
}

.beer-art {
  display: flex;
  align-items: center;
  justify-content: center;

  height: 240px;
  margin-bottom: 22px;
  overflow: hidden;

  background:
    radial-gradient(
      ellipse at center,
      rgba(209, 170, 99, 0.12),
      transparent 70%
    );
}

.beer-art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;

  filter:
    drop-shadow(
      0 18px 15px rgba(0, 0, 0, 0.4)
    );

  transition: transform 250ms ease;
}

.beer-card > small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
  letter-spacing: 1px;
}

.beer-card h3 {
  margin: 12px 0 6px;
  font-size: 20px;
  font-weight: 400;
  line-height: 1.3;
}

.card-price {
  display: flex;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 20px;
  color: var(--gold);
  font-size: 17px;
}

@media (hover: hover) {
  .beer-card:hover {
    border-color: #756343;
    background: #1c2018;
  }

  .beer-card:hover .beer-art img {
    transform: translateY(-5px) scale(1.03);
  }
}

/* =========================
   FIDELIZACIÓN
   ========================= */

.club {
  display: grid;
  grid-template-columns:
    minmax(0, 1fr)
    minmax(0, 1fr);
  align-items: center;
  gap: 48px;

  margin: 30px 5%;
  padding: 45px;
  border: 1px solid #494a35;
  border-radius: 6px;

  background:
    linear-gradient(
      120deg,
      #22251b,
      #161910
    );
}

.club > * {
  min-width: 0;
}

.club h2 {
  margin: 18px 0;
  font-size: 48px;
}

.club p {
  max-width: 330px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}

.member-card {
  position: relative;
  min-height: 230px;
  padding: 30px;

  border: 1px solid rgba(180, 156, 98, 0.5);
  border-radius: 14px;

  background:
    radial-gradient(
      ellipse at top right,
      rgba(150, 125, 60, 0.33),
      transparent 70%
    ),
    #20251a;

  box-shadow: 10px 25px 40px rgba(0, 0, 0, 0.4);
  transform: rotate(-3deg);
}

.member-card > span {
  display: block;
  color: var(--gold);
  font-size: 13px;
  letter-spacing: 2px;
}

.member-card > small {
  display: block;
  margin: 10px 0 35px;
  font-size: 8px;
  letter-spacing: 4px;
}

.member-card strong {
  display: block;
  font-size: 22px;
  font-weight: 400;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.member-card p {
  margin-top: 25px;
  font-size: 8px;
  letter-spacing: 2px;
}

#redeem {
  margin-top: 12px;
  font-size: 12px;
}

/* =========================
   INSTALACIÓN Y PIE
   ========================= */

.install {
  padding: 60px 20px;
  text-align: center;
}

.install h2 {
  margin: 16px 0;
  font-size: clamp(28px, 3vw, 40px);
}

.install p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}

#install {
  margin-top: 15px;
  border-color: var(--gold);
  color: var(--gold);
}

footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;

  padding: 30px 5%;
  border-top: 1px solid var(--line);

  color: var(--muted);
  font-size: 10px;
  line-height: 1.6;
}

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

/* =========================
   REGISTRO E INICIO DE SESIÓN
   ========================= */

dialog {
  width: calc(100% - 32px);
  max-width: 440px;
  max-height: calc(100dvh - 40px);
  padding: 35px;
  overflow-y: auto;

  border: 1px solid var(--gold);
  border-radius: 10px;

  background: var(--surface);
  color: var(--text);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
}

dialog h2 {
  margin-top: 18px;
}

.close {
  float: right;
  min-width: 36px;
  min-height: 36px;
  padding: 4px 10px;
  font-size: 24px;
  line-height: 1;
}

form {
  display: grid;
  gap: 18px;
}

label {
  display: grid;
  gap: 9px;
  font-size: 12px;
  line-height: 1.5;
}

input:not([type="range"]) {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 13px;

  border: 1px solid #545a44;
  border-radius: 4px;

  background: #11140e;
  color: var(--text);
}

#auth-form .primary {
  justify-content: center;
  width: 100%;
  margin-top: 4px;
}

#switch,
#logout {
  margin-top: 20px;
  font-size: 12px;
}

#auth-status {
  margin-bottom: 0;
  color: var(--gold);
  font-size: 13px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

/* =========================
   TABLET
   ========================= */

@media (max-width: 1100px) {
  nav {
    gap: 18px;
  }

  .hero {
    grid-template-columns:
      minmax(0, 1fr)
      minmax(0, 1fr);
    gap: 30px;
  }

  .hero > #market {
    grid-column: 1 / -1;
  }

  #prices {
    display: grid;
    grid-template-columns:
      minmax(0, 1fr)
      minmax(0, 1fr);
    gap: 0 24px;
  }

  .ticker > span:last-child {
    display: none;
  }

  .beer-card {
    flex-basis: calc((100% - 40px) / 3);
  }

  .club {
    gap: 30px;
    padding: 35px;
  }

  .club h2 {
    font-size: 42px;
  }
}

/* =========================
   MÓVIL
   ========================= */

@media (max-width: 650px) {
  header {
    gap: 12px;
    min-height: 80px;
    padding: 16px 5%;
  }

  .brand {
    font-size: 11px;
    letter-spacing: 0.5px;
  }

  .brand > span {
    margin-right: 5px;
    font-size: 21px;
  }

  .brand small {
    padding-left: 30px;
    font-size: 6px;
    letter-spacing: 2px;
  }

  nav {
    display: none;
  }

  #account {
    padding: 10px;
    font-size: 10px;
  }

  .ticker {
    gap: 15px;
    min-height: 44px;
    font-size: 8px;
  }

  .ticker > span:nth-child(2),
  .ticker > span:last-child {
    display: none;
  }

  .hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
    padding: 30px 5% 35px;
  }

  .hero h1 {
    font-size: clamp(46px, 11vw, 66px);
    letter-spacing: -2px;
  }

  .hero .muted {
    max-width: 100%;
    font-size: 14px;
  }

  .hero-meta {
    gap: 35px;
    margin-top: 25px;
  }

  .stage {
    min-height: 470px;
  }

  #beer-model,
  .stage > img {
    top: 5px;
    left: 5px;
    width: calc(100% - 10px);
    height: calc(100% - 65px);
  }

  .vertical {
    right: 0;
    font-size: 7px;
    letter-spacing: 2px;
  }

  .stage-footer {
    right: 5px;
    bottom: 8px;
    left: 5px;
  }

  .hero > #market {
    grid-column: auto;
  }

  #market {
    padding: 22px;
  }

  #prices {
    display: block;
  }

  #beers {
    padding: 35px 5%;
  }

  .section-head {
    align-items: flex-end;
    gap: 15px;
  }

  .section-head h2 {
    font-size: 29px;
  }

  .section-head > div:last-child {
    gap: 5px;
  }

  #previous,
  #next {
    padding: 10px;
  }

  .beer-cards {
    gap: 16px;
  }

  .beer-card {
    flex-basis: 82%;
    min-width: 0;
    padding: 22px;
  }

  .beer-art {
    height: 250px;
  }

  .club {
    grid-template-columns: minmax(0, 1fr);
    gap: 35px;
    margin: 20px 5%;
    padding: 25px;
  }

  .club h2 {
    font-size: 40px;
  }

  .member-card {
    padding: 25px;
    transform: none;
  }

  .member-card strong {
    font-size: 20px;
  }

  .install {
    padding: 45px 5%;
  }

  footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  dialog {
    padding: 25px;
  }

  input:not([type="range"]) {
    font-size: 16px;
  }
}

/* =========================
   MOVIMIENTO REDUCIDO
   ========================= */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  button,
  .primary,
  nav a,
  .beer-card,
  .beer-art img {
    transition: none;
  }

  .beer-card:hover .beer-art img {
    transform: none;
  }

  .member-card {
    transform: none;
  }
}