:root {
    --bg: #faf8f4; --surface: #ffffff; --ink: #24211d; --muted: #6f695f;
    --line: #ded9cf; --accent: #8c2f25; --accent-ink: #ffffff; --flag-bg: #f8e9d2; --flag-ink: #6e4708;
    --target: #fbe7a8; --meta: #f1ece1;
    --lv1: #8c2f25; --lv1-ink: #ffffff;
    --lv2: #b5574a; --lv2-ink: #ffffff;
    --lv3: #dd9a8f; --lv3-ink: #24211d;
    --lv4: #eec6bf; --lv4-ink: #24211d;
    --lv5: #f7e3df; --lv5-ink: #24211d;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #1b1a18; --surface: #24221f; --ink: #ece8e0; --muted: #a79f92;
        --line: #3b3833; --accent: #d9776a; --accent-ink: #1b1a18; --flag-bg: #453517; --flag-ink: #f0d39a;
        --target: #5a4a16; --meta: #2e2b27;
        --lv1: #e08a7d; --lv1-ink: #1b1a18;
        --lv2: #b9675b; --lv2-ink: #1b1a18;
        --lv3: #8a4a41; --lv3-ink: #ffffff;
        --lv4: #5f3a34; --lv4-ink: #ffffff;
        --lv5: #43302c; --lv5-ink: #ece8e0;
    }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink);
       font: 14px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; }
.wrap { max-width: 1500px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
/* A fejléc mindig látszik, csak az alatta lévő tartalom görög. */
html, body { height: 100%; }
body { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }
.site-header { flex: none; z-index: 10; }
.page-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.page-body { padding-top: 20px; padding-bottom: 60px; }
h1 { font-size: 22px; margin: 0; }
.sub { color: var(--muted); margin: 2px 0 14px; }
a { color: var(--accent); }
.empty { color: var(--muted); padding: 24px 0; }

/* Fejléc és menü */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.site-header-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 0 28px; }
.brand { display: flex; align-items: center; gap: 10px; min-height: 46px; font-size: 16px; font-weight: 600; color: var(--ink); text-decoration: none; }
.logo { display: block; height: 46px; width: auto; padding: 3px 0; }
.site-header nav { display: flex; flex-wrap: wrap; gap: 2px 4px; margin-left: -8px; }
.site-header nav a { padding: 6px 8px; color: var(--ink); text-decoration: none; border-bottom: 2px solid transparent; }
.site-header nav a:hover { color: var(--accent); }
.site-header nav a[aria-current] { color: var(--accent); font-weight: 600; border-bottom-color: var(--accent); }

/* Nyelvváltó */
.lang-switch { display: flex; gap: 2px; margin-left: auto; font-size: 13px; }
.lang-switch a { padding: 3px 7px; color: var(--muted); text-decoration: none; border-radius: 3px; }
.lang-switch a:hover { color: var(--accent); }
.lang-switch a[aria-current] { color: var(--accent-ink); background: var(--accent); font-weight: 600; }

/* Szerkeszthető szöveges oldalak */
.prose { max-width: 720px; font-size: 16px; line-height: 1.55; }
.prose h1 { font-size: 26px; margin: 8px 0 16px; line-height: 1.25; }
.prose h2 { font-size: 19px; margin: 28px 0 10px; }
.prose h3 { font-size: 16px; margin: 22px 0 8px; }
.prose img { max-width: 100%; height: auto; }
.publist { list-style: none; margin: 0; padding: 0; }
.publist li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.publist cite { font-style: italic; }
.publist .note { color: var(--muted); font-size: 14px; }

/* Kezdőlap */
.prose:has(.home-grid) { max-width: 1240px; }
.home-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 48px; align-items: start; }
.home-col h2:first-child { font-size: 26px; margin: 8px 0 16px; line-height: 1.25; }
@media (max-width: 800px) {
    .home-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Aláírás a kezdőlap alján: középen, felette rövid vonal */
.signature { margin: 36px 0 0; text-align: center; }
.signature::before { content: ""; display: block; width: 100px; margin: 0 auto 12px; border-top: 1px solid var(--muted); }

/* Bal oldali menü és tartalom (Elemzések) */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.side-layout { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 16px 32px; align-items: start; }
.side-nav { position: sticky; top: 0; display: flex; flex-direction: column; gap: 2px; font-size: 15px; }
.side-nav a { padding: 7px 10px; color: var(--ink); text-decoration: none; border-left: 3px solid transparent; }
.side-nav a:hover { color: var(--accent); }
.side-nav a[aria-current] { color: var(--accent); font-weight: 600; border-left-color: var(--accent); background: var(--meta); }
@media (max-width: 700px) {
    .side-layout { grid-template-columns: minmax(0, 1fr); }
    .side-nav { position: static; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
}

/* Az Elemzések oldalon a kurzus adatbázisából átvett szöveg */
.course-text { max-width: 860px; }
.course-text h3 { font-size: 21px; line-height: 1.3; margin: 0 0 12px; }
.course-text h5 { font-size: 17px; margin: 24px 0 8px; }
.course-text table { width: auto; max-width: 100%; margin: 12px auto; background: none; font-size: 14px; }
.course-text table caption { padding-bottom: 8px; font-weight: 600; }
.course-text td { border: 0; padding: 3px; }
.course-text p.quot { margin: 14px 40px; padding: 10px 12px; font-size: 15px; background: var(--flag-bg); color: var(--ink);
                      border-left: 2px solid var(--accent); }
.course-text p.figurelabel { margin: 4px 0 26px; text-align: center; font-size: 13px; color: var(--muted); }
.course-text .img-responsive_atto_image_button_left { float: left; margin: 4px 16px 8px 0; }
@media (max-width: 600px) {
    .course-text p.quot { margin: 14px 0; }
}

/* Kinevezők: idővonal és testületek */
.timeline-bar { border-top: 1px solid var(--line); }
#timeline { height: 62px; }
#timeline .vis-timeline { border: 0; }
#timeline .vis-time-axis .vis-text { color: var(--muted); font-size: 11px; }
#timeline .vis-time-axis .vis-grid.vis-minor, #timeline .vis-time-axis .vis-grid.vis-major { border-color: var(--line); }
#timeline .vis-item.vis-point .vis-item-content { display: none; }
#timeline .vis-item.vis-dot { border-color: var(--muted); background: var(--muted); cursor: pointer; }
#timeline .vis-custom-time { background: var(--accent); width: 3px; cursor: ew-resize; }
#timeline .vis-custom-time-marker { background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 600;
                                    padding: 1px 5px; border-radius: 2px; top: 0; white-space: nowrap; }
.archon-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 18px; margin-bottom: 4px; }
.archon-head h1 { font-variant-numeric: tabular-nums; }
.datepick { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.datepick input { font: inherit; padding: 3px 6px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 4px; }
.archon-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px 24px; margin-top: 14px; align-items: start; transition: opacity .15s; }
#archon-result[aria-busy="true"] .archon-grid { opacity: .55; }
.archon-col { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 10px 12px 14px; }
.archon-col h3 { flex: 0 0 100%; margin: 0; padding-bottom: 6px; font-size: 15px; border-bottom: 2px solid var(--accent); }
.archon-person { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 84px; font-size: 13px; line-height: 1.25; text-align: center; }
.archon-person img, .archon-person .noportrait { display: block; flex: none; width: 72px; height: 90px; border-radius: 2px; object-fit: cover; background: var(--line); }

/* Listák oldal */
.dates { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 18px; padding: 0; list-style: none; }
.dates a { display: block; padding: 5px 9px; border: 1px solid var(--line); border-radius: 4px;
           background: var(--surface); color: var(--ink); text-decoration: none;
           font-variant-numeric: tabular-nums; white-space: nowrap; }
.dates a:hover { border-color: var(--accent); }
.dates small { color: var(--muted); margin-left: 4px; font-size: 12px; }
.dates a[aria-current] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.dates a[aria-current] small { color: inherit; }
.head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 20px; }
.head h2 { font-size: 19px; margin: 0; }
.resolution-head { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); justify-content: flex-start; gap: 6px 18px; }
.resolution-head h2 { font-size: 27px; line-height: 1.2; color: var(--accent); }
.head-count { color: var(--muted); font-size: 14px; }
.resolution-head > a { margin-left: auto; }
.stat { margin: 6px 0; }
.stat > span:first-child { color: var(--muted); margin-right: 6px; }
.dist-item { white-space: nowrap; margin-right: 10px; }
.dist-item b { font-weight: 600; font-variant-numeric: tabular-nums; }
.jump { margin: 14px 0 20px; padding: 8px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.jump a { margin-right: 14px; display: inline-block; }
section { margin-bottom: 30px; scroll-margin-top: 8px; }
section > h3 { position: sticky; top: 0; z-index: 2; background: var(--bg); margin: 0; padding: 8px 0 6px;
               font-size: 16px; border-bottom: 2px solid var(--ink); }
section > h3 small { font-weight: 400; color: var(--muted); font-size: 13px; margin-left: 6px; }
.jogok { color: var(--muted); font-size: 13px; padding: 6px 0; }
.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; background: var(--surface); }
th, td { padding: 4px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
td.num, th.num { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
td.szerv { font-weight: 500; }
td.nosplit { color: var(--muted); font-style: italic; }
/* Rögzített oszlopszélességek, hogy a táblázatok egymás alatt egy vonalban álljanak */
.list-table { table-layout: fixed; min-width: 1110px; }
.list-table.with-raw { min-width: 1700px; }
.list-table td { overflow-wrap: break-word; }
.list-table .flag { white-space: normal; }
.col-num { width: 44px; }
.col-jog { width: 130px; }
.col-note3 { width: 140px; }
.col-szamossag { width: 80px; }
.col-megj { width: 150px; }
.col-flags { width: 110px; }
.col-raw { width: 220px; }
.col-id { width: 60px; }
.col-newoid { width: 90px; }
td.metacol, th.metacol { background: var(--meta); }
td.metacol-first, th.metacol-first { border-left: 1px solid var(--line); }
td.rawcol, th.rawcol { background: color-mix(in srgb, var(--line) 28%, transparent); }
tr.notpos td { background: var(--flag-bg); }
tr:target td { background: var(--target); }
tbody tr { scroll-margin-top: 48px; }
.flag { display: inline-block; padding: 0 5px; border-radius: 3px; background: var(--flag-bg);
        color: var(--flag-ink); font-size: 12px; white-space: nowrap; }

/* Keresés */
.searchform { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin: 14px 0 8px; }
.searchform label { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--muted); flex: 1 1 240px; max-width: 380px; }
.searchform input { font: inherit; font-size: 15px; padding: 7px 9px; color: var(--ink); background: var(--surface);
                    border: 1px solid var(--line); border-radius: 4px; width: 100%; }
.searchform input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.searchform button { font: inherit; font-size: 15px; font-weight: 600; padding: 7px 16px; cursor: pointer;
                     color: var(--accent-ink); background: var(--accent); border: 1px solid var(--accent); border-radius: 4px; }
.examples { color: var(--muted); margin: 0 0 16px; }
.examples a { margin-left: 8px; white-space: nowrap; }
.result-count { margin: 16px 0 8px; font-size: 15px; }
.matrix { width: auto; min-width: 100%; }
.matrix th, .matrix td { padding: 4px 3px; text-align: center; vertical-align: middle; }
.matrix th small { display: block; font-weight: 400; }
.matrix .pos { position: sticky; left: 0; z-index: 1; background: var(--surface); text-align: left;
               padding: 4px 10px 4px 6px; min-width: 190px; max-width: 320px; white-space: normal; border-right: 1px solid var(--line); }
.matrix .pos b { font-weight: 600; }
.matrix tbody .pos { font-size: 13px; font-weight: 400; color: var(--ink); }
@media (max-width: 600px) {
    .matrix .pos { min-width: 130px; max-width: 150px; }
}
.code { display: block; min-width: 42px; padding: 2px 3px; margin: 1px 0; border-radius: 3px; font-size: 12px;
        font-weight: 600; text-decoration: none; white-space: nowrap; }
.code:hover { text-decoration: underline; }
.lv1 { background: var(--lv1); color: var(--lv1-ink); }
.lv2 { background: var(--lv2); color: var(--lv2-ink); }
.lv3 { background: var(--lv3); color: var(--lv3-ink); }
.lv4 { background: var(--lv4); color: var(--lv4-ink); }
.lv5 { background: var(--lv5); color: var(--lv5-ink); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 14px 0 6px; padding: 0; list-style: none; font-size: 13px; }
.legend li { display: flex; align-items: center; gap: 5px; }
.legend .code { display: inline-block; min-width: 0; padding: 1px 5px; margin: 0; }
.caveat { color: var(--muted); font-size: 13px; max-width: 900px; margin: 6px 0; }

/* Q&A: a kérdésre kattintva nyílik és csukódik a válasz */
.qa { border-bottom: 1px solid var(--line); }
.qa summary { display: flex; gap: 10px; align-items: baseline; padding: 11px 4px; font-weight: 600; cursor: pointer; list-style: none; }
.qa summary::-webkit-details-marker { display: none; }
.qa summary::before { content: "▸"; flex: none; width: 18px; font-size: 22px; line-height: 1; text-align: center; color: var(--accent); transition: transform .15s; }
.qa[open] summary::before { transform: rotate(90deg); }
.qa summary:hover { color: var(--accent); }
.qa summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.qa > :not(summary) { margin: 0 0 0 32px; padding: 6px 16px; background: var(--meta); }
.qa > summary + * { padding-top: 14px; }
.qa > :last-child { margin-bottom: 14px; padding-bottom: 14px; }
.qa > ul, .qa > ol { padding-left: 36px; }
