/* =====================================================================
   Bryjow.pl – Dzieje Starego Sącza
   Kolory z herbu miasta: błękit pola, czerń habitu, złoto aureoli, pergamin.
   ===================================================================== */

@font-face { font-family: "Cormorant Garamond"; font-style: normal; font-weight: 600; font-display: swap;
  src: url(../fonts/cormorant-garamond-latin-ext-600-normal.woff2) format("woff2");
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Cormorant Garamond"; font-style: normal; font-weight: 600; font-display: swap;
  src: url(../fonts/cormorant-garamond-latin-600-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Cormorant Garamond"; font-style: normal; font-weight: 700; font-display: swap;
  src: url(../fonts/cormorant-garamond-latin-ext-700-normal.woff2) format("woff2");
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Cormorant Garamond"; font-style: normal; font-weight: 700; font-display: swap;
  src: url(../fonts/cormorant-garamond-latin-700-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Cormorant Garamond"; font-style: italic; font-weight: 600; font-display: swap;
  src: url(../fonts/cormorant-garamond-latin-ext-600-italic.woff2) format("woff2");
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Cormorant Garamond"; font-style: italic; font-weight: 600; font-display: swap;
  src: url(../fonts/cormorant-garamond-latin-600-italic.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Lora"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(../fonts/lora-latin-ext-400-normal.woff2) format("woff2");
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Lora"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(../fonts/lora-latin-400-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Lora"; font-style: italic; font-weight: 400; font-display: swap;
  src: url(../fonts/lora-latin-ext-400-italic.woff2) format("woff2");
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Lora"; font-style: italic; font-weight: 400; font-display: swap;
  src: url(../fonts/lora-latin-400-italic.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Lora"; font-style: normal; font-weight: 600; font-display: swap;
  src: url(../fonts/lora-latin-ext-600-normal.woff2) format("woff2");
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Lora"; font-style: normal; font-weight: 600; font-display: swap;
  src: url(../fonts/lora-latin-600-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --parchment: #f6f0e4;
  --parchment-2: #efe5d0;
  --paper: #fbf8f1;
  --ink: #2a2119;
  --ink-soft: #5e5044;
  --line: #ddd0b7;
  --navy: #1c2b45;
  --navy-2: #24375a;
  --blue: #1f5f9e;
  --gold: #a87b22;
  --gold-light: #e2bf62;
  --crimson: #8b1e2d;
  --pc: var(--blue);               /* kolor bieżącej epoki */

  --display: "Cormorant Garamond", "Garamond", "Georgia", serif;
  --serif: "Lora", "Georgia", "Times New Roman", serif;

  --radius: 6px;
  --shadow: 0 1px 2px rgba(42, 33, 25, .06), 0 6px 20px rgba(42, 33, 25, .08);
  --gutter: 16px;
  --header-h: 60px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 12px); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body {
  margin: 0;
  background: var(--parchment);
  color: var(--ink);
  font: 400 1.0625rem/1.7 var(--serif);
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--blue); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--crimson); }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 700; line-height: 1.15; margin: 0 0 .5em; color: var(--ink); letter-spacing: .005em; }
h1 { font-size: clamp(2.2rem, 7vw, 3.6rem); }
h2 { font-size: clamp(1.7rem, 5vw, 2.3rem); }
h3 { font-size: 1.4rem; }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--gold-light); outline-offset: 2px; }

.wrap { width: 100%; max-width: 72rem; margin: 0 auto; padding: 0 var(--gutter); }
.prose-wrap { max-width: 44rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--gold-light); color: var(--ink); padding: .5rem 1rem; z-index: 100; }
.skip:focus { left: 8px; top: 8px; }

/* ------------------------------------------------------------------ nagłówek */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--navy);
  color: #f3ead6;
  border-bottom: 2px solid var(--gold);
}
.header-inner { display: flex; align-items: center; gap: 1rem; min-height: var(--header-h); }
.brand { display: flex; align-items: center; gap: .6rem; color: inherit; text-decoration: none; margin-right: auto; }
.brand:hover { color: #fff; }
.brand-herb { width: 34px; height: auto; filter: drop-shadow(0 1px 1px rgba(0,0,0,.4)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name { font-family: var(--display); font-weight: 700; font-size: 1.45rem; letter-spacing: .02em; }
.brand-tld { color: var(--gold-light); }
.brand-sub { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: #cdbf9f; }

.nav-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; margin-right: -8px;
  background: none; border: 0; color: inherit; cursor: pointer;
}
.nav-toggle-bars, .nav-toggle-bars::before, .nav-toggle-bars::after {
  display: block; width: 24px; height: 2px; background: currentColor; border-radius: 1px; position: relative; transition: transform .25s, background .25s;
}
.nav-toggle-bars::before, .nav-toggle-bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle-bars::before { top: -7px; }
.nav-toggle-bars::after { top: 7px; }
.nav-open .nav-toggle-bars { background: transparent; }
.nav-open .nav-toggle-bars::before { transform: translateY(7px) rotate(45deg); }
.nav-open .nav-toggle-bars::after { transform: translateY(-7px) rotate(-45deg); }

.site-nav {
  position: fixed; inset: var(--header-h) 0 0 0;
  background: var(--navy);
  padding: 1.25rem var(--gutter) 2rem;
  overflow-y: auto;
  display: none;
  flex-direction: column; gap: 1.5rem;
}
.nav-open .site-nav { display: flex; }
.nav-list { list-style: none; margin: 0; padding: 0; }
.nav-list a {
  display: block; padding: .7rem 0; border-bottom: 1px solid rgba(226, 191, 98, .18);
  color: #f3ead6; text-decoration: none; font-family: var(--display); font-size: 1.6rem; font-weight: 600;
}
.nav-list a[aria-current] { color: var(--gold-light); }
.nav-list a:hover { color: #fff; }

.lang-switch { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.lang-switch a {
  display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .6rem; border-radius: 4px;
  color: #e6dcc4; text-decoration: none; font-size: .8rem; letter-spacing: .08em; border: 1px solid rgba(226, 191, 98, .25);
}
.lang-switch img { width: 22px; height: 15px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,.25); }
.lang-switch a[aria-current] { border-color: var(--gold-light); color: #fff; background: rgba(226, 191, 98, .12); }
.lang-switch a:hover { color: #fff; }

@media (min-width: 75em) {
  .nav-toggle { display: none; }
  .site-nav { position: static; display: flex; flex-direction: row; align-items: center; padding: 0; background: none; overflow: visible; gap: 1.25rem; }
  .nav-list { display: flex; gap: .15rem; }
  .nav-list a { border: 0; font-family: var(--serif); font-size: .92rem; font-weight: 400; padding: .45rem .6rem; border-radius: 4px; white-space: nowrap; }
  .nav-list a[aria-current] { background: rgba(226, 191, 98, .14); }
  .lang-switch a span { display: none; }
  .lang-switch a { padding: .3rem .35rem; }
}
body.nav-open { overflow: hidden; }

.notice-translation { background: #fff3cf; border-bottom: 1px solid #e8d38f; font-size: .9rem; padding: .5rem 0; color: #5a4712; }

/* ------------------------------------------------------------------ elementy wspólne */
.kicker {
  display: inline-block; font-size: .78rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--pc); font-weight: 600; margin-bottom: .6rem;
}
.page-head { padding-top: 2.5rem; padding-bottom: 1.5rem; }
.page-head .lead { font-size: 1.15rem; color: var(--ink-soft); max-width: 42rem; }
.lead { font-size: 1.15rem; line-height: 1.65; }

.ornament {
  height: 18px; margin: 2rem auto; max-width: 18rem; opacity: .7;
  background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 18'%3E%3Cg fill='none' stroke='%23a87b22' stroke-width='1.2'%3E%3Cpath d='M0 9h92M148 9h92'/%3E%3Cpath d='M120 2l7 7-7 7-7-7z' fill='%23a87b22'/%3E%3Ccircle cx='102' cy='9' r='2.5'/%3E%3Ccircle cx='138' cy='9' r='2.5'/%3E%3C/g%3E%3C/svg%3E");
}

.btn {
  display: inline-flex; align-items: center; gap: .5rem; min-height: 44px;
  padding: .65rem 1.2rem; border-radius: 999px; border: 1px solid var(--gold);
  font: 600 .95rem/1 var(--serif); text-decoration: none; cursor: pointer;
  background: var(--gold); color: #fff; transition: background .2s, color .2s, border-color .2s;
}
.btn:hover { background: #8e6719; color: #fff; }
.btn-ghost { background: transparent; color: inherit; border-color: currentColor; }
.btn-ghost:hover { background: rgba(255,255,255,.12); color: inherit; }
.btn-small { min-height: 36px; padding: .4rem .9rem; font-size: .85rem; }

.tag { display: inline-block; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; padding: .15rem .5rem; border-radius: 3px; font-family: var(--serif); font-weight: 600; vertical-align: middle; }
.tag-legend { background: #e6eef7; color: #1b4c80; }
.tag-disputed { background: #f7e3e3; color: #7e1d27; }

.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}

/* ------------------------------------------------------------------ strona główna */
.hero {
  position: relative; color: #fff; isolation: isolate;
  min-height: min(86vh, 44rem); display: flex; align-items: flex-end;
  background: var(--navy);
}
.hero-img { position: absolute; inset: 0; z-index: -2; overflow: hidden; }
.hero-img img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 45%; }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(180deg, rgba(28,43,69,.25) 0%, rgba(28,43,69,.15) 35%, rgba(20,28,44,.82) 78%, rgba(20,28,44,.95) 100%);
}
.hero-inner { padding: 6rem var(--gutter) 2.5rem; }
.hero-herb { width: 64px; margin-bottom: 1rem; filter: drop-shadow(0 2px 6px rgba(0,0,0,.5)); }
.hero .kicker { color: var(--gold-light); }
.hero h1 { color: #fff; font-size: clamp(2.6rem, 10vw, 5rem); line-height: 1; margin-bottom: .3em; text-shadow: 0 2px 12px rgba(0,0,0,.35); }
.hero-tagline { font-family: var(--display); font-style: italic; font-size: clamp(1.25rem, 4.2vw, 1.75rem); color: #f3e6c4; margin-bottom: 1.6rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; }
.hero-credit { position: absolute; right: 8px; bottom: 6px; font-size: .65rem; color: rgba(255,255,255,.6); }
.hero-credit a { color: inherit; }

.intro { padding-top: 3rem; padding-bottom: 1rem; text-align: center; }
.intro .lead { max-width: 40rem; margin: 0 auto; color: var(--ink-soft); }

.section { padding-top: 2.5rem; padding-bottom: 2.5rem; }
.section-head { margin-bottom: 1.5rem; }
.section-head p { color: var(--ink-soft); max-width: 40rem; }

/* pasek epok */
.era-strip { display: flex; height: 10px; border-radius: 5px; overflow: hidden; margin: 0 0 1.5rem; }
.era-strip span { flex: 1; background: var(--pc); }

.period-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; list-style: none; padding: 0; margin: 0; }
@media (min-width: 40em) { .period-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 64em) { .period-grid { grid-template-columns: repeat(4, 1fr); } }
.period-card {
  position: relative; display: flex; flex-direction: column; height: 100%;
  padding: 1.25rem 1.25rem 1.1rem; text-decoration: none; color: inherit;
  border-top: 5px solid var(--pc); transition: transform .2s, box-shadow .2s;
}
.period-card:hover { transform: translateY(-2px); color: inherit; box-shadow: 0 2px 4px rgba(42,33,25,.08), 0 12px 28px rgba(42,33,25,.12); }
.period-num { font-family: var(--display); font-weight: 700; font-size: 2.4rem; line-height: 1; color: var(--pc); opacity: .9; }
.period-years { font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; color: var(--pc); font-weight: 600; margin: .35rem 0 .2rem; }
.period-card h3 { font-size: 1.45rem; margin-bottom: .4rem; }
.period-card p { font-size: .93rem; color: var(--ink-soft); margin: 0; }
.period-card .arrow { margin-top: auto; padding-top: .8rem; font-size: .85rem; color: var(--pc); font-weight: 600; }

.milestones { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
@media (min-width: 48em) { .milestones { grid-template-columns: repeat(2, 1fr); } }
.milestone { display: flex; gap: 1rem; padding: 1rem 1.1rem; border-left: 4px solid var(--pc); background: var(--paper); border-radius: 0 var(--radius) var(--radius) 0; }
.milestone-date { font-family: var(--display); font-weight: 700; font-size: 1.25rem; color: var(--pc); min-width: 5.5rem; line-height: 1.2; }
.milestone strong { display: block; font-weight: 600; }
.milestone div span { font-size: .92rem; color: var(--ink-soft); }

.explore-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 40em) { .explore-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 64em) { .explore-grid { grid-template-columns: repeat(4, 1fr); } }
.explore-card { overflow: hidden; text-decoration: none; color: inherit; display: flex; flex-direction: column; }
.explore-card:hover { color: inherit; }
.explore-card img { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; transition: transform .4s; }
.explore-card:hover img { transform: scale(1.03); }
.explore-card .body { padding: 1rem 1.1rem 1.2rem; }
.explore-card h3 { margin-bottom: .3rem; }
.explore-card p { font-size: .93rem; color: var(--ink-soft); margin: 0; }

.bryjow-teaser {
  display: grid; gap: 1.25rem; align-items: center; padding: 1.75rem; margin: 1rem 0 3rem;
  background: var(--navy); color: #efe4c9; border-radius: var(--radius);
  background-image: radial-gradient(circle at 100% 0, rgba(226,191,98,.18), transparent 55%);
}
.bryjow-teaser h2 { color: #fff; margin-bottom: .4rem; }
.bryjow-teaser .kicker { color: var(--gold-light); }
.bryjow-teaser p { margin-bottom: 1rem; }
.bryjow-teaser .bowl { font-size: 3.5rem; line-height: 1; }
@media (min-width: 48em) { .bryjow-teaser { grid-template-columns: auto 1fr; padding: 2rem 2.5rem; } }

/* ------------------------------------------------------------------ rozdziały */
.chapter-hero {
  background: var(--pc); color: #fff; position: relative; overflow: hidden;
  padding: 2.5rem 0 2.25rem;
}
.chapter-hero::after {
  content: attr(data-num); position: absolute; right: -.05em; bottom: -.28em;
  font: 700 clamp(9rem, 38vw, 20rem)/1 var(--display); color: rgba(255,255,255,.09); pointer-events: none;
}
.chapter-hero .kicker { color: rgba(255,255,255,.85); }
.chapter-hero h1 { color: #fff; margin-bottom: .2em; }
.chapter-hero .years { font-family: var(--display); font-style: italic; font-size: 1.5rem; color: rgba(255,255,255,.9); margin: 0 0 1rem; }
.chapter-hero .lead { max-width: 40rem; color: rgba(255,255,255,.92); margin: 0; }
.chapter-meta { margin-top: 1rem; font-size: .85rem; color: rgba(255,255,255,.75); }

.breadcrumbs { font-size: .85rem; margin-bottom: .75rem; }
.breadcrumbs a { color: inherit; opacity: .85; }

.chapter-layout { display: grid; gap: 2rem; padding-top: 2rem; padding-bottom: 1rem; }
@media (min-width: 64em) {
  .chapter-layout { grid-template-columns: minmax(0, 44rem) 15rem; justify-content: space-between; }
  .chapter-aside { position: sticky; top: calc(var(--header-h) + 1.5rem); align-self: start; }
}
.toc { font-size: .92rem; padding: 1rem 1.1rem; border-left: 3px solid var(--pc); background: var(--paper); border-radius: 0 var(--radius) var(--radius) 0; }
.toc p { font-family: var(--display); font-weight: 700; font-size: 1.15rem; margin-bottom: .4rem; }
.toc ol { margin: 0; padding-left: 1.2rem; }
.toc li { margin: .25rem 0; }
.toc a { color: var(--ink); text-decoration: none; }
.toc a:hover { color: var(--pc); text-decoration: underline; }
.chapter-aside .btn { margin-top: 1rem; background: var(--pc); border-color: var(--pc); }

.prose { font-size: 1.08rem; }
.prose h2 { margin-top: 2.2rem; color: var(--ink); }
.prose h2::after { content: ""; display: block; width: 3rem; height: 3px; background: var(--pc); margin-top: .4rem; border-radius: 2px; }
.prose h3 { margin-top: 1.6rem; }
.prose blockquote { margin: 1.5rem 0; padding: .25rem 0 .25rem 1.25rem; border-left: 3px solid var(--gold); font-family: var(--display); font-style: italic; font-size: 1.35rem; line-height: 1.45; color: var(--ink-soft); }
.prose ul { padding-left: 1.25rem; }
.prose li { margin: .3rem 0; }
.prose em { font-style: italic; }
.dropcap::first-letter {
  float: left; font: 700 4.1em/.82 var(--display); color: var(--pc);
  margin: .06em .1em 0 0; padding: .05em .05em 0 0;
}

.box { margin: 1.75rem 0; padding: 1.1rem 1.25rem; border-radius: var(--radius); font-size: .98rem; }
.box > :last-child { margin-bottom: 0; }
.box-title { font-family: var(--display); font-weight: 700; font-size: 1.25rem; margin-bottom: .5rem; display: flex; align-items: center; gap: .5rem; }
.box-title::before { flex: 0 0 auto; font-size: 1rem; }
.box-facts { background: var(--paper); border: 1px solid var(--line); border-top: 4px solid var(--pc); box-shadow: var(--shadow); }
.box-facts .box-title::before { content: "✦"; color: var(--pc); }
.box-facts ul { list-style: none; padding: 0; margin: 0; }
.box-facts li { padding: .45rem 0; border-bottom: 1px dotted var(--line); }
.box-facts li:last-child { border: 0; }
.box-facts strong { color: var(--pc); }
.box-legend { background: #eaf0f6; border-left: 4px solid var(--blue); font-style: italic; }
.box-legend .box-title { color: #1b4c80; font-style: normal; }
.box-legend .box-title::before { content: "❦"; }
.box-dispute { background: #faf0ee; border-left: 4px dashed var(--crimson); }
.box-dispute .box-title { color: var(--crimson); }
.box-dispute .box-title::before { content: "⚖"; }
.box-sources { font-size: .86rem; background: transparent; border-top: 1px solid var(--line); border-radius: 0; padding: 1.25rem 0 0; margin-top: 2.5rem; color: var(--ink-soft); }
.box-sources ul { columns: 2 14rem; column-gap: 1.5rem; padding-left: 1rem; margin: 0; }
.box-sources li { break-inside: avoid; }

.chapter-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: .6rem; margin: 1rem 0 0; }
.chapter-photos a { display: block; border-radius: 4px; overflow: hidden; }
.chapter-photos img { aspect-ratio: 1; object-fit: cover; width: 100%; transition: transform .3s; }
.chapter-photos a:hover img { transform: scale(1.04); }

.pager { display: grid; gap: 1rem; grid-template-columns: 1fr; padding-top: 1.5rem; padding-bottom: 3rem; }
@media (min-width: 40em) { .pager { grid-template-columns: 1fr 1fr; } }
.pager a { display: block; padding: 1rem 1.2rem; text-decoration: none; color: inherit; border-left: 4px solid var(--pc); }
.pager a.next { text-align: right; border-left: 0; border-right: 4px solid var(--pc); }
.pager small { display: block; font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); }
.pager strong { font-family: var(--display); font-size: 1.35rem; color: var(--pc); }

/* ------------------------------------------------------------------ kalendarium */
.tl-controls {
  position: sticky; top: var(--header-h); z-index: 20;
  background: rgba(246, 240, 228, .96); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line); padding: .6rem 0;
}
.tl-chips { display: flex; gap: .4rem; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
.tl-chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: .4rem; min-height: 36px;
  padding: .3rem .8rem; border-radius: 999px; border: 1px solid var(--line); background: var(--paper);
  font: 400 .85rem/1 var(--serif); color: var(--ink); cursor: pointer; white-space: nowrap;
}
.chip::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--pc); }
.chip[data-period="all"]::before { background: conic-gradient(#8a5a2b 0 14%, #1f5f9e 0 28%, #8b1e2d 0 42%, #2f5d46 0 57%, #8a6700 0 71%, #4a5560 0 85%, #22717f 0); }
.chip[aria-pressed="true"] { background: var(--pc); border-color: var(--pc); color: #fff; }
.chip[data-period="all"][aria-pressed="true"] { background: var(--navy); border-color: var(--navy); }
.tl-toggle { display: flex; align-items: center; gap: .5rem; font-size: .85rem; margin-top: .45rem; color: var(--ink-soft); }
.tl-toggle input { width: 18px; height: 18px; accent-color: var(--navy); }

.timeline { position: relative; padding: 1.5rem 0 3rem; }
.timeline::before { content: ""; position: absolute; top: 0; bottom: 0; left: 15px; width: 2px; background: linear-gradient(var(--line), var(--line)); }
.tl-period { position: relative; }
.tl-period-head {
  position: relative; margin: 1.5rem 0 1rem; padding: .9rem 1rem .9rem 3rem;
  background: var(--pc); color: #fff; border-radius: var(--radius);
}
.tl-period-head::before { content: attr(data-num); position: absolute; left: 0; top: 0; bottom: 0; width: 2.3rem; display: grid; place-items: center; font: 700 1.3rem/1 var(--display); background: rgba(0,0,0,.15); border-radius: var(--radius) 0 0 var(--radius); }
.tl-period-head h2 { color: #fff; font-size: 1.55rem; margin: 0; }
.tl-period-head p { margin: .1rem 0 0; font-size: .85rem; opacity: .9; }
.tl-period-head a { color: #fff; font-size: .85rem; }
.tl-list { list-style: none; margin: 0; padding: 0; }
.tl-item { position: relative; padding: 0 0 1.25rem 2.6rem; }
.tl-item::before {
  content: ""; position: absolute; left: 9px; top: .55rem; width: 14px; height: 14px; border-radius: 50%;
  background: var(--parchment); border: 3px solid var(--pc);
}
.tl-item.is-key::before { left: 5px; top: .4rem; width: 22px; height: 22px; background: var(--pc); box-shadow: 0 0 0 4px rgba(255,255,255,.7); }
.tl-date { font-family: var(--display); font-weight: 700; font-size: 1.2rem; color: var(--pc); line-height: 1.3; }
.tl-item.is-key .tl-date { font-size: 1.45rem; }
.tl-card { padding: .7rem .95rem .8rem; margin-top: .2rem; }
.tl-item.is-key .tl-card { border-left: 4px solid var(--pc); }
.tl-card h3 { font-family: var(--serif); font-size: 1.02rem; font-weight: 600; margin: 0 0 .25rem; line-height: 1.4; }
.tl-card p { margin: 0; font-size: .95rem; color: var(--ink-soft); }
.tl-card .tl-meta { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .45rem; font-size: .82rem; }
.tl-card img { width: 100%; max-width: 22rem; aspect-ratio: 3/2; object-fit: cover; border-radius: 4px; margin: .5rem 0 .2rem; }
.tl-key-only .tl-item:not(.is-key) { display: none; }
.tl-period[hidden] { display: none; }
@media (min-width: 48em) {
  .timeline::before { left: 50%; margin-left: -1px; }
  .tl-period-head { max-width: 30rem; margin-left: auto; margin-right: auto; text-align: center; padding-left: 3rem; padding-right: 3rem; }
  .tl-item { width: 50%; padding: 0 2.25rem 1.25rem 0; text-align: right; }
  .tl-item::before { left: auto; right: -8px; }
  .tl-item.is-key::before { right: -12px; left: auto; }
  .tl-item.alt { margin-left: 50%; padding: 0 0 1.25rem 2.25rem; text-align: left; }
  .tl-item.alt::before { right: auto; left: -8px; }
  .tl-item.alt.is-key::before { left: -12px; }
  .tl-item:not(.alt) .tl-card { text-align: left; }
  .tl-item:not(.alt).is-key .tl-card { border-left: 0; border-right: 4px solid var(--pc); }
  .tl-item:not(.alt) .tl-card img { margin-left: auto; }
}
@media (prefers-reduced-motion: no-preference) {
  .reveal { opacity: 0; transform: translateY(14px); transition: opacity .5s ease, transform .5s ease; }
  .reveal.in { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------------ zabytki i mapa */
.map-wrap { position: relative; margin: 0 0 1rem; }
#map { height: 62vh; min-height: 320px; max-height: 560px; border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow); background: #e8e2d4; z-index: 1; }
.map-legend { display: flex; flex-wrap: wrap; gap: .35rem .9rem; font-size: .82rem; color: var(--ink-soft); margin: .6rem 0 0; padding: 0; list-style: none; }
.map-legend li { display: inline-flex; align-items: center; gap: .35rem; }
.map-legend li::before { content: ""; width: 11px; height: 11px; border-radius: 50%; background: var(--pc); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--pc); }
.map-pin {
  width: 26px; height: 26px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  background: var(--pc); border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35);
}
.map-pin span { display: block; transform: rotate(45deg); color: #fff; font: 700 12px/22px var(--serif); text-align: center; }
.leaflet-popup-content { font-family: var(--serif); font-size: .9rem; margin: .8rem 1rem; }
.leaflet-popup-content h3 { font-size: 1.15rem; margin: 0 0 .2rem; }
.leaflet-popup-content p { margin: 0 0 .4rem; }
.leaflet-container a.popup-link { color: var(--blue); font-weight: 600; }
.leaflet-container { font-family: var(--serif); }

.mon-list { display: grid; gap: 1.25rem; grid-template-columns: 1fr; margin: 1.5rem 0 3rem; padding: 0; list-style: none; }
@media (min-width: 48em) { .mon-list { grid-template-columns: 1fr 1fr; } }
@media (min-width: 72em) { .mon-list { grid-template-columns: repeat(3, 1fr); } }
.mon { overflow: hidden; display: flex; flex-direction: column; border-top: 4px solid var(--pc); scroll-margin-top: calc(var(--header-h) + 12px); }
.mon:target { box-shadow: 0 0 0 3px var(--gold-light), var(--shadow); }
.mon figure { margin: 0; position: relative; }
.mon figure img { aspect-ratio: 16/10; object-fit: cover; width: 100%; }
.mon figcaption { position: absolute; right: 0; bottom: 0; font-size: .62rem; background: rgba(0,0,0,.45); color: #eee; padding: .1rem .4rem; }
.mon figcaption a { color: inherit; }
.mon .body { padding: 1rem 1.1rem 1.1rem; display: flex; flex-direction: column; flex: 1; }
.mon .mon-period { font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--pc); font-weight: 600; }
.mon h2 { font-size: 1.5rem; margin: .2rem 0 .2rem; }
.mon .addr { font-size: .85rem; color: var(--ink-soft); margin: 0 0 .5rem; }
.mon .dates { font-size: .85rem; background: var(--parchment-2); border-radius: 4px; padding: .35rem .6rem; margin-bottom: .7rem; }
.mon .text p { font-size: .95rem; }
.mon details { margin: .2rem 0 .8rem; font-size: .9rem; }
.mon summary { cursor: pointer; color: var(--pc); font-weight: 600; padding: .3rem 0; }
.mon details ul { padding-left: 1.1rem; margin: .3rem 0; }
.mon .src { font-size: .78rem; color: var(--ink-soft); }
.mon .actions { margin-top: auto; padding-top: .5rem; }
.mon .actions .btn { background: var(--pc); border-color: var(--pc); }

/* ------------------------------------------------------------------ rządcy */
.rulers-intro { max-width: 44rem; }
.ruler-group { margin: 2rem 0; }
.ruler-group-head { border-left: 5px solid var(--pc); padding: .2rem 0 .2rem 1rem; margin-bottom: 1rem; }
.ruler-group-head h2 { margin: 0; }
.ruler-group-head .yrs { font-family: var(--display); font-style: italic; font-size: 1.2rem; color: var(--pc); }
.ruler-group-head p { color: var(--ink-soft); margin: .4rem 0 0; max-width: 44rem; font-size: .97rem; }
.ruler-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
@media (min-width: 48em) { .ruler-list { grid-template-columns: 1fr 1fr; } }
.ruler { display: grid; grid-template-columns: 7.5rem 1fr; gap: .2rem 1rem; padding: .85rem 1rem; }
.ruler-years { font-family: var(--display); font-weight: 700; font-size: 1.1rem; color: var(--pc); line-height: 1.25; }
.ruler-name { font-weight: 600; }
.ruler-role { display: block; font-size: .85rem; color: var(--ink-soft); font-style: italic; }
.ruler-note { font-size: .88rem; margin: .3rem 0 0; }
.ruler-src { font-size: .75rem; }
.ruler-gap { margin-top: .75rem; padding: .8rem 1rem; border: 1px dashed #b9a988; border-radius: var(--radius); font-size: .9rem; color: var(--ink-soft); background: repeating-linear-gradient(-45deg, transparent 0 8px, rgba(168,123,34,.05) 8px 16px); }
.ruler-gap strong { color: var(--crimson); }
@media (max-width: 30em) { .ruler { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------ postacie */
.people-grid { display: grid; gap: 1.1rem; grid-template-columns: 1fr; margin: 1.5rem 0 3rem; padding: 0; list-style: none; }
@media (min-width: 48em) { .people-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 72em) { .people-grid { grid-template-columns: repeat(3, 1fr); } }
.person { padding: 1.2rem 1.25rem; border-top: 4px solid var(--pc); display: flex; flex-direction: column; scroll-margin-top: calc(var(--header-h) + 12px); }
.person-mono { width: 3rem; height: 3rem; border-radius: 50%; background: var(--pc); color: #fff; display: grid; place-items: center; font: 700 1.35rem/1 var(--display); margin-bottom: .7rem; }
.person h2 { font-size: 1.45rem; margin: 0 0 .15rem; }
.person .role { font-style: italic; color: var(--pc); font-size: .92rem; margin: 0 0 .25rem; }
.person .life { font-size: .82rem; color: var(--ink-soft); margin: 0 0 .7rem; }
.person p.text { font-size: .95rem; }
.person .src { font-size: .78rem; color: var(--ink-soft); margin-top: auto; }

/* ------------------------------------------------------------------ galeria */
.gal-filter { margin: 0 0 1.25rem; }
.gallery { columns: 2 10rem; column-gap: .75rem; margin: 0 0 3rem; padding: 0; list-style: none; }
@media (min-width: 48em) { .gallery { columns: 3 14rem; column-gap: 1rem; } }
.gallery li { break-inside: avoid; margin: 0 0 .75rem; }
@media (min-width: 48em) { .gallery li { margin-bottom: 1rem; } }
.gallery li[hidden] { display: none; }
.gallery figure { margin: 0; background: var(--paper); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); border-bottom: 3px solid var(--pc); }
.gallery button { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.gallery img { width: 100%; }
.gallery figcaption { padding: .55rem .7rem .65rem; font-size: .85rem; line-height: 1.45; }
.gallery .yr { font-family: var(--display); font-weight: 700; color: var(--pc); font-size: 1rem; }
.gallery .cr { display: block; font-size: .72rem; color: var(--ink-soft); margin-top: .2rem; }

.lightbox { position: fixed; inset: 0; z-index: 200; background: rgba(15, 18, 26, .94); display: none; flex-direction: column; color: #eee; }
.lightbox.open { display: flex; }
.lightbox-stage { flex: 1; display: flex; align-items: center; justify-content: center; padding: 3.5rem .5rem .5rem; min-height: 0; }
.lightbox-stage img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox-cap { padding: .75rem var(--gutter) 1.25rem; font-size: .9rem; max-width: 50rem; margin: 0 auto; text-align: center; }
.lightbox-cap a { color: var(--gold-light); }
.lightbox-cap .cr { display: block; font-size: .78rem; opacity: .8; margin-top: .25rem; }
.lb-btn { position: absolute; background: rgba(255,255,255,.1); color: #fff; border: 0; width: 44px; height: 44px; border-radius: 50%; font-size: 1.4rem; cursor: pointer; }
.lb-btn:hover { background: rgba(255,255,255,.22); }
.lb-close { top: 8px; right: 8px; }
.lb-prev { left: 8px; top: 50%; }
.lb-next { right: 8px; top: 50%; }

/* ------------------------------------------------------------------ strony tekstowe */
.page-body { padding-bottom: 3rem; }
.page-body.prose h2:first-child { margin-top: 0; }

/* ------------------------------------------------------------------ stopka */
.site-footer { background: var(--navy); color: #d9cdb1; font-size: .92rem; border-top: 3px solid var(--gold); margin-top: 2rem; }
.site-footer a { color: #efe4c9; text-decoration: none; }
.site-footer a:hover { color: var(--gold-light); text-decoration: underline; }
.footer-grid { display: grid; gap: 2rem; padding-top: 2.5rem; padding-bottom: 1.5rem; }
@media (min-width: 48em) { .footer-grid { grid-template-columns: 1.3fr 1fr; } }
.footer-about { display: flex; gap: 1rem; align-items: flex-start; }
.footer-about img { width: 56px; flex: 0 0 auto; }
.footer-brand { font-family: var(--display); font-size: 1.6rem; font-weight: 700; color: #fff; margin: 0; line-height: 1.1; }
.footer-tag { font-style: italic; color: var(--gold-light); margin: 0 0 .6rem; }
.footer-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.footer-nav ul { list-style: none; padding: 0; margin: 0; }
.footer-nav li { margin: .3rem 0; }
.footer-legal { border-top: 1px solid rgba(226,191,98,.2); padding-top: 1rem; padding-bottom: 1.5rem; font-size: .78rem; color: #b5a888; display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; }
.footer-legal p { margin: 0; }

/* ------------------------------------------------------------------ 404 */
.notfound { text-align: center; padding-top: 4rem; padding-bottom: 4rem; }
.notfound .big { font: 700 6rem/1 var(--display); color: var(--gold); }

@media print {
  .site-header, .site-footer, .tl-controls, .chapter-aside, .pager, .nav-toggle { display: none !important; }
  body { background: #fff; }
}

/* poprawki układu */
.chapter-aside { order: -1; }
@media (min-width: 64em) { .chapter-aside { order: 0; grid-column: 2; grid-row: 1; } .chapter-layout > article { grid-column: 1; grid-row: 1; } }
.ico { width: 1em; height: 1em; vertical-align: -.15em; display: inline-block; fill: currentColor; }

/* filtry epok: na szerszych ekranach wszystkie widoczne (kilka rzędów), bez przewijania */
@media (min-width: 48em) {
  .tl-chips { flex-wrap: wrap; overflow: visible; }
}
.tl-chips.is-dragging { cursor: grabbing; user-select: none; }
.tl-chips.is-dragging .chip { pointer-events: none; }

/* cyrylica (wersja ukraińska) – pobierana tylko, gdy strona zawiera znaki cyrylicy */
@font-face { font-family: "Cormorant Garamond"; font-style: normal; font-weight: 600; font-display: swap;
  src: url(../fonts/cormorant-garamond-cyrillic-600-normal.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Cormorant Garamond"; font-style: normal; font-weight: 700; font-display: swap;
  src: url(../fonts/cormorant-garamond-cyrillic-700-normal.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Cormorant Garamond"; font-style: italic; font-weight: 600; font-display: swap;
  src: url(../fonts/cormorant-garamond-cyrillic-600-italic.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Lora"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(../fonts/lora-cyrillic-400-normal.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Lora"; font-style: italic; font-weight: 400; font-display: swap;
  src: url(../fonts/lora-cyrillic-400-italic.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Lora"; font-style: normal; font-weight: 600; font-display: swap;
  src: url(../fonts/lora-cyrillic-600-normal.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }

/* przełącznik języków: na telefonie przyciski w menu, na komputerze rozwijana lista */
.lang-current { display: none; }
.lang-name { display: none; }
@media (min-width: 75em) {
  .lang-wrap { position: relative; }
  .lang-current {
    display: inline-flex; align-items: center; gap: .4rem; min-height: 36px; padding: .3rem .6rem;
    background: none; color: #e6dcc4; border: 1px solid rgba(226, 191, 98, .35); border-radius: 4px;
    font: 400 .8rem/1 var(--serif); letter-spacing: .08em; cursor: pointer;
  }
  .lang-current:hover, .lang-wrap.open .lang-current { color: #fff; border-color: var(--gold-light); }
  .lang-current img { width: 22px; height: 15px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,.25); }
  .lang-current .caret { font-size: .7rem; opacity: .8; }
  .lang-wrap .lang-switch {
    display: none; position: absolute; right: 0; top: calc(100% + 8px); z-index: 60;
    flex-direction: column; gap: 2px; min-width: 12.5rem; padding: .4rem;
    background: var(--navy-2); border: 1px solid rgba(226, 191, 98, .3); border-radius: 6px; box-shadow: 0 10px 30px rgba(0,0,0,.35);
  }
  .lang-wrap.open .lang-switch { display: flex; }
  .lang-wrap .lang-switch a { display: flex; width: 100%; padding: .45rem .6rem; border: 0; gap: .6rem; font-size: .9rem; letter-spacing: 0; }
  .lang-wrap .lang-switch a:hover { background: rgba(255,255,255,.08); }
  .lang-wrap .lang-switch a[aria-current] { background: rgba(226, 191, 98, .16); }
  .lang-wrap .lang-switch .lang-code { display: none !important; }
  .lang-wrap .lang-switch .lang-name { display: inline; }
}

/* herb w nagłówku nie może się zwężać (Safari potrafi ścisnąć obrazek w układzie flex do zera) */
.brand-herb, .footer-about img, .hero-herb { flex-shrink: 0; height: auto; }
.brand { min-width: 0; }
.brand-text { min-width: 0; }
