/* Sądu to nie obchodzi — static site styles */

/* ---------- Fonts (self-hosted, SIL OFL) ---------- */
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url("fonts/fraunces-latin-ext-wght-normal.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-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url("fonts/fraunces-latin-wght-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: "Source Serif 4";
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url("fonts/source-serif-4-latin-ext-wght-normal.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-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url("fonts/source-serif-4-latin-wght-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: "Source Serif 4";
  font-style: italic;
  font-weight: 200 900;
  font-display: swap;
  src: url("fonts/source-serif-4-latin-ext-wght-italic.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-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: italic;
  font-weight: 200 900;
  font-display: swap;
  src: url("fonts/source-serif-4-latin-wght-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;
}

/* ---------- Tokens ---------- */
:root {
  --paper: #f7f3ec;
  --paper-raised: #fffdf9;
  --ink: #1f1b18;
  --ink-soft: #5b534c;
  --ink-faint: #8a8078;
  --rule: #e4dcd0;
  --accent: #8e2b2b;
  --accent-soft: #f1e2dc;
  --accent-ink: #fff;
  --shadow: 0 1px 2px rgb(40 25 15 / .06), 0 8px 24px -12px rgb(40 25 15 / .18);

  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-text: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --font-ui: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --measure: 40rem;
  --wide: 60rem;
  --gutter: clamp(1rem, 4vw, 2rem);
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #171412;
    --paper-raised: #211d1a;
    --ink: #ece5dc;
    --ink-soft: #b4aa9f;
    --ink-faint: #857b72;
    --rule: #342e29;
    --accent: #e08a7a;
    --accent-soft: #3a2320;
    --accent-ink: #1a0f0d;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px -12px rgb(0 0 0 / .6);
  }
  img { filter: brightness(.92); }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 1rem;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: clamp(1.0625rem, .98rem + .35vw, 1.1875rem);
  line-height: 1.7;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main { flex: 1; width: 100%; }

img { max-width: 100%; height: auto; display: block; }

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: .18em;
}
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection { background: var(--accent); color: var(--accent-ink); }

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  padding: .5rem 1rem;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-ui);
  z-index: 10;
}
.skip-link:focus { top: 1rem; }

.eyebrow {
  margin: 0 0 .75rem;
  font-family: var(--font-ui);
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ---------- Header ---------- */
.site-header {
  border-bottom: 1px solid var(--rule);
}
.site-header__inner {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 1.1rem var(--gutter);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem 2rem;
}
.brand {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--ink);
  line-height: 1.15;
}
.brand__name {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -.01em;
}
.brand__tagline {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: .9rem;
  color: var(--ink-soft);
}
.site-nav {
  display: flex;
  gap: 1.5rem;
  font-family: var(--font-ui);
  font-size: .9rem;
}
.site-nav a {
  color: var(--ink-soft);
  text-decoration: none;
}
.site-nav a:hover { color: var(--accent); }

/* ---------- Chips / topics ---------- */
.topics {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}
.chip {
  display: inline-block;
  padding: .3rem .8rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-family: var(--font-ui);
  font-size: .8rem;
  line-height: 1.4;
  color: var(--ink-soft);
  text-decoration: none;
  background: var(--paper-raised);
  transition: border-color .15s, color .15s, background .15s;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip[aria-current="page"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

/* ---------- Hero (index & category) ---------- */
.hero {
  max-width: var(--wide);
  margin: 0 auto;
  padding: clamp(2.5rem, 7vw, 5rem) var(--gutter) clamp(1.5rem, 4vw, 2.5rem);
}
.hero__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 1.6rem + 5vw, 5rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -.03em;
}
.hero__lede {
  max-width: 38rem;
  margin: 1.25rem 0 0;
  font-size: 1.15em;
  color: var(--ink-soft);
}
.hero--compact .hero__title { font-size: clamp(2.2rem, 1.4rem + 4vw, 3.75rem); }
.topics--hero { margin-top: 1.75rem; }

/* ---------- Table of contents ---------- */
.toc {
  list-style: none;
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0 var(--gutter) clamp(3rem, 8vw, 6rem);
  counter-reset: none;
}
.toc-item + .toc-item { border-top: 1px solid var(--rule); }
.toc-item__link {
  display: grid;
  grid-template-columns: 3.25rem 1fr 6.5rem;
  gap: 1.25rem;
  align-items: center;
  padding: 1.5rem .75rem;
  margin: 0 -.75rem;
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
  transition: background .2s;
}
.toc-item__link:hover { background: var(--paper-raised); box-shadow: var(--shadow); }
.toc-item__num {
  align-self: start;
  padding-top: .15rem;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 300;
  line-height: 1;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}
.toc-item__link:hover .toc-item__num { color: var(--accent); }
.toc-item__body { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.toc-item__title {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 1.05rem + .8vw, 1.6rem);
  font-weight: 550;
  line-height: 1.2;
  letter-spacing: -.01em;
  text-wrap: balance;
}
.toc-item__link:hover .toc-item__title { color: var(--accent); }
.toc-item__excerpt {
  font-size: .95em;
  line-height: 1.55;
  color: var(--ink-soft);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.toc-item__meta {
  font-family: var(--font-ui);
  font-size: .78rem;
  color: var(--ink-faint);
}
.toc-item__thumb {
  width: 6.5rem;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 10px;
  background: var(--rule);
}

@media (max-width: 600px) {
  .toc-item__link {
    grid-template-columns: 1fr 4.5rem;
    gap: .35rem 1rem;
    padding: 1.25rem .75rem;
  }
  .toc-item__num {
    grid-column: 1 / -1;
    font-family: var(--font-ui);
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .12em;
  }
  .toc-item__num::before { content: "Rozdział "; }
  .toc-item__thumb { width: 4.5rem; align-self: start; }
  .toc-item__excerpt { display: none; }
}

/* ---------- Chapter ---------- */
.chapter {
  padding: clamp(2.5rem, 7vw, 5rem) var(--gutter) 2rem;
}
.chapter__header {
  max-width: var(--measure);
  margin: 0 auto 2.5rem;
}
.chapter__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 1.3rem + 4vw, 3.9rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -.025em;
  text-wrap: balance;
}
.chapter__meta {
  margin: 1.25rem 0 0;
  font-family: var(--font-ui);
  font-size: .85rem;
  color: var(--ink-faint);
}
.chapter__topics {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin: 1rem 0 0;
}

/* ---------- Prose ---------- */
.prose {
  max-width: var(--measure);
  margin: 0 auto;
  hyphens: auto;
  -webkit-hyphens: auto;
  overflow-wrap: break-word;
}
.prose > * { margin: 0 0 1.25em; }
.prose > :last-child { margin-bottom: 0; }

.prose h2 {
  margin: 2.2em 0 .8em;
  font-family: var(--font-display);
  font-size: 1.55em;
  font-weight: 550;
  line-height: 1.2;
  letter-spacing: -.015em;
  text-wrap: balance;
}
.prose h2 strong { font-weight: inherit; }

/* A heading directly after the illustration acts as a subtitle. */
.prose > figure:first-child + h2 {
  margin-top: 0;
  font-style: italic;
  font-weight: 400;
  color: var(--ink-soft);
}

.prose figure { margin: 2.25em 0; }
.prose > figure:first-child { margin-top: 0; }
.prose figure img {
  width: 100%;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
@media (min-width: 64rem) {
  .prose > figure {
    margin-left: -6rem;
    margin-right: -6rem;
  }
}
.prose figcaption {
  margin-top: .75rem;
  font-family: var(--font-ui);
  font-size: .82rem;
  line-height: 1.5;
  color: var(--ink-faint);
  text-align: center;
}

.prose blockquote {
  margin-left: 0;
  padding-left: 1.25em;
  border-left: 3px solid var(--accent);
  font-style: italic;
  color: var(--ink-soft);
}
.prose ol, .prose ul { padding-left: 1.4em; }
.prose li + li { margin-top: .4em; }
.prose li::marker { color: var(--accent); }

.prose hr {
  border: 0;
  margin: 3em auto;
  text-align: center;
}
.prose hr::after {
  content: "⁂";
  color: var(--ink-faint);
  font-size: 1.3em;
}

.prose .lead {
  font-size: 1.2em;
  line-height: 1.5;
  color: var(--ink-soft);
}
.prose .align-center { text-align: center; }
.prose .align-right { text-align: right; }

.prose .group {
  padding: 1.25em 1.5em;
  border-radius: var(--radius);
  background: var(--paper-raised);
  border: 1px solid var(--rule);
}
.prose .group > * { margin: 0; }
.prose .group > * + * { margin-top: .35em; }

.prose a[href^="#_ftn"] { font-family: var(--font-ui); font-size: .8em; text-decoration: none; }

/* ---------- Pager ---------- */
.pager {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 2rem var(--gutter) clamp(3rem, 8vw, 5rem);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1rem;
  align-items: stretch;
}
.pager__link {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper-raised);
  color: var(--ink);
  text-decoration: none;
  transition: border-color .15s, box-shadow .15s;
}
.pager__link:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.pager__link--next { text-align: right; }
.pager__label {
  font-family: var(--font-ui);
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
}
.pager__title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 550;
  line-height: 1.25;
}
.pager__toc {
  align-self: center;
  font-family: var(--font-ui);
  font-size: .85rem;
  color: var(--ink-soft);
}
@media (max-width: 640px) {
  .pager { grid-template-columns: 1fr; }
  .pager__toc { order: 3; justify-self: center; margin-top: .5rem; }
  .pager__spacer { display: none; }
  .pager__link--next { text-align: left; }
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--rule);
  padding: 2.5rem var(--gutter) 3rem;
  text-align: center;
}
.site-footer .topics { justify-content: center; max-width: var(--wide); margin: 0 auto; }
.site-footer__motto {
  margin: 0 0 1.25rem;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.25rem;
  color: var(--ink-soft);
}
.site-footer__meta {
  margin: 1.5rem 0 0;
  font-family: var(--font-ui);
  font-size: .78rem;
  color: var(--ink-faint);
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

@media print {
  .site-header, .site-footer, .pager, .chapter__topics { display: none; }
  body { background: #fff; color: #000; }
}
