/* Motyw stron publicznych — jasny, automatyczny tryb ciemny, akcent per portal (--accent z <style> w base.html). */
:root {
  --accent: #2f5bd3;
  --bg: #ffffff;
  --surface: #f6f7f9;
  --border: #e4e7ec;
  --text: #16191d;
  --text-2: #4b5563;
  --muted: #6b7280;
  --link: var(--accent);
  --accent-soft: color-mix(in srgb, var(--accent) 10%, transparent);
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgb(16 24 40 / .05), 0 4px 16px rgb(16 24 40 / .06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-prose: Charter, "Bitstream Charter", "Iowan Old Style", Georgia, Cambria, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --measure: 720px;
  --wide: 1200px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1013;
    --surface: #171a1f;
    --border: #262b33;
    --text: #e8eaed;
    --text-2: #c2c7cf;
    --muted: #8f96a1;
    --link: color-mix(in srgb, var(--accent) 60%, white);
    --accent-soft: color-mix(in srgb, var(--accent) 22%, transparent);
    --shadow: none;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 84px; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
  font: 17px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; }
main:focus { outline: none; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 3px; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.015em; text-wrap: balance; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 100; padding: 8px 14px; background: var(--accent); color: #fff; border-radius: var(--radius-sm); }
.skip-link:focus { top: 12px; }

.container { width: 100%; max-width: calc(var(--measure) + 40px); margin: 0 auto; padding: 0 20px; }
.container--wide { max-width: calc(var(--wide) + 40px); }
.section { margin-top: 48px; margin-bottom: 48px; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 18px; font-weight: 600; }
.empty { color: var(--muted); padding: 32px 0; }
.eyebrow { margin: 0 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); font-weight: 600; }
.meta { margin: 0; font-size: 14px; color: var(--muted); }
.meta a { color: inherit; }
.meta__author { font-weight: 600; color: var(--text) !important; text-decoration: none; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-header__inner { display: flex; align-items: center; gap: 24px; min-height: 64px; }
.brand { font-weight: 800; font-size: 20px; letter-spacing: -0.02em; color: var(--text); text-decoration: none; white-space: nowrap; }
.brand__logo { height: 36px; width: auto; }
.site-nav { display: flex; align-items: center; gap: 20px; margin-left: auto; }
.site-nav ul { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.site-nav ul a { display: block; padding: 6px 12px; border-radius: 999px; color: var(--text-2); text-decoration: none; font-size: 15px; font-weight: 500; }
.site-nav ul a:hover { background: var(--surface); color: var(--text); }
.site-nav ul a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.header-search { display: flex; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 0 4px 0 14px; }
.header-search input { border: 0; background: transparent; color: var(--text); font: 15px var(--font); padding: 7px 0; width: 160px; outline: none; }
.header-search button { border: 0; background: transparent; color: var(--muted); padding: 6px 8px; cursor: pointer; display: grid; place-items: center; }
.header-search:focus-within { border-color: var(--accent); }
.nav-toggle, .nav-toggle__btn { display: none; }

/* ---------- Hero ---------- */
.hero { padding: 72px 0 24px; }
.hero__title { font-size: clamp(34px, 5vw, 56px); margin: 0; max-width: 18ch; }
.hero__subtitle { font-size: clamp(17px, 2vw, 21px); color: var(--text-2); max-width: 60ch; margin: 14px 0 0; }
.hero--image { position: relative; padding: 0; color: #fff; min-height: 380px; display: flex; align-items: flex-end; overflow: hidden; }
.hero--image .hero__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero--image::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgb(0 0 0 / .72), rgb(0 0 0 / .1) 70%); }
.hero--image .hero__content { position: relative; z-index: 1; padding-top: 72px; padding-bottom: 40px; }
.hero--image .hero__subtitle { color: rgb(255 255 255 / .88); }

/* ---------- Chips ---------- */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 12.5px; font-weight: 600; text-decoration: none; line-height: 1.7;
}
@media (prefers-color-scheme: dark) { .chip { color: var(--link); } }
.chip:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.chip--lg { padding: 6px 14px; font-size: 14px; font-weight: 500; background: var(--surface); color: var(--text-2); border: 1px solid var(--border); }
.chip--lg:hover { border-color: var(--accent); color: var(--accent); background: var(--surface); }

/* ---------- Cards ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 32px 28px; }
.featured-grid { display: grid; grid-template-columns: 1.6fr 1fr; grid-template-rows: auto auto; gap: 28px; }
.featured-grid .card--large { grid-row: span 2; }
.card { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card__media { display: block; aspect-ratio: 3 / 2; border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.card:hover .card__media img { transform: scale(1.03); }
.card__placeholder { display: grid; place-items: center; height: 100%; font-size: 48px; font-weight: 800; color: var(--accent); background: var(--accent-soft); text-transform: uppercase; }
.card__body { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.card__title { margin: 0; font-size: 20px; }
.card--large .card__title { font-size: clamp(24px, 3vw, 32px); }
.card__title a { color: var(--text); text-decoration: none; }
.card__title a:hover { color: var(--accent); }
.card__excerpt { margin: 0; color: var(--text-2); font-size: 15.5px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Page headers ---------- */
.page-header { margin: 8px 0 36px; max-width: 760px; }
.page-header h1 { font-size: clamp(30px, 4vw, 44px); margin: 0; }
.page-header__desc { color: var(--text-2); margin-top: 12px; font-size: 18px; }
.page-header__desc p { margin: 0 0 8px; }
.page-header--author { display: flex; gap: 24px; align-items: center; max-width: none; }

/* ---------- Breadcrumbs ---------- */
.breadcrumbs { font-size: 14px; color: var(--muted); margin: 24px 0 20px; display: flex; flex-wrap: wrap; gap: 6px; }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs [aria-current] { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40ch; }

/* ---------- Article ---------- */
.article__header { margin-bottom: 28px; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.article__header .breadcrumbs { margin-bottom: 4px; }
.article__title { font-size: clamp(32px, 4.6vw, 48px); margin: 0; letter-spacing: -0.025em; }
.article__hero { margin: 0 auto 40px; }
.article__hero img { width: 100%; border-radius: var(--radius); aspect-ratio: 16 / 9; object-fit: cover; }
.draft-banner { margin: 0; padding: 6px 12px; border-radius: var(--radius-sm); background: #fdf1dc; color: #8a5300; font-size: 14px; font-weight: 600; }

.toc { margin: 0 0 32px; padding: 16px 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.toc summary { cursor: pointer; font-weight: 700; font-size: 15px; }
.toc ol { margin: 10px 0 0; padding-left: 22px; font-size: 15.5px; display: grid; gap: 4px; }
.toc a { color: var(--text-2); text-decoration: none; }
.toc a:hover { color: var(--accent); text-decoration: underline; }

.prose { font-family: var(--font-prose); font-size: 20px; line-height: 1.72; color: var(--text); overflow-wrap: break-word; }
.prose > :first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose table, .prose pre { margin: 0 0 1.15em; }
.prose h2, .prose h3, .prose h4 { font-family: var(--font); margin: 1.9em 0 .55em; }
.prose h2 { font-size: 28px; }
.prose h3 { font-size: 22px; }
.prose li { margin: .3em 0; }
.prose li::marker { color: var(--accent); }
.prose strong { font-weight: 700; }
.prose a { color: var(--link); }
.prose img { border-radius: var(--radius); margin: 1.6em auto; }
.prose blockquote { border-left: 3px solid var(--accent); padding: 2px 0 2px 20px; color: var(--text-2); font-style: italic; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2.5em 0; }
.prose table { width: 100%; border-collapse: collapse; font-family: var(--font); font-size: 16px; display: block; overflow-x: auto; }
.prose th, .prose td { border-bottom: 1px solid var(--border); padding: 10px 12px; text-align: left; }
.prose th { background: var(--surface); }
.prose code { font-family: var(--mono); font-size: .85em; background: var(--surface); padding: 2px 5px; border-radius: 5px; }
.prose pre { background: var(--surface); padding: 16px; border-radius: var(--radius-sm); overflow-x: auto; font-size: 15px; }
.prose pre code { background: none; padding: 0; }
.prose :target { scroll-margin-top: 84px; }

.article__tags { margin: 40px 0 0; }
.author-box { display: flex; gap: 16px; align-items: flex-start; margin: 40px 0 0; padding: 20px; border: 1px solid var(--border); border-radius: var(--radius); }
.author-box p { margin: 4px 0 0; color: var(--text-2); font-size: 15px; }
.author-box__name { font-weight: 700; color: var(--text); text-decoration: none; }
.post-ai-notice { margin: 24px 0 0; font-size: 13.5px; color: var(--muted); }
.related { margin-top: 72px; padding-top: 40px; border-top: 1px solid var(--border); }

.avatar { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; flex: none; }
.avatar--lg { width: 96px; height: 96px; }
.avatar--placeholder { display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: 22px; text-transform: uppercase; }
.avatar--lg.avatar--placeholder { font-size: 36px; }

/* ---------- Authors ---------- */
.authors-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
.author-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 28px 20px; border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text); transition: border-color .2s, box-shadow .2s; }
.author-card:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.author-card h2 { font-size: 18px; margin: 8px 0 0; }
.author-card p { margin: 0; color: var(--text-2); font-size: 14.5px; }

/* ---------- Search ---------- */
.search-box { display: flex; gap: 10px; max-width: 640px; margin: 0 0 40px; }
.search-box input { flex: 1; min-width: 0; padding: 12px 16px; font: 17px var(--font); color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.search-box input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.button { padding: 0 20px; border: 0; border-radius: var(--radius-sm); background: var(--accent); color: #fff; font: 600 16px var(--font); cursor: pointer; }
.button:hover { filter: brightness(1.08); }

/* ---------- Pagination ---------- */
.pagination { display: flex; justify-content: center; align-items: center; gap: 6px; margin: 48px 0 0; flex-wrap: wrap; }
.pagination__link { display: grid; place-items: center; min-width: 40px; height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: 999px; color: var(--text-2); text-decoration: none; font-size: 15px; }
.pagination__link:hover { border-color: var(--accent); color: var(--accent); }
.pagination__link--active { background: var(--accent); border-color: var(--accent); color: #fff; }
.pagination__dots { color: var(--muted); padding: 0 4px; }

/* ---------- Footer ---------- */
.site-footer { margin-top: 96px; border-top: 1px solid var(--border); background: var(--surface); font-size: 15px; color: var(--text-2); }
.site-footer__cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 32px; padding: 48px 0 32px; }
.site-footer__col h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 10px; }
.site-footer__col p { margin: 6px 0 0; }
.site-footer__col--brand strong { font-size: 18px; color: var(--text); }
.site-footer__bottom { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 20px 0 28px; border-top: 1px solid var(--border); font-size: 14px; color: var(--muted); }
.site-footer a { color: inherit; }

.staff-fab { position: fixed; right: 20px; bottom: 20px; z-index: 30; padding: 10px 16px; border-radius: 999px; background: var(--text); color: var(--bg); font: 600 14px var(--font); text-decoration: none; box-shadow: 0 6px 20px rgb(0 0 0 / .2); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .featured-grid { grid-template-columns: 1fr; }
  .featured-grid .card--large { grid-row: auto; }
}
@media (max-width: 760px) {
  body { font-size: 16px; }
  .site-header__inner { flex-wrap: wrap; gap: 0; }
  .nav-toggle__btn { display: flex; flex-direction: column; justify-content: center; gap: 5px; width: 44px; height: 44px; margin-left: auto; cursor: pointer; }
  .nav-toggle__btn span { display: block; height: 2px; width: 22px; margin: 0 auto; background: var(--text); border-radius: 2px; transition: transform .2s, opacity .2s; }
  .site-nav { display: none; width: 100%; flex-direction: column; align-items: stretch; gap: 12px; padding: 8px 0 16px; margin: 0; }
  .site-nav ul { flex-direction: column; }
  .site-nav ul a { padding: 10px 4px; border-radius: 0; font-size: 17px; }
  .header-search input { width: 100%; }
  .nav-toggle:checked ~ .site-nav { display: flex; }
  .nav-toggle:checked + .nav-toggle__btn span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle:checked + .nav-toggle__btn span:nth-child(2) { opacity: 0; }
  .nav-toggle:checked + .nav-toggle__btn span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .section { margin-top: 32px; margin-bottom: 32px; }
  .hero { padding-top: 40px; }
  .hero--image { min-height: 300px; }
  .card-grid { grid-template-columns: 1fr; }
  .prose { font-size: 18px; }
  .prose h2 { font-size: 24px; }
  .page-header--author { flex-direction: column; align-items: flex-start; }
  .site-footer { margin-top: 64px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  .site-header, .site-footer, .staff-fab, .related, .toc { display: none; }
  .prose { font-size: 12pt; }
}
