/* ==========================================================
   TudásTárs – főoldal
   Színek: porosz kék tinta + lángfestési színek a négy közönségnek
   (nátrium = gyerekek, kálium = ismeretterjesztés,
    réz = képzés, stroncium = kutatás és PR)
   ========================================================== */

@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-hu.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2010-2033, U+20AC, U+2122, U+2192, U+2212;
}
@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-hu-ext.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  unicode-range: U+0150-0151, U+0170-0171;
}
@font-face {
  font-family: "Source Serif";
  src: url("../fonts/sourceserif-hu.woff2") format("woff2");
  font-weight: 200 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2010-2033, U+20AC, U+2122, U+2192, U+2212;
}
@font-face {
  font-family: "Source Serif";
  src: url("../fonts/sourceserif-hu-ext.woff2") format("woff2");
  font-weight: 200 900;
  font-display: swap;
  unicode-range: U+0150-0151, U+0170-0171;
}

:root {
  --paper: #ffffff;
  --mist: #eef3f6;
  --ink: #0f3550;          /* porosz kék */
  --ink-soft: #46627a;
  --line: #d3dee6;

  --na: #e8a10c;  --na-tint: #fcefd0;  --na-deep: #6b4500;   /* nátrium */
  --k:  #8b6bc9;  --k-tint:  #ece6f8;  --k-deep:  #46307e;   /* kálium */
  --cu: #138a72;  --cu-tint: #dcf0ea;  --cu-deep: #0a5244;   /* réz */
  --sr: #c8283e;  --sr-tint: #f8e0e3;  --sr-deep: #7c1425;   /* stroncium */

  --sans: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Source Serif", Georgia, "Times New Roman", serif;

  --wrap: 1240px;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --gap: 10px;
  --radius: 6px;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 5rem; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.65;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; display: block; }

a { color: inherit; }

h1, h2, h3 {
  font-family: var(--sans);
  line-height: 1.1;
  margin: 0;
}

h2 {
  font-size: clamp(1.75rem, 1.2rem + 1.8vw, 2.6rem);
  font-weight: 750;
  font-stretch: 118%;
  letter-spacing: -0.01em;
}

h3 {
  font-size: 1.1rem;
  font-weight: 650;
}

p { margin: 0 0 1em; }

:focus-visible {
  outline: 3px solid var(--na);
  outline-offset: 3px;
  border-radius: 2px;
}

.wrap {
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.vh {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: 1rem; top: -3rem;
  z-index: 100;
  background: var(--ink);
  color: #fff;
  padding: .6rem 1rem;
  font-family: var(--sans);
  text-decoration: none;
}
.skip:focus { top: 1rem; }

/* ---------- Fejléc ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  min-height: 4.25rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  text-decoration: none;
  font-family: var(--sans);
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 4px;
  background: var(--ink);
  color: #fff;
  font-weight: 750;
  font-stretch: 112%;
  font-size: 1rem;
}

.brand__name {
  font-size: 1.3rem;
  font-weight: 750;
  font-stretch: 118%;
  letter-spacing: -0.01em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  font-family: var(--sans);
  font-size: .95rem;
}

.site-nav ul {
  display: flex;
  gap: 1.35rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav a {
  text-decoration: none;
  font-weight: 500;
}

.site-nav ul a:hover { text-decoration: underline; text-underline-offset: .3em; text-decoration-thickness: 2px; }

.lang {
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  padding: .15rem .45rem;
  font-size: .8rem;
  font-weight: 650;
}
.lang:hover { background: var(--ink); color: #fff; }

.menu-toggle {
  display: none;
  font: 600 .95rem var(--sans);
  color: var(--ink);
  background: none;
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  padding: .4rem .8rem;
  cursor: pointer;
}

@media (max-width: 1100px) {
  .menu-toggle { display: inline-block; }
  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    padding: 1rem var(--gutter) 1.5rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  .site-nav.is-open { display: flex; }
  .site-nav ul { flex-direction: column; gap: .2rem; width: 100%; }
  .site-nav ul a { display: block; padding: .55rem 0; font-size: 1.1rem; }
}

/* ---------- Nyitó ---------- */

.hero { padding-block: clamp(3rem, 7vw, 6rem) clamp(2rem, 4vw, 3rem); }

.hero__inner {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 2rem 4rem;
  align-items: end;
}

.hero h1 {
  font-size: clamp(2.6rem, 1.3rem + 4.8vw, 5.4rem);
  font-weight: 800;
  font-stretch: 125%;
  line-height: .98;
  letter-spacing: -0.015em;
  max-width: 11ch;
  text-wrap: balance;
}

.lead {
  font-size: clamp(1.1rem, 1rem + .35vw, 1.3rem);
  line-height: 1.55;
  max-width: 36rem;
  color: var(--ink);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin: 1.5rem 0 0;
}

.btn {
  display: inline-block;
  font: 600 1rem/1 var(--sans);
  text-decoration: none;
  padding: .9rem 1.25rem;
  border-radius: 4px;
  border: 2px solid var(--ink);
}
.btn--solid { background: var(--ink); color: #fff; }
.btn--solid:hover { background: #0a2639; border-color: #0a2639; }
.btn--line:hover { background: var(--mist); }

@media (max-width: 860px) {
  .hero__inner { grid-template-columns: 1fr; }
}

/* ---------- Periódusos rendszer ---------- */

.table-section { padding-bottom: clamp(3rem, 6vw, 5rem); }

.ptable {
  --cols: 6;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-template-areas:
    "tr  info info info info hd"
    "tc  tp   key  key  ek   nm"
    "tf  es   tz   tk   pe   lsz";
  gap: var(--gap);
}

/* a lista "átlátszó": az elemei közvetlenül a rácsba kerülnek */
.ptable__grid { display: contents; list-style: none; margin: 0; padding: 0; }
.cell { min-width: 0; }

.ptable__info { grid-area: info; }
.ptable__key  { grid-area: key; }

/* kategória-változók */
[data-cat="kids"]     { --c: var(--na); --c-tint: var(--na-tint); --c-deep: var(--na-deep); --c-on: #2b1c00; }
[data-cat="public"]   { --c: var(--k);  --c-tint: var(--k-tint);  --c-deep: var(--k-deep);  --c-on: #fff; }
[data-cat="training"] { --c: var(--cu); --c-tint: var(--cu-tint); --c-deep: var(--cu-deep); --c-on: #fff; }
[data-cat="research"] { --c: var(--sr); --c-tint: var(--sr-tint); --c-deep: var(--sr-deep); --c-on: #fff; }

.el {
  position: relative;
  display: flex;
  flex-direction: column;
  aspect-ratio: 1 / 1;
  padding: clamp(.55rem, 1vw, .9rem);
  border-radius: var(--radius);
  background: var(--c-tint);
  color: var(--c-deep);
  text-decoration: none;
  font-family: var(--sans);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--c) 45%, transparent);
  transition: background-color .18s ease, color .18s ease, opacity .25s ease, transform .18s ease;
}

.el__year {
  font-size: .8rem;
  font-weight: 550;
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
}

.el__sym {
  margin-top: auto;
  font-size: clamp(2rem, 1rem + 2.6vw, 3.6rem);
  font-weight: 750;
  font-stretch: 112%;
  line-height: 1;
  letter-spacing: -0.02em;
}

.el__name {
  margin-top: .35rem;
  font-size: clamp(.72rem, .6rem + .3vw, .9rem);
  font-weight: 550;
  line-height: 1.2;
  min-height: 2.4em;
  hyphens: manual;
  overflow-wrap: anywhere;
}

.el:hover,
.el:focus-visible {
  background: var(--c);
  color: var(--c-on);
  transform: translateY(-2px);
}

/* Szűrés közönség szerint */
.ptable[data-filter="kids"]     .el:not([data-cat="kids"]),
.ptable[data-filter="public"]   .el:not([data-cat="public"]),
.ptable[data-filter="training"] .el:not([data-cat="training"]),
.ptable[data-filter="research"] .el:not([data-cat="research"]) { opacity: .22; }

/* Kiolvasó mező (a táblázat "rése") */
.ptable__info {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0 clamp(.5rem, 2vw, 1.5rem) .25rem;
  font-family: var(--sans);
  min-width: 0;
}

.info__title {
  font-size: clamp(1.1rem, .9rem + .7vw, 1.5rem);
  font-weight: 700;
  font-stretch: 110%;
  line-height: 1.15;
  margin: 0 0 .3rem;
}

.info__meta {
  font-size: .85rem;
  font-weight: 600;
  color: var(--c-deep, var(--ink-soft));
  margin: 0 0 .35rem;
  min-height: 1.2em;
}

.info__desc {
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ink-soft);
  margin: 0;
  max-width: 52ch;
}

/* Jelmagyarázat */
.ptable__key {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: .15rem;
  padding: 0 .75rem;
}

.key {
  display: flex;
  align-items: center;
  gap: .55rem;
  width: 100%;
  font: 550 .85rem/1.25 var(--sans);
  color: var(--ink);
  text-align: left;
  background: none;
  border: 0;
  border-radius: 4px;
  padding: .3rem .4rem;
  cursor: pointer;
}

.key__swatch {
  flex: none;
  width: .95rem;
  height: .95rem;
  border-radius: 3px;
  background: var(--c);
}

.key:hover { background: var(--mist); }
.key[aria-pressed="true"] { background: var(--c-tint); color: var(--c-deep); font-weight: 700; }

.table-more {
  margin: 1.5rem 0 0;
  font-family: var(--sans);
  font-weight: 600;
}

/* Betöltéskor: a programok indulási sorrendjében "fellángolnak" */
@media (prefers-reduced-motion: no-preference) {
  .js .el {
    animation: flame .75s cubic-bezier(.3, .7, .3, 1) backwards;
    animation-delay: calc(var(--i) * 75ms + 150ms);
  }
  @keyframes flame {
    0%   { opacity: 0; background: var(--paper); }
    35%  { opacity: 1; background: var(--c); color: var(--c-on); }
    100% { opacity: 1; background: var(--c-tint); color: var(--c-deep); }
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .el { transition: none; }
  .el:hover, .el:focus-visible { transform: none; }
}

/* Keskenyebb képernyőn: sima rács, kategóriánként */
@media (max-width: 980px) {
  .ptable {
    grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
    grid-template-areas: none;
  }
  .ptable__info { display: none; }
  .ptable__key {
    grid-area: auto;
    grid-column: 1 / -1;
    order: -1;
    justify-content: flex-start;
    flex-direction: row;
    flex-wrap: wrap;
    gap: .25rem .5rem;
    padding: 0 0 .5rem;
  }
  .key { width: auto; }
  .cell { grid-area: auto !important; }
}

@media (max-width: 420px) {
  .ptable { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .el__year { font-size: .68rem; }
}

/* ---------- Rólunk ---------- */

.about {
  background: var(--mist);
  padding-block: clamp(3.5rem, 7vw, 6rem);
}

.about .wrap {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 2.5rem 4rem;
}

.about__intro p {
  margin-top: 1.25rem;
  font-size: 1.15rem;
  max-width: 34rem;
}

.about__orgs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2rem 2.5rem;
  align-content: start;
}

.org {
  border-top: 3px solid var(--ink);
  padding-top: 1rem;
}
.org h3 { margin-bottom: .6rem; font-size: 1.2rem; }
.org p { color: var(--ink); }

.about__team { grid-column: 1 / -1; margin: 0; }

.text-link {
  font-family: var(--sans);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: .28em;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
}
.text-link:hover { text-decoration-color: currentColor; }

.photos {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: var(--gap);
  margin-top: 1rem;
}

.photos figure { margin: 0; }

.photos img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius);
  background: #dbe5ec;
}
.photos figure:first-child img { aspect-ratio: auto; height: 100%; max-height: none; }
.photos figure:first-child { display: grid; grid-template-rows: 1fr auto; }

.photos figcaption {
  font-family: var(--sans);
  font-size: .85rem;
  color: var(--ink-soft);
  padding-top: .5rem;
}

@media (max-width: 900px) {
  .about .wrap { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .about__orgs { grid-template-columns: 1fr; }
  .photos { grid-template-columns: 1fr 1fr; }
  .photos figure:first-child { grid-column: 1 / -1; }
  .photos figure:first-child img { aspect-ratio: 16 / 10; height: auto; }
}

/* ---------- Események és írások ---------- */

.news { padding-block: clamp(3.5rem, 7vw, 6rem); }

.news__cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2.5rem;
  margin-top: 2rem;
}

.news__item { border-top: 1px solid var(--line); padding-top: 1rem; }

.news__kind {
  font-size: .9rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: .75rem;
}

.news__title {
  font-family: var(--sans);
  font-size: 1.3rem;
  font-weight: 700;
  font-stretch: 105%;
  line-height: 1.2;
  margin-bottom: .4rem;
}
.news__title a { text-decoration: none; }
.news__title a:hover { text-decoration: underline; text-underline-offset: .2em; }

.news__meta {
  font-family: var(--sans);
  font-size: .9rem;
  color: var(--ink-soft);
}

.pubs { list-style: none; margin: 0 0 1rem; padding: 0; }
.pubs li + li { border-top: 1px solid var(--line); }
.pubs a {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .55rem 0;
  text-decoration: none;
  font-family: var(--sans);
  font-weight: 550;
  line-height: 1.3;
}
.pubs a:hover { text-decoration: underline; text-underline-offset: .2em; }
.pubs img { flex: none; width: 50px; height: 43px; object-fit: cover; border-radius: 3px; background: var(--mist); }

@media (max-width: 900px) {
  .news__cols { grid-template-columns: 1fr; gap: 2rem; }
}

/* ---------- Partnerek ---------- */

.partners { padding-block: 0 clamp(3.5rem, 7vw, 5rem); }
.partners h2 { font-size: 1.3rem; font-stretch: 105%; font-weight: 700; }

.logos {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 1.5rem 0 0;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem 2.5rem;
}

.logos img {
  height: 50px;
  width: auto;
  max-width: 170px;
  object-fit: contain;
  mix-blend-mode: multiply;
}

/* ---------- Lábléc / kapcsolat ---------- */

.site-footer {
  background: var(--ink);
  color: #fff;
  padding-block: clamp(3.5rem, 7vw, 6rem) 2rem;
}

.site-footer h2 { margin-bottom: 2.5rem; }

.contact {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 2rem;
}

.contact h3 {
  font-size: .9rem;
  font-weight: 600;
  color: #a9c1d3;
  margin-bottom: .6rem;
}

.contact p { margin: 0 0 .3rem; }

.contact__big {
  font-family: var(--sans);
  font-size: clamp(1.15rem, 1rem + .6vw, 1.5rem);
  font-weight: 650;
  text-decoration: none;
}
.contact__big:hover { text-decoration: underline; text-underline-offset: .2em; }

address { font-style: normal; line-height: 1.55; }

.social { list-style: none; margin: 0; padding: 0; }
.social li { margin-bottom: .3rem; }
.social a { text-underline-offset: .25em; text-decoration-color: rgba(255,255,255,.4); }
.social a:hover { text-decoration-color: #fff; }

.site-footer__bottom {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 4rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, .2);
  font-family: var(--sans);
  font-size: .85rem;
  color: #a9c1d3;
}
.site-footer__bottom p { margin: 0; }
.site-footer__bottom a { color: #fff; }

@media (max-width: 900px) {
  .contact { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .contact { grid-template-columns: 1fr; }
  .site-footer__bottom { flex-direction: column; }
}
