:root {
  --crema: #f4f1e8;
  --crema-2: #efe8d3;
  --linea: #e1dac6;
  --esmeralda: #123524;
  --esmeralda-2: #2f6b4b;
  --oro: #b8973f;
  --oro-medio: #9a7b2e;
  --oro-texto: #7f6424;
  --error: #9c2b22;

  --titulo: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --texto: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --orn: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cg fill='none' stroke='%23d6c48e' stroke-width='1.2'%3E%3Ccircle cx='24' cy='24' r='22'/%3E%3Ccircle cx='24' cy='24' r='8'/%3E%3Cpath d='M24 2v14M24 32v14M2 24h14M32 24h14'/%3E%3C/g%3E%3C/svg%3E");
  --estrella: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23b8973f' d='M12 0c.8 6.6 4.9 11.2 12 12-7.1.8-11.2 5.4-12 12-.8-6.6-4.9-11.2-12-12C7.1 11.2 11.2 6.6 12 0z'/%3E%3C/svg%3E");
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--crema);
  color: var(--esmeralda);
  font-family: var(--texto);
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.5;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

main { max-width: 34rem; margin: 0 auto; padding: 0 1.25rem 3rem; }
main.wide { max-width: 68rem; }

button, select, input { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--esmeralda-2); outline-offset: 3px; }

/* ---- Encabezado ---- */
.hero { position: relative; text-align: center; padding: 3.25rem 0 .5rem; }

.label, .eyebrow, .btn, .bar button {
  font-family: var(--sans);
  font-size: .75rem;
  font-weight: 500;
  letter-spacing: .38em;
  text-transform: uppercase;
}
.label { margin: 0; color: var(--oro-texto); }

.eyebrow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin: 0;
  color: var(--oro-texto);
}
.eyebrow::before, .eyebrow::after {
  content: '';
  width: 2.5rem;
  height: 1px;
  background: var(--oro);
}

h1, h2 { font-family: var(--titulo); font-weight: 400; }

h1 {
  margin: 1.25rem 0 .75rem;
  font-size: clamp(2.9rem, 13vw, 4.5rem);
  line-height: 1.08;
}
h1 em { font-style: italic; color: var(--esmeralda-2); }

.place {
  margin: 0;
  font-size: clamp(.82rem, 3.7vw, 1.05rem);
  font-weight: 500;
  letter-spacing: .22em;
  text-transform: uppercase;
}

.star {
  position: absolute;
  width: 1rem;
  height: 1rem;
  background: var(--estrella) center / contain no-repeat;
  opacity: .65;
}
.s1 { left: 5%; top: 6.2rem; }
.s2 { right: 6%; top: 3.6rem; width: .7rem; height: .7rem; }
.s3 { right: 14%; top: 10.4rem; width: .8rem; height: .8rem; }

/* ---- Tarjeta con doble borde y ornamentos ---- */
.card {
  position: relative;
  margin-top: 2.25rem;
  padding: 3rem 1.75rem 2.75rem;
  background: var(--crema);
  border: 1px solid var(--linea);
  box-shadow: 0 28px 40px -28px rgb(18 53 36 / .35);
  text-align: center;
}
.card::before {
  content: '';
  position: absolute;
  inset: .7rem;
  border: 1px solid var(--linea);
  pointer-events: none;
}
.card::after {
  content: '';
  position: absolute;
  inset: 1rem;
  background:
    var(--orn) left top / 2.2rem no-repeat,
    var(--orn) right bottom / 2.2rem no-repeat;
  pointer-events: none;
}
.card > * { position: relative; z-index: 1; }

.badge {
  display: grid;
  place-items: center;
  width: 4.25rem;
  height: 4.25rem;
  margin: 0 auto 1.5rem;
  border: 1px solid #e3d9bc;
  border-radius: 50%;
  background: var(--crema-2);
}

.card-title {
  margin: .9rem 0 .75rem;
  font-size: 1.85rem;
  line-height: 1.2;
}
#count { color: var(--oro-medio); }

.accent {
  margin: 0 0 1rem;
  font-family: var(--titulo);
  font-style: italic;
  font-size: 1.55rem;
  color: var(--oro-medio);
}

.note { margin: 0 auto 1.75rem; max-width: 24rem; font-size: 1.2rem; }

/* ---- Botones ---- */
.btn {
  min-height: 3.4rem;
  width: min(100%, 20rem);
  padding: 1rem 1.5rem;
  border: 1.5px solid var(--esmeralda);
  background: transparent;
  color: var(--esmeralda);
  text-indent: .38em;
}
.btn-primary { background: var(--esmeralda); color: var(--crema); }
.btn:hover { background: var(--esmeralda); color: var(--crema); }
.btn-primary:hover { background: var(--esmeralda-2); border-color: var(--esmeralda-2); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: progress; }

.link {
  border: 0;
  background: none;
  padding: .5rem;
  color: var(--esmeralda);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--oro);
  text-underline-offset: 4px;
}

/* ---- Cola de subida ---- */
.queue { list-style: none; margin: 1.25rem 0 0; padding: 0; display: grid; gap: .5rem; }
.queue:empty { display: none; }
.queue li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .15rem .75rem;
  padding: .6rem .9rem;
  border: 1px solid var(--linea);
  background: #faf8f1;
  font-size: 1.05rem;
}
.q-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-state { color: var(--oro-texto); }
.queue progress { grid-column: 1 / -1; width: 100%; height: .35rem; accent-color: var(--esmeralda-2); }
.queue li.fail { border-color: var(--error); }
.queue li.fail .q-state { color: var(--error); grid-column: 1 / -1; }
.queue .q-close { grid-column: 1 / -1; justify-self: start; padding-left: 0; }

.status { min-height: 1.6rem; margin: .75rem 0 0; text-align: center; font-size: 1.1rem; font-style: italic; }

/* ---- Galería ---- */
.grid {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}
.grid:empty { display: none; }
.grid li { position: relative; aspect-ratio: 1; overflow: hidden; background: var(--crema-2); }
.grid img, .grid video { width: 100%; height: 100%; object-fit: cover; display: block; }
.grid .open { position: absolute; inset: 0; border: 0; background: transparent; padding: 0; }
.grid .del {
  position: absolute;
  top: .3rem;
  right: .3rem;
  width: 2.25rem;
  height: 2.25rem;
  border: 0;
  border-radius: 50%;
  background: rgb(18 53 36 / .88);
  color: var(--crema);
  font-family: var(--sans);
  font-size: 1.3rem;
  line-height: 1;
}
.grid .tag {
  position: absolute;
  left: .3rem;
  bottom: .3rem;
  padding: .1rem .55rem;
  background: rgb(18 53 36 / .88);
  color: var(--crema);
  font-family: var(--sans);
  font-size: .7rem;
  pointer-events: none;
}

.foot { margin-top: 2.5rem; text-align: center; font-size: 1.1rem; font-style: italic; }
.foot p { margin: 0 auto .25rem; max-width: 24rem; }

/* ---- Visor de pantalla completa ---- */
.viewer {
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--esmeralda);
  color: var(--crema);
}
.viewer[open] { display: flex; flex-direction: column; }
.viewer::backdrop { background: var(--esmeralda); }
.stage { flex: 1; min-height: 0; display: grid; place-items: center; padding: 1rem; }
.stage img, .stage video { max-width: 100%; max-height: 100%; object-fit: contain; }
.caption { margin: 0; padding: 0 1rem; text-align: center; font-size: 1.05rem; font-style: italic; }
.bar { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: center; padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom)); }
.bar button, .bar a {
  min-width: 7.5rem;
  padding: .85rem 1.25rem;
  border: 1.5px solid var(--oro);
  background: transparent;
  color: var(--crema);
  font-family: var(--sans);
  font-size: .75rem;
  font-weight: 500;
  letter-spacing: .3em;
  text-transform: uppercase;
  text-align: center;
  text-decoration: none;
  text-indent: .3em;
}
.bar .danger { border-color: #e6a597; color: #f3c3b8; }
.bar :focus-visible { outline-color: var(--crema); }

@media (min-width: 30rem) {
  .card { padding-left: 2.5rem; padding-right: 2.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .btn:active { transform: none; }
}
