:root {
  color-scheme: dark;
  --bg: #0d0c0b;
  --panel: #181613;
  --gold: #c3a16b;
  --muted: #a99d8b;
  --line: #554633;
}

body {
  margin: 0;
  background: radial-gradient(ellipse at 50% 0%, #242019 0%, var(--bg) 55%);
  color: #eee7dc;
  font-family: Inter, Arial, sans-serif;
  min-height: 100vh;
}

.back {
  font-size: 12px;
  text-decoration: none;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.back:hover {
  color: var(--gold);
}

.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.nav-link {
  font-size: 12px;
  text-decoration: none;
  letter-spacing: 0.12em;
  color: var(--muted);
}

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

header {
  text-align: center;
  padding: 74px 12px 62px;
}

h1,
h2,
h3 {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 500;
}

h1 {
  font-size: clamp(48px, 8vw, 88px);
  letter-spacing: 0.045em;
  color: #d7b782;
  margin: 14px 0 12px;
}

header .rule {
  width: 210px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  margin: 0 auto 22px;
}

.intro {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.9;
  max-width: 540px;
  margin: 16px auto 0;
}

.section-head {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 22px;
  color: var(--gold);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.section-head:after {
  content: "";
  height: 1px;
  background: var(--line);
  flex: 1;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

.tile {
  border: 1px solid #51432f;
  background: var(--panel);
  text-align: left;
  color: inherit;
  padding: 0;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  overflow: hidden;
}

.tile:hover,
.tile:focus-visible {
  transform: translateY(-4px);
  border-color: var(--gold);
  box-shadow: 0 14px 36px #0008;
  outline: none;
}

.art {
  height: 208px;
  position: relative;
  overflow: hidden;
  background: #242019;
}

.art:after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, #17130e99, transparent 70%);
}

.art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.7);
  transition: transform 0.3s;
}

.tile:hover img {
  transform: scale(1.04);
}

.art .symbol {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: Georgia, serif;
  font-size: 80px;
  color: #c7a46b;
  text-shadow: 0 5px 28px #000;
  z-index: 1;
}

.art.ledger {
  background: radial-gradient(circle at 60% 30%, #77603a, #201c16 70%);
}

.art.thanks {
  background: radial-gradient(circle at 60% 35%, #7b4b29, #1a1713 75%);
}

.art.christmas {
  background: radial-gradient(circle at 65% 25%, #6b5429, #15211a 70%);
}

.art.latino {
  background: radial-gradient(circle at 50% 40%, #79512f, #201b15 70%);
}
/* Cafecito thumbnail only — show entire image */
.art.latino img {
    object-fit: contain;
}

.art.random {
  background: radial-gradient(circle at 55% 30%, #525057, #171719 75%);
}

.tile-content {
  padding: 21px 21px 24px;
}

.tile h2 {
  font-size: 29px;
  line-height: 1.1;
  margin: 0 0 7px;
  color: #e0c28f;
}

.tile p {
  font-size: 12px;
  line-height: 1.7;
  color: #b9ac97;
  margin: 0 0 15px;
  min-height: 41px;
}

.meta {
  font-size: 10px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: #a68b60;
}

.overlay[hidden] {
  display: none;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: #000c;
  display: grid;
  place-items: center;
  padding: 20px;
}

.dialog {
  width: min(780px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: #181613;
  border: 1px solid var(--gold);
  box-shadow: 0 20px 80px #000;
  padding: 28px;
  position: relative;
}

.close {
  position: absolute;
  right: 18px;
  top: 12px;
  background: none;
  border: 0;
  color: #e2c492;
  font-size: 30px;
  cursor: pointer;
}

.dialog h2 {
  color: #e0c28f;
  font-size: 28px;
  margin: 4px 38px 5px 0;
}

.dialog p {
  color: #bcb09d;
  font-size: 13px;
  line-height: 1.7;
}

.poster-preview {
  display: block;
  max-width: 100%;
  max-height: 52vh;
  object-fit: contain;
  margin: 22px auto;
  border: 1px solid #655438;
}

.placeholder {
  border: 1px dashed #655438;
  padding: 45px 18px;
  text-align: center;
  color: #a9997e;
  margin-top: 24px;
  font-size: 13px;
}

body.modal-open {
  overflow: hidden;
}

@media (max-width: 800px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .art {
    height: 180px;
  }
}

@media (max-width: 540px) {
  .shell {
    padding: 20px 17px 60px;
  }
  header {
    padding: 55px 0 45px;
  }
  .grid {
    grid-template-columns: 1fr;
  }
  .art {
    height: 210px;
  }
  .tile p {
    min-height: 0;
  }
  .dialog {
    padding: 20px;
  }
}

/* Collection gallery and full-poster viewer */
.dialog {
  width: min(1040px, 100%);
}
.dialog.viewer-mode {
  width: min(1100px, 100%);
}
.gallery-count {
  margin: 12px 0 18px !important;
  color: #b9ac97;
}
.poster-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}
.poster-tile {
  background: #211d17;
  border: 1px solid #5c4a32;
  padding: 12px;
  color: #dfc395;
  cursor: pointer;
  text-align: center;
  min-width: 0;
  transition: border-color 0.2s, transform 0.2s;
}
.poster-tile:hover,
.poster-tile:focus-visible {
  border-color: var(--gold);
  transform: translateY(-2px);
  outline: 2px solid transparent;
}
.poster-tile img {
  width: 100%;
  height: 205px;
  object-fit: contain;
  display: block;
  background: #0d0c0b;
}
.poster-name {
  display: block;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 22px;
  margin-top: 9px;
}
.gallery-pagination,
.poster-navigation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
}
.gallery-control,
.gallery-back {
  background: transparent;
  border: 1px solid #80663f;
  color: #e0c28f;
  padding: 10px 14px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.gallery-control:hover:not(:disabled),
.gallery-back:hover {
  background: #31281d;
}
.gallery-control:disabled {
  opacity: 0.35;
  cursor: default;
}
.gallery-page {
  color: #b9ac97;
  font-size: 12px;
  text-align: center;
}
.gallery-back {
  margin: 10px 0 20px;
}
.full-poster-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #100e0c;
  padding: 12px;
  min-height: 150px;
}
.full-poster {
  display: block;
  max-width: 100%;
  max-height: 62vh;
  width: auto;
  height: auto;
  object-fit: contain;
}
@media (max-width: 700px) {
  .poster-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .poster-tile img {
    height: 170px;
  }
}
@media (max-width: 430px) {
  .poster-grid {
    grid-template-columns: 1fr;
  }
  .poster-tile img {
    height: 230px;
  }
  .gallery-control {
    padding: 8px;
    font-size: 11px;
  }
  .dialog h2 {
    font-size: 32px;
  }
}

/* Zoomable poster viewer — desktop and mobile */
.dialog.viewer-mode { max-height: min(96dvh, 1100px); }
.full-poster-wrap {
  height: min(65dvh, 680px);
  min-height: 180px;
  padding: 0;
  overflow: hidden;
  position: relative;
  touch-action: none;
  cursor: default;
  user-select: none;
}
.full-poster-wrap.is-zoomed { cursor: grab; }
.full-poster-wrap.is-zoomed:active { cursor: grabbing; }
.full-poster { max-width: none; max-height: none; flex: none; transform-origin: center center; pointer-events: none; }
.zoom-toolbar { display:flex; justify-content:center; align-items:center; flex-wrap:wrap; gap:10px; margin-top:12px; }
.zoom-readout { min-width:52px; text-align:center; color:#e0c28f; font-size:12px; }
.zoom-button { min-width:40px; font-size:19px; padding:6px 10px; }
@media (max-width: 700px) {
  .overlay { padding: 8px; }
  .dialog.viewer-mode { padding: 12px; max-height: calc(100dvh - 16px); }
  .dialog.viewer-mode h2 { font-size: 25px; }
  .dialog.viewer-mode #dialog-desc { margin: 3px 0; }
  .full-poster-wrap { height: 53dvh; min-height: 140px; }
  .poster-navigation { gap: 6px; margin-top: 12px; }
  .gallery-back { margin: 5px 0 10px; }
}
@media (max-width: 900px) and (orientation: landscape) and (max-height: 550px) {
  .overlay { padding: 4px; }
  .dialog.viewer-mode { padding: 8px 12px; max-height: calc(100dvh - 8px); }
  .dialog.viewer-mode h2 { font-size: 21px; margin: 0 30px 0 0; }
  .dialog.viewer-mode #dialog-desc { display: none; }
  .gallery-back { margin: 2px 0 5px; padding: 5px 9px; }
  .full-poster-wrap { height: 48dvh; min-height: 100px; }
  .zoom-toolbar { margin-top: 5px; gap: 6px; }
  .zoom-toolbar .gallery-control, .poster-navigation .gallery-control { padding: 5px 9px; }
  .poster-navigation { margin-top: 5px; }
}

/* Minimal poster viewer: title/description only appear in gallery mode. */
.dialog.viewer-mode #dialog-title,
.dialog.viewer-mode #dialog-desc { display: none; }
.dialog.viewer-mode .close { position: sticky; top: 0; margin: -10px -8px 4px auto; display: block; z-index: 2; width: 42px; height: 42px; line-height: 1; background: #181613; border: 1px solid #80663f; border-radius: 4px; }
.dialog.viewer-mode .full-poster-wrap { height: min(72dvh, 740px); }
@media (max-width: 700px) { .dialog.viewer-mode .full-poster-wrap { height: 62dvh; } }
@media (max-width: 900px) and (orientation: landscape) and (max-height: 550px) { .dialog.viewer-mode .full-poster-wrap { height: 52dvh; } }
