/* ============================================================
   helemba.hu – stíluslap
   1) Alapok (tokenek, reset, tipográfia) – a portfólió is ezt kapja
   2) Helemba-oldal szekciói
   ============================================================ */

/* ---------- 1. Tokenek ---------- */
:root {
  --paper: #f4efe4;
  --paper-2: #ebe4d4;
  --surface: #fbf8f1;
  --ink: #1e2624;
  --ink-2: #47514e;
  --muted: #6b7470;
  --line: #d9d0bd;
  --river: #2e5c5e;
  --river-deep: #1d3f41;
  --ochre: #9a5f24;
  --on-dark: #f4efe4;
  --on-dark-2: #c9d3cf;

  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-text: 'Source Sans 3', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --wrap: 1180px;
  --gutter: clamp(16px, 4vw, 40px);
  --radius: 6px;
  --section-y: clamp(64px, 10vw, 128px);
  --header-h: 68px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #131a19;
    --paper-2: #182120;
    --surface: #1b2423;
    --ink: #ebe6da;
    --ink-2: #c2c7c2;
    --muted: #97a19c;
    --line: #2f3b39;
    --river: #86b9b5;
    --river-deep: #0e2425;
    --ochre: #d9a066;
  }
}

/* ---------- Reset & alapok ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; animation: none !important; } }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: clamp(17px, 1.05vw + 12px, 19px);
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
a { color: var(--river); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { color: var(--ochre); }
:focus-visible { outline: 2px solid var(--ochre); outline-offset: 3px; border-radius: 2px; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 500; line-height: 1.12; margin: 0; font-variation-settings: 'SOFT' 50; }
h2 { font-size: clamp(2rem, 3.4vw + .6rem, 3.3rem); letter-spacing: -.015em; }
h3 { font-size: clamp(1.35rem, 1vw + 1rem, 1.7rem); }
p { margin: 0 0 1em; }
figure { margin: 0; }
figcaption { font-size: .85rem; color: var(--muted); margin-top: .7rem; line-height: 1.45; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: var(--radius); }
.skip:focus { top: 12px; }

.wrap { width: 100%; max-width: calc(var(--wrap) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }
.eyebrow { font-size: .78rem; letter-spacing: .18em; text-transform: uppercase; font-weight: 600; color: var(--ochre); margin-bottom: 1rem; }
.eyebrow-light { color: #e6c89c; }
.prose p { hyphens: auto; }
.prose-p { max-width: 62ch; }
.narrow { max-width: 68ch; }

.btn {
  display: inline-flex; align-items: center; gap: .5em;
  padding: .8em 1.5em; border-radius: 999px;
  font-weight: 600; font-size: .95rem; text-decoration: none;
  border: 1.5px solid currentColor; transition: background .2s, color .2s;
}
.btn-light { color: #fff; }
.btn-light:hover { background: #fff; color: var(--river-deep); }
.btn-lg { font-size: clamp(1rem, 1vw + .7rem, 1.35rem); padding: .9em 1.8em; }

/* ---------- 2. Fejléc ---------- */
.site-header {
  position: fixed; inset: 0 0 auto; z-index: 50; height: var(--header-h);
  color: #fff; transition: background .3s, box-shadow .3s, color .3s;
}
.site-header.is-solid { background: color-mix(in srgb, var(--paper) 94%, transparent); color: var(--ink); box-shadow: 0 1px 0 var(--line); backdrop-filter: blur(10px); }
.header-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { font-family: var(--font-display); font-size: 1.55rem; font-weight: 600; color: inherit; text-decoration: none; letter-spacing: -.01em; }
.brand:hover { color: inherit; }
.nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: clamp(14px, 2vw, 30px); }
.nav a { color: inherit; text-decoration: none; font-size: .95rem; font-weight: 500; padding: 6px 0; border-bottom: 1.5px solid transparent; }
.nav a:hover, .nav a.is-active { border-bottom-color: currentColor; color: inherit; }
.nav-toggle { display: none; }

@media (max-width: 860px) {
  .nav-toggle {
    display: grid; place-items: center; width: 44px; height: 44px; margin-right: -10px;
    background: none; border: 0; color: inherit; cursor: pointer;
  }
  .nav-toggle-bars, .nav-toggle-bars::before, .nav-toggle-bars::after {
    display: block; width: 22px; height: 2px; background: currentColor; border-radius: 2px; position: relative; transition: transform .25s, background .25s;
  }
  .nav-toggle-bars::before, .nav-toggle-bars::after { content: ''; position: absolute; left: 0; }
  .nav-toggle-bars::before { top: -7px; } .nav-toggle-bars::after { top: 7px; }
  .nav-open .nav-toggle-bars { background: transparent; }
  .nav-open .nav-toggle-bars::before { transform: translateY(7px) rotate(45deg); }
  .nav-open .nav-toggle-bars::after { transform: translateY(-7px) rotate(-45deg); }
  .nav {
    position: fixed; inset: var(--header-h) 0 auto; background: var(--paper); color: var(--ink);
    border-bottom: 1px solid var(--line); padding: 8px var(--gutter) 20px;
    transform: translateY(-8px); opacity: 0; visibility: hidden; transition: opacity .2s, transform .2s, visibility .2s;
  }
  .nav-open .nav { opacity: 1; transform: none; visibility: visible; }
  .nav ul { flex-direction: column; gap: 0; }
  .nav a { display: block; padding: 12px 0; font-size: 1.1rem; border-bottom: 1px solid var(--line); }
  .nav-open.site-header { background: var(--paper); color: var(--ink); }
}

/* ---------- Hero ---------- */
.hero { position: relative; min-height: max(100svh, 620px); display: flex; align-items: flex-start; color: #fff; overflow: hidden; background: var(--river-deep); }
.hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 78%; }
.hero-shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(12,26,28,.78) 0%, rgba(12,26,28,.55) 32%, rgba(12,26,28,.08) 62%, rgba(12,26,28,0) 80%, rgba(12,26,28,.35) 100%), linear-gradient(90deg, rgba(12,26,28,.45) 0%, rgba(12,26,28,0) 55%); }
.hero-content { position: relative; padding-top: calc(var(--header-h) + clamp(28px, 7vh, 80px)); padding-bottom: 48px; }
.hero h1 { font-size: clamp(3.6rem, 9vw, 8rem); font-weight: 400; letter-spacing: -.03em; line-height: .92; font-variation-settings: 'SOFT' 100, 'WONK' 1; text-shadow: 0 2px 30px rgba(0,0,0,.25); }
.hero-sub { font-family: var(--font-display); font-style: italic; font-size: clamp(1.2rem, 1.4vw + .7rem, 1.8rem); margin: .5rem 0 1.4rem; color: #f1e7d6; }
.hero-quote { margin: 0 0 1.8rem; max-width: 50ch; padding-left: 1.1rem; border-left: 2px solid #e6c89c; color: #eef1ef; font-size: 1rem; }
.hero-quote p { margin: 0; }

/* ---------- Számok ---------- */
.facts { background: var(--river-deep); color: var(--on-dark); }
.facts-grid { display: grid; grid-template-columns: repeat(4, 1fr); }
.fact { padding: clamp(24px, 3vw, 36px) clamp(12px, 2vw, 28px); border-left: 1px solid rgba(255,255,255,.14); display: flex; flex-direction: column; gap: 4px; }
.fact:first-child { border-left: 0; padding-left: 0; }
.fact-num { font-family: var(--font-display); font-size: clamp(1.7rem, 2.4vw + .5rem, 2.6rem); line-height: 1.1; }
.fact-label { font-size: .88rem; color: var(--on-dark-2); line-height: 1.35; }
@media (max-width: 760px) {
  .facts-grid { grid-template-columns: 1fr 1fr; }
  .fact:nth-child(odd) { border-left: 0; padding-left: 0; }
  .fact:nth-child(n+3) { border-top: 1px solid rgba(255,255,255,.14); }
}

/* ---------- Szekciók ---------- */
.section { padding-block: var(--section-y); }
.section-paper { background: var(--paper-2); }
.section-dark { background: var(--river-deep); color: var(--on-dark); }
.section-head { max-width: 760px; margin-bottom: clamp(40px, 6vw, 72px); }
.section-lead { font-size: 1.15em; color: var(--ink-2); margin-top: 1.1rem; }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(32px, 6vw, 88px); align-items: center; }
.split + .split { margin-top: clamp(48px, 8vw, 104px); }
.split-top { align-items: start; }
.split-text h2 { margin-bottom: 1.6rem; }
.split-media img { border-radius: var(--radius); width: 100%; }
.split-rev .split-media { order: -1; }
@media (max-width: 860px) {
  .split { grid-template-columns: 1fr; }
  .split-rev .split-media { order: 0; }
}
.note { margin-top: 2rem; padding: 1.3rem 1.5rem; background: var(--surface); border-left: 3px solid var(--ochre); border-radius: 0 var(--radius) var(--radius) 0; font-family: var(--font-display); font-style: italic; font-size: 1.08rem; line-height: 1.5; }
.note p { margin: 0; }

/* ---------- Idézet-sáv ---------- */
.band { position: relative; min-height: min(78vh, 720px); display: flex; align-items: center; color: #fff; overflow: hidden; background: #111; }
.band-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.band-shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(8,16,18,.78) 0%, rgba(8,16,18,.35) 60%, rgba(8,16,18,.1) 100%); }
.band-quote { position: relative; margin: 0 auto; }
@media (max-width: 760px) { .band-shade { background: rgba(8,16,18,.6); } }
.band-quote p { max-width: 30ch; font-family: var(--font-display); font-size: clamp(1.4rem, 2.2vw + .7rem, 2.4rem); line-height: 1.3; font-weight: 300; margin: 0; }
.band-quote p::before { content: '„'; }
.band-quote p::after { content: '”'; }

/* ---------- Történet ---------- */
.history { display: grid; grid-template-columns: 250px 1fr; gap: clamp(32px, 6vw, 96px); align-items: start; }
.chapters, .chart-box { min-width: 0; }
.history-nav { position: sticky; top: calc(var(--header-h) + 24px); }
.history-nav ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.history-nav a { display: block; padding: .5rem 0 .5rem 1.1rem; margin-left: -1px; border-left: 2px solid transparent; color: var(--ink-2); text-decoration: none; font-size: .95rem; line-height: 1.35; }
.history-nav a span { font-variant-numeric: tabular-nums; color: var(--muted); margin-right: .4rem; font-size: .8rem; }
.history-nav a:hover { color: var(--ink); }
.history-nav a.is-active { border-left-color: var(--ochre); color: var(--ink); font-weight: 600; }
.chapter + .chapter { margin-top: clamp(48px, 6vw, 80px); padding-top: clamp(48px, 6vw, 80px); border-top: 1px solid var(--line); }
.chapter-head { display: flex; gap: 1.2rem; align-items: baseline; margin-bottom: 1.4rem; }
.chapter-num { font-family: var(--font-display); font-size: 2.6rem; line-height: 1; color: var(--ochre); font-weight: 300; }
.chapter-years { margin: .35rem 0 0; color: var(--muted); font-size: .9rem; letter-spacing: .02em; }
.chapter .prose { max-width: 66ch; }
.chapter .prose > p:first-child { font-size: 1.08em; color: var(--ink); }
@media (max-width: 960px) {
  .history { grid-template-columns: 1fr; }
  .history-nav { display: none; }
}

.more summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: .5rem; font-weight: 600; color: var(--river); font-size: .95rem; padding: .35rem 0; }
.more summary::-webkit-details-marker { display: none; }
.more summary::after { content: ''; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-3px); transition: transform .2s; }
.more[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
.more[open] summary { order: 2; margin-top: .4rem; }
.more[open] { display: flex; flex-direction: column; }
.more .more-close, .more[open] .more-open { display: none; }
.more[open] .more-close { display: inline; }
.more summary:hover { color: var(--ochre); }

/* Diagram */
.chart-box { margin-top: 1.6rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(16px, 3vw, 28px); max-width: 760px; }
.chart-title { margin: 0 0 .8rem; font-size: .95rem; font-weight: 600; color: var(--ink); }
.chart-scroll { overflow-x: auto; margin-inline: -4px; padding-inline: 4px; }
.chart { width: 100%; min-width: 540px; height: auto; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 12px; font-family: var(--font-text); font-variant-numeric: tabular-nums; }
.chart .bar path { fill: var(--river); transition: fill .15s; }
.chart .bar .hit { fill: transparent; }
.chart .val { fill: var(--ink); font-size: 13px; font-weight: 600; font-family: var(--font-text); font-variant-numeric: tabular-nums; }
.chart .val-hover { opacity: 0; transition: opacity .15s; }
.chart .bar:hover path, .chart .bar:focus-visible path { fill: var(--ochre); }
.chart .bar:hover .val-hover, .chart .bar:focus-visible .val-hover { opacity: 1; }
.chart .bar:focus-visible { outline: none; }
.chart-source { margin: .8rem 0 0; font-size: .8rem; color: var(--muted); }
.table-view { margin-top: 1rem; font-size: .9rem; }
.table-view summary { cursor: pointer; color: var(--river); font-weight: 600; }
.table-view table { margin-top: .8rem; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table-view th, .table-view td { text-align: left; padding: .3rem 1.6rem .3rem 0; border-bottom: 1px solid var(--line); }
.table-view td:last-child, .table-view th:last-child { text-align: right; padding-right: 0; }

/* Határnevek */
.names { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 1.4rem 0 0; }
.names > div { padding: 1.1rem 1.2rem; box-shadow: 1px 0 0 var(--line), 0 1px 0 var(--line); }
.names dt { font-family: var(--font-display); font-size: 1.12rem; margin-bottom: .3rem; }
.names dd { margin: 0; font-size: .93rem; color: var(--ink-2); line-height: 1.5; }

/* ---------- Természet ---------- */
.painting img { box-shadow: 0 18px 40px -18px rgba(0,0,0,.35); }
.flora { margin: clamp(40px, 6vw, 72px) 0; padding: clamp(24px, 4vw, 44px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.flora h3 { margin-bottom: 1.3rem; }
.flora-list { list-style: none; margin: 0; padding: 0; columns: 3 240px; column-gap: 32px; }
.flora-list li { break-inside: avoid; padding: .45rem 0; border-bottom: 1px dashed var(--line); font-weight: 500; }
.flora-list i { display: block; font-weight: 400; font-size: .85rem; color: var(--muted); }
.nat-bottom { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 88px); align-items: center; }
.nat-bottom .prose { max-width: 66ch; }
.pull { font-family: var(--font-display); font-size: clamp(1.4rem, 1.6vw + .9rem, 2.1rem); line-height: 1.3; margin: 0; padding-left: clamp(20px, 3vw, 36px); border-left: 2px solid var(--ochre); color: var(--river); }
@media (max-width: 860px) { .nat-bottom { grid-template-columns: 1fr; } }

/* ---------- Emlékek ---------- */
.cult { display: grid; gap: clamp(48px, 7vw, 96px); }
.cult-block h3 { margin-bottom: 1.1rem; }
.cult-block > .prose { columns: 2 320px; column-gap: clamp(32px, 5vw, 64px); }
.cult-media { display: grid; grid-template-columns: 1fr 1.1fr; gap: clamp(32px, 6vw, 80px); align-items: start; }
.cult-media img { border-radius: var(--radius); width: 100%; }
.cult-media-rev figure { order: 2; }
.cult-media-rev figure img { max-height: 640px; object-fit: cover; }
@media (max-width: 860px) {
  .cult-media { grid-template-columns: 1fr; }
  .cult-media-rev figure { order: 0; }
  .cult-media-rev figure img { max-height: 420px; }
}

/* ---------- Galéria ---------- */
.gallery { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-rows: clamp(150px, 16vw, 230px); grid-auto-flow: dense; gap: 10px; }
.g-item a { display: block; height: 100%; overflow: hidden; border-radius: 4px; background: var(--paper-2); }
.g-item img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.g-item a:hover img { transform: scale(1.04); }
.g-tall { grid-row: span 2; }
.g-wide { grid-column: span 2; }
.g-big { grid-column: span 2; grid-row: span 2; }
@media (max-width: 760px) {
  .gallery { grid-template-columns: 1fr 1fr; grid-auto-rows: 150px; }
}

.lightbox { border: 0; padding: 0; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; background: rgba(8,12,12,.94); color: #fff; }
.lightbox::backdrop { background: rgba(0,0,0,.6); }
.lightbox[open] { display: grid; grid-template-columns: 64px 1fr 64px; align-items: center; }
.lightbox figure { grid-column: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100vh; padding: 56px 0 24px; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 120px); object-fit: contain; }
.lightbox figcaption { color: #cfd6d3; text-align: center; }
.lightbox button { background: none; border: 0; color: #fff; font-size: 2.6rem; line-height: 1; cursor: pointer; width: 64px; height: 64px; opacity: .8; }
.lightbox button:hover { opacity: 1; }
.lb-close { position: absolute; top: 8px; right: 8px; }
.lb-prev { grid-column: 1; } .lb-next { grid-column: 3; }
@media (max-width: 600px) {
  .lightbox[open] { grid-template-columns: 40px 1fr 40px; }
  .lightbox button { width: 40px; }
}

/* ---------- Kapcsolat & lábléc ---------- */
.contact { display: flex; justify-content: space-between; align-items: flex-end; gap: 32px; flex-wrap: wrap; }
.contact h2 { margin-bottom: 1rem; }
.contact p { max-width: 50ch; color: var(--on-dark-2); margin: 0; }
.site-footer { background: #0f2324; color: var(--on-dark-2); padding: 40px 0; font-size: .88rem; }
.footer-inner { display: grid; grid-template-columns: auto 1fr auto; gap: 32px; align-items: center; }
.footer-inner p { margin: 0; }
.brand-small { font-size: 1.3rem; color: var(--on-dark); }
.credits { max-width: 70ch; }
@media (max-width: 760px) { .footer-inner { grid-template-columns: 1fr; gap: 12px; } }
