/* ============================================================
   Museum exhibit site — dark "museum" theme.
   Elderly-first: large type, high contrast, big tap targets.
   ============================================================ */

:root {
  --bg: #0b0b0c;
  --panel: #121214;
  --panel-2: #1a1a1d;
  --panel-hover: #202024;

  --gold: #d4af37;
  --gold-soft: #c9a227;
  --muted: #c2a96b;

  --white: #f7f7f7;
  --text-dim: #a9a9ad;
  --border: #2a2a2e;
  --border-gold: #5a4c1e;

  --ok: #4caf50;
  --ok-bg: #15301a;
  --no: #e2574c;
  --no-bg: #3a1c1a;

  --focus: #ffd34d;

  --radius: 16px;
  --radius-sm: 8px;
  --shadow: 0 4px 16px rgba(0, 0, 0, .45);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, .6);

  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px;

  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { font-size: 20px; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  background: var(--bg);
  color: var(--white);
}

img { max-width: 100%; display: block; }

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

h1, h2, h3 { color: var(--gold); line-height: 1.25; margin: 0; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding-inline: var(--sp-5);
}

.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;
}

.skip-link {
  position: absolute; left: var(--sp-3); top: -100px;
  background: var(--gold); color: var(--bg);
  padding: var(--sp-3) var(--sp-4); border-radius: var(--radius-sm);
  font-weight: 700; z-index: 100;
}
.skip-link:focus { top: var(--sp-3); }

/* Focus — always visible for keyboard users */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

/* ---- Header ---------------------------------------------------- */

.site-header {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.site-header__inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-4); min-height: 80px;
}
.brand {
  display: flex; align-items: center; gap: var(--sp-3);
  text-decoration: none; color: var(--gold);
  font-size: 1.3rem; font-weight: 700;
  padding: var(--sp-2) 0;
}
.brand__icon { font-size: 1.6rem; }

/* ---- Language switcher ---------------------------------------- */

.lang-switch { display: flex; gap: var(--sp-2); }
.lang-switch__form { margin: 0; }
.lang-pill {
  min-width: 56px; min-height: 56px;
  padding: var(--sp-2) var(--sp-3);
  font: inherit; font-weight: 700; font-size: .9rem;
  letter-spacing: .04em; cursor: pointer;
  background: transparent; color: var(--muted);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: background .15s ease, color .15s ease;
}
.lang-pill.is-active {
  background: var(--gold); color: var(--bg); border-color: var(--gold);
}
@media (hover: hover) {
  .lang-pill:hover { background: var(--panel-hover); color: var(--white); }
  .lang-pill.is-active:hover { background: var(--gold-soft); color: var(--bg); }
}

/* ---- Breadcrumbs / back / buttons ----------------------------- */

.breadcrumbs {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2);
  padding-top: var(--sp-4); font-size: .85rem; color: var(--muted);
}
.breadcrumbs a { color: var(--muted); text-decoration: none; padding: var(--sp-2) var(--sp-1); }
.breadcrumbs a:hover { color: var(--gold); text-decoration: underline; }
.breadcrumbs__sep { color: var(--text-dim); }
.breadcrumbs [aria-current="page"] { color: var(--gold); font-weight: 700; }

.site-main { padding-block: var(--sp-6) var(--sp-7); }

.btn-back, .btn {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  min-height: 56px; padding: var(--sp-3) var(--sp-5);
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  background: var(--panel-2); color: var(--gold);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: background .15s ease;
}
.btn--gold { background: var(--gold); color: var(--bg); border-color: var(--gold); font-weight: 700; }
@media (hover: hover) {
  .btn-back:hover, .btn:hover { background: var(--panel-hover); }
  .btn--gold:hover { background: var(--gold-soft); }
}
.btn-back { margin-bottom: var(--sp-5); }

/* ---- Page heading --------------------------------------------- */

.page-title { font-size: 2rem; }
.page-intro { color: var(--muted); font-size: 1rem; max-width: 68ch; margin-top: var(--sp-3); }

.hall-head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-4);
  border-bottom: 1px solid var(--border); padding-bottom: var(--sp-4);
  margin-bottom: var(--sp-5);
}
.hall-head__count { color: var(--muted); }

/* ---- Home: hall tiles ----------------------------------------- */

.hall-grid {
  display: grid; gap: var(--sp-5); margin-top: var(--sp-6);
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
.hall-tile {
  display: flex; flex-direction: column; text-decoration: none;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  transition: transform .15s ease, border-color .15s ease;
}
.hall-tile__media {
  position: relative; aspect-ratio: 16 / 10;
  overflow: hidden; background: var(--panel-2);
}
/* Absolute so a tall image can't override the box's aspect-ratio. */
.hall-tile__media img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
}
.hall-tile__empty {
  display: flex; align-items: center; justify-content: center;
  height: 100%; font-size: 3rem; color: var(--text-dim);
}
.hall-tile__body { padding: var(--sp-5); }
.hall-tile__code {
  display: block; color: var(--gold); font-weight: 700;
  letter-spacing: .04em; font-size: .85rem; margin-bottom: var(--sp-1);
}
.hall-tile__label { display: block; color: var(--gold); font-size: 1.3rem; font-weight: 700; }
.hall-tile__count { color: var(--muted); }
@media (hover: hover) {
  .hall-tile:hover { transform: translateY(-2px); border-color: var(--gold); box-shadow: var(--shadow-lg); }
}

/* ---- Exhibit card grid ---------------------------------------- */

.card-grid {
  display: grid; gap: var(--sp-5);
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}
.card {
  display: flex; flex-direction: column; text-decoration: none; color: var(--white);
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  transition: transform .15s ease, border-color .15s ease;
}
.card__media {
  position: relative; aspect-ratio: 16 / 10;
  overflow: hidden; background: var(--panel-2);
}
/* Absolute so a tall image can't override the box's aspect-ratio. */
.card__thumb { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.card__thumb--empty {
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem; color: var(--text-dim);
}
.card__body { padding: var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-2); }
.card__code {
  color: var(--gold); font-weight: 700; letter-spacing: .04em;
  font-size: .85rem; white-space: nowrap;
}
.card__title {
  font-size: 1.1rem; line-height: 1.25; color: var(--white);
  /* Always reserve 2 lines so every card is the same height. */
  min-height: 2.5em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card__subtitle {
  margin: 0; color: var(--muted); font-size: .85rem; line-height: 1.5;
  min-height: 3em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
@media (hover: hover) {
  .card:hover { transform: translateY(-2px); border-color: var(--gold); box-shadow: var(--shadow-lg); }
}

/* ---- Availability mini-table ---------------------------------- */

.avail {
  position: absolute; right: var(--sp-3); bottom: var(--sp-3);
  background: rgba(26, 26, 29, .95); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: var(--sp-2);
}
.avail__table { border-collapse: collapse; }
.avail__table th, .avail__table td {
  font-size: 13px; font-weight: 600; color: var(--muted);
  text-align: center; padding: 2px;
}
.avail__table thead th { letter-spacing: .04em; }
.avail__table tbody th { text-align: right; padding-right: var(--sp-2); }
.avail__cell {
  width: 24px; height: 24px; border-radius: 6px; font-size: 13px;
}
.avail__cell.is-yes { background: var(--ok-bg); color: var(--ok); }
.avail__cell.is-no { background: var(--no-bg); color: var(--no); }
.avail__images {
  margin: var(--sp-2) 0 0; padding-top: var(--sp-2);
  border-top: 1px solid var(--border);
  font-size: 13px; font-weight: 600; color: var(--muted);
  text-align: center;
}
.avail__images.is-yes span:first-of-type { color: var(--ok); }
.avail__images.is-no span:first-of-type { color: var(--no); }

/* ---- Hall toolbar: number jump + notices ---------------------- */

.jump {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2);
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-5);
}
.jump__label { color: var(--muted); font-weight: 600; margin-right: var(--sp-2); }
.jump__prefix { color: var(--gold); font-weight: 700; }
.jump__input {
  min-height: 56px; width: 120px; padding: var(--sp-2) var(--sp-3);
  font: inherit; background: var(--panel-2); color: var(--white);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.notice {
  background: var(--panel-2); border: 1px solid var(--border-gold);
  border-radius: var(--radius-sm); padding: var(--sp-3) var(--sp-4);
  color: var(--muted); margin: 0 0 var(--sp-4);
}
.notice--error { border-color: var(--no); color: var(--no); }

/* ---- Pagination ----------------------------------------------- */

.pager {
  display: flex; align-items: center; justify-content: center; gap: var(--sp-4);
  margin-top: var(--sp-7);
}
.pager__status { color: var(--muted); }

/* ---- Exhibit detail: media stage ------------------------------ */

.stage { margin-bottom: var(--sp-6); }
.stage__tabs { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.stage__tab {
  min-height: 56px; padding: var(--sp-3) var(--sp-5);
  font: inherit; font-weight: 600; cursor: pointer;
  background: transparent; color: var(--muted);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.stage__tab.is-active { background: var(--gold); color: var(--bg); border-color: var(--gold); }
.stage__panel { display: none; }
.stage__panel.is-active { display: block; }

.stage__video, .gallery__main {
  width: 100%; aspect-ratio: 16 / 9; object-fit: contain;
  background: #000; border-radius: var(--radius);
}
.stage--empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--sp-3); aspect-ratio: 16 / 9;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-dim); font-size: 3rem;
}
.stage--empty p { font-size: 1rem; margin: 0; }

/* 360 viewer */
.viewer360 {
  position: relative; aspect-ratio: 16 / 9;
  background: #000; border-radius: var(--radius); overflow: hidden;
  cursor: ew-resize;
}
.viewer360__frame { width: 100%; height: 100%; object-fit: contain; }
.viewer360__hint {
  position: absolute; left: 50%; bottom: var(--sp-4); transform: translateX(-50%);
  background: rgba(0, 0, 0, .7); color: var(--gold);
  padding: var(--sp-2) var(--sp-4); border-radius: 999px; font-size: .85rem;
}

/* Gallery */
.gallery__thumbs { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-3); }
.gallery__thumb {
  width: 80px; height: 80px; padding: 0; cursor: pointer;
  background: var(--panel-2); border: 3px solid transparent;
  border-radius: var(--radius-sm); overflow: hidden;
}
.gallery__thumb img { width: 100%; height: 100%; object-fit: cover; }
.gallery__thumb.is-active { border-color: var(--gold); }

/* ---- Exhibit detail: text ------------------------------------- */

.exhibit-head { margin-bottom: var(--sp-5); }
.exhibit-head__code {
  color: var(--gold); font-weight: 700; letter-spacing: .04em; white-space: nowrap;
}
.exhibit-head__title { font-size: 1.6rem; margin: var(--sp-2) 0; }
.exhibit-head__subtitle { color: var(--muted); margin: 0; }

.audio {
  background: var(--panel-2); border: 1px solid var(--border-gold);
  border-radius: var(--radius); padding: var(--sp-5); margin-bottom: var(--sp-6);
}
.audio__title { font-size: 1.3rem; margin-bottom: var(--sp-3); }
.audio__player { width: 100%; }
.audio__bg { display: flex; align-items: center; gap: var(--sp-2); margin-top: var(--sp-3); color: var(--muted); }

.description { margin-bottom: var(--sp-6); }
.description__title { font-size: 1.3rem; margin-bottom: var(--sp-3); }
.description__body { max-width: 68ch; color: var(--white); }
.description__body p { margin: 0 0 var(--sp-3); }

.prevnext {
  display: flex; justify-content: space-between; gap: var(--sp-4);
  border-top: 1px solid var(--border); padding-top: var(--sp-5);
}
.prevnext__link {
  display: flex; align-items: center; gap: var(--sp-3);
  min-height: 56px; padding: var(--sp-3) var(--sp-5);
  text-decoration: none; color: var(--gold);
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.prevnext__link--next { margin-left: auto; text-align: right; }
@media (hover: hover) {
  .prevnext__link:hover, .stage__tab:hover { background: var(--panel-hover); }
}

/* ---- Footer --------------------------------------------------- */

.site-footer { background: var(--panel); border-top: 1px solid var(--border); }
.site-footer__inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: var(--sp-4); padding-block: var(--sp-5); color: var(--text-dim);
}

/* ---- Responsive ----------------------------------------------- */

@media (max-width: 640px) {
  .container { padding-inline: var(--sp-4); }
  .site-header__inner { min-height: 64px; }
  .page-title { font-size: 1.5rem; }
  .exhibit-head__title { font-size: 1.3rem; }
  .card-grid, .hall-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
