
/* ===============================
   Additional Fonts
   =============================== */

@font-face {
  font-family: 'MrPalkerDadCond';
  src: url('../fonts/MrPalkerDad-Cond-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'NewspaperSansCTT';
  src: url('../fonts/NewspaperSansCTT-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}


/* ===============================
   Fonts
   =============================== */

@font-face {
  font-family: 'SchoolBook', Georgia, serif;
  src: url('../fonts/SchoolBook-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'SchoolBook';
  src: url('../fonts/SchoolBook-Italic.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
}

@font-face {
  font-family: 'SchoolBook';
  src: url('../fonts/SchoolBook-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'SchoolBook';
  src: url('../fonts/SchoolBook-BoldItalic.woff2') format('woff2');
  font-weight: 700;
  font-style: italic;
  font-display: swap;
  font-display: swap;
}

@font-face {
  font-family: 'MrPalkerDadCond';
  src: url('../fonts/MrPalkerDad-Cond-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'NewspaperSansCTT';
  src: url('../fonts/NewspaperSansCTT-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'NewspaperSansCTT';
  src: url('../fonts/NewspaperSansCTT-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root{
  --bg:#fbf6ef;
  --bg-alt:#f7f1e8;
  --text:#1f2328;
  --muted:#616b75;
  --line:#e3d8cc;
  --accent:#c8342d; /* route red */
  --blue:#2e5fbf;
  --radius:10px;
  --container:1120px;
}

/* ===============================
   Typography system (SchoolBook tuned)
   =============================== */

:root{
  /* Type scale */
  --fs-00: 12px;
  --fs-0:  13px;
  --fs-1:  16px;
  --fs-2:  18px;
  --fs-3:  20px;
  --fs-4:  26px;
  --fs-5:  34px;
  --fs-6:  44px;

  /* Line-heights */
  --lh-tight: 1.15;
  --lh-snug:  1.25;
  --lh-body:  1.65;
  --lh-loose: 1.85;

  /* Tracking */
  --trk-0: 0;
  --trk-1: 0.01em;
  --trk-2: 0.02em;
}

*{ box-sizing:border-box; }
html,body{ margin:0; padding:0; }
body{
  font-family: system-ui, -apple-system, "Inter", "Segoe UI", Roboto, Arial, "Noto Sans", "Liberation Sans", sans-serif;
  color:var(--text);
  background:var(--bg);
  font-size: var(--fs-1);
  line-height: var(--lh-body);
}

a{ color:inherit; text-decoration:none; }
a:hover{ text-decoration:underline; text-decoration-thickness:1px; text-underline-offset:3px; }

.container{
  max-width:var(--container);
  margin:0 auto;
  padding:0 20px;
}

.site-header{
  position:sticky;
  top:0;
  background:color-mix(in srgb, var(--bg) 92%, white 8%);
  border-bottom:1px solid var(--line);
  z-index:20;
  backdrop-filter:saturate(140%) blur(8px);
}

.site-header__inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
  padding:14px 0;
}

/* Mobile navigation toggle */
.nav-toggle{
  display:none;
  align-items:center;
  gap:10px;
  padding:8px 10px;
  border-radius:999px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.25);
  cursor:pointer;
  font-family: 'NewspaperSansCTT', system-ui, sans-serif;
}
.nav-toggle:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; }
.nav-toggle__label{ font-size: var(--fs-0); color: var(--muted); }
.nav-toggle__bar{
  width:18px;
  height:2px;
  background: color-mix(in srgb, var(--text) 80%, var(--accent) 20%);
  display:block;
  border-radius:2px;
}
.nav-toggle__bar + .nav-toggle__bar{ margin-top:3px; }

.site-header__panel{
  display:flex;
  align-items:center;
  gap:18px;
}

.site-header.is-open .nav-toggle{ border-color: color-mix(in srgb, var(--accent) 40%, var(--line) 60%); }

@media (max-width: 920px){
  .nav-toggle{ display:inline-flex; }
  .site-header__inner{ gap:12px; }
  .site-header__panel{
    position:fixed;
    left:0;
    right:0;
    top:var(--header-h, 64px);
    padding:16px 18px 18px;
    background: color-mix(in srgb, var(--bg) 92%, white 8%);
    border-bottom:1px solid var(--line);
    box-shadow: 0 16px 30px rgba(0,0,0,.10);
    z-index:25;
    display:none;
    flex-direction:column;
    align-items:stretch;
    gap:14px;
    max-height: calc(100vh - var(--header-h, 64px));
    overflow:auto;
  }
  .site-header.is-open .site-header__panel{ display:flex; }
  .menu{ flex-direction:column; align-items:stretch; gap:8px; }
  .menu a{ padding:10px 12px; border-radius:12px; background: rgba(255,255,255,.25); }
  .site-tools{ justify-content:space-between; }
  .pochtovoe-lab-lang__name{ display:none; } /* keep flag-only to save space */
}

.custom-logo{
  max-height:var(--partners-logo-h, 56px);
  width:auto;
}

.menu{ list-style:none; margin:0; padding:0; display:flex; gap:18px; align-items:center; }
.menu a{ padding:6px 8px; border-radius:8px; }
.menu a:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; }

.site-tools{ display:flex; align-items:center; gap:12px; }

/* Social icons */
.social__list{ list-style:none; margin:0; padding:0; display:flex; gap:8px; align-items:center; }
.social__link{
  width:34px; height:34px;
  display:inline-flex;
  align-items:center; justify-content:center;
  border-radius:999px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.25);
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
.social__link:hover{
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line) 60%);
  background: rgba(255,255,255,.4);
  text-decoration:none;
}
.social__link svg{ width:18px; height:18px; fill: color-mix(in srgb, var(--text) 80%, var(--accent) 20%); }

.pochtovoe-lab-lang__list{ list-style:none; margin:0; padding:0; display:flex; gap:10px; align-items:center; }
.pochtovoe-lab-lang__link{ display:flex; gap:6px; align-items:center; padding:6px 8px; border:1px solid transparent; border-radius:999px; }
.pochtovoe-lab-lang__item.is-current .pochtovoe-lab-lang__link{ border-color:var(--line); background:rgba(255,255,255,.35); }
.pochtovoe-lab-lang__flag{ border-radius:2px; display:block; }
.pochtovoe-lab-lang__name{ font-size:14px; color:var(--muted); }

.site-main{ padding-bottom:60px; }

.hero{
  padding:70px 0 40px;
}
.hero__inner{
  text-align:center;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:14px;
}
.hero__logo .custom-logo{ max-height: var(--hero-logo-h, 110px); height:auto; width:auto; }
@media (max-width: 480px){
  .hero__logo .custom-logo{ max-height: min(var(--hero-logo-h, 110px), 260px); }
}
@media (max-width: 360px){
  .hero__logo .custom-logo{ max-height: min(var(--hero-logo-h, 110px), 220px); }
}

.hero__rule{
  width:min(520px, 92vw);
  height:2px;
  background:linear-gradient(90deg, transparent, var(--accent), transparent);
  margin-top:6px;
}
.hero__subtitle{
  font-size:20px;
  color:var(--muted);
  margin-top:6px;
}
.hero__lead{
  max-width:760px;
  margin:0;
  font-size:20px;
  color:color-mix(in srgb, var(--text) 72%, var(--muted) 28%);
}
.hero__actions{
  display:flex;
  gap:14px;
  margin-top:18px;
  flex-wrap:wrap;
  justify-content:center;
}

.btn{
  display:inline-flex;
  gap:10px;
  align-items:center;
  justify-content:center;
  padding:12px 18px;
  border-radius:12px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.35);
  transition:transform .12s ease, border-color .12s ease, background .12s ease;
  font-weight:600;
}
.btn:hover{ transform:translateY(-1px); border-color:color-mix(in srgb, var(--accent) 35%, var(--line) 65%); text-decoration:none; }
.btn--primary span, .btn--ghost span, .btn--accent span{ color:var(--accent); }

.btn--accent{
  border-color:color-mix(in srgb, var(--accent) 40%, var(--line) 60%);
  background:color-mix(in srgb, var(--bg) 70%, white 30%);
}

.section{ padding:54px 0; border-top:1px solid var(--line); }
.section--alt{ background:var(--bg-alt); }

.section__head{ margin-bottom:18px; }
.section__head--split{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap:14px;
}


.grid{ display:grid; gap:18px; }
.grid--3{ grid-template-columns:repeat(3, minmax(0, 1fr)); }
.grid--cards{ grid-template-columns:repeat(3, minmax(0, 1fr)); }

.card{
  background:rgba(255,255,255,.42);
  border:1px solid var(--line);
  border-radius:16px;
  padding:18px;
}
.card--station{ position:relative; padding-top:22px; }
.station-dot{
  width:10px; height:10px; border-radius:50%;
  background:var(--accent);
  position:absolute; top:18px; left:18px;
}
.card__title a{ text-decoration:none; }
.card__title a:hover{ text-decoration:underline; text-decoration-color:var(--accent); }
.card__excerpt{ color:var(--muted); }

.link{ color:var(--muted); text-decoration:none; }
.link:hover{ color:var(--text); text-decoration:underline; text-decoration-color:var(--accent); }

.timeline{
  display:flex;
  flex-direction:column;
  gap:16px;
  position:relative;
  padding-left:22px;
}
.timeline:before{
  content:"";
  position:absolute;
  left:8px;
  top:0;
  bottom:0;
  width:2px;
  background:var(--line);
}
.timeline__item{
  display:flex;
  gap:14px;
  align-items:flex-start;
}
.timeline__dot{
  width:10px; height:10px;
  border-radius:50%;
  background:var(--accent);
  margin-top:6px;
  flex:0 0 auto;
}
.timeline__title a{ font-weight:650; text-decoration:none; }
.timeline__title a:hover{ text-decoration:underline; text-decoration-color:var(--accent); }

.meta{ font-size:13px; color:var(--muted); }

.content{ padding:44px 0; }
.prose h1{ font-size:38px; letter-spacing:-0.03em; margin:0 0 10px; }
.prose p{ max-width:72ch; }

.figure img{ width:100%; height:auto; border-radius:16px; border:1px solid var(--line); }

.cta{ text-align:center; }
.cta__inner{ display:flex; flex-direction:column; align-items:center; gap:14px; }

.site-footer{
  border-top:1px solid var(--line);
  background:var(--bg-alt);
  padding:34px 0;
}
.site-footer__inner{
  display:grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap:18px;
}
.site-footer__title{ font-weight:700; margin-bottom:8px; }
.site-footer__desc{ color:var(--muted); }

.muted{ color:var(--muted); }


/* Headings scale */
.prose h1, .h1{ font-size: var(--fs-6); line-height: var(--lh-tight); margin: 0 0 14px; letter-spacing: var(--trk-1); }
.prose h2, .h2{ font-size: var(--fs-5); line-height: var(--lh-tight); margin: 0 0 12px; letter-spacing: var(--trk-1); }
.prose h3, .h3{ font-size: var(--fs-4); line-height: var(--lh-snug);  margin: 0 0 10px; letter-spacing: var(--trk-0); }
.prose h4, .h4{ font-size: var(--fs-3); line-height: var(--lh-snug);  margin: 0 0 8px;  letter-spacing: var(--trk-0); }
.prose h5, .h5{ font-size: var(--fs-2); line-height: var(--lh-snug);  margin: 0 0 6px;  letter-spacing: var(--trk-0); }
.prose h6, .h6{ font-size: var(--fs-1); line-height: var(--lh-snug);  margin: 0 0 6px;  letter-spacing: var(--trk-2); text-transform: uppercase; }

/* Body text rhythm */
.prose p{ margin: 0 0 14px; max-width: 72ch; }
.prose ul, .prose ol{ margin: 0 0 14px 1.1em; padding:0; max-width: 72ch; }
.prose li{ margin: 0 0 6px; }
.prose a{ text-decoration-thickness: 1px; text-underline-offset: 3px; }
.prose strong{ font-weight: 700; }

/* Quotes */
.prose blockquote{
  margin: 18px 0;
  padding: 14px 16px 14px 18px;
  border-left: 3px solid var(--accent);
  background: rgba(255,255,255,.35);
  border-radius: 14px;
  max-width: 72ch;
}
.prose blockquote p{ margin: 0; line-height: var(--lh-loose); }
.prose cite{
  display:block;
  margin-top: 10px;
  font-style: normal;
  color: var(--muted);
  font-size: var(--fs-0);
}

/* Captions */
.figure figcaption,
.wp-caption-text,
.prose .caption,
.caption{
  margin-top: 8px;
  font-size: var(--fs-0);
  line-height: 1.5;
  color: var(--muted);
  font-family: 'NewspaperSansCTT', 'Inter', sans-serif;
}



/* Serbian Cyrillic tuning
   - Cyrillic often appears visually denser: reduce tracking
   - Provide robust fallbacks for Cyrillic coverage if custom fonts miss glyphs
*/
html[lang^="sr"] body{
  font-feature-settings: "kern" 1, "liga" 1;
}
html[lang^="sr"] .hero__logo,
html[lang^="sr"] .hero__title,
html[lang^="sr"] .h1,
html[lang^="sr"] .h2,
html[lang^="sr"] .h3,
html[lang^="sr"] .h4,
html[lang^="sr"] .h5,
html[lang^="sr"] .h6{
  letter-spacing: 0; /* avoid over-tracking Cyrillic */
}

/* Fallback stacks: if your paid fonts lack SR glyphs, these cover Cyrillic well */
html[lang^="sr"] body{
  font-family: 'SchoolBook', 'Noto Serif', Georgia, serif;
}
html[lang^="sr"] .site-header,
html[lang^="sr"] .menu,
html[lang^="sr"] .pochtovoe-lab-lang__name,
html[lang^="sr"] .meta{
  font-family: 'NewspaperSansCTT', 'Noto Sans', system-ui, sans-serif;
}



/* ===============================
   Language-specific typography
   =============================== */

/* Cyrillic (RU, SR) */
html[lang^="ru"] body,
html[lang^="sr"] body {
  font-family: 'SchoolBook', 'Noto Serif', Georgia, serif;
}

/* Latin (EN, PT-BR) */
html[lang^="en"] body,
html[lang^="pt"] body {
  font-family: 'SchoolBook', 'Georgia', serif;
}

/* UI / Navigation */
.site-header,
.menu,
.meta,
.pochtovoe-lab-lang__name {
  font-family: 'NewspaperSansCTT', system-ui, sans-serif;
}

/* Display / Hero */
.hero__logo,
.hero__title,
.h1, .h2, .h3 {
  font-family: 'MrPalkerDadCond', system-ui, sans-serif;
}



/* ===============================
   Long words / overflow handling
   =============================== */

.prose,
.card,
.timeline__title,
.card__title,
.h1, .h2, .h3, .h4, .h5, .h6 {
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
}



/* Direction card optional image */
.card__media{
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.25);
  display: grid;
  place-items: center;
  margin-bottom: 10px;
  overflow: hidden;
}
.card__media img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display:block;
}



/* Language dropdown (Polylang) */
.lang-dd{ position: relative; }
.lang-dd[open] .lang-dd__summary{ border-color: color-mix(in srgb, var(--accent) 35%, var(--line) 65%); }
.lang-dd__summary{
  list-style:none;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:7px 10px;
  border-radius:999px;
  border:1px solid var(--line);
  background: rgba(255,255,255,.25);
  user-select:none;
  font-family: 'NewspaperSansCTT', system-ui, sans-serif;
}
.lang-dd__summary::-webkit-details-marker{ display:none; }
.lang-dd__panel{
  position:absolute;
  right:0;
  margin-top:8px;
  min-width: 180px;
  background: rgba(255,255,255,.92);
  border:1px solid var(--line);
  border-radius:16px;
  box-shadow: 0 12px 30px rgba(0,0,0,.08);
  padding:8px;
  z-index: 50;
  backdrop-filter: blur(10px);
}
.lang-dd__list{ list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:4px; }
.lang-dd__link{
  display:flex;
  align-items:center;
  gap:10px;
  padding:8px 10px;
  border-radius:12px;
  color: var(--text);
  text-decoration:none;
  white-space: normal;
  overflow-wrap:anywhere;
}
.lang-dd__link:hover{ background: rgba(0,0,0,.04); }
.lang-dd__item.is-current .lang-dd__link{ background: rgba(0,0,0,.06); }
.lang-dd__flag{ width:18px; height:12px; border-radius:3px; object-fit:cover; }
.lang-dd__name{ font-size: var(--fs-0); line-height: 1.2; }


@media (max-width: 920px){
  .grid--3, .grid--cards{ grid-template-columns:repeat(2, minmax(0, 1fr)); }
  .site-footer__inner{ grid-template-columns:1fr; }
  .site-header__inner{ flex-wrap:wrap; }
}
@media (max-width: 560px){
  :root{
    --fs-2: 17px;
    --fs-3: 19px;
    --fs-4: 22px;
    --fs-5: 28px;
    --fs-6: 36px;
  }
  .container{ padding:0 16px; }
  .grid--3, .grid--cards{ grid-template-columns:1fr; }
  .hero{ padding:46px 0 26px; }
  .hero__lead{ font-size:18px; }
  .h2{ font-size:24px; }
  .hero__actions{ gap:10px; }
  .btn{ width:100%; }
}


.site-header,
.menu,
.pochtovoe-lab-lang__name,
.meta {
  font-family: 'NewspaperSansCTT', 'Inter', sans-serif;
}

.hero__logo,
.hero__title,
.h1,
.h2,
.h3 {
  font-family: 'MrPalkerDadCond', 'Inter Tight', sans-serif;
  letter-spacing: 0.01em;
}


.menu--footer{ flex-direction:column; align-items:flex-start; gap:10px; }
.menu--footer a{ white-space:normal; overflow-wrap:anywhere; word-break:break-word; hyphens:auto; }


.site-footer__bar{ margin-top:18px; border-top:1px solid var(--line); padding:16px 0; }
.site-footer__copyright{ color:var(--muted); font-size: var(--fs-0); font-family: 'NewspaperSansCTT', system-ui, sans-serif; overflow-wrap:anywhere; }

/* ===============================
   Direction switcher (Education / Research / Volunteering)
   =============================== */

.dir-switcher{ margin: 22px 0 18px; }
.dir-switcher__list{ display:flex; flex-wrap:wrap; gap:10px; padding:0; margin:0; list-style:none; }
.dir-switcher__btn{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:10px 12px;
  border:1px solid var(--line);
  border-radius: 999px;
  text-decoration:none;
  color: var(--text);
  background: color-mix(in srgb, var(--bg) 85%, #fff 15%);
  transition: transform .12s ease, border-color .12s ease, background-color .12s ease;
}
.dir-switcher__btn:hover{ transform: translateY(-1px); border-color: color-mix(in srgb, var(--accent) 35%, var(--line) 65%); }
.dir-switcher__btn.is-active{
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line) 45%);
  background: color-mix(in srgb, var(--accent) 14%, var(--bg) 86%);
}

@media (max-width: 560px){
  .dir-switcher__list{
    flex-wrap:nowrap;
    overflow-x:auto;
    -webkit-overflow-scrolling:touch;
    padding-bottom:6px;
  }
  .dir-switcher__btn{ white-space:nowrap; flex:0 0 auto; }
}

.dir-panels{ margin-top: 16px; }
.dir-panel{ display:none; }
.dir-panel.is-active{ display:block; }
.dir-panel__head{ margin-bottom: 14px; }


/* Homepage mode: Image (cover / “obraz”) */
.hero--image{
  position:relative;
  padding:0;
  min-height: calc(var(--hero-min-vh, 100) * 1vh);
  display:flex;
  align-items:flex-end;
  background-size:cover;
  background-position:center;
  background-repeat:no-repeat;
}
.hero__shade{
  position:absolute;
  inset:0;
  background:linear-gradient(180deg, rgba(0,0,0,.18) 0%, rgba(0,0,0,.45) 62%, rgba(0,0,0,.62) 100%);
  pointer-events:none;
}
.hero__inner--image{
  position:relative;
  z-index:1;
  text-align:left;
  align-items:flex-start;
  padding: clamp(24px, 6vw, 64px) 0;
  gap:12px;
}
.hero__subtitle--image{
  color: rgba(255,255,255,.86);
}
.hero__h1{
  margin:0;
  font-size: clamp(34px, 5vw, 64px);
  line-height:1.05;
  letter-spacing:-0.02em;
  color:#fff;
}
.hero__lead--image{
  color: rgba(255,255,255,.86);
  max-width: 52ch;
}
.site-title--ghost{
  width:1px;
  height:1px;
  overflow:hidden;
  display:block;
}

/* Optional: make header sit nicer on image mode */
.site-header--home-image{
  backdrop-filter: saturate(1.2) blur(6px);
}


/* Partners section */
.partners__grid{
  display:grid;
  grid-template-columns:repeat(var(--partners-cols, 6), minmax(0, 1fr));
  gap:18px;
  align-items:center;
}
@media (max-width: 980px){
  .partners__grid{ grid-template-columns:repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 640px){
  .partners__grid{ grid-template-columns:repeat(2, minmax(0, 1fr)); }
}
.partners__item{
  display:flex;
  justify-content:center;
  align-items:center;
  min-height:calc(var(--partners-logo-h, 56px) + 28px);
}
.partners__link, .partners__nolink{
  display:flex;
  justify-content:center;
  align-items:center;
  width:100%;
  min-height:calc(var(--partners-logo-h, 56px) + 28px);
  padding:10px;
  border-radius:10px;
}
.partners__logo{
  height:var(--partners-logo-h, 56px);
  width:auto;
  max-width:100%;
  object-fit:contain;
  filter:grayscale(1) contrast(.95) opacity(.72);
  transition:filter .18s ease, opacity .18s ease;
}
.partners__link:hover .partners__logo,
.partners__link:focus .partners__logo{
  filter:grayscale(0) contrast(1) opacity(1);
}
.partners__text{
  font-size:14px;
  color:var(--muted);
  text-align:center;
}
