:root {
  --paper: #F6F5F0;
  --card: #FDFCF9;
  --ink: #20261F;
  --muted: #6B7069;
  --line: #DFDED6;
  --accent: #1E5C43;
  --accent-soft: #E3EDE7;
  --gold: #A87F2E;
  --rust: #A34E2E;
  --amber: #B07A1B;
  --slate: #4A6178;
  --serif: 'Spectral', Georgia, serif;
  --sans: 'Work Sans', system-ui, -apple-system, sans-serif;
  --maxw: 44rem;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #181B17;
    --card: #20241F;
    --ink: #EBEAE2;
    --muted: #9AA096;
    --line: #32362F;
    --accent: #7CC2A2;
    --accent-soft: #24352C;
    --gold: #CBA452;
    --rust: #C97B58;
    --amber: #D0A04C;
    --slate: #8AA5BE;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.7;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
img { max-width: 100%; height: auto; }
iframe { max-width: 100%; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; line-height: 1.25; }

/* Header */
.site-header {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.4rem 1.25rem 1.1rem;
  display: flex;
  flex-wrap: wrap;
  gap: .6rem 1.5rem;
  align-items: baseline;
  justify-content: space-between;
}
.site-name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--ink);
}
.site-name span { color: var(--accent); font-weight: 500; }
.site-name:hover { text-decoration: none; }
.site-nav { display: flex; flex-wrap: wrap; gap: .25rem .9rem; font-size: .9rem; }
.site-nav a { color: var(--muted); }
.site-nav a.active { color: var(--ink); border-bottom: 2px solid var(--accent); }
.site-nav a:hover { color: var(--ink); text-decoration: none; }

main { max-width: var(--maxw); margin: 0 auto; padding: 0 1.25rem 3rem; }

/* Signature rule: breviary double hairline */
.rule-double {
  height: 5px;
  border-top: 1px solid var(--accent);
  border-bottom: 1px solid var(--line);
  margin: 1.2rem 0 0;
}

/* Hero */
.hero { padding: 2.2rem 0 1.4rem; }
.hero-row { display: flex; gap: 2rem; align-items: center; }
.hero-photo {
  width: clamp(120px, 22vw, 190px);
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--line);
  flex-shrink: 0;
}
@media (max-width: 540px) {
  .hero-row { flex-direction: column; align-items: flex-start; gap: 1.2rem; }
  .hero-photo { width: 132px; }
}
.eyebrow {
  margin: 0 0 .5rem;
  font-size: .8rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}
.hero h1 {
  margin: 0;
  font-size: clamp(1.5rem, 4.5vw, 2.1rem);
  font-weight: 500;
  max-width: 34ch;
}

/* Featured */
.section-label {
  margin: 1.8rem 0 .6rem;
  font-size: .8rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}
.featured-card {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.1rem 1.3rem;
  color: var(--ink);
}
.featured-card:hover { border-color: var(--accent); text-decoration: none; }
.featured-title {
  display: block;
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 500;
  margin: .3rem 0 .2rem;
}
.featured-meta { font-size: .85rem; color: var(--muted); }

/* Category dots */
.cat-dot {
  display: inline-block;
  width: .55em; height: .55em;
  border-radius: 50%;
  background: var(--muted);
  margin-right: .45em;
  vertical-align: baseline;
}
.cat-dot[data-cat="nauczania"] { background: var(--accent); }
.cat-dot[data-cat="audio"] { background: var(--amber); }
.cat-dot[data-cat="wideo"], .cat-dot[data-cat="video"] { background: var(--rust); }
.cat-dot[data-cat="swiatlo-zycie"] { background: var(--gold); }
.cat-dot[data-cat="kartki-z-notatnika"] { background: var(--slate); }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin: 2rem 0 1.1rem; }
.chip {
  font: inherit;
  font-size: .85rem;
  padding: .3rem .85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.chip:hover { border-color: var(--accent); color: var(--ink); }
.chip.active { background: var(--accent); border-color: var(--accent); color: var(--paper); }
.chip.active .cat-dot { background: var(--paper); }

/* Library grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .7rem; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .85rem 1rem;
  color: var(--ink);
}
.card:hover { border-color: var(--accent); text-decoration: none; }
.card[hidden] { display: none; }
.card-title { display: block; font-weight: 500; font-size: .95rem; line-height: 1.4; margin: .25rem 0 .3rem; }
.card-meta { font-size: .8rem; color: var(--muted); }
.grid-empty { color: var(--muted); }
.more {
  display: block;
  margin: 1.5rem auto 0;
  font: inherit;
  font-size: .9rem;
  padding: .5rem 1.4rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
}
.more:hover { border-color: var(--accent); }

/* Post */
.post { padding-top: 1.8rem; }
.post-meta { margin: 0 0 .4rem; font-size: .85rem; color: var(--muted); }
.post-header h1 { margin: 0; font-size: clamp(1.5rem, 4.5vw, 2rem); }
.post-body { margin-top: 1.6rem; }
.post-body > p:first-child { font-size: 1.1rem; }
.post-body blockquote {
  margin: 1.5rem 0;
  padding: .2rem 0 .2rem 1.1rem;
  border-left: 3px solid var(--gold);
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink);
}
.post-back { margin-top: 2.5rem; font-size: .9rem; }

/* Embeds */
.embed { margin: 1.6rem 0; }
.embed iframe { width: 100%; border: 0; border-radius: 12px; }
.embed.is-video iframe { aspect-ratio: 16 / 9; height: auto; }
.yt-facade {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  cursor: pointer;
  padding: 0;
}
.yt-facade img { width: 100%; height: 100%; object-fit: cover; opacity: .85; }
.yt-facade::after {
  content: '▶';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 2.6rem;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0,0,0,.6);
}

/* Footer */
.site-footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.4rem 1.25rem 2.2rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1.5rem;
  justify-content: space-between;
  font-size: .85rem;
  color: var(--muted);
}
.site-footer p { margin: 0; }
.social a { margin-left: 1rem; }
.social a:first-child { margin-left: 0; }

@media (prefers-reduced-motion: no-preference) {
  .card, .featured-card, .chip { transition: border-color .15s ease; }
}
