:root {
  color-scheme: dark;
  --bg: #0e0e0e;
  --fg: #e9e9e6;
  --mut: #86867f;
  --line: #232323;
  --panel: #121212;
  --bar: 52px;
  --foot: 36px;
  --idx: clamp(340px, 33.333vw, 760px);
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font: 13px/1.4 "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 1px solid var(--mut); outline-offset: 3px; }

/* ---------- header ---------- */
#bar {
  position: fixed; inset: 0 0 auto 0; height: var(--bar); z-index: 5;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 28px;
  padding: 0 24px; background: var(--bg);
}
#name {
  color: var(--fg); text-decoration: none; white-space: nowrap;
  font-weight: 600; font-size: 13px; letter-spacing: .16em; text-transform: uppercase;
}
#name:hover { color: #fff; }
#name { justify-self: start; text-align: left; }
#cats { display: flex; gap: 22px; }
#cats button {
  padding: 4px 0; color: var(--mut); letter-spacing: .04em;
  border-bottom: 1px solid transparent;
}
#cats button:hover { color: var(--fg); }
#cats button.on { color: var(--fg); border-bottom-color: var(--fg); }
/* eszközök a fejléc közepén: infó + teljes képernyő (csak ikonok; a kattintható felület nagyobb a jelnél) */
#tools {
  position: absolute; left: 50%; top: 0; height: 100%; transform: translateX(-50%);
  display: flex; align-items: center;
}
.tool {
  height: 100%; width: 44px; display: flex; align-items: center; justify-content: center;
  color: var(--mut); transition: color .12s;
}
.tool:hover, .tool.on { color: var(--fg); }
.tool svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
#fs .exit { display: none; }
#fs.on .enter { display: none; }
#fs.on .exit { display: inline; }
#fs[hidden] { display: none; }
@media (max-width: 899px) { #fs { display: none; } }   /* keskenyen nincs hely, telefonon amúgy sincs értelme */

#meta { color: var(--mut); white-space: nowrap; }
#title { color: var(--fg); }
#count { margin-left: 12px; font-variant-numeric: tabular-nums; }

/* ---------- stage ---------- */
#stage {
  position: fixed; top: var(--bar); bottom: var(--foot); left: 0; right: 0;
  padding: 10px 64px; display: flex; align-items: center; justify-content: center;
  touch-action: pan-y;
}
body.idx #stage { right: var(--idx); }
#stage[data-d="l"] { cursor: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Cpath d='M19 7L10 16l9 9' fill='none' stroke='black' stroke-opacity='.55' stroke-width='5' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M19 7L10 16l9 9' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") 16 16, w-resize; }
#stage[data-d="r"] { cursor: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Cpath d='M13 7l9 9-9 9' fill='none' stroke='black' stroke-opacity='.55' stroke-width='5' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M13 7l9 9-9 9' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") 16 16, e-resize; }

#slide { display: flex; align-items: center; justify-content: center; gap: 24px; }
#slide.col { flex-direction: column; gap: 24px; }
#slide.in { animation: fade .18s ease-out; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* a kép nem <img>: háttérként jelenik meg, nem mentheto / hozzaadhato kozvetlenul */
.ph {
  flex: none; background-repeat: no-repeat; background-position: center; background-size: 100% 100%;
  pointer-events: none;
}

/* ---------- footer ---------- */
#foot {
  position: fixed; inset: auto 0 0 0; height: var(--foot); z-index: 5;
  display: flex; align-items: center; justify-content: center; gap: 18px;
  padding: 0 24px; color: var(--mut); font-size: 11px; letter-spacing: .04em; background: var(--bg);
}
body.idx #foot { right: var(--idx); }
#copy { flex: 1; text-align: center; }
#ftitle { display: none; }

/* ---------- nyilak: a kép két oldalán, középmagasságban; a kattintható sáv sokkal nagyobb a jelnél ---------- */
.arrow {
  position: fixed; top: var(--bar); bottom: var(--foot); width: 64px; z-index: 3;
  display: flex; align-items: center; color: var(--mut); touch-action: manipulation;
}
.arrow svg { width: 14px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.arrow:hover, .arrow:active { color: var(--fg); }
#prev { left: 0; justify-content: flex-start; padding-left: 22px; }
#next { right: 0; justify-content: flex-end; padding-right: 22px; }
body.idx #next { right: var(--idx); }

/* ---------- index: jobb oldali panel + íves fül ---------- */
#index {
  position: fixed; top: var(--bar); bottom: 0; right: 0; width: var(--idx); z-index: 4;
  background: var(--panel); border-left: 1px solid var(--line);
  overflow-y: auto; overscroll-behavior: contain; padding: 8px 24px 40px;
  transform: translateX(101%); visibility: hidden;
  transition: transform .16s ease-out, visibility 0s linear .16s;
  scrollbar-width: thin; scrollbar-color: #2b2b2b transparent;
}
body.idx #index { transform: none; visibility: visible; transition: transform .16s ease-out, visibility 0s; }
#index::-webkit-scrollbar { width: 8px; }
#index::-webkit-scrollbar-track { background: transparent; }
#index::-webkit-scrollbar-thumb { background: #2b2b2b; border-radius: 4px; }
#index::-webkit-scrollbar-thumb:hover { background: #444; }

#idx-tab {
  position: fixed; top: calc(var(--bar) + 70px); right: 0; z-index: 6;
  width: 28px; padding: 14px 0 16px; display: flex; flex-direction: column; align-items: center; gap: 12px;
  background: var(--panel); color: var(--mut);
  border: 1px solid var(--line); border-right: 0; border-radius: 12px 0 0 12px;
  transition: right .16s ease-out, color .12s;
}
#idx-tab:hover { color: var(--fg); }
#idx-tab .lab { writing-mode: vertical-rl; font-size: 11px; letter-spacing: .18em; text-transform: uppercase; }
#idx-tab .chev {
  width: 7px; height: 7px; border-top: 1.5px solid currentColor; border-right: 1.5px solid currentColor;
  transform: rotate(45deg);                        /* › nyitva: kattintásra jobbra becsukódik */
}
body:not(.idx) #idx-tab .chev { transform: rotate(-135deg); }   /* ‹ zárva: kattintásra kinyílik */
body.idx #idx-tab { right: var(--idx); }

#index section { padding-top: 22px; }
#index h2 {
  font-weight: 400; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--mut);
  padding-bottom: 12px; display: flex; justify-content: space-between;
}
#index .grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 12px; }
#index .s { text-align: left; display: block; color: var(--mut); min-width: 0; }
#index .th {
  display: block; aspect-ratio: 1; background-size: cover; background-position: center 30%;
  background-color: #1a1a1a; opacity: .78; outline: 1px solid transparent; outline-offset: 2px;
}
#index .s:hover .th { opacity: 1; }
#index .s.on .th { opacity: 1; outline-color: var(--fg); }
#index .t { display: block; margin-top: 6px; font-size: 11px; line-height: 1.3; letter-spacing: .02em; }
#index .s:hover, #index .s.on { color: var(--fg); }
#index .t i { font-style: normal; color: var(--mut); margin-left: 4px; }

/* ---------- keskeny kijelzo ---------- */
@media (max-width: 759px) {
  :root { --bar: 84px; --idx: 100vw; }
  #bar {
    grid-template-columns: 1fr; grid-template-rows: 44px 40px; gap: 0; padding: 0 16px;
    grid-template-areas: "name" "cats";
  }
  #name { grid-area: name; }
  #cats { grid-area: cats; gap: 18px; overflow-x: auto; scrollbar-width: none; }
  #meta { display: none; }
  #tools { left: auto; right: 6px; transform: none; height: 44px; }   /* telefonon az első sor jobb szélén */
  #stage { padding: 6px 12px; }
  body.idx #stage, body.idx #foot { right: 0; }
  #index { padding: 8px 40px 40px 16px; }
  body.idx #idx-tab { right: 0; }                  /* teljes szélességű panelnél a fül a panel szélén marad */
  #foot { padding: 0 16px; }
  #ftitle { display: block; flex: 1; text-align: left; color: var(--fg); }
  #copy { display: none; }
  .arrow { width: 48px; color: #fff; opacity: .7; filter: drop-shadow(0 0 3px rgba(0, 0, 0, .8)); }
  #prev { padding-left: 10px; }
  #next { padding-right: 10px; }
  body.idx .arrow { display: none; }
}

/* névjegy (kapcsolat) felugró ablak */
#card {
  position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, .62);
  display: flex; align-items: center; justify-content: center; padding: 16px;
  animation: fade .14s ease-out;
}
#card[hidden] { display: none; }
#card .box:focus { outline: none; }
#card .box {
  position: relative; min-width: 300px; max-width: 100%; padding: 34px 44px 32px;
  background: #141414; border: 1px solid #2a2a2a; border-radius: 6px;
}
#card h2 { font-weight: 600; font-size: 13px; letter-spacing: .16em; text-transform: uppercase; margin-bottom: 22px; }
#card dl { display: grid; gap: 4px; }
#card dt { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--mut); margin-top: 12px; }
#card dt:first-child { margin-top: 0; }
#card dd { font-size: 18px; letter-spacing: .02em; -webkit-user-select: text; user-select: text; }
#card a { color: var(--fg); text-decoration: none; border-bottom: 1px solid #444; }
#card a:hover { border-bottom-color: var(--fg); }
#card .x { position: absolute; top: 6px; right: 8px; width: 36px; height: 36px; font-size: 22px; line-height: 1; color: var(--mut); }
#card .x:hover { color: var(--fg); }

@media print { html { display: none !important; } }
