
/* 
  Ostravské muzeum – Signpost
  --------------------------------------------------
  - Touch, 4×2 grid by default (PAGE_SIZE=8)
  - Modal video supports MP4 and YouTube (nocookie)
  - Pager hides automatically when there's only 1 page
*/

:root{ --safe-top: env(safe-area-inset-top, 0px); --safe-bottom: env(safe-area-inset-bottom, 0px); }

:root {
  --bg: #0f1115;
  --surface: #151923;
  --text: #e8ecf1;
  --muted: #a7b0c0;
  --accent: #9b87f5;
  --border: #2a3040;
  --radius: 16px;
  --gap: 18px;
  --shadow: 0 6px 24px rgba(0,0,0,0.25);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Manrope", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 600px at 15% 10%, #182035 0%, #0f1115 55%) fixed;
}

.container { width: min(1200px, 92vw); margin: 0 auto; }

.page-wrap { min-height: 100dvh; display: flex; flex-direction: column; }
.site-header { position: sticky; top: 0; z-index: 10; background: rgba(15,17,21,0.85); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);   padding-top: var(--safe-top);
}
.header-inner { display: block; padding: 24px 0; text-align: center; }
.site-title { margin: 0; font-size: clamp(20px, 3.2vw, 28px); letter-spacing: 0.3px; font-weight: 800;  text-align: center;  text-transform: uppercase; }



main { flex: 1; padding: 24px 0; }

.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gap);
}
.tile {
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #1b2132, #121826);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: clip;
  cursor: pointer;
  transition: transform 0.12s ease;
  -webkit-appearance: none;
  text-align: center;
}
.tile:active { transform: scale(0.99); }
.tile:focus,
.tile:focus-visible { outline: none; }
.tile-media {
  display: grid; place-items: center;
  aspect-ratio: 16/10;
  background: #0b0f18;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.tile-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile-body { padding: 14px 14px 16px;  text-align: center;   
  
  
}
.tile h3 { margin: 0 auto; font-size: clamp(16px, 2.2vw, 20px); font-weight: 650; color: #f1f4fb;  text-align: center;   
  max-width: 28ch;
  display: inline-block;
}
.tile p  { margin: 0 auto; font-size: 14px; color: var(--muted); min-height: 2.6em;  text-align: center;   
  max-width: 28ch;
  display: inline-block;
}

.site-footer { position: sticky; bottom: 0; background: rgba(15,17,21,0.85); border-top: 1px solid var(--border); }
.pager { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; padding: 12px 0; }
.pager-btn {
  justify-self: start;
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 12px;
  font-size: 18px;
  padding: 10px 14px;
  width: 110px;
  cursor: pointer;
}
.pager-btn:last-child { justify-self: end; }
.page-info { text-align: center; color: var(--muted); font-size: 14px; }

.modal {
  position: fixed; inset: 0; display: none;
  background: rgba(6, 8, 12, 0.72);
  backdrop-filter: blur(2px);
  padding: 22px;
  align-items: center; justify-content: center;
}
.modal.open { display: flex; }
.modal-card {
  width: min(1000px, 94vw);
  max-height: 88dvh;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  box-shadow: var(--shadow);
  padding: 18px;
  position: relative;
}
.modal-close {
  position: absolute; top: 10px; right: 12px;
  width: 44px; height: 40px; font-size: 26px;
  border-radius: 12px;
  appearance: none; border: 1px solid var(--border);
  background: #0f1422; color: var(--text);
  cursor: pointer;
}
.modal-title { margin: 0 40px 6px 4px; font-weight: 700; font-size: clamp(18px, 2.4vw, 22px); }
.modal-desc  { margin: 0 40px 12px 4px; color: var(--muted); font-size: 14px; }

.video-host { border: 1px solid var(--border); border-radius: 14px; overflow: clip; background: #0b0f18; }
.video-host iframe,
.video-host video { width: 100%; height: min(58vh, 62dvh); display: block; }

.no-scroll { overflow: hidden; }

@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 620px) {
  .grid { grid-template-columns: 1fr; }
  .pager-btn { width: auto; }
}
