/* Esoterica — Explore (TASK-056). New stylesheet, built on the existing
   hermes-tokens.css custom properties. No legacy area (retired hermes-lab
   or hermes-3d) markup or styles are reused; only the shared design tokens. */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--h-page);
  color: var(--h-on-dark-2);
  font: var(--h-font-size)/var(--h-line-height) system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

.ex-skip {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 100;
  background: var(--hl-panel-text-strong);
  color: var(--hl-on-dark);
  padding: 10px 16px;
  border-radius: 0 0 var(--h-r) 0;
}
.ex-skip:focus {
  left: 0;
}

.ex-header {
  padding: clamp(20px, 4vw, 40px) var(--h-pad) 18px;
  border-bottom: 1px solid var(--h-a-gold-26);
  background: linear-gradient(180deg, var(--h-a-gold-10), transparent);
}
.ex-header-inner { max-width: 1100px; margin: 0 auto; }
.ex-home {
  display: inline-block;
  color: var(--h-t-prag-on-dark);
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 10px;
  min-height: var(--h-tap);
  line-height: var(--h-tap);
}
.ex-home:hover, .ex-home:focus-visible { color: var(--h-gold); }
.ex-header h1 {
  margin: 0;
  font-size: clamp(28px, 6vw, 46px);
  color: var(--h-on-dark);
  letter-spacing: -0.02em;
}
.ex-tagline { color: var(--h-on-dark-3); margin: 6px 0 0; max-width: 60ch; }

.ex-controls {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px var(--h-pad);
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
}
.ex-search-row { display: flex; flex-direction: column; gap: 6px; flex: 1 1 280px; }
.ex-search-row label { font-size: 13px; color: var(--h-on-dark-3); font-weight: 700; }
#ex-q {
  min-height: var(--h-tap);
  padding: 0 14px;
  border-radius: var(--h-r);
  border: 1px solid var(--h-a-gold-34);
  background: var(--h-panel-6);
  color: var(--h-ink);
  font-size: 16px;
}
#ex-q:focus-visible { outline: 3px solid var(--h-gold); outline-offset: 2px; }

.ex-types {
  border: 1px solid var(--h-a-gold-26);
  border-radius: var(--h-r);
  padding: 8px 14px 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
}
.ex-types legend { padding: 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--h-t-lanac-on-dark); font-weight: 800; }
.ex-types label { display: flex; align-items: center; gap: 6px; font-size: 14px; min-height: var(--h-tap); color: var(--h-on-dark-2); }
.ex-types input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--h-gold); }

main { max-width: 1100px; margin: 0 auto; padding: 0 var(--h-pad) 60px; }

.ex-section { margin-top: 28px; }
.ex-section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.ex-section-head h2 { margin: 0; font-size: 20px; color: var(--h-on-dark); }
#ex-count { margin: 0; color: var(--h-on-dark-3); font-size: 14px; }

#graph-toggle {
  min-height: var(--h-tap);
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--h-a-gold-34);
  background: var(--h-panel-6);
  color: var(--h-ink);
  font-weight: 700;
  cursor: pointer;
}
#graph-toggle:focus-visible { outline: 3px solid var(--h-gold); outline-offset: 2px; }

.ex-hint { color: var(--h-on-dark-3); font-size: 13px; max-width: 70ch; }
.ex-graph-wrap {
  border: 1px solid var(--h-a-gold-26);
  border-radius: var(--h-r-pop);
  background: var(--h-a-white-035);
  overflow: auto;
}
#ex-graph { width: 100%; height: auto; min-width: 640px; display: block; }
#ex-graph .ex-edge { stroke: var(--h-a-gold-30); stroke-width: 1.4; }
#ex-graph .ex-node-tema circle { fill: var(--h-t-sefira-on-dark); }
#ex-graph .ex-node-modulo circle { fill: var(--h-t-stup-on-dark); }
#ex-graph a text { fill: var(--h-on-dark-2); font-size: 11px; }
#ex-graph a { cursor: pointer; }
#ex-graph a:focus-visible circle, #ex-graph a:hover circle { stroke: var(--h-gold); stroke-width: 3; }

.ex-results { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.ex-card {
  border: 1px solid var(--h-a-gold-26);
  border-radius: var(--h-r-pop);
  background: var(--h-panel-6);
  color: var(--h-ink);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ex-card-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ex-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--h-a-gold-34);
  color: var(--h-accent);
}
.ex-badge[data-type="tema"] { color: #7a5b00; border-color: #d9b35c; }
.ex-badge[data-type="modulo"] { color: #14509b; border-color: #7fb0e6; }
.ex-badge[data-type="entitet"] { color: #1d7a37; border-color: #7fcf98; }
.ex-badge[data-type="putanja"] { color: #b3352f; border-color: #e6a6a1; }
.ex-card h3 { margin: 0; font-size: 17px; }
.ex-card button.ex-open { all: unset; cursor: pointer; color: inherit; }
.ex-card button.ex-open:focus-visible { outline: 3px solid var(--h-accent); outline-offset: 2px; border-radius: 4px; }
.ex-card p { margin: 0; font-size: 14px; color: var(--h-ink-3); }
.ex-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ex-chip { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--hl-chip-bg); border: 1px solid var(--h-a-brown-24); color: var(--h-ink-3); }

.ex-empty {
  margin-top: 16px;
  padding: 20px;
  border: 1px dashed var(--h-a-gold-34);
  border-radius: var(--h-r);
  color: var(--h-on-dark-3);
  text-align: center;
}

.ex-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: var(--h-a-black-62);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.ex-dialog-backdrop[hidden] { display: none; }
.ex-dialog {
  width: min(640px, 100%);
  max-height: 86vh;
  overflow: auto;
  background: var(--h-panel);
  color: var(--h-ink);
  border-radius: var(--h-r-pop);
  border: 1px solid var(--h-a-gold-56);
  box-shadow: var(--h-shadow);
  padding: 20px;
}
.ex-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
#ex-dialog-close {
  width: var(--h-tap);
  height: var(--h-tap);
  border-radius: 50%;
  border: 1px solid var(--h-a-brown-24);
  background: var(--hl-panel-text-strong);
  color: var(--hl-on-dark);
  font-size: 20px;
  cursor: pointer;
}
#ex-dialog-close:focus-visible { outline: 3px solid var(--h-gold); outline-offset: 2px; }
#ex-dialog-title { margin: 4px 0 6px; font-size: 22px; }
.ex-dialog-meta { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; font-size: 13px; margin: 12px 0; }
.ex-dialog-meta dt { color: var(--h-accent-2); font-weight: 700; }
.ex-dialog-meta dd { margin: 0; }
.ex-dialog-links a { color: var(--h-accent); font-weight: 700; }
.ex-dialog-enrichments { margin: 16px 0; }
.ex-enrichment { border-top: 1px solid var(--h-a-brown-24); padding-top: 12px; margin-top: 12px; }
.ex-enrichment h3 { margin: 0 0 8px; font-size: 17px; color: var(--h-accent); }
.ex-enrichment h4 { margin: 12px 0 4px; font-size: 14px; }
.ex-enrichment p { white-space: pre-line; }

.ex-footer { padding: 24px var(--h-pad) 40px; color: var(--h-on-dark-3); font-size: 12px; text-align: center; }

@media (max-width: 640px) {
  .ex-results { grid-template-columns: 1fr; }
  #ex-graph { min-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
