/* =========================================================
   shared.css — společné pro index.html, article.html, about.html
   =========================================================
   Sem patří JEN to, co je na všech 3 stránkách identické: barevné
   proměnné, hvězdné pozadí, systém "plovoucích citátů" a souhvězdí
   mezi nimi, a základní focus-visible. Rozvržení jednotlivých stránek
   (panely sekcí, tělo článku, obsah "O Zajdovi"...) zůstává v jejich
   vlastních <style> blocích — to sdílené není a nemělo by být.
   ========================================================= */

/* === PLYNULÝ PŘECHOD MEZI STRÁNKAMI (View Transitions) ===
   Nativní funkce prohlížeče — homepage → článek a zpátky se místo
   tvrdého překliknutí jemně prolne. Podporováno v Chrome/Edge (a
   postupně přibývá), ostatní prohlížeče tenhle řádek beze změny
   ignorují a fungují jako dřív. Žádný JS, žádné riziko. */
@view-transition {
  navigation: auto;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --void: #08080f;
  --void-2: #0e0f1c;
  --panel: rgba(20, 21, 38, 0.55);
  --panel-solid: rgba(28, 29, 48, 0.92);
  --panel-border: rgba(140, 150, 255, 0.18);
  --panel-border-hover: rgba(255, 122, 69, 0.55);
  --aurora: #8f6bff;
  --aurora-dim: rgba(143, 107, 255, 0.4);
  --ember: #ff7a45;
  --ember-dim: rgba(255, 122, 69, 0.4);
  --nova: #2fe6c9;
  --nova-dim: rgba(47, 230, 201, 0.35);
  --parchment: #f8f5ef;
  --mist: #b3b6da;
  --mist-dim: #6a6d90;
  --hairline: linear-gradient(90deg, var(--aurora), var(--ember));
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--void);
  color: var(--parchment);
  overflow-x: hidden;
  min-height: 100vh;
  position: relative;
  font-weight: 400;
}

.bg {
  position: fixed; inset: 0; z-index: 0;
  background:
    radial-gradient(ellipse 900px 600px at 50% 8%, rgba(255,122,69,0.15), transparent 60%),
    radial-gradient(circle at 85% 85%, rgba(47,230,201,0.13), transparent 55%),
    radial-gradient(circle at 12% 75%, rgba(143,107,255,0.08), transparent 55%),
    linear-gradient(180deg, #06060c 0%, #0a0a16 45%, #08080f 100%);
}

/* === HVĚZDNÉ POZADÍ === */
.stars { position: fixed; inset: 0; z-index: 1; pointer-events: none; }
.star {
  position: absolute; width: 2px; height: 2px; background: #fff; border-radius: 50%;
  opacity: 0; animation: twinkle var(--dur) ease-in-out infinite; animation-delay: var(--del);
  box-shadow: 0 0 4px rgba(255,255,255,0.6);
}
.star:nth-of-type(7n) { background: var(--ember); box-shadow: 0 0 6px var(--ember-dim); width: 3px; height: 3px; }
.star:nth-of-type(11n) { background: var(--nova); box-shadow: 0 0 6px var(--nova-dim); }
.star:nth-of-type(17n) { background: var(--aurora); box-shadow: 0 0 6px var(--aurora-dim); }
@keyframes twinkle { 0%,100% { opacity: 0.08; transform: scale(0.5); } 50% { opacity: 0.9; transform: scale(1); } }

/* === SOUHVĚZDÍ MEZI CITÁTY === */
.constellation-layer { position: fixed; inset: 0; z-index: 4; pointer-events: none; width: 100%; height: 100%; }
.constellation-line { stroke: var(--nova); stroke-width: 1; transition: stroke-opacity 0.3s ease; }
.constellation-line.active { stroke: #fff; }

/* === PLOVOUCÍ CITÁTY === */
.quote-star { position: absolute; max-width: 300px; pointer-events: auto; z-index: 5; animation: drift linear infinite; }
.quote-star:hover, .quote-star.hover-active { animation-play-state: paused !important; z-index: 6; }

.signal-dot {
  position: absolute; top: 8px; left: -12px; width: 6px; height: 6px; border-radius: 50%;
  background: var(--nova); box-shadow: 0 0 10px var(--nova), 0 0 22px var(--nova-dim);
  animation: signal-pulse 1.15s ease-in-out infinite;
}
.quote-star.revealed .signal-dot { opacity: 0; transition: opacity 0.4s ease; }
@keyframes signal-pulse { 0%,100% { opacity: 0.3; transform: scale(0.75); } 50% { opacity: 1; transform: scale(1.35); } }

.comet-tail {
  position: absolute; top: 8px; left: -12px; width: 100px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--nova-dim) 65%, transparent);
  transform-origin: left center;
  transform: translateY(-50%) rotate(var(--tail-angle));
  filter: blur(2px); opacity: 0.5; pointer-events: none;
  transition: opacity 0.3s ease;
}
.quote-star:hover .comet-tail, .quote-star.hover-active .comet-tail { opacity: 0; }

.quote-star::after {
  content: ''; position: absolute; top: 50%; left: 50%; width: 4px; height: 4px;
  transform: translate(-50%, -50%) scale(0); border-radius: 50%;
  background: radial-gradient(circle, #fff 0%, var(--ember) 35%, transparent 72%);
  box-shadow: 0 0 0 rgba(255,255,255,0);
  opacity: 0; pointer-events: none; z-index: -1;
  transition: transform 0.55s cubic-bezier(.22,1,.36,1), opacity 0.4s ease, box-shadow 0.55s ease;
}
.quote-star:hover::after, .quote-star.hover-active::after {
  transform: translate(-50%, -50%) scale(46);
  opacity: 0.16;
  box-shadow: 0 0 60px 20px rgba(255,255,255,0.25);
}

.quote-inner {
  font-family: 'Space Grotesk', sans-serif; font-weight: 300;
  color: rgba(244,241,234,0.7); font-size: 15px;
  text-shadow: 0 0 12px rgba(255,255,255,0.15); line-height: 1.5;
  opacity: 0; transform: translateY(6px) scale(0.94);
  transition: transform 0.45s cubic-bezier(.34,1.56,.64,1), opacity 0.6s ease, text-shadow 0.4s ease, color 0.3s ease;
}
.quote-star.revealed .quote-inner { opacity: 1; transform: translateY(0) scale(1); }
.quote-text { font-variant-ligatures: none; }
.quote-star:hover .quote-inner,
.quote-star.hover-active .quote-inner {
  transform: scale(1.3); color: #fff; font-weight: 400;
  text-shadow: 0 0 16px #fff, 0 0 34px #fff, 0 0 60px var(--ember), 0 0 90px var(--nova-dim);
}
.quote-author {
  font-family: 'Inter', sans-serif; color: var(--ember); font-size: 0.62em;
  opacity: 0; display: block; margin-top: 5px; font-style: normal; letter-spacing: 0.3px;
  transition: opacity 0.5s ease, color 0.3s ease;
}
.quote-author.shown { opacity: 0.85; }
.quote-star:hover .quote-author, .quote-star.hover-active .quote-author { color: var(--nova); opacity: 1; }
@keyframes drift { from { transform: translate(var(--sx), var(--sy)); opacity: 0; } 10% { opacity: 0.8; } 90% { opacity: 0.8; } to { transform: translate(var(--ex), var(--ey)); opacity: 0; } }

/* === ZÁKLADNÍ LIGHTBOX (jednoduchá verze — index.html a about.html;
   article.html má vlastní rozšířenou verzi s listováním/fullscreen,
   tu si definuje sama, protože je funkčně jiná, ne jen jinak stylovaná) === */
.lightbox-overlay { position: fixed; inset: 0; z-index: 9999; background: rgba(4,4,10,0.92); display: none; align-items: center; justify-content: center; cursor: zoom-out; }
.lightbox-overlay.open { display: flex; }
.lightbox-overlay img { max-width: 90vw; max-height: 90vh; border-radius: 10px; box-shadow: 0 0 50px rgba(140,150,255,0.25); touch-action: none; }
@media (prefers-reduced-motion: no-preference) {
  .lightbox-overlay img { transition: transform 0.22s cubic-bezier(.22,1,.36,1), opacity 0.18s ease; }
}

:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; }

/* === SKIP LINK — "Přeskočit na obsah" ===
   Neviditelné, dokud na něj klávesnicí/čtečkou nenajedeš Tabem — pak
   vyjede shora. Bez tohohle musí klávesnicoví uživatelé na každé
   stránce protabovat celou navigaci/hvězdné pozadí, než se dostanou
   k vlastnímu obsahu. */
.skip-link {
  position: absolute;
  top: -60px; left: 12px;
  z-index: 10000;
  background: var(--ember);
  color: #08080f;
  font-weight: 700;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: 8px;
  text-decoration: none;
  transition: top 0.2s ease;
}
.skip-link:focus {
  top: 12px;
}

/* === "ULOŽIT NA POZDĚJI" === */
.save-btn.saved {
  color: var(--nova);
  border-color: var(--nova);
  background: rgba(47,230,201,0.14);
}

.saved-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--mist); font-size: 13px; cursor: pointer;
  padding: 6px 14px; border-radius: 20px;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: color 0.2s, border-color 0.2s;
}
.saved-link:hover, .saved-link:focus-visible {
  color: var(--parchment); border-color: var(--panel-border-hover);
}

.remove-saved-btn {
  background: none; border: none; color: var(--mist-dim); cursor: pointer;
  font-size: 13px; padding: 4px 8px; margin-left: auto; flex-shrink: 0;
  border-radius: 50%; transition: color 0.2s, background 0.2s;
}
.remove-saved-btn:hover { color: var(--ember); background: rgba(255,122,69,0.12); }

/* === OBSAH ČLÁNKU (TOC) === */
.toc-box {
  background: var(--panel-solid, var(--panel));
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  margin: 0 0 28px;
  overflow: hidden;
}
.toc-box summary {
  padding: 14px 20px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600; font-size: 14.5px; color: var(--parchment);
  cursor: pointer; user-select: none; list-style: none;
  display: flex; align-items: center; gap: 8px;
}
.toc-box summary::-webkit-details-marker { display: none; }
.toc-box summary::after {
  content: '▾'; margin-left: auto; color: var(--mist-dim); font-size: 12px;
  transition: transform 0.2s ease;
}
.toc-box[open] summary::after { transform: rotate(180deg); }
.toc-list {
  padding: 4px 20px 16px;
  display: flex; flex-direction: column; gap: 2px;
  border-top: 1px solid rgba(140,150,255,0.1);
  padding-top: 12px;
}
.toc-list a {
  color: var(--mist); text-decoration: none; font-size: 14px;
  padding: 5px 0; transition: color 0.2s;
}
.toc-list a:hover, .toc-list a:focus-visible { color: var(--ember); }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

@media (prefers-reduced-motion: reduce) {
  .star, .quote-star { animation: none !important; opacity: 0.6; }
  .signal-dot, .comet-tail { display: none; }
  .quote-inner { opacity: 1 !important; transform: none !important; }
  .constellation-layer { display: none; }
  .quote-star::after { display: none; }
}

/* === DOTYKOVÁ ZPĚTNÁ VAZBA (":active") ===
   Hover efekty (:hover) na mobilu/tabletu nikdy nenaskočí — dotykové
   zařízení nemá kurzor, který by nad prvkem "visel". Tenhle blok proto
   doplňuje jemnou, okamžitou odezvu na samotné stisknutí prstem u karet
   a tlačítek, co ji dosud vůbec neměly. Netýká se to obyčejných textových
   odkazů (ty svou zpětnou vazbu dostávají podtržením/barvou při :hover,
   scale by tam naopak působilo rušivě). */
@media (prefers-reduced-motion: no-preference) {
  .section-panel,
  .latest-item,
  .section-modal-close,
  .travel-map-modal-close,
  .travel-map-modal-theme-toggle,
  .travel-map-modal-play-btn,
  .sort-toggle button {
    transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease, filter 0.2s ease;
  }
  .section-panel:active { transform: scale(0.98); }
  .latest-item:active { transform: scale(0.99); }
  .section-modal-close:active,
  .travel-map-modal-close:active,
  .travel-map-modal-theme-toggle:active,
  .travel-map-modal-play-btn:active { transform: scale(0.9); }
  .sort-toggle button:active { transform: scale(0.94); }
}
