/* marcinrdzak.pl – jeden arkusz dla wersji PL i EN.
   Bez zewnętrznych fontów i skryptów: nic nie łączy się z serwerami trzecich stron. */

:root {
  --paper: #eceee9;      /* szarozielona tektura pudła archiwalnego */
  --sheet: #f7f8f5;      /* karta opisu */
  --ink: #1d2433;        /* atrament żelazowo-galasowy */
  --muted: #586271;
  --rule: #c5cbc2;
  --verdigris: #2c5a4d;  /* patyna – linki i akcent */
  --measure: 66ch;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", "URW Palladio L", Georgia, serif;
}

* { box-sizing: border-box; }

/* płynna wielkość tekstu: ok. 17 px na telefonie, 18 px na laptopie, do 21 px na dużym monitorze */
html { font-size: clamp(1.0625rem, 0.95rem + 0.22vw, 1.3125rem); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  line-height: 1.6;
  font-variant-numeric: oldstyle-nums proportional-nums;
}

a { color: var(--verdigris); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible { outline: 2px solid var(--verdigris); outline-offset: 3px; border-radius: 2px; }

.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: 1rem; top: 1rem; background: var(--sheet); padding: .4rem .8rem; z-index: 10; }

/* ---------- nagłówek strony ---------- */
.top {
  max-width: 62rem; margin: 0 auto; padding: 1.2rem 1.5rem;
  display: flex; flex-wrap: wrap; gap: .6rem 1.6rem; align-items: baseline; justify-content: space-between;
}
.top .home { color: var(--ink); text-decoration: none; font-style: italic; }
.top nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; font-size: .9rem; }
.top nav a { color: var(--muted); text-decoration: none; }
.top nav a:hover, .top nav a[aria-current] { color: var(--ink); text-decoration: underline; }
.lang { font-size: .9rem; }

/* ---------- hero: opis jak w inwentarzu archiwalnym (ISAD(G)) ---------- */
.record {
  max-width: 62rem; margin: 1rem auto 0; padding: 0 1.5rem;
}
.record h1 {
  font-weight: 400;
  font-size: clamp(2.6rem, 7vw, 4.6rem); overflow-wrap: break-word;
  line-height: 1.02;
  letter-spacing: -0.015em;
  margin: 0 0 .35em;
}
.record h1 span { display: block; }
.record h1 .middle { font-style: italic; color: var(--muted); font-size: .55em; letter-spacing: 0; margin: .15em 0 .1em; }

.card {
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-left: 6px solid var(--verdigris);
  padding: 1.4rem 1.6rem 1.2rem;
  max-width: 48rem;
}
.card dl { margin: 0; display: grid; grid-template-columns: 11.5rem 1fr; gap: .45rem 1.2rem; }
.card dt { font-style: italic; color: var(--muted); font-size: .9rem; padding-top: .12rem; }
.card dd { margin: 0; }
.card .ref { font-variant-numeric: lining-nums tabular-nums; letter-spacing: .02em; }
.card-note { font-size: .85rem; color: var(--muted); margin: .6rem 0 0; max-width: 48rem; }

/* ---------- sekcje ---------- */
main { padding-bottom: 3rem; }
section {
  max-width: 62rem; margin: 0 auto; padding: 3.2rem 1.5rem 0;
}
section > h2 {
  font-weight: 400; font-size: 1.75rem; line-height: 1.2; margin: 0 0 1.1rem;
  padding-top: .9rem; border-top: 1px solid var(--ink);
  max-width: 48rem;
}
section h3, section h2.minor {
  font-weight: 400; font-style: italic; font-size: 1.15rem; margin: 1.8rem 0 .6rem; color: var(--muted);
}
p, .prose { max-width: var(--measure); }
.lede { font-size: 1.15rem; line-height: 1.55; }

/* listy z rokiem na marginesie – to rzeczywiste sekwencje chronologiczne */
.dated { list-style: none; margin: 0; padding: 0; max-width: 54rem; }
.dated li {
  display: grid; grid-template-columns: 6.5rem 1fr; gap: 0 1.2rem;
  padding: .55rem 0; border-bottom: 1px solid var(--rule);
}
.dated li:last-child { border-bottom: 0; }
.dated .when { color: var(--muted); font-variant-numeric: lining-nums tabular-nums; font-size: .92rem; padding-top: .1rem; }
.dated .what { max-width: var(--measure); }
.dated .meta { display: block; color: var(--muted); font-size: .92rem; }
.dated cite { font-style: italic; }

.plain { padding-left: 1.1rem; max-width: var(--measure); }
.plain li { margin: .25rem 0; }

.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(17rem, 100%), 1fr)); gap: 0 2.5rem; max-width: 54rem; }

/* ---------- kontakt i stopka ---------- */
.contact dl { display: grid; grid-template-columns: 9rem 1fr; gap: .4rem 1.2rem; max-width: 48rem; margin: 0; }
.contact dt { font-style: italic; color: var(--muted); }
.contact dd { margin: 0; overflow-wrap: anywhere; }

footer {
  max-width: 62rem; margin: 0 auto; padding: 1.5rem; font-size: .85rem; color: var(--muted);
  border-top: 1px solid var(--rule);
}

/* ---------- małe ekrany ---------- */
@media (max-width: 40rem) {
  .card { padding: 1.1rem 1.1rem 1rem; }
  .card dl, .contact dl { grid-template-columns: 1fr; gap: 0; }
  .card dd, .contact dd { margin-bottom: .55rem; }
  .dated li { grid-template-columns: 1fr; }
  .dated .when { padding-top: 0; }
}

@media print {
  body { background: #fff; }
  .top nav, .skip { display: none; }
  .card { border-left-width: 3px; }
  a { color: var(--ink); }
}

/* ---------- podstrony ---------- */
.sub section { padding-top: 1.5rem; }
.sub section > h1 {
  font-weight: 400; font-size: clamp(1.8rem, 7vw, 3.6rem); hyphens: auto; overflow-wrap: break-word; line-height: 1.05; letter-spacing: -0.01em;
  margin: 0 0 1.6rem; max-width: 48rem;
}
.top nav a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--verdigris); text-decoration-thickness: 2px; }

section h2.minor { border-top: 0; padding-top: 0; max-width: none; }
.dated .what, .card dd, p { overflow-wrap: break-word; }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

/* ---------- urządzenia dotykowe: większe pola do kliknięcia w menu ---------- */
@media (pointer: coarse) {
  .top nav ul { gap: .1rem .4rem; margin-left: -.35rem; }
  .top .home { margin-left: -.35rem; }
  .top nav a, .top .home { display: inline-block; padding: .55rem .35rem; min-height: 44px; }
  .top { padding-top: .6rem; padding-bottom: .6rem; }
}

/* ---------- duże monitory: szerszy układ ---------- */
@media (min-width: 110rem) {
  .top, .record, section, footer { max-width: 72rem; }
  .dated, .cols { max-width: 62rem; }
}

/* ---------- tablet w poziomie i laptop: menu w jednej linii, język po prawej ---------- */
@media (min-width: 48rem) and (max-width: 64rem) {
  .top nav ul { gap: .3rem .9rem; }
}

/* ---------- przełącznik języka: flagi z podpisem ---------- */
.langs { list-style: none; margin: 0; padding: 0; display: flex; gap: .3rem; font-size: .9rem; }
.langs a {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .3rem .55rem; border: 1px solid transparent; border-radius: 3px;
  color: var(--muted); text-decoration: none; font-variant-numeric: lining-nums;
}
.langs img { display: block; width: 24px; height: 15px; outline: 1px solid var(--rule); }
.langs a:hover { color: var(--ink); border-color: var(--rule); }
.langs a[aria-current="true"] { color: var(--ink); border-color: var(--ink); background: var(--sheet); }
@media (pointer: coarse) { .langs { margin-left: -.6rem; } .langs a { min-height: 44px; padding: .55rem .6rem; } }
@media print { .langs { display: none; } }

/* ---------- przycisk „na górę” ---------- */
#gora:focus { outline: none; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
.totop {
  position: fixed; z-index: 20;
  right: max(1rem, env(safe-area-inset-right)); bottom: max(1.25rem, env(safe-area-inset-bottom));
  width: 48px; height: 48px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--ink); color: var(--sheet);
  box-shadow: 0 2px 6px rgba(29, 36, 51, .25);
}
.totop:hover { background: var(--verdigris); }
.totop:focus-visible { outline: 3px solid var(--verdigris); outline-offset: 3px; }
.js .totop { opacity: 0; visibility: hidden; transform: translateY(.6rem); transition: opacity .2s, transform .2s, visibility .2s; }
.js .totop.is-visible { opacity: 1; visibility: visible; transform: none; }
@media (prefers-reduced-motion: reduce) { .js .totop { transition: none; transform: none; } }
@media print { .totop { display: none; } }

/* ---------- WCAG 2.2: pola do kliknięcia min. 24 px (2.5.8), fokus niezasłonięty przez przycisk „na górę” (2.4.11) ---------- */
html { scroll-padding-bottom: 5.5rem; }
.top nav a, .top .home { display: inline-flex; align-items: center; min-height: 24px; min-width: 24px; }

/* ---------- ORCID iD w formacie pełnym ---------- */
.orcid { display: inline-flex; align-items: center; gap: .4rem; overflow-wrap: anywhere; }
.orcid-icon { flex: none; width: 1em; height: 1em; }

/* ---------- stopka zawsze na dole okna, także przy krótkiej treści ---------- */
body { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
body > main { flex: 1 0 auto; }
body > .top, body > footer { flex-shrink: 0; width: 100%; }

/* ---------- daty dzienne: szersza kolumna dat ---------- */
.dated li { grid-template-columns: 10.5rem 1fr; }
.dated .when time { white-space: nowrap; }

/* ---------- dydaktyka według lat akademickich ---------- */
.yearnav { display: flex; flex-wrap: wrap; gap: .2rem .9rem; margin: 1.2rem 0 .5rem; max-width: 54rem; font-size: .95rem; }
.yearnav span { color: var(--muted); font-style: italic; }
.yearnav a { display: inline-flex; align-items: center; min-height: 24px; }
.note { color: var(--muted); font-size: .95rem; }
section h2.year { color: var(--ink); font-style: normal; font-size: 1.4rem; margin-top: 2.6rem; padding-top: .8rem; border-top: 1px solid var(--rule); max-width: 54rem; }
section h3.sem { font-size: 1.05rem; margin: 1.1rem 0 .4rem; }
.courses { list-style: none; margin: 0; padding: 0; max-width: 54rem; }
.courses > li { margin: 0 0 .8rem; }
.courses .prog { display: block; color: var(--muted); font-size: .95rem; }
.courses ul { margin: .2rem 0 0; padding-left: 1.1rem; }
.courses ul li { margin: .15rem 0; max-width: var(--measure); }
.meta-inline { color: var(--muted); font-size: .92rem; }
@media (max-width: 40rem) { .dated li { grid-template-columns: 1fr; } }

/* ---------- zakresy dat: łamanie wiersza tylko przed myślnikiem ---------- */
.dated .when time, .dated .when .to { white-space: nowrap; }
.dated .when .to { display: inline-block; }

/* ---------- przycisk „na górę” ukryty od pierwszej chwili, bez mignięcia przed uruchomieniem skryptu ---------- */
@media (scripting: enabled) {
  .totop:not(.is-visible) { opacity: 0; visibility: hidden; transform: translateY(.6rem); }
}

/* ---------- przycisk „Wysoki kontrast” ---------- */
.contrast-toggle {
  display: inline-flex; align-items: center; gap: .4rem; min-height: 24px;
  padding: .3rem .6rem; border: 1px solid var(--rule); border-radius: 3px;
  background: transparent; color: var(--ink); font: inherit; font-size: .9rem; cursor: pointer;
}
.contrast-toggle:hover { border-color: var(--ink); }
.contrast-toggle:focus-visible { outline: 2px solid var(--verdigris); outline-offset: 3px; }

.contrast-toggle[hidden] { display: none; }
@media (pointer: coarse) { .contrast-toggle { min-height: 44px; } }
@media print { .contrast-toggle { display: none; } }

/* ---------- wersja kontrastowa (włączana przyciskiem) ---------- */
html[data-contrast="high"] {
  --paper: #000; --sheet: #000; --ink: #fff; --muted: #fff; --rule: #fff; --verdigris: #ff0;
}
html[data-contrast="high"] a { color: #ff0; }
html[data-contrast="high"] .top nav a, html[data-contrast="high"] .langs a { color: #fff; }
html[data-contrast="high"] .top nav a[aria-current="page"] { color: #ff0; text-decoration-color: #ff0; }
html[data-contrast="high"] .card { border-color: #fff; border-left-color: #ff0; }
html[data-contrast="high"] .totop { background: #ff0; color: #000; box-shadow: none; }
html[data-contrast="high"] .totop:hover { background: #fff; }
html[data-contrast="high"] .langs img { outline-color: #fff; }
html[data-contrast="high"] .contrast-toggle { background: #ff0; color: #000; border-color: #ff0; }
html[data-contrast="high"] :focus-visible { outline-color: #ff0; }

/* ---------- ustawienia systemu: zwiększony kontrast i motywy kontrastowe Windows ---------- */
@media (prefers-contrast: more) {
  :root:not([data-contrast="high"]) { --muted: #1d2433; --rule: #1d2433; --verdigris: #133d33; }
}
@media (forced-colors: active) {
  .contrast-toggle, .langs a, .totop { border: 1px solid ButtonText; }
  .card { border: 1px solid CanvasText; }
}
.tools { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; }
footer p { margin: .35rem 0; }
footer .copy { margin-top: .6rem; }
footer p { margin: .3rem 0; max-width: none; }

/* ---------- okładka monografii ---------- */
.with-cover .what { display: flex; gap: 1.3rem; align-items: flex-start; }
.cover { flex: none; width: 9rem; height: auto; border: 1px solid var(--rule); box-shadow: 0 2px 8px rgba(29, 36, 51, .18); }
.with-cover .txt { display: block; }
@media (max-width: 40rem) {
  .with-cover .what { flex-direction: column; gap: .8rem; }
  .cover { width: 8rem; }
}
@media print { .cover { box-shadow: none; } }

/* Typografia: bez pojedynczych słów w ostatnim wierszu (Chrome/Edge 117+, Safari 26+; w innych przeglądarkach działają twarde spacje w HTML) */
p, li, .what, .meta, dd, dt, figcaption { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; }
.nw { white-space: nowrap; }
.tr { color: var(--muted); font-style: normal; }

/* ---------- menu przyklejone do góry okna podczas przewijania ----------
   Tło na całą szerokość okna, treść wyrównana do kolumny strony.
   Na telefonach i niskich ekranach menu chowa się przy przewijaniu w dół i wraca przy przewijaniu w górę,
   żeby nie zasłaniało treści (WCAG 1.4.10). */
body > .top {
  position: sticky; top: 0; z-index: 30;
  max-width: none; margin: 0;
  padding-left: max(1.5rem, calc((100% - 62rem) / 2 + 1.5rem));
  padding-right: max(1.5rem, calc((100% - 62rem) / 2 + 1.5rem));
  background: var(--paper);
  border-bottom: 1px solid transparent;
}
@media (min-width: 110rem) {
  body > .top { padding-left: calc((100% - 72rem) / 2 + 1.5rem); padding-right: calc((100% - 72rem) / 2 + 1.5rem); }
}
body > .top.is-stuck { border-bottom-color: var(--rule); box-shadow: 0 2px 8px rgba(29, 36, 51, .08); }
.skip:focus { z-index: 40; }
/* fokus i kotwice nie chowają się pod menu (WCAG 2.4.11) */
html { scroll-padding-top: calc(var(--top-h, 0px) + 1rem); }
@media (max-width: 47.99rem), (max-height: 30rem) {
  .js body > .top { transition: transform .25s ease; }
  .js body > .top.is-hidden { transform: translateY(-100%); box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) { .js body > .top { transition: none; } }
html[data-contrast="high"] body > .top.is-stuck { box-shadow: none; }
@media print { body > .top { position: static; border: 0; box-shadow: none; } }
time { white-space: nowrap; }
.meta-inline { white-space: nowrap; }
