/* ===== tokens ============================================================ */
:root {
  --bg: #ffffff;
  --bg-soft: #fafafa;
  --fg: #111111;
  --fg-muted: #5f5f5f;
  --fg-faint: #8a8a8a;
  --rule: #e6e6e6;
  --rule-strong: #d0d0d0;

  --content-narrow: 740px;
  --content-wide: 1080px;
  --content-fullbleed: 1600px;

  --pad: clamp(1rem, 4vw, 2rem);

  --eyebrow: 0.78rem;
  --body: 1.125rem;
  --h1: clamp(2.25rem, 4.5vw, 3.5rem);
  --h2: clamp(1.5rem, 2.6vw, 2rem);
  --card-title: clamp(1.6rem, 2.4vw, 2.1rem);
}

/* ===== reset ============================================================= */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 17px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI",
               "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-feature-settings: "kern", "liga";
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  color: var(--fg);
  background: var(--bg);
  line-height: 1.7;
  font-size: var(--body);
}
img, video, iframe { max-width: 100%; height: auto; display: block; }

a { color: var(--fg); text-decoration: underline; text-underline-offset: 3px;
    text-decoration-thickness: 1px; text-decoration-color: var(--rule-strong); }
a:hover { text-decoration-color: var(--fg); }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; border-radius: 2px; }

/* ===== header / footer =================================================== */
.site-header { border-bottom: 1px solid var(--rule); }
.site-header-inner {
  max-width: var(--content-wide);
  margin: 0 auto;
  padding: 1.25rem var(--pad);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}
.brand {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--fg);
}
.lang-toggle { font-size: 0.92rem; color: var(--fg-muted); display: flex; gap: 0.6rem; align-items: baseline; }
.lang-toggle a { text-decoration: none; color: var(--fg-muted); font-weight: 500; }
.lang-toggle a.active { color: var(--fg); font-weight: 700; }
.lang-toggle a:hover { color: var(--fg); }

/* Per-locale category strip directly under the brand bar. */
.cat-nav { border-top: 1px solid var(--rule); }
.cat-nav-inner {
  max-width: var(--content-wide);
  margin: 0 auto;
  padding: 0.75rem var(--pad);
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  font-size: 0.92rem;
}
.cat-nav-inner a {
  text-decoration: none;
  color: var(--fg-muted);
  font-weight: 500;
  white-space: nowrap;
  padding: 0.15rem 0;
  letter-spacing: 0.005em;
}
.cat-nav-inner a:hover { color: var(--fg); }
.cat-nav-inner a.active {
  color: var(--fg);
  font-weight: 700;
  border-bottom: 2px solid var(--fg);
}
@media (max-width: 700px) {
  /* Let categories scroll horizontally on narrow screens instead of
     wrapping to many lines and pushing content way down. */
  .cat-nav-inner {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    gap: 1rem;
  }
  .cat-nav-inner::-webkit-scrollbar { display: none; }
}

.site-footer { border-top: 1px solid var(--rule); margin-top: 6rem; background: var(--bg-soft); }
.site-footer-inner {
  max-width: var(--content-wide);
  margin: 0 auto;
  padding: 1.5rem var(--pad);
  color: var(--fg-muted);
  font-size: 0.92rem;
}

/* ===== eyebrow (date label, all caps muted) ============================== */
.eyebrow {
  display: inline-block;
  font-size: var(--eyebrow);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin: 0 0 0.5rem;
}

/* ===== index pages (/, /pl/, /en/, /<lang>/<cat>/) ======================= */
.index { max-width: var(--content-wide); margin: 0 auto; padding: 3.5rem var(--pad) 2rem; }
.index-head { margin-bottom: 3rem; }
.index-title { font-size: var(--h1); margin: 0 0 0.75rem; line-height: 1.05; letter-spacing: -0.015em; font-weight: 700; }
.index-intro { color: var(--fg-muted); font-size: 1.1rem; max-width: 640px; }
.index-intro p { margin: 0; }

.post-list { display: flex; flex-direction: column; gap: 2.5rem; margin-top: 0; }

/* Card with hero: bordered container so the image + body read as one
   article. Hover gently lifts the card. */
.post-card {
  border: 1px solid var(--rule);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg);
  transition: border-color 180ms ease, box-shadow 220ms ease, transform 220ms ease;
}
.post-card:hover {
  border-color: var(--rule-strong);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.06);
  transform: translateY(-2px);
}
.post-card-link {
  display: block;
  text-decoration: none;
  color: var(--fg);
}
.post-card-hero {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--bg-soft);
}
.post-card-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 500ms ease;
}
.post-card-link:hover .post-card-hero img { transform: scale(1.03); }

.post-card-body { padding: 1.5rem 1.75rem 1.75rem; }
.post-card-title {
  font-size: var(--card-title);
  line-height: 1.15;
  letter-spacing: -0.012em;
  font-weight: 700;
  margin: 0 0 0.5rem;
}
.post-card-excerpt {
  margin: 0;
  color: var(--fg-muted);
  font-size: 1.02rem;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Card without a hero image: keep the same bordered container so it sits
   in the same visual rhythm as image cards, just shorter. */
.post-card--no-hero .post-card-body {
  padding: 1.5rem 1.75rem 1.5rem;
}

.empty { color: var(--fg-muted); padding: 3rem 0; text-align: center; }

/* ===== post detail ======================================================= */
.post { padding-bottom: 4rem; }
.post-hero {
  width: 100%;
  max-width: var(--content-fullbleed);
  margin: 0 auto 3rem;
  aspect-ratio: 21 / 9;
  overflow: hidden;
  background: var(--bg-soft);
}
.post-hero img { width: 100%; height: 100%; object-fit: cover; }

.post-head {
  max-width: var(--content-narrow);
  margin: 0 auto 2.5rem;
  padding: 0 var(--pad);
}
.post-title {
  font-size: var(--h1);
  line-height: 1.05;
  letter-spacing: -0.015em;
  font-weight: 700;
  margin: 0 0 0.75rem;
}
.post-lede {
  font-size: 1.2rem;
  line-height: 1.55;
  color: var(--fg-muted);
  margin: 0;
}

.post-body {
  max-width: var(--content-narrow);
  margin: 0 auto;
  padding: 0 var(--pad);
  font-size: var(--body);
}
.post-body > * + * { margin-top: 1.25rem; }
.post-body h2 { font-size: 1.65rem; line-height: 1.2; margin-top: 3rem; letter-spacing: -0.01em; font-weight: 700; }
.post-body h3 { font-size: 1.3rem; line-height: 1.3; margin-top: 2.25rem; font-weight: 700; }
.post-body p { margin: 1.25rem 0; }
.post-body ul, .post-body ol { padding-left: 1.5rem; margin: 1.25rem 0; }
.post-body li { margin: 0.4rem 0; }
.post-body blockquote {
  border-left: 3px solid var(--rule-strong);
  padding-left: 1.5rem;
  margin: 1.75rem 0;
  color: var(--fg-muted);
  font-style: italic;
}
.post-body a { color: var(--fg); text-decoration-color: var(--fg-muted); }
.post-body a:hover { text-decoration-color: var(--fg); }

.post-foot { max-width: var(--content-narrow); margin: 4rem auto 0; padding: 2rem var(--pad) 0; border-top: 1px solid var(--rule); }
.license { color: var(--fg-muted); font-size: 0.92rem; margin: 0; }

/* ===== blocks inside post body =========================================== */
.block-image { margin: 2.5rem 0; }
.block-image img { width: 100%; height: auto; }
.block-image figcaption {
  margin-top: 0.6rem;
  color: var(--fg-muted);
  font-size: 0.92rem;
  text-align: center;
  line-height: 1.5;
}

.block-embed { margin: 2.5rem 0; }
.block-embed iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; }

.block-gallery {
  margin: 2.5rem 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}
.block-gallery figure { margin: 0; }
.block-gallery img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.block-gallery figcaption {
  font-size: 0.85rem;
  color: var(--fg-muted);
  margin-top: 0.4rem;
  text-align: center;
}

.block-download {
  margin: 1.75rem 0;
  padding: 1rem 1.25rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--bg-soft);
}
.block-download a { color: var(--fg); text-decoration: none; }
.block-download a::before { content: "↓ "; color: var(--fg-muted); margin-right: 0.4rem; }
.block-download a:hover { text-decoration: underline; }

/* ===== code ============================================================== */
code, pre, kbd, samp {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
}
:not(pre) > code {
  background: var(--bg-soft);
  border: 1px solid var(--rule);
  padding: 0.08em 0.4em;
  border-radius: 3px;
  font-size: 0.88em;
}
pre {
  background: #1a1a1a;
  color: #f5f5f5;
  padding: 1.25rem 1.5rem;
  border-radius: 6px;
  overflow-x: auto;
  line-height: 1.55;
  margin: 2rem 0;
}
pre code { background: transparent; border: 0; padding: 0; color: inherit; }

/* ===== mobile ============================================================ */
@media (max-width: 600px) {
  .post-list { gap: 3rem; }
  .post-hero { aspect-ratio: 16 / 9; margin-bottom: 2rem; }
  .index { padding-top: 2.5rem; }
}
