/* brodzikowski.dk: biała karta, czerń, rubryka (cynober) i złoto jak w średniowiecznym rękopisie */
/* tytuły: Cinzel Decorative — rzymskie kapitaliki z ozdobnikami, czytelne i z polskimi znakami */
@font-face { font-family: "Cinzel Decorative"; font-weight: 400; font-display: swap; src: url(/fonts/cinzel-decorative-400-latin.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: "Cinzel Decorative"; font-weight: 400; font-display: swap; src: url(/fonts/cinzel-decorative-400-latin-ext.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Cinzel Decorative"; font-weight: 700; font-display: swap; src: url(/fonts/cinzel-decorative-700-latin.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: "Cinzel Decorative"; font-weight: 700; font-display: swap; src: url(/fonts/cinzel-decorative-700-latin-ext.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Cinzel Decorative"; font-weight: 900; font-display: swap; src: url(/fonts/cinzel-decorative-900-latin.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: "Cinzel Decorative"; font-weight: 900; font-display: swap; src: url(/fonts/cinzel-decorative-900-latin-ext.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "EB Garamond"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(/fonts/eb-garamond-latin.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: "EB Garamond"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(/fonts/eb-garamond-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "EB Garamond"; font-style: italic; font-weight: 400 700; font-display: swap;
  src: url(/fonts/eb-garamond-italic-latin.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: "EB Garamond"; font-style: italic; font-weight: 400 700; font-display: swap;
  src: url(/fonts/eb-garamond-italic-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --ink: #1c1915;
  --muted: #6a6257;
  --rubric: #a3221b;
  --gold: #a8811f;
  --gold-bright: #d8b048;
  --gold-soft: #f1e6c4;
  --line: #d9cfb8;
  --spouse: #faf6ec;
  --shadow: 0 1px 2px rgba(40, 30, 10, .06), 0 3px 10px rgba(40, 30, 10, .05);
  --serif: "EB Garamond", "Iowan Old Style", Palatino, Georgia, serif;
  --display: "Cinzel Decorative", "EB Garamond", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 20px/1.6 var(--serif);
}
a { color: inherit; text-decoration-color: var(--gold); text-underline-offset: .18em; }
a:hover { color: var(--gold); }
h1, h2 { font-weight: 400; line-height: 1.15; }
h1 { font-family: var(--display); font-weight: 700; font-size: clamp(2rem, 5vw, 3rem); letter-spacing: .02em; margin: 0 0 .4rem; }
h1::first-letter { color: var(--rubric); }
h2 { font-weight: 600; font-size: 1.5rem; margin: 2.2rem 0 .6rem; color: var(--rubric); font-variant: small-caps; letter-spacing: .03em; }

/* nagłówek */
.site-header {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .6rem 1.5rem;
  padding: .9rem clamp(16px, 4vw, 48px);
  border-bottom: 3px double var(--gold);
  background: var(--surface);
}
.brand { display: flex; align-items: center; gap: .75rem; text-decoration: none; }
.brand img { display: block; width: 44px; height: auto; }
.brand-name { display: flex; align-items: center; font-family: var(--display); font-weight: 700; font-size: 1.55rem; line-height: 1; color: var(--ink); letter-spacing: .02em; }
.brand-name .initial-svg { width: 2.15em; height: 2.15em; margin-right: .08em; flex: none; }
.brand:hover .brand-name { color: var(--ink); }
.site-header nav { display: flex; flex-wrap: wrap; gap: .2rem 1.1rem; font: 15px/1.4 var(--sans); }
.site-header nav a { text-decoration: none; padding: .25rem 0; border-bottom: 2px solid transparent; }
.site-header nav a[aria-current="page"] { border-bottom-color: var(--rubric); }
.site-header nav .lang { color: var(--muted); }

main { max-width: 1100px; margin: 0 auto; padding: clamp(24px, 5vw, 56px) clamp(16px, 4vw, 48px); }

/* strona główna: karta tytułowa rękopisu */
.title-page {
  max-width: 820px; margin: 0 auto; text-align: center;
  padding: clamp(28px, 5vw, 56px) clamp(8px, 3vw, 40px);
  border-top: 3px double var(--gold); border-bottom: 3px double var(--gold);
}
.incipit {
  display: flex; align-items: center; justify-content: center; gap: .2em;
  margin: 0; font-family: var(--display); font-weight: 700; text-align: left;
  font-size: clamp(2rem, 6.4vw, 4.1rem); line-height: 1.08; letter-spacing: .015em;
}
.incipit::first-letter { color: inherit; }
.incipit .initial-svg { flex: none; width: 2.55em; height: 2.55em; }
.incipit-rest { display: flex; flex-direction: column; }
.incipit-rest .l1 { color: var(--ink); }
.incipit-rest .l2 { color: var(--ink); }
.initial-svg { display: block; overflow: visible; }
.rubric-line {
  font-family: var(--display); font-weight: 700; color: var(--rubric); letter-spacing: .04em;
  font-size: clamp(1.4rem, 3.6vw, 2.2rem); margin: 1rem 0 0;
}
.fleuron { color: var(--gold); font-size: 2.2rem; line-height: 1; margin: 1.2rem 0 .4rem; letter-spacing: .6em; }
.title-page .lead { margin: .4rem auto 0; font-style: italic; }
.lead { font-size: 1.2rem; color: var(--muted); max-width: 38em; }
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .7rem; margin-top: 1.8rem; }
.btn {
  display: inline-block; padding: .65rem 1.2rem; border-radius: 6px;
  background: var(--ink); color: var(--bg); text-decoration: none; font: 600 18px/1.2 var(--serif); letter-spacing: .02em;
}
.btn:hover { background: var(--rubric); color: #fff; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn.ghost:hover { box-shadow: inset 0 0 0 1px var(--rubric); color: var(--rubric); }

.facts {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
  margin: clamp(32px, 6vw, 64px) 0 0; background: var(--line);
  border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
}
.facts div { background: var(--surface); padding: 1.1rem 1.2rem; }
.facts strong { display: block; font-family: var(--display); font-weight: 700; font-size: 2.2rem; line-height: 1.1; color: var(--rubric); }
.facts span { font: 14px/1.4 var(--sans); color: var(--muted); }

.prose { max-width: 44em; }
.prose ul { padding-left: 1.2em; }
.prose li { margin: .25rem 0; }
.note, .sources { font-size: .95rem; color: var(--muted); }
.sources { margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }

.branches {
  list-style: none; padding: 0 !important; margin: 1.5rem 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .8rem;
}
.branches a {
  display: flex; flex-direction: column; height: 100%;
  padding: .9rem 1rem; border-radius: 8px; text-decoration: none;
  background: var(--surface); box-shadow: var(--shadow); border: 1px solid var(--line); border-top: 3px solid var(--rubric);
}
.branches a:hover { color: inherit; outline: 1px solid var(--gold); }
.branch-name { font-weight: 600; font-size: 1.1rem; }
.branch-maiden, .branch-years { font-size: .92rem; color: var(--muted); }
.branch-count { margin-top: auto; padding-top: .5rem; font: 13px/1.3 var(--sans); color: var(--rubric); }

/* strona herbu */
.arms-page { display: grid; grid-template-columns: minmax(180px, 300px) 1fr; gap: clamp(24px, 5vw, 64px); align-items: start; }
.arms-figure { margin: 0; position: sticky; top: 24px; text-align: center; }
.arms-figure img { width: 100%; height: auto; }
.arms-figure figcaption { font-style: italic; color: var(--muted); margin-top: .4rem; }
.arms-page h1 { margin-top: 0; }

/* drzewo */
.page-head { margin-bottom: 1.5rem; }
.tree-tools {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .8rem 1.5rem;
  padding: .7rem 0 1rem; border-bottom: 1px solid var(--line); margin-bottom: 1.5rem;
  font: 14px/1.4 var(--sans); color: var(--muted);
}
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; margin: 0; padding: 0; }
.legend li { display: flex; align-items: center; gap: .45rem; }
.swatch { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }
.swatch.blood { background: var(--surface); border-left: 4px solid var(--gold); box-shadow: inset 0 0 0 1px var(--line); }
.swatch.spouse { background: var(--spouse); box-shadow: inset 0 0 0 1px var(--line); }
.toggles { display: flex; gap: .5rem; }
.toggles button {
  font: inherit; color: var(--ink); background: var(--surface); cursor: pointer;
  border: 1px solid var(--line); border-radius: 6px; padding: .35rem .75rem;
}
.toggles button:hover { border-color: var(--gold); }

.tree-wrap { overflow-x: auto; padding-bottom: 1rem; }
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { margin-left: 1.1rem; }
.tree li { position: relative; padding: .35rem 0 .35rem 1.6rem; }
.tree > li { padding-left: 0; }
.tree ul > li::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; border-left: 1.5px solid var(--line);
}
.tree ul > li:last-child::before { bottom: auto; height: 1.75rem; }
.tree ul > li::after {
  content: ""; position: absolute; left: 0; top: 1.75rem; width: 1.3rem; border-top: 1.5px solid var(--line);
}
.tree summary { list-style: none; cursor: pointer; display: block; }
.tree summary::-webkit-details-marker { display: none; }
.tree details:not([open]) > summary .couple { box-shadow: var(--shadow), 4px 4px 0 -1px var(--surface), 4px 4px 0 0 var(--line); }
.tree li:target > .couple, .tree li:target > details > summary .couple { outline: 2px solid var(--gold); outline-offset: 2px; }

.couple {
  display: inline-flex; flex-wrap: wrap; align-items: stretch; gap: .4rem;
  position: relative; background: var(--surface); border-radius: 8px; box-shadow: var(--shadow);
  border: 1px solid var(--line); padding: .45rem; max-width: 100%;
}
.couple .gen { align-self: center; margin: 0 .15rem 0 .25rem; }
.gen {
  display: inline-grid; place-items: center; min-width: 1.7rem; height: 1.7rem; padding: 0 .3rem;
  border-radius: 999px; background: var(--gold-soft); color: var(--ink);
  font: 600 11px/1 var(--sans); letter-spacing: .03em;
}
.person {
  display: flex; flex-direction: column; justify-content: center;
  padding: .35rem .7rem; border-radius: 5px; min-width: 9rem;
}
.person.is-blood { border-left: 4px solid var(--gold); }
.person.is-spouse { background: var(--spouse); }
.person .name { font-weight: 600; line-height: 1.3; }
.person .maiden { font-weight: 400; font-style: italic; color: var(--muted); }
.person .name { font-size: 1.08rem; }
.person .life, .person .burial, .person .in-law { font: 13px/1.45 var(--sans); color: var(--muted); }
.person .in-law { margin-top: .2rem; max-width: 26rem; }
.person .unknown { font-weight: 400; font-style: italic; color: var(--muted); }
.spouse { display: flex; align-items: center; gap: .35rem; }
.spouse .ring { color: var(--gold); font-size: 1.1rem; }
.spouse .marr { font: 12px/1 var(--sans); color: var(--muted); }

/* stopka */
.site-footer {
  border-top: 3px double var(--gold); background: var(--surface);
  padding: 1.5rem clamp(16px, 4vw, 48px); font: 13px/1.6 var(--sans); color: var(--muted);
}
.site-footer p { margin: .2rem 0; max-width: 1100px; }

@media (max-width: 720px) {
  body { font-size: 17px; }
  .brand-name { font-size: 1.25rem; }
  .incipit { font-size: 1.6rem; gap: .25em; }
  .title-page { padding-inline: 0; }
  .brand img { width: 36px; }
  .facts { grid-template-columns: 1fr; }
  .arms-page { grid-template-columns: 1fr; }
  .arms-figure { position: static; max-width: 200px; margin: 0 auto; }
  .tree ul { margin-left: .4rem; }
  .tree li { padding-left: 1.1rem; }
  .tree ul > li::after { width: .9rem; }
  .couple { display: flex; padding-top: .7rem; }
  .couple .gen { position: absolute; top: -.6rem; left: -.6rem; margin: 0; min-width: 1.45rem; height: 1.45rem; font-size: 10px; }
  .person { min-width: 0; }
  .spouse { flex-basis: 100%; }
}

/* rodowód: kula z imionami */
.page-pedigree main { max-width: none; padding: 0; }
.page-pedigree .site-footer { display: none; }
.pedigree { position: relative; }
.sphere-stage {
  position: relative; overflow: hidden; overflow: clip; touch-action: none; user-select: none; -webkit-user-select: none;
  height: calc(100svh - 92px); min-height: 460px;
  background: radial-gradient(ellipse at 50% 50%, #fff 0%, #fff 55%, #faf7f0 100%);
}
.stage-title {
  position: absolute; top: 14px; left: clamp(16px, 4vw, 48px); z-index: 2000; margin: 0;
  font-size: clamp(2rem, 4vw, 2.8rem); pointer-events: none;
}
.arcs { position: absolute; inset: 0; }
.nodes { position: absolute; inset: 0; }
.node {
  position: absolute; left: 0; top: 0; transform-origin: 50% 50%;
  display: flex; flex-direction: column; align-items: center;
  padding: .2rem .55rem; border: 0; border-radius: 8px; background: transparent;
  font: 500 22px/1.12 var(--serif); color: var(--ink); text-align: center; white-space: nowrap;
  cursor: pointer; will-change: transform, opacity; opacity: 0;
  text-shadow: 0 0 6px #fff, 0 0 3px #fff;
}
.node .g { font-weight: 600; }
.node .s { font-size: .74em; letter-spacing: .02em; color: var(--muted); }
.node .unknown { font-style: italic; font-weight: 400; }
.node.is-deceased .g::after { content: " †"; font-weight: 400; font-size: .7em; color: var(--muted); }
.node.is-close .g { color: var(--rubric); }
.node.is-focus { background: rgba(255,255,255,.7); box-shadow: 0 0 0 1px var(--gold-soft), 0 6px 24px rgba(168,129,31,.18); }
.node.is-focus .g { color: var(--rubric); }
.node.is-focus .s { color: var(--ink); }
.node:hover .g, .node:focus-visible .g { text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: .15em; }
.node:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.tip, .bubble {
  background: rgba(255, 255, 255, .58);
  -webkit-backdrop-filter: blur(9px) saturate(1.15); backdrop-filter: blur(9px) saturate(1.15);
  border: 1px solid rgba(168, 129, 31, .35);
  box-shadow: 0 10px 34px rgba(40, 30, 10, .14);
}
.tip {
  position: absolute; left: 0; top: 0; z-index: 3000; pointer-events: none;
  max-width: 260px; padding: .45rem .7rem; border-radius: 10px;
  font: 15px/1.35 var(--serif); display: flex; flex-direction: column;
}
.tip em { color: var(--muted); }
.tip-years { font: 13px/1.4 var(--sans); color: var(--muted); }
.tip-rel { font-style: italic; color: var(--rubric); }

.bubble {
  position: absolute; z-index: 3500;
  top: 50%; left: calc(50% + 120px); transform: translateY(-50%) scale(.96); opacity: 0;
  width: min(380px, calc(100% - 50% - 140px)); min-width: 280px; max-height: calc(100% - 40px); overflow: auto;
  padding: 1.1rem 1.25rem 1rem; border-radius: 22px;
  transition: opacity .35s ease, transform .35s ease;
}
.bubble.is-open { opacity: 1; transform: translateY(-50%) scale(1); }
.bubble::before {
  content: ""; position: absolute; left: -9px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%) rotate(45deg);
  background: inherit; border-left: 1px solid rgba(168,129,31,.35); border-bottom: 1px solid rgba(168,129,31,.35);
}
.b-close {
  position: absolute; top: .4rem; right: .6rem; border: 0; background: none; cursor: pointer;
  font-size: 1.6rem; line-height: 1; color: var(--muted);
}
.b-close:hover { color: var(--rubric); }
.b-name { margin: 0 1.6rem .1rem 0; font: 600 1.4rem/1.2 var(--serif); color: var(--ink); font-variant: normal; letter-spacing: 0; }
.b-maiden { margin: 0; font-style: italic; color: var(--muted); }
.b-rel { margin: .2rem 0 0; font-style: italic; color: var(--rubric); }
.b-rows { margin-top: .7rem; display: grid; gap: .45rem; font-size: 1rem; }
.b-row { display: grid; grid-template-columns: 7.5rem 1fr; gap: .6rem; line-height: 1.35; }
.b-label { font: 12px/1.6 var(--sans); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.b-private { margin: 0; font: 13px/1.4 var(--sans); color: var(--muted); }
.b-muted { color: var(--muted); font-size: .9em; }
.b-link {
  border: 0; background: none; padding: 0; cursor: pointer; font: inherit; color: var(--ink);
  text-decoration: underline; text-decoration-color: var(--gold-soft); text-underline-offset: .15em; text-align: left;
}
.b-link:hover { color: var(--rubric); text-decoration-color: var(--rubric); }

.home-btn {
  position: absolute; z-index: 2500; top: 20px; right: clamp(16px, 4vw, 48px);
  border: 1px solid var(--line); background: rgba(255,255,255,.75); border-radius: 999px;
  padding: .45rem .95rem; font: 600 16px/1.2 var(--serif); color: var(--ink); cursor: pointer;
}
.home-btn:hover { border-color: var(--rubric); color: var(--rubric); }
.hint {
  position: absolute; z-index: 2000; left: 50%; bottom: 14px; transform: translateX(-50%);
  width: min(640px, calc(100% - 32px)); margin: 0; text-align: center;
  font: 14px/1.45 var(--sans); color: var(--muted); pointer-events: none; transition: opacity .8s ease;
}
.hint.is-faded { opacity: 0; }
.hint-touch { display: none; }
@media (hover: none) { .hint-mouse { display: none; } .hint-touch { display: inline; } }
.noscript { position: absolute; inset: 40% 16px auto; text-align: center; }

@media (max-width: 720px) {
  .sphere-stage { height: calc(100svh - 160px); }
  .hint { bottom: 8px; font-size: 13px; }
  .node { font-size: 19px; }
  .bubble, .bubble.is-open {
    top: auto; bottom: 12px; left: 12px; right: 12px; width: auto; min-width: 0; max-height: 58%;
    transform: none;
  }
  .bubble { transform: translateY(12px); }
  .bubble.is-open { transform: none; }
  .bubble::before { display: none; }
  .b-row { grid-template-columns: 6rem 1fr; }
  .home-btn { top: auto; bottom: 14px; right: 50%; transform: translateX(50%); }
}
@media (prefers-reduced-motion: reduce) { .bubble, .hint { transition: none; } }
.tip[hidden], .bubble[hidden], .home-btn[hidden] { display: none; }

/* --- funkcje jak na fo-to.dk --- */
/* przenikanie między stronami (js/page-transition.js): przy wyjściu ekran miękko bieleje;
   przy wejściu treść widać od razu (nic nie zasłania strony, gdy animacja nie ruszy) */
.page-fade-overlay {
  position: fixed; inset: 0; z-index: 10000; background: #fff; pointer-events: none;
  opacity: 0; transition: opacity .28s ease-in;
}
.page-fade-overlay.is-leaving { opacity: 1; }
main { animation: page-in .45s ease-out both; }
@keyframes page-in { from { transform: translateY(6px); } to { transform: none; } }

/* przycisk „do góry” (js/back-to-top.js) */
.back-to-top {
  position: fixed; right: 18px; bottom: 18px; z-index: 900;
  width: 46px; height: 46px; border-radius: 50%;
  border: 1px solid var(--gold); background: rgba(255,255,255,.9); color: var(--rubric);
  font: 600 22px/1 var(--serif); cursor: pointer; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity .3s ease, transform .3s ease; transform: translateY(8px);
}
.back-to-top.visible { opacity: 1; pointer-events: auto; transform: none; }
.back-to-top:hover { background: var(--rubric); color: #fff; border-color: var(--rubric); }

/* wtapianie sekcji (js/scroll-reveal.js) */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .7s ease, transform .7s ease; }
.reveal.reveal-visible { opacity: 1; transform: none; }

/* ochrona obrazków (js/image-protect.js) — długie przytrzymanie na iOS */
img { -webkit-touch-callout: none; -webkit-user-drag: none; }

/* słaby sprzęt (js/perf-detect.js) */
.low-perf .tip, .low-perf .bubble { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(255,255,255,.94); }

/* menu mobilne (js/mobile-nav.js) */
.nav-toggle { display: none; }
@media (max-width: 720px) {
  .site-header { position: relative; flex-wrap: nowrap; }
  .nav-toggle {
    display: inline-flex; flex-direction: column; justify-content: center; gap: 5px;
    width: 44px; height: 44px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px;
    background: #fff; cursor: pointer;
  }
  .nav-toggle span { display: block; height: 2px; background: var(--ink); border-radius: 2px; transition: transform .25s ease, opacity .25s ease; }
  .nav-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
  .nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .site-header nav {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 5000;
    flex-direction: column; gap: 0; padding: .4rem 16px .8rem;
    background: #fff; border-bottom: 3px double var(--gold); box-shadow: 0 12px 24px rgba(40,30,10,.08);
    font-size: 18px;
    visibility: hidden; opacity: 0; transform: translateY(-6px); transition: opacity .2s ease, transform .2s ease, visibility 0s .2s;
  }
  .nav-open nav { visibility: visible; opacity: 1; transform: none; transition: opacity .2s ease, transform .2s ease; }
  .site-header nav a { padding: .7rem 0; border-bottom: 1px solid var(--line); }
  .site-header nav a:last-child { border-bottom: 0; }
  .site-header nav a[aria-current="page"] { color: var(--rubric); border-bottom-color: var(--line); }
  .sphere-stage { height: calc(100svh - 76px); }
}
@media (prefers-reduced-motion: reduce) {
  .page-fade-overlay { transition: none; }
  main { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .back-to-top { transition: none; }
}

/* widok publiczny / rodzinny */
.family-banner {
  margin: 1rem 0 0; padding: .6rem .9rem; border-radius: 8px;
  background: #faf6ec; border: 1px solid var(--line);
  font: 14px/1.5 var(--sans); color: var(--muted);
}
.family-banner a { color: var(--rubric); font-weight: 600; white-space: nowrap; }
.family-banner.is-family { background: #fbf1ef; border-color: #e7c4bf; color: var(--ink); }
.stage-banner { position: absolute; z-index: 2400; left: clamp(16px, 4vw, 48px); top: 74px; max-width: min(520px, calc(100% - 32px)); pointer-events: auto; }
.stage-banner .family-banner { margin: 0; background: rgba(255,255,255,.82); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); font-size: 13px; }
@media (max-width: 720px) {
  .stage-banner { top: 62px; right: 16px; }
  .stage-banner .family-banner { font-size: 12px; padding: .45rem .7rem; }
}

/* anonimowe osoby i strona zgody */
.person.is-anon .name, .node.is-anon .g { font-style: italic; font-weight: 500; color: var(--muted); }
.person.is-self { box-shadow: inset 0 0 0 2px var(--gold); }
.family-banner.is-warning { background: #fff7e6; border-color: #e9c77b; color: var(--ink); }
.family-banner + .family-banner { margin-top: .5rem; }
.consent-page .lead { font-style: normal; }
.consent-intro { font-size: 1rem; color: var(--muted); }
.consent-card { margin: 1.4rem 0; padding: 1.1rem 1.25rem; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow); }
.consent-card h2 { margin: 0 0 .4rem; font-variant: normal; color: var(--ink); }
.consent-child { font-size: .8em; color: var(--muted); font-weight: 400; }
.consent-q { margin: .2rem 0 .8rem; }
.consent-opt { display: flex; gap: .7rem; align-items: flex-start; padding: .55rem 0; border-top: 1px solid var(--line); cursor: pointer; }
.consent-opt input { width: 20px; height: 20px; margin-top: .25rem; accent-color: var(--rubric); flex: none; }
.consent-opt small { color: var(--muted); font: 13px/1.4 var(--sans); }
.consent-opt:has(input:disabled) { opacity: .5; cursor: default; }
.consent-note { font: 13px/1.5 var(--sans); color: var(--muted); }
.consent-actions { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.consent-actions .btn { border: 0; cursor: pointer; }
.consent-status { font: 14px/1.4 var(--sans); color: var(--muted); }
.branch-name.is-anon { font-style: italic; }

/* logowanie i nieudane logowanie */
.login-steps { padding-left: 1.3em; }
.login-steps li { margin: .5rem 0; }
.login-page code, .denied-card code { font: 15px/1 ui-monospace, Menlo, monospace; background: #faf6ec; border: 1px solid var(--line); border-radius: 4px; padding: .1em .35em; }
.login-actions { justify-content: flex-start; }
.page-denied main { display: grid; place-items: center; min-height: calc(100svh - 100px); }
.denied-card {
  max-width: 560px; width: 100%; text-align: center;
  padding: clamp(24px, 5vw, 44px); border: 1px solid var(--line); border-radius: 16px;
  background: #fff; box-shadow: var(--shadow); border-top: 3px double var(--gold);
}
.denied-card h1 { margin-top: .2rem; }
.denied-card .lead { margin-inline: auto; }
.denied-icon { font-size: 2.4rem; margin: 0; }
.denied-tips { text-align: left; display: inline-block; margin: .4rem auto 0; padding-left: 1.2em; font-size: 1rem; }
.denied-card .note { margin-top: 1.4rem; }
.login-form label { display: block; font: 600 14px/1.4 var(--sans); margin-bottom: .35rem; }
.login-row { display: flex; gap: .6rem; flex-wrap: wrap; }
.login-row input {
  flex: 1 1 240px; min-width: 0; padding: .65rem .8rem; font: 17px/1.3 var(--sans);
  border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink);
}
.login-row input:focus { outline: 2px solid var(--gold); outline-offset: 1px; border-color: var(--gold); }
.login-row .btn { border: 0; cursor: pointer; }
.login-row .btn:disabled { opacity: .6; cursor: wait; }
.login-actions .btn[data-logout] { cursor: pointer; font: 600 18px/1.2 var(--serif); }

/* dawny tekst (legenda) */
.old-text {
  margin: 1.2rem 0; padding: 1.1rem 1.3rem 1rem; border-left: 4px solid var(--rubric);
  background: #fcf9f1; border-radius: 0 10px 10px 0; font-style: italic; font-size: 1.08rem; line-height: 1.7;
}
.old-text p { margin: 0; }
.old-text p::first-letter { font-family: var(--display); font-style: normal; font-weight: 900; color: var(--rubric); font-size: 1.6em; }
.old-text footer { margin-top: .7rem; font: 13px/1.5 var(--sans); font-style: normal; color: var(--muted); }

/* karty z historii */
.history-page .family-banner { font-size: 14px; }
.lineage { padding-left: 1.3em; }
.lineage li { margin: .55rem 0; }
.history-cards { display: grid; gap: 1.2rem; margin: 2rem 0; }
.history-card {
  padding: 1.2rem 1.4rem 1rem; background: #fff; border: 1px solid var(--line); border-radius: 12px;
  border-top: 3px double var(--gold); box-shadow: var(--shadow);
}
.history-card header { margin-bottom: .5rem; }
.history-card h3 { margin: 0; font: 700 1.35rem/1.25 var(--display); letter-spacing: .02em; }
.history-card h3::first-letter { color: var(--rubric); }
.hc-meta { margin: .2rem 0 0; font: 14px/1.4 var(--sans); color: var(--muted); }
.history-card p { margin: .6rem 0; }
.hc-sources { font: 13px/1.55 var(--sans) !important; color: var(--muted); border-top: 1px solid var(--line); padding-top: .6rem; margin-top: .9rem !important; }
.tree-branch { margin-top: 3rem; padding-top: 1.5rem; border-top: 3px double var(--gold); }
.tree-branch .lead { max-width: 44em; }

/* linia warszawska: zdjęcia, ramki */
.warsaw-line .eyebrow a { color: var(--rubric); text-decoration: none; }
.hist-photo { margin: 1.4rem 0 1.8rem; }
.hist-photo img { display: block; width: 100%; height: auto; max-height: 520px; object-fit: cover; border-radius: 10px; box-shadow: var(--shadow); background: #f4efe3; }
.hist-photo figcaption { margin-top: .5rem; font-size: .98rem; font-style: italic; color: var(--ink); }
.hist-photo .credit { display: block; margin-top: .2rem; font: 12px/1.4 var(--sans); font-style: normal; color: var(--muted); }
.hist-photo .credit a { color: var(--muted); }
.photo-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.photo-pair .hist-photo img { height: 300px; }
.history-note {
  margin: 2rem 0; padding: 1.1rem 1.3rem; border-radius: 12px;
  background: #fbf6ea; border: 1px solid var(--line); border-left: 4px solid var(--gold);
}
.history-note h3 { margin: 0 0 .4rem; font: 700 1.2rem/1.3 var(--display); color: var(--rubric); }
.history-note p, .history-note li { font-size: 1rem; }
.more-link { margin: 1.2rem 0 2rem; }
@media (max-width: 720px) { .photo-pair { grid-template-columns: 1fr; } .photo-pair .hist-photo img { height: auto; } }
.person .probable { color: var(--gold); font-weight: 700; cursor: help; }
.person .pnote { font: 12px/1.4 var(--sans); color: var(--muted); margin-top: .15rem; max-width: 28rem; }
.b-note { margin: .3rem 0 0; font: 13px/1.45 var(--sans); color: var(--muted); }

/* ===== galerie (przeniesione z privat.fo-to.dk) — wersja jasna: wtapianie w biel ===== */
.page-gallery main, .page-stage main { max-width: none; padding: 0; }
.page-stage .site-footer { display: none; }
.gallery-stage {
  position: relative; width: 100%; height: calc(100svh - 92px); min-height: 420px;
  background: #fff; overflow: hidden; cursor: grab; touch-action: pan-y;
}
.gallery-stage.dragging { cursor: grabbing; }
.gallery-photo {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: center;
  opacity: 0; transition: opacity 2.53s ease-in-out;
  -webkit-user-drag: none; user-select: none; -webkit-touch-callout: none;
}
.gallery-photo.visible { opacity: 1; }
.gallery-bar { position: absolute; top: 0; right: 0; display: flex; gap: 10px; padding: 14px clamp(16px, 3vw, 32px); z-index: 13; }
.gallery-bar button, .gallery-prev, .gallery-next {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line);
  background: rgba(255,255,255,.78); color: var(--ink); font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); box-shadow: var(--shadow);
}
.gallery-bar button:hover, .gallery-prev:hover, .gallery-next:hover { border-color: var(--gold); color: var(--rubric); }
.gallery-prev, .gallery-next { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; font-size: 24px; z-index: 13; }
.gallery-prev { left: clamp(10px, 2vw, 24px); }
.gallery-next { right: clamp(10px, 2vw, 24px); }
.gallery-grid-toggle.active { background: var(--gold-soft); }
.gallery-info { font-family: var(--serif); font-style: italic; font-weight: 700; }
.gallery-title {
  position: absolute; left: clamp(16px, 3vw, 32px); top: 14px; z-index: 13; margin: 0;
  font: 700 clamp(1.4rem, 3vw, 2rem)/1.1 var(--display); color: var(--ink); text-shadow: 0 0 8px #fff, 0 0 3px #fff;
}
.gallery-title::first-letter { color: var(--rubric); }
.gallery-counter { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 13; font: 13px/1 var(--sans); color: var(--muted); background: rgba(255,255,255,.8); padding: .35rem .7rem; border-radius: 999px; }
.gallery-grid { display: none; position: absolute; inset: 0; top: 70px; overflow-y: auto; padding: 16px clamp(16px, 3vw, 32px) 32px; background: #fff; z-index: 14; }
.gallery-grid.open { display: block; }
.gallery-grid-inner { columns: 200px; column-gap: 14px; }
.gallery-thumb {
  display: block; width: 100%; height: auto; margin: 0 0 14px; break-inside: avoid; cursor: pointer;
  background: #f5f1e8; border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease;
}
.gallery-thumb:hover { transform: scale(1.03); box-shadow: 0 6px 20px rgba(40,30,10,.18); }
.gallery-intro {
  position: fixed; inset: 0; z-index: 3000; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(255,255,255,.35); transition: opacity .6s ease-in-out;
}
.gallery-intro.hidden { opacity: 0; pointer-events: none; }
.gallery-intro-card {
  max-width: 34rem; max-height: calc(100vh - 32px); overflow-y: auto; padding: 28px 32px; border-radius: 18px;
  background: rgba(255,255,255,.7); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border: 1px solid rgba(168,129,31,.35); box-shadow: 0 10px 34px rgba(40,30,10,.14);
  color: var(--ink); font-size: 1.05rem; line-height: 1.6; text-align: center;
}
.gallery-intro-title { margin: 0 0 14px; font: 700 1.8rem/1.2 var(--display); }
.gallery-intro-title::first-letter { color: var(--rubric); }
.gallery-intro-text { margin: 0 0 12px; }
.gallery-intro-close { margin-top: 10px; padding: 10px 22px; border: 0; border-radius: 999px; background: var(--ink); color: #fff; font: 600 17px/1.2 var(--serif); cursor: pointer; }
.gallery-intro-close:hover { background: var(--rubric); }
@media (max-width: 720px) {
  .gallery-stage { height: calc(100svh - 76px); }
  .gallery-bar button, .gallery-prev, .gallery-next { width: 38px; height: 38px; font-size: 18px; }
  .gallery-grid-inner { columns: 130px; column-gap: 8px; }
  .gallery-title { font-size: 1.2rem; max-width: 50%; }
}

/* strona „Galerie”: pokaz z bieli + karty */
.showcase { position: relative; height: min(62vh, 560px); background: #fff; overflow: hidden; }
.showcase-layer {
  position: absolute; inset: 0; background-size: contain; background-position: center; background-repeat: no-repeat; opacity: 0;
}
.galleries-wrap { max-width: 1100px; margin: 0 auto; padding: 24px clamp(16px, 4vw, 48px) 56px; }
.gallery-cards { list-style: none; padding: 0; margin: 1.5rem 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.2rem; }
.gallery-card a { display: block; text-decoration: none; background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); height: 100%; }
.gallery-card a:hover { border-color: var(--gold); color: inherit; }
.gallery-card .gc-cover { aspect-ratio: 3/2; background: #f4efe3 center/cover no-repeat; }
.gallery-card .gc-body { padding: .9rem 1.1rem 1.1rem; }
.gallery-card h2 { margin: 0 0 .2rem; font: 700 1.25rem/1.25 var(--display); color: var(--ink); font-variant: normal; letter-spacing: .02em; }
.gallery-card h2::first-letter { color: var(--rubric); }
.gallery-card p { margin: 0; font-size: .98rem; color: var(--muted); }

/* Madagaskar */
.mada-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; margin: 1.5rem 0; }
.mada-photos img { width: 100%; aspect-ratio: 3/2; object-fit: cover; border-radius: 8px; box-shadow: var(--shadow); }
.mada-route { columns: 2; column-gap: 2rem; font-size: 1rem; padding-left: 1.2em; }
.mada-route li { break-inside: avoid; margin: .2rem 0; }
@media (max-width: 720px) { .mada-photos { grid-template-columns: repeat(2, 1fr); } .mada-route { columns: 1; } }

/* e-mail do logowania */
.family-banner.is-email { background: #eef5fb; border-color: #bcd6ea; color: var(--ink); position: relative; padding-right: 2.4rem; }
.banner-close { position: absolute; top: .35rem; right: .5rem; border: 0; background: none; font-size: 1.3rem; line-height: 1; cursor: pointer; color: var(--muted); }
.email-card.is-missing { border-color: #bcd6ea; background: #f7fbfe; }
.email-form { display: flex; flex-wrap: wrap; gap: .6rem; align-items: end; margin-top: .6rem; }
.email-form[hidden] { display: none; }
.email-form label { display: grid; gap: .25rem; flex: 1 1 240px; font-size: .95rem; }
.email-form input { font: inherit; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 8px; }
.email-status { margin: .5rem 0 0; font-size: .95rem; }
.email-status:empty { display: none; }
.linklike { border: 0; background: none; padding: 0; font: inherit; color: var(--rubric); text-decoration: underline; cursor: pointer; }
