/* ===================================================================
   History component — funguje standalone i jako součást index.html.
   Proměnné se opírají o values z styles.css; fallbacky zajišťují
   funkčnost na standalone stránce (historie.html).
=================================================================== */

:root {
  --h-text:    var(--color-text,    #1a1a1a);
  --h-muted:   var(--color-muted,   #666);
  --h-border:  var(--color-border,  #e0e0e0);
  --h-bg-alt:  var(--color-bg-alt,  #f5f5f5);
  --h-radius:  var(--radius,        4px);
  --h-overlay: rgba(0, 0, 0, 0.88);
  --h-ease:    0.2s ease;
}

body.h-scroll-lock { overflow: hidden; }

/* === Timeline === */
.h-timeline {
  position: relative;
  padding-left: 2.25rem;
}

.h-timeline::before {
  content: '';
  position: absolute;
  left: 0.55rem;
  top: 0.6rem;
  bottom: 0;
  width: 1px;
  background: linear-gradient(to bottom, var(--h-border) 85%, transparent);
}

.h-entry {
  position: relative;
  margin-bottom: 3.5rem;
}

.h-entry::before {
  content: '';
  position: absolute;
  left: -1.85rem;
  top: 0.5rem;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--h-text);
  border: 2px solid var(--h-bg-alt, #f5f5f5);
  box-shadow: 0 0 0 1px var(--h-border);
}

.h-year-badge {
  display: inline-block;
  background: var(--h-text);
  color: #fff;
  padding: 0.15rem 0.6rem;
  border-radius: var(--h-radius);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.h-entry-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--h-text);
  margin-bottom: 0.4rem;
}

.h-entry-desc {
  color: var(--h-muted);
  margin-bottom: 1.25rem;
  max-width: 65ch;
  line-height: 1.7;
}

.h-empty {
  color: var(--h-muted);
  font-style: italic;
}

/* === Galerie fotografií === */
.h-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.h-photo-item {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: var(--h-radius);
  cursor: pointer;
  background: var(--h-border);
  border: none;
  padding: 0;
}

.h-photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}
.h-photo-item:hover img,
.h-photo-item:focus-visible img { transform: scale(1.04); }

/* === Video grid === */
.h-video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.h-video-card {
  border: 1px solid var(--h-border);
  padding: 0;
  border-radius: var(--h-radius);
  overflow: hidden;
  background: #111;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: border-color var(--h-ease);
}
.h-video-card:hover { border-color: var(--h-text); }

.h-video-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #222;
}

.h-video-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}
.h-video-card:hover .h-video-thumb img,
.h-video-card:focus-visible .h-video-thumb img { transform: scale(1.04); }

.h-no-thumb { width: 100%; height: 100%; background: #2a2a2a; }

.h-play-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.35);
  transition: background var(--h-ease);
}
.h-video-card:hover .h-play-icon,
.h-video-card:focus-visible .h-play-icon { background: rgba(0,0,0,.5); }

.h-play-icon::after {
  content: '';
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 14px 0 14px 24px;
  border-color: transparent transparent transparent #fff;
  margin-left: 4px;
  display: block;
}

.h-video-title {
  padding: 0.5rem 0.75rem;
  font-size: 0.88rem;
  color: #ccc;
  margin: 0;
}

/* ===================================================================
   Overlay
=================================================================== */
.h-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: var(--h-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.h-ovr-btn {
  background: rgba(255,255,255,.12);
  border: none;
  color: #fff;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background var(--h-ease);
}
.h-ovr-btn:hover { background: rgba(255,255,255,.25); }

/* ===================================================================
   Lightbox
=================================================================== */
#h-lightbox { z-index: 500; }

.h-lb-figure {
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.h-lb-figure img {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: var(--h-radius);
  display: block;
}

.h-lb-figure figcaption {
  color: #aaa;
  font-size: 0.875rem;
  text-align: center;
  letter-spacing: 0.02em;
}

.h-lb-close { position: fixed; top: 1rem;   right: 1rem;  font-size: 1.75rem; width: 3rem;    height: 3rem; }
.h-lb-prev  { position: fixed; left: 1rem;  top: 50%; transform: translateY(-50%); font-size: 2.5rem; width: 3.25rem; height: 3.25rem; }
.h-lb-next  { position: fixed; right: 1rem; top: 50%; transform: translateY(-50%); font-size: 2.5rem; width: 3.25rem; height: 3.25rem; }

/* ===================================================================
   Video modal
=================================================================== */
.h-video-box {
  background: #000;
  border-radius: var(--h-radius);
  width: 100%;
  max-width: 860px;
  padding: 2.75rem 1rem 1rem;
  position: relative;
}

.h-vm-close { position: absolute; top: 0.5rem; right: 0.75rem; font-size: 1.75rem; width: 2.75rem; height: 2.75rem; }

.h-video-resp {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: var(--h-radius);
}

.h-video-resp iframe,
.h-video-resp video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* ===================================================================
   Modaly (heslo) — fallback pro standalone stránku
=================================================================== */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: var(--h-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-box {
  background: #fff;
  border-radius: var(--h-radius);
  padding: 2rem;
  width: 100%;
  max-width: 420px;
  position: relative;
}

.modal-box h2 { margin-bottom: 0.5rem; }
.modal-box > p { color: var(--h-muted); margin-bottom: 1.25rem; }
.modal-box input { margin-bottom: 1rem; }

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 1.75rem;
  cursor: pointer;
  color: var(--h-muted);
  line-height: 1;
}
.modal-close:hover { color: var(--h-text); }

/* ===================================================================
   Responzivita
=================================================================== */
@media (max-width: 600px) {
  .h-timeline     { padding-left: 1.75rem; }
  .h-entry::before { left: -1.5rem; }
  .h-photo-grid   { grid-template-columns: repeat(3, 1fr); }
  .h-video-grid   { grid-template-columns: 1fr; }
  .h-lb-prev      { left: 0.25rem; }
  .h-lb-next      { right: 0.25rem; }
}

@media (max-width: 400px) {
  .h-photo-grid { grid-template-columns: repeat(2, 1fr); }
}
