:root {
  --page: #f5f5f3;
  --surface: #ffffff;
  --surface-soft: #f0efec;
  --text: #242322;
  --muted: #66615d;
  --line: #d8d5d1;
  --accent: #8a1c2f;
  --accent-strong: #6d1223;
  --action: #8a1c2f;
  --accent-soft: #f6e8eb;
  --gold: #9a7840;
  --shadow: 0 18px 52px rgba(39, 31, 27, .09);
  --font-scale: 1;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --page: #121315;
  --surface: #1b1d20;
  --surface-soft: #24272b;
  --text: #f1f0ed;
  --muted: #c0bbb5;
  --line: #41444a;
  --accent: #f07084;
  --accent-strong: #ff9aab;
  --action: #8f1730;
  --accent-soft: #3a2027;
  --gold: #d4b678;
  --shadow: 0 18px 52px rgba(0, 0, 0, .28);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html {
  background: var(--page);
  color: var(--text);
  font-size: calc(100% * var(--font-scale));
  scroll-behavior: smooth;
}

body {
  min-width: 0;
  margin: 0;
  overflow-x: hidden;
  background: var(--page);
  color: var(--text);
  font-family: "Avenir Next", Avenir, "Segoe UI", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.72;
}

a { color: var(--accent-strong); text-underline-offset: .2em; }
button, input, select { font: inherit; }
img { display: block; max-width: 100%; }

.skip-link {
  position: fixed;
  z-index: 1000;
  top: .75rem;
  left: .75rem;
  padding: .7rem 1rem;
  border: 2px solid var(--accent);
  background: var(--surface);
  color: var(--text);
  transform: translateY(-180%);
}

.skip-link:focus { transform: translateY(0); }

.site-header {
  position: sticky;
  z-index: 100;
  top: 0;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  box-shadow: 0 6px 24px rgba(30, 24, 20, .055);
  backdrop-filter: blur(18px);
}

.flag-line { display: grid; grid-template-columns: 1fr 1fr; height: 4px; }
.flag-line span:first-child { background: #fff; }
.flag-line span:last-child { background: #dc143c; }

.header-inner,
.nav-row,
.site-footer {
  width: min(1220px, calc(100% - 2.5rem));
  margin-inline: auto;
}

.header-inner {
  min-height: 84px;
  display: grid;
  grid-template-columns: auto minmax(260px, 540px) auto;
  align-items: center;
  gap: clamp(1rem, 3vw, 2rem);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .72rem;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--gold);
  border-radius: 50%;
  color: var(--accent);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.4rem;
  font-weight: 700;
  box-shadow: inset 0 0 0 4px var(--surface);
  outline: 1px solid color-mix(in srgb, var(--gold) 45%, transparent);
  outline-offset: 3px;
}

.brand strong {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.14rem;
  letter-spacing: .13em;
  line-height: 1.1;
  white-space: nowrap;
}

.brand small {
  display: block;
  margin-top: .25rem;
  color: var(--muted);
  font-size: .72rem;
  letter-spacing: .06em;
  line-height: 1.2;
}

.site-search { position: relative; margin: 0; }
.site-search > label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
.search-field { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; min-height: 44px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-soft); overflow: hidden; }
.search-field > span { padding-left: .9rem; color: var(--accent); font-size: 1.2rem; }
.search-field input { min-width: 0; height: 42px; padding: 0 .75rem; border: 0; outline: 0; background: transparent; color: var(--text); font-size: .93rem; }
.search-field input::placeholder { color: var(--muted); opacity: 1; }
.search-field button { align-self: stretch; padding: 0 1rem; border: 0; border-left: 1px solid var(--line); background: var(--action); color: #fff; font-weight: 700; cursor: pointer; }
.search-field:focus-within { border-color: var(--accent); outline: 3px solid color-mix(in srgb, var(--accent) 18%, transparent); }

.search-results {
  position: absolute;
  z-index: 150;
  top: calc(100% + .45rem);
  left: 0;
  right: 0;
  max-height: min(66vh, 520px);
  overflow: auto;
  padding: .45rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.search-results a { display: block; padding: .75rem .8rem; border-radius: 5px; color: var(--text); text-decoration: none; }
.search-results a:hover, .search-results a:focus-visible { background: var(--accent-soft); outline: 0; }
.search-results strong { display: block; color: var(--accent-strong); }
.search-results span { display: block; margin-top: .18rem; color: var(--muted); font-size: .82rem; line-height: 1.45; }
.search-results p { margin: .65rem; color: var(--muted); font-size: .88rem; }

.header-actions,
.font-controls { display: flex; align-items: center; gap: .3rem; }

.header-actions button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
  font-size: .82rem;
  font-weight: 700;
}

.header-actions button { min-width: 38px; padding: 0 .58rem; cursor: pointer; }
.language-control { position: relative; }
.language-toggle { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; min-width: 58px; padding: 0 .45rem; cursor: pointer; }
.language-menu {
  position: absolute;
  z-index: 220;
  top: calc(100% + .35rem);
  right: 0;
  min-width: 76px;
  max-height: min(65vh, 410px);
  overflow-y: auto;
  padding: .25rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.language-menu[hidden] { display: none; }
.header-actions .language-menu button {
  display: block;
  width: 100%;
  min-height: 34px;
  padding: .35rem .6rem;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.header-actions .language-menu button:hover,
.header-actions .language-menu button:focus-visible { background: var(--accent-soft); color: var(--accent-strong); outline: 0; }
.header-actions .language-menu button[aria-checked="true"] { background: var(--accent-soft); color: var(--accent-strong); font-weight: 800; }
.theme-button { display: inline-flex; align-items: center; gap: .35rem; }
.header-actions > button:hover, .header-actions > button:focus-visible, .font-controls button:hover, .font-controls button:focus-visible, .language-toggle:hover, .language-toggle:focus-visible { border-color: var(--accent); outline: 2px solid color-mix(in srgb, var(--accent) 26%, transparent); outline-offset: 2px; }

.nav-row {
  min-height: 50px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}

.site-directory { position: relative; justify-self: start; }
.site-directory summary { display: flex; align-items: center; gap: .5rem; padding: .55rem 0; color: var(--text); font-weight: 750; cursor: pointer; list-style: none; }
.site-directory summary::-webkit-details-marker { display: none; }
.site-directory nav { position: absolute; top: calc(100% + .25rem); left: 0; width: min(780px, calc(100vw - 2.5rem)); max-height: min(72vh, 650px); overflow: auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .35rem; padding: .65rem; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); box-shadow: var(--shadow); }
.site-directory:not([open]) nav { display: none; }
.site-directory nav a { display: grid; gap: .1rem; padding: .72rem .8rem; border-radius: 5px; color: var(--text); text-decoration: none; }
.site-directory nav a:hover { background: var(--accent-soft); }
.site-directory nav a.is-current { background: var(--action); color: #fff; }
.site-directory nav a span { color: var(--muted); font-size: .78rem; }
.site-directory nav a.is-current span { color: #fff; opacity: .82; }

.current-section { display: flex; gap: .55rem; margin: 0; font-size: .84rem; }
.current-section span { color: var(--muted); }
.header-email { width: min(420px, 100%); justify-self: end; }

.email-graphic { display: inline-flex; max-width: 100%; color: var(--accent-strong); vertical-align: middle; user-select: none; -webkit-user-select: none; }
.email-graphic svg { display: block; max-width: 100%; height: auto; pointer-events: none; }
.email-graphic text { font-family: "Avenir Next", Avenir, "Segoe UI", Arial, sans-serif; }
.email-address { font-size: 16px; font-weight: 800; letter-spacing: .02em; }
.email-description { color: var(--muted); font-size: 12.5px; font-weight: 600; letter-spacing: .005em; }

.history-content { width: min(1120px, calc(100% - 2.5rem)); margin: clamp(1.25rem, 3vw, 2.6rem) auto; }
.eyebrow { margin: 0 0 .7rem; color: var(--accent); font-size: .78rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
h1, h2, h3 { color: var(--text); font-family: Georgia, "Times New Roman", serif; line-height: 1.15; text-wrap: balance; }
h1 { font-size: clamp(2.45rem, 7vw, 5.8rem); }
h2 { font-size: clamp(1.65rem, 3.5vw, 2.7rem); }
h3 { font-size: clamp(1.2rem, 2vw, 1.55rem); }

.home-hero {
  min-height: 560px;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(260px, .75fr);
  align-items: center;
  gap: clamp(2rem, 7vw, 6rem);
  padding: clamp(2.5rem, 8vw, 7rem) clamp(1.2rem, 5vw, 4.5rem);
  border-top: 7px solid var(--action);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero-copy h1 { margin: 0 0 1rem; }
.hero-copy .lead { max-width: 760px; margin: 0 0 1.2rem; color: var(--text); font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.2rem, 2.2vw, 1.6rem); line-height: 1.48; }
.hero-copy > p:last-of-type { max-width: 720px; color: var(--muted); text-align: justify; }
.hero-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-top: 2rem; }
.hero-facts span { padding: 1rem; border-left: 3px solid var(--accent); background: var(--surface-soft); color: var(--muted); font-size: .86rem; }
.hero-facts strong { display: block; color: var(--text); font-family: Georgia, serif; font-size: 1.75rem; line-height: 1; }

.hero-portrait { margin: 0; text-align: center; }
.hero-portrait img { width: 63px; height: 100px; margin-inline: auto; object-fit: contain; border-radius: 2px; filter: saturate(.58) contrast(1.04) brightness(.93); box-shadow: 8px 8px 0 var(--accent-soft); }
.hero-portrait figcaption { max-width: 230px; margin: 1.1rem auto 0; color: var(--muted); font-size: .82rem; line-height: 1.5; }

.journey-note { display: grid; grid-template-columns: minmax(260px, .8fr) minmax(0, 1.2fr); align-items: center; gap: clamp(2rem, 6vw, 5rem); padding: clamp(3rem, 7vw, 6rem) clamp(1rem, 4vw, 3rem); }
.journey-note img { width: 100%; max-height: 360px; object-fit: contain; filter: saturate(.5) contrast(1.05) brightness(.88); }
.journey-note h2, .section-heading h2, .contribution-note h2 { margin: 0 0 1rem; }
.journey-note p:last-child, .section-heading > p:last-child, .contribution-note p { color: var(--muted); }
.journey-note p:last-child, .contribution-note p { text-align: justify; }

.section-directory { padding: clamp(2.5rem, 6vw, 5rem) clamp(1rem, 4vw, 3rem); border-top: 1px solid var(--line); }
.section-heading { max-width: 720px; margin-bottom: 2.4rem; }
.directory-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.directory-grid a { min-height: 104px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1rem; padding: 1.1rem 1.2rem; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--text); text-decoration: none; transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease; }
.directory-grid a:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 12px 28px rgba(70, 30, 35, .08); }
.directory-grid a > span { color: var(--accent); font-family: Georgia, serif; font-size: 1.15rem; }
.directory-grid strong { display: block; font-family: Georgia, serif; font-size: 1.05rem; }
.directory-grid p { margin: .25rem 0 0; color: var(--muted); font-size: .84rem; line-height: 1.45; }
.directory-grid b { color: var(--accent); font-size: 1.2rem; }

.contribution-note { display: grid; grid-template-columns: auto 1fr; gap: 1.25rem; margin: clamp(2rem, 6vw, 5rem) 0; padding: clamp(1.5rem, 4vw, 3rem); border: 1px solid var(--line); border-left: 6px solid var(--action); background: var(--surface); }
.contribution-note > span { color: var(--gold); font-size: 2.2rem; }
.contribution-note h2 { font-size: clamp(1.4rem, 2.5vw, 2rem); }
.contribution-note p { margin: 0; }

.article-page { max-width: 960px; margin-inline: auto; padding: clamp(1.2rem, 4vw, 3.8rem); border-top: 7px solid var(--action); background: var(--surface); box-shadow: var(--shadow); }
.article-header { margin-bottom: 2.5rem; padding-bottom: 2rem; border-bottom: 1px solid var(--line); }
.article-header h1 { margin: 0 0 1rem; font-size: clamp(2.1rem, 6vw, 4.4rem); }
.article-header > p:last-child { max-width: 720px; margin: 0; color: var(--muted); font-family: Georgia, serif; font-size: 1.16rem; }

.article-body { min-width: 0; color: var(--text); font-family: "Avenir Next", Avenir, "Segoe UI", Arial, sans-serif; }
.article-body :where(p, li, td, th, span, b, strong, i, em, u) { color: inherit !important; background: transparent !important; font-family: inherit !important; font-size: 1rem !important; line-height: 1.72 !important; overflow-wrap: anywhere; }
.article-body p { margin: 0 0 .62rem; text-align: justify; text-align-last: auto; hyphens: auto; }
[data-legacy-vml-image] { display: block; width: auto; max-width: 100%; height: auto; margin-inline: auto; }
[data-missing-photo] {
  display: flex;
  min-height: 10rem;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: .65rem;
  padding: 1rem;
  border: 1px dashed color-mix(in srgb, var(--accent-strong) 52%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 5%, var(--surface));
  color: var(--muted);
  text-align: center;
}
[data-missing-photo] > span { color: var(--accent-strong); font-size: 1.45rem; }
[data-missing-photo] strong { max-width: 24rem; font-size: .88rem; line-height: 1.35; }
[data-file="zapiskiuczniaMielec1947do53.htm"] .article-body table:has(> tbody > tr > td [data-missing-photo]) > tbody > tr {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
}
.article-body :where(h1, h2, h3, h4) { margin: 2.2rem 0 .85rem; color: var(--text) !important; font-family: Georgia, "Times New Roman", serif !important; line-height: 1.22 !important; }
.article-body a { color: var(--accent-strong) !important; text-decoration-thickness: 1px; }
.article-body img { width: auto; max-width: 100% !important; height: auto !important; margin: 1.5rem auto; filter: saturate(.56) contrast(1.04) brightness(.9); }
.article-body table { width: 100% !important; max-width: 100% !important; display: block; overflow-x: auto; border-collapse: collapse; scrollbar-color: var(--accent) var(--surface-soft); }
.article-body tbody { min-width: 100%; }
.article-body td, .article-body th { min-width: 0 !important; padding: .6rem !important; border: 1px solid var(--line) !important; background: var(--surface) !important; vertical-align: top; }
.article-body tr:last-child p:last-child, .article-body td > p:last-child { margin-bottom: 0; }
.article-body table p { line-height: 1.55 !important; }
.synchronic-table-scroll { width: 100%; overflow-x: auto; border: 1px solid var(--line); scrollbar-color: var(--accent) var(--surface-soft); }
[data-file="Tablica synchroniczna.htm"] .synchronic-table-scroll table { display: table; width: 100% !important; min-width: 760px !important; table-layout: fixed; }
[data-file="Tablica synchroniczna.htm"] .synchronic-table-scroll th { vertical-align: middle !important; background: var(--accent-soft) !important; color: var(--text) !important; font-weight: 800; line-height: 1.35 !important; text-align: left; }
[data-file="Tablica synchroniczna.htm"] .synchronic-table-scroll :is(th, td):first-child { width: 92px; text-align: center; }
[data-file="Tablica synchroniczna.htm"] .synchronic-table-scroll p { margin-block: .2rem; }
.article-body [lang^="EN" i] { display: none !important; }
.article-body sup { color: var(--accent); }
.article-body .outdated-address { display: inline; color: var(--accent-strong) !important; font-weight: 800; }

.site-footer { padding: 2rem 0 2.8rem; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .8rem 2rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .84rem; }
.footer-brand { display: flex; align-items: center; gap: .75rem; }
.footer-brand p { margin: 0; }
.footer-brand strong { color: var(--text); font-family: Georgia, serif; font-size: 1.05rem; }
.footer-cross { color: var(--gold); font-size: 1.6rem; }
.footer-contact { display: flex; align-items: center; gap: .7rem; }
.archive-note { grid-column: 1 / -1; margin: 0; }

.translation-note { position: fixed; right: 1rem; bottom: 1rem; z-index: 200; max-width: 370px; padding: .9rem 1rem; border: 1px solid var(--accent); border-radius: 6px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); font-size: .9rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 1020px) {
  .header-inner { grid-template-columns: auto 1fr; padding: .8rem 0; }
  .site-search { grid-column: 1 / -1; grid-row: 2; }
  .header-actions { justify-self: end; }
}

@media (max-width: 760px) {
  .header-inner, .nav-row, .site-footer, .history-content { width: min(100% - 1rem, 1120px); }
  .brand small { display: none; }
  .theme-button span:last-child, .font-controls button[data-font="reset"] { display: none; }
  .header-actions button { min-width: 36px; padding: 0 .45rem; }
  .nav-row { grid-template-columns: 1fr auto; }
  .current-section { display: none; }
  .header-email { display: none; }
  .site-directory nav { grid-template-columns: 1fr; width: calc(100vw - 1rem); }
  .home-hero { min-height: 0; grid-template-columns: 1fr; padding: 2.4rem 1.2rem; }
  .hero-portrait { max-width: 310px; }
  .journey-note { grid-template-columns: 1fr; padding-inline: .5rem; }
  .journey-note img { max-height: 280px; }
  .directory-grid { grid-template-columns: 1fr; }
  .article-page { padding: 1.25rem; }
  .site-footer { grid-template-columns: 1fr; }
  .archive-note { grid-column: 1; }
}

@media (max-width: 460px) {
  .header-inner { gap: .65rem; }
  .brand { gap: .5rem; }
  .brand-mark { width: 36px; height: 36px; }
  .brand strong { font-size: .92rem; letter-spacing: .07em; }
  .language-toggle { min-width: 52px; }
  .search-field button { padding-inline: .7rem; font-size: .8rem; }
  .search-field input { font-size: .86rem; }
  .header-email { display: none; }
  .nav-row { grid-template-columns: 1fr; }
  .hero-facts { grid-template-columns: 1fr; }
  .contribution-note { grid-template-columns: 1fr; }
  .footer-contact { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .directory-grid a { transition: none; }
}

@media print {
  .site-header, .site-footer, .skip-link, .translation-note { display: none !important; }
  .history-content, .article-page { width: 100%; margin: 0; padding: 0; box-shadow: none; }
}
