/* ==========================================================================
   ReDiTu base — reset, tipográfia, layout. Csak tokenekből dolgozik.
   ========================================================================== */

/* Metrika-illesztett fallback: amíg az Urbanist tölt, ne ugorjon a layout (CLS). */
@font-face {
  font-family: "Urbanist Fallback";
  src: local("Arial");
  size-adjust: 97%;
  ascent-override: 98%;
  descent-override: 25%;
  line-gap-override: 0%;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--nav-h) + var(--sp-16));
}

body, [data-theme] {
  background-color: var(--bg);
  color: var(--text);
}

body {
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: var(--text-body);
  font-weight: var(--fw-regular);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- Címsorok ---------- */
h1, h2, h3, h4, .h1, .h2, .h3, .h4, .display {
  color: var(--heading);
  font-weight: var(--fw-bold);
  letter-spacing: -0.01em;
  text-wrap: balance;
}
h1, .h1 { font-size: var(--text-h1); line-height: var(--lh-h1); margin-bottom: var(--gap-heading-lg); }
h2, .h2 { font-size: var(--text-h2); line-height: var(--lh-h2); margin-bottom: var(--gap-heading-lg); }
h3, .h3 { font-size: var(--text-h3); line-height: var(--lh-h3); margin-bottom: var(--gap-heading-sm); }
h4, .h4 { font-size: var(--text-h4); line-height: var(--lh-h4); margin-bottom: var(--gap-heading-sm); }
.display { font-size: var(--text-display); line-height: var(--lh-h1); letter-spacing: -0.02em; }

/* ---------- Szöveg ---------- */
p, ul, ol, dl, blockquote, figure, table, pre { margin-bottom: var(--gap-paragraph); }
:is(p, ul, ol, dl, blockquote, figure, table, pre):last-child { margin-bottom: 0; }
p, li, blockquote { max-width: var(--measure); text-wrap: pretty; }
ul, ol { padding-left: var(--sp-24); }
li + li { margin-top: var(--sp-8); }

.lead { font-size: var(--text-lead); line-height: 1.6; color: var(--text-2); }
.meta { font-size: var(--text-meta); line-height: var(--lh-ui); font-weight: var(--fw-semibold); letter-spacing: 0.04em; color: var(--text-muted); }
.overline { font-size: var(--text-meta); line-height: var(--lh-ui); font-weight: var(--fw-bold); letter-spacing: 0.12em; text-transform: uppercase; color: var(--link); margin-bottom: var(--sp-8); display: block; }
.muted { color: var(--text-muted); }
.num { font-variant-numeric: tabular-nums lining-nums; }

a { color: var(--link); text-decoration-thickness: 0.08em; text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 0.14em; }

/* Címsor a folyószövegben: felette nagyobb levegő, mint alatta */
.prose > :is(h2, h3, h4):not(:first-child) { margin-top: var(--sp-48); }

/* ---------- Média — rögzített méret, hogy a CLS 0,1 alatt maradjon ---------- */
img, picture, video, svg, canvas { display: block; max-width: 100%; }
img, video { height: auto; }
.media { position: relative; overflow: hidden; background: var(--bg-tint); }
.media > :is(img, svg, video) { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ratio-16x9 { aspect-ratio: 16 / 9; }
.ratio-4x3 { aspect-ratio: 4 / 3; }
.ratio-1x1 { aspect-ratio: 1; }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: calc(var(--container) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: var(--section-y); }
.section--subtle { background: var(--bg-subtle); }
.section--tint { background: var(--bg-tint); }
.section--warm { background: var(--bg-warm); }

.stack > * + * { margin-top: var(--stack, var(--sp-16)); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--cluster, var(--sp-16)); }

/* Mobil: 1 oszlop → tablet: 2 → laptop: 3/4 */
.grid { display: grid; gap: var(--sp-16); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) {
  .grid { gap: var(--sp-24); }
  .grid--2, .grid--3, .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ---------- Akadálymentesség ---------- */
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: var(--radius-sm); }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: var(--sp-16); top: var(--sp-8); z-index: calc(var(--z-overlay) + 1);
  padding: var(--sp-8) var(--sp-16); border-radius: var(--radius-sm);
  background: var(--primary); color: var(--on-primary); font-weight: var(--fw-semibold);
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

/* ---------- Téma szerinti megjelenítés (pl. logó világos/sötét változata) ---------- */
.only-dark { display: none !important; }
[data-theme="dark"] .only-light { display: none !important; }
[data-theme="dark"] .only-dark { display: revert !important; }
