/* === FONTS === */
/* Self-hosted jak na synektrze: bez zewnętrznych CDN. Pełne polskie znaki są w podzbiorze latin-ext. */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/Inter-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: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/Inter-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-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('../fonts/JetBrainsMono-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: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('../fonts/JetBrainsMono-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-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Literata';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/Literata-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: 'Literata';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/Literata-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-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Literata';
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/Literata-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: 'Literata';
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/Literata-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-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Układ: kolumna tekstu 40rem, od 1100px spis treści po prawej, tabele i galerie wychodzą poza kolumnę.
   Baza z synektry (Inter, JetBrains Mono, neutralne ink/paper), akcent przesunięty z niebieskiego w indygo. */
:root {
  --paper: #FFFFFF;
  --paper-2: hsl(225 30% 97%);
  --paper-3: hsl(225 25% 93.5%);
  --ink: #14191E;
  --ink-2: #2A2F36;
  --muted: hsl(225 8% 42%);
  --rule: hsl(225 18% 89%);
  --accent-indigo: hsl(234 64% 50%);
  --accent-indigo-soft: hsl(234 85% 96%);
  --accent: var(--accent-indigo);
  --accent-soft: var(--accent-indigo-soft);
  --note: hsl(30 80% 34%);
  --note-soft: hsl(40 80% 95%);
  --plate: #FFFFFF;
  --cover-plate: #FFFFFF;
  --tile-sat: 45%;
  --tile-bg-l: 92%;
  --tile-fg-l: 30%;
  --swatch-edge: hsl(225 15% 78%);
  --shadow: hsl(225 30% 10% / .14);
  --code-kw: hsl(234 60% 48%);
  --code-str: hsl(152 55% 27%);
  --code-com: hsl(225 8% 46%);
  --code-num: hsl(18 80% 38%);
  --code-var: hsl(326 60% 40%);
  --code-fn: hsl(268 45% 46%);
  --scrim: hsl(225 30% 6% / .94);
  --scrim-ink: hsl(225 25% 95%);
  --scrim-btn: hsl(225 20% 100% / .12);
  --scrim-btn-hover: hsl(225 20% 100% / .22);

  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-serif: 'Literata', Georgia, 'Times New Roman', serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-text: var(--font-serif);
  --text-size: 1.125rem;

  --measure: 40rem;
  --page: 70rem;
  --toc: 15rem;
  --radius: 10px;
  --radius-sm: 6px;
  --radius-pill: 999px;
  --ease: .2s ease;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: hsl(225 20% 8%);
    --paper-2: hsl(225 18% 11%);
    --paper-3: hsl(225 16% 16%);
    --ink: hsl(225 25% 93%);
    --ink-2: hsl(225 14% 80%);
    --muted: hsl(225 10% 63%);
    --rule: hsl(225 14% 20%);
    --accent-indigo: hsl(234 95% 77%);
    --accent-indigo-soft: hsl(234 35% 17%);
    --note: hsl(38 85% 64%);
    --note-soft: hsl(36 30% 12%);
    --plate: hsl(225 20% 90%);
    --tile-bg-l: 18%;
    --tile-fg-l: 74%;
    --swatch-edge: hsl(225 12% 40%);
    --shadow: hsl(225 40% 2% / .5);
    --code-kw: hsl(234 90% 79%);
    --code-str: hsl(150 50% 66%);
    --code-com: hsl(225 10% 58%);
    --code-num: hsl(25 90% 70%);
    --code-var: hsl(330 75% 77%);
    --code-fn: hsl(270 70% 80%);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --paper: hsl(225 20% 8%);
  --paper-2: hsl(225 18% 11%);
  --paper-3: hsl(225 16% 16%);
  --ink: hsl(225 25% 93%);
  --ink-2: hsl(225 14% 80%);
  --muted: hsl(225 10% 63%);
  --rule: hsl(225 14% 20%);
  --accent-indigo: hsl(234 95% 77%);
  --accent-indigo-soft: hsl(234 35% 17%);
  --note: hsl(38 85% 64%);
  --note-soft: hsl(36 30% 12%);
  --plate: hsl(225 20% 90%);
  --tile-bg-l: 18%;
  --tile-fg-l: 74%;
  --swatch-edge: hsl(225 12% 40%);
  --shadow: hsl(225 40% 2% / .5);
  --code-kw: hsl(234 90% 79%);
  --code-str: hsl(150 50% 66%);
  --code-com: hsl(225 10% 58%);
  --code-num: hsl(25 90% 70%);
  --code-var: hsl(330 75% 77%);
  --code-fn: hsl(270 70% 80%);
  color-scheme: dark;
}

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

/* Od 1600px strona rośnie razem z ekranem, jak przy zoomie przeglądarki: 2560px (1440p) to 130%,
   3840px (4K) to 170%. Układ jest w rem, więc skaluje się cały. Część w rem zostawia działający zoom. */
html { font-size: max(1rem, .5rem + .5vw); }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

@media (min-width: 720px) {
  body {
    padding-left: max(32px, env(safe-area-inset-left, 0px));
    padding-right: max(32px, env(safe-area-inset-right, 0px));
  }
}

img { max-width: 100%; }
button { font: inherit; }
[hidden] { display: none !important; }

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

.eyebrow,
.section-label {
  margin: 0;
  font-family: var(--font-mono);
  font-size: .75rem;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
}
.eyebrow--accent { color: var(--accent); }

/* === HEADER === */
.site-header {
  max-width: var(--page);
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.125rem;
  border-bottom: 1px solid var(--rule);
}

.brand {
  display: inline-flex;
  align-items: baseline;
  color: var(--ink);
  text-decoration: none;
  font-size: 1.125rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}
.brand__dot { color: var(--accent); }
.brand__tld {
  font-family: var(--font-mono);
  font-size: .9375rem;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--muted);
}

.nav {
  display: flex;
  align-items: center;
  gap: .125rem;
}
.nav__link {
  padding: .5rem .625rem;
  border-radius: var(--radius-pill);
  color: var(--ink-2);
  text-decoration: none;
  font-size: .9375rem;
  font-weight: 500;
}
@media (min-width: 600px) {
  .nav { gap: .25rem; }
  .nav__link { padding-inline: .875rem; }
}

.theme-toggle {
  width: 2.5rem;
  height: 2.5rem;
  margin-left: .25rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--rule);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
}
.theme-toggle svg {
  width: 1.125rem;
  height: 1.125rem;
  display: none;
}
/* Ikona pokazuje widoczny motyw tymi samymi warunkami co tokeny, więc nie czeka na JS. */
.theme-toggle [data-icon="light"],
:root[data-theme="dark"] .theme-toggle [data-icon="dark"] { display: block; }
:root[data-theme="dark"] .theme-toggle [data-icon="light"] { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle [data-icon="light"] { display: none; }
  :root:not([data-theme="light"]) .theme-toggle [data-icon="dark"] { display: block; }
}

/* === HOME === */
.home {
  max-width: var(--page);
  margin-inline: auto;
  padding-block: clamp(2.5rem, 7vw, 5rem) 4rem;
}

.intro {
  max-width: 60rem;
  display: grid;
  gap: 1.125rem;
}
.intro__title {
  margin: 0;
  font-size: clamp(2.25rem, 1.5rem + 3.4vw, 4rem);
  line-height: 1.04;
  letter-spacing: -0.04em;
  font-weight: 650;
  text-wrap: balance;
}
.intro__title:focus { outline: none; }
.intro__lead {
  margin: 0;
  max-width: 50rem;
  font-family: var(--font-text);
  font-size: clamp(1.125rem, 1rem + .45vw, 1.3125rem);
  line-height: 1.6;
  color: var(--ink-2);
}
.intro__stats {
  margin: .25rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: .25rem 1.5rem;
  font-family: var(--font-mono);
  font-size: .8125rem;
  color: var(--muted);
}

.hero {
  margin-top: clamp(2rem, 5vw, 3rem);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--paper-3);
}
.hero picture { display: block; }
/* Obraz jest 16:9; na szerokim ekranie pełny kadr spychałby wpisy pod zgięcie, więc zostaje środkowy
   pas z biurkiem. Na telefonie pas byłby za niski, żeby cokolwiek na nim rozpoznać. */
.hero img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
@media (min-width: 720px) {
  .hero img { aspect-ratio: 12 / 5; }
}
/* Baner kategorii ma 3:1 i zostaje w pełnym kadrze: postać albo motocykl stoją przy bocznej krawędzi,
   więc każde przycięcie by je ucinało. */
.hero--banner img { aspect-ratio: 3 / 1; }

.home__grid {
  margin-top: clamp(3rem, 7vw, 4.5rem);
  display: grid;
  gap: 3rem;
  grid-template-areas: "featured" "aside" "archive";
}
.featured { grid-area: featured; }
.home__aside { grid-area: aside; }
.archive { grid-area: archive; }

@media (min-width: 960px) {
  .home__grid {
    grid-template-columns: minmax(0, 1fr) 17rem;
    grid-template-areas: "featured aside" "archive aside";
    column-gap: 5rem;
    row-gap: 4rem;
  }
  .home__aside {
    align-self: start;
    position: sticky;
    top: calc(env(safe-area-inset-top, 0px) + 2rem);
  }
}

.featured {
  display: grid;
  gap: 1rem;
  min-width: 0;
}
.featured__list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--rule);
}
.teaser { border-bottom: 1px solid var(--rule); }
.teaser__link {
  display: grid;
  grid-template-columns: 6rem minmax(0, 1fr);
  align-items: start;
  gap: 1rem;
  padding-block: 1.5rem;
  color: inherit;
  text-decoration: none;
}
.teaser__body {
  display: grid;
  gap: .5rem;
  min-width: 0;
}
.teaser__thumb {
  aspect-ratio: 4 / 3;
  max-width: 100%;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--paper-3);
}
.teaser__thumb picture {
  display: block;
  height: 100%;
}
.teaser__thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--ease);
}
/* Zdjęcia produktowe na białym tle i logotypy: całe, na jasnej płytce zamiast przycięcia */
.teaser__thumb--contain {
  padding: .5rem;
  background: var(--cover-plate);
  box-shadow: inset 0 0 0 1px var(--rule);
}
.teaser__thumb--contain img { object-fit: contain; }
@media (min-width: 600px) {
  .teaser__link {
    grid-template-columns: 10rem minmax(0, 1fr);
    gap: 1.5rem;
  }
}
.teaser__meta {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .25rem 1rem;
  font-family: var(--font-mono);
  font-size: .75rem;
  color: var(--muted);
}
.teaser__title {
  margin: 0;
  font-size: clamp(1.375rem, 1.2rem + .8vw, 1.75rem);
  line-height: 1.2;
  letter-spacing: -0.025em;
  font-weight: 650;
  text-wrap: balance;
  transition: color var(--ease);
}
.teaser__excerpt {
  margin: 0;
  max-width: 38rem;
  font-family: var(--font-text);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink-2);
}

.home__aside {
  display: grid;
  gap: 2.5rem;
  min-width: 0;
}
.aside-block {
  display: grid;
  gap: 1rem;
}
.aside-text {
  margin: 0;
  font-size: .9375rem;
  line-height: 1.6;
  color: var(--ink-2);
}
.aside-text a { color: var(--accent); }

.archive {
  display: grid;
  gap: 1.25rem;
  min-width: 0;
  scroll-margin-top: 1.5rem;
}
.archive__year {
  display: grid;
  gap: .5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
}
.archive__year-label {
  margin: 0;
  font-family: var(--font-mono);
  font-size: .875rem;
  font-weight: 600;
  color: var(--ink);
}
.archive__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
}
.archive__item {
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr);
  align-items: center;
  gap: .875rem;
  padding-block: .375rem;
}
.archive__thumb {
  aspect-ratio: 4 / 3;
  max-width: 100%;
  border-radius: 4px;
  overflow: hidden;
  background: var(--paper-3);
}
.archive__thumb picture {
  display: block;
  height: 100%;
}
.archive__thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.archive__thumb--contain {
  padding: .2rem;
  background: var(--cover-plate);
  box-shadow: inset 0 0 0 1px var(--rule);
}
.archive__thumb--contain img { object-fit: contain; }
.archive__text {
  display: grid;
  gap: .125rem;
  min-width: 0;
}
.archive__title {
  color: var(--ink);
  font-size: .9375rem;
  font-weight: 500;
  line-height: 1.45;
  text-decoration: none;
}
.archive__meta {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem .75rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: .6875rem;
}
.archive__meta time { font-variant-numeric: tabular-nums; }
.archive__cat {
  letter-spacing: .06em;
  text-transform: uppercase;
}
@media (min-width: 600px) {
  .archive__year {
    grid-template-columns: 4.5rem minmax(0, 1fr);
    gap: 1rem;
  }
  .archive__item { grid-template-columns: 4rem minmax(0, 1fr); }
}

/* Kafelek wpisu bez zdjęcia: odcień i znak kategorii */
.tile {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  background: hsl(var(--tile-hue) var(--tile-sat) var(--tile-bg-l));
  color: hsl(var(--tile-hue) 55% var(--tile-fg-l));
  font-family: var(--font-mono);
  font-size: .75rem;
  font-weight: 600;
}
.teaser__thumb .tile { font-size: 1.375rem; }
.tile[data-cat="programowanie"] { --tile-hue: 190; }
.tile[data-cat="linux-i-sprzet"] { --tile-hue: 145; }
.tile[data-cat="motocykle"] { --tile-hue: 22; }
.tile[data-cat="gry"] { --tile-hue: 285; }
.tile[data-cat="rozne"] {
  --tile-hue: 225;
  --tile-sat: 14%;
}

/* === POST === */
.post { padding-block: 1.25rem 4rem; }

.post__layout {
  max-width: var(--measure);
  margin-inline: auto;
}
@media (min-width: 1100px) {
  .post__layout--toc {
    max-width: var(--page);
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--toc);
    gap: 4rem;
  }
}

.post__main {
  min-width: 0;
  container-type: inline-size;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  padding-block: .5rem;
  color: var(--muted);
  font-size: .875rem;
  font-weight: 500;
  text-decoration: none;
}

.post__header {
  max-width: var(--measure);
  margin-top: 1.5rem;
  display: grid;
  gap: 1rem;
}
.post__meta {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .25rem 1rem;
  font-family: var(--font-mono);
  font-size: .75rem;
  color: var(--muted);
}
.meta-dates { white-space: nowrap; }
.meta-arrow {
  margin-inline: .45em;
  color: var(--muted);
}
.meta-updated { color: var(--note); }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.post__title {
  margin: 0;
  font-size: clamp(2rem, 1.4rem + 2.8vw, 3.25rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
  font-weight: 650;
  text-wrap: balance;
}
.post__title:focus { outline: none; }

.facts {
  margin: .5rem 0 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-block: 1px solid var(--rule);
}
.facts__row {
  display: grid;
  gap: .25rem;
  padding: .875rem 1rem .875rem 0;
}
.facts__row:nth-child(n + 3) { border-top: 1px solid var(--rule); }
.facts dt {
  font-family: var(--font-mono);
  font-size: .6875rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.facts dd {
  margin: 0;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
@media (min-width: 640px) {
  .facts { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .facts__row:nth-child(n + 3) { border-top: 0; }
}

.archived {
  max-width: var(--measure);
  margin-top: 1.75rem;
  padding: 1rem 1.25rem;
  display: grid;
  gap: .375rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper-2);
}
.archived__label {
  margin: 0;
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.archived__text {
  margin: 0;
  color: var(--ink-2);
  font-size: .9375rem;
  line-height: 1.55;
}
.archived__text a { color: var(--accent); }

/* === TOC === */
.toc__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .125rem;
}
.toc__item a {
  display: block;
  padding-block: .3rem;
  color: var(--muted);
  font-size: .875rem;
  line-height: 1.4;
  text-decoration: none;
}
.toc__item--l3 a {
  padding-left: .875rem;
  font-size: .8125rem;
}
.toc__item a[aria-current="true"] {
  color: var(--accent);
  font-weight: 600;
}

.toc--inline {
  max-width: var(--measure);
  margin-top: 1.75rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
.toc__summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .75rem 1rem;
  list-style: none;
  cursor: pointer;
  font-size: .9375rem;
  font-weight: 600;
}
.toc__summary::-webkit-details-marker { display: none; }
.toc__summary::after {
  content: "";
  width: .5rem;
  height: .5rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  rotate: 45deg;
  translate: 0 -.15rem;
  transition: rotate var(--ease);
}
.toc--inline[open] .toc__summary::after {
  rotate: 225deg;
  translate: 0 .1rem;
}
.toc--inline .toc__list { padding: 0 1rem 1rem; }

.post__aside { display: none; }
@media (min-width: 1100px) {
  .post__layout--toc .toc--inline { display: none; }
  .post__aside {
    display: block;
    padding-top: 5.75rem;
  }
}
.toc--side {
  position: sticky;
  top: calc(env(safe-area-inset-top, 0px) + 2rem);
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
  display: grid;
  gap: .75rem;
}

/* === PROSE === */
.prose {
  max-width: var(--measure);
  margin-top: 2.25rem;
  font-family: var(--font-text);
  font-size: var(--text-size);
  line-height: 1.75;
  color: var(--ink-2);
  hyphens: auto;
  overflow-wrap: break-word;
}
.prose > * { margin-block: 0; }
.prose > * + * { margin-top: 1.25em; }
.prose::after {
  content: "";
  display: table;
  clear: both;
}

.prose h2,
.prose h3 {
  clear: both;
  font-family: var(--font-sans);
  color: var(--ink);
  text-wrap: balance;
  hyphens: manual;
  scroll-margin-top: 1.5rem;
}
.prose h2 {
  margin-top: 2.25em;
  font-size: 1.625rem;
  line-height: 1.2;
  letter-spacing: -0.025em;
  font-weight: 650;
}
.prose h3 {
  margin-top: 2em;
  font-size: 1.25rem;
  line-height: 1.3;
  letter-spacing: -0.015em;
  font-weight: 650;
}
.prose h2 + *,
.prose h3 + * { margin-top: .75em; }

.prose a {
  color: var(--accent);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .2em;
  text-decoration-color: var(--accent);
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
}
.prose strong {
  font-weight: 650;
  color: var(--ink);
}
.prose ul,
.prose ol { padding-left: 1.25em; }
.prose li + li { margin-top: .35em; }
.prose li::marker { color: var(--accent); }
.prose abbr[title] {
  text-decoration: underline dotted;
  text-underline-offset: .2em;
  cursor: help;
}
.prose sup { line-height: 0; }
.prose blockquote {
  margin-inline: 0;
  padding-left: 1.25em;
  border-left: 3px solid var(--rule);
  color: var(--muted);
}
.prose blockquote > * { margin-block: 0; }
.prose blockquote > * + * { margin-top: 1em; }
.prose :not(pre) > code {
  padding: .12em .35em;
  border-radius: 4px;
  background: var(--paper-3);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: .82em;
  overflow-wrap: anywhere;
  hyphens: none;
}

.wide { width: 100%; }
@supports (width: 1cqi) {
  .prose > .wide { width: 100cqi; }
}

/* === FIGURES & GALLERY === */
.figure {
  margin-inline: 0;
  display: grid;
  gap: .5rem;
}
/* Obraz nie rośnie ponad swój rozmiar: zdjęcia i logotypy ze starszych wpisów mają po 50-300 px. */
.figure__link {
  display: block;
  justify-self: start;
  max-width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--paper-2);
  cursor: zoom-in;
}
/* Grafika z przezroczystym tłem (np. naklejka) stoi wprost na stronie, bo płytka odcina jej kontur. */
.figure--transparent .figure__link { background: none; }
.figure picture,
.gallery__item picture { display: block; }
.figure img {
  display: block;
  max-width: 100%;
  height: auto;
}
.figure figcaption {
  font-family: var(--font-sans);
  font-size: .8125rem;
  line-height: 1.45;
  color: var(--muted);
  hyphens: manual;
}
@media (min-width: 600px) {
  .figure--right,
  .figure--left {
    width: fit-content;
    max-width: min(46%, 19rem);
  }
  .figure--right {
    float: right;
    margin: .4em 0 1em 1.75rem;
  }
  .figure--left {
    float: left;
    margin: .4em 1.75rem 1em 0;
  }
  .prose > .figure--right + *,
  .prose > .figure--left + * { margin-top: 0; }
}

.gallery {
  --cols: 3;
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  gap: .5rem;
}
.gallery[data-count="1"] {
  --cols: 1;
  max-width: 17rem;
}
.gallery[data-count="2"],
.gallery[data-count="4"] { --cols: 2; }
@media (min-width: 600px) {
  .gallery[data-count="4"] { --cols: 4; }
}
.gallery__item {
  display: block;
  aspect-ratio: 1;
  max-width: 100%;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--paper-3);
  cursor: zoom-in;
}
.gallery__item picture { height: 100%; }
.gallery__item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--ease);
}
.gallery[data-count="1"] .gallery__item { aspect-ratio: auto; }
.gallery[data-count="1"] .gallery__item img { height: auto; }

/* Porównanie wersji: obrazy w całości, na telefonie jeden pod drugim, żeby oba mieściły się na ekranie. */
.gallery.gallery--compare { --cols: 1; }
@media (min-width: 600px) {
  .gallery.gallery--compare { --cols: 2; }
}
.gallery--compare .gallery__item { aspect-ratio: auto; }
.gallery--compare .gallery__item img { height: auto; }


/* === CODE === */
.code {
  margin-inline: 0;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper-2);
  overflow: hidden;
  hyphens: none;
}
.code__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .3rem .375rem .3rem 1rem;
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: .6875rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.code__copy {
  padding: .3rem .7rem;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}
.code__pre {
  margin: 0;
  padding: 1rem 1.125rem;
  overflow-x: auto;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: .8125rem;
  line-height: 1.65;
  tab-size: 4;
}
.code__pre code { font: inherit; }
@media (min-width: 600px) {
  .code__pre { font-size: .875rem; }
}

/* === ANIMATIONS === */
/* Kadr i przyciski dokłada public/js/anim.js, sceny rysują w SVG na tych samych tokenach co reszta strony. */
.anim {
  margin-inline: 0;
  display: grid;
  gap: .5rem;
}
.anim__stage {
  position: relative;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper-2);
  overflow: hidden;
  hyphens: none;
}
.anim__stage > svg {
  display: block;
  width: 100%;
  height: auto;
  font-family: var(--font-sans);
}
.anim__fallback {
  margin: 0;
  padding: 2.5rem 1.25rem;
  font-family: var(--font-sans);
  font-size: .875rem;
  color: var(--muted);
  text-align: center;
}
.anim__bar {
  display: flex;
  align-items: center;
  gap: .75rem;
  font-family: var(--font-sans);
  font-size: .8125rem;
}
.anim__play,
.anim__sound {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .4rem .9rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-pill);
  background: var(--paper);
  color: var(--ink-2);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--ease), border-color var(--ease);
}
.anim__play {
  min-width: 7.5rem;
  justify-content: center;
  border-color: var(--accent);
  background: var(--accent);
  color: var(--paper);
}
.anim__play:hover { background: color-mix(in srgb, var(--accent) 85%, var(--ink)); }
.anim__play[data-state="playing"] {
  background: var(--paper);
  color: var(--accent);
}
.anim__sound:hover { background: var(--paper-3); }
.anim__sound svg {
  width: 1.1rem;
  height: 1.1rem;
}
.anim__sound .anim__mute,
.anim__sound[aria-pressed="false"] .anim__waves { display: none; }
.anim__sound[aria-pressed="false"] .anim__mute { display: inline; }
.anim__sound[aria-pressed="false"] { color: var(--muted); }
.anim__progress {
  flex: 1;
  height: 3px;
  border-radius: var(--radius-pill);
  background: var(--rule);
  overflow: hidden;
}
.anim__progress::before {
  content: '';
  display: block;
  height: 100%;
  background: var(--accent);
  transform: scaleX(var(--p, 0));
  transform-origin: left;
}
.anim figcaption {
  font-family: var(--font-sans);
  font-size: .8125rem;
  line-height: 1.45;
  color: var(--muted);
  hyphens: manual;
}

/* === UPDATE === */
.update {
  clear: both;
  display: grid;
  gap: 1em;
  padding: 1.25rem 1.25rem 1.375rem;
  border-radius: var(--radius);
  background: var(--note-soft);
  scroll-margin-top: 1.5rem;
}
.update > * { margin: 0; }
.update .code { background: var(--paper); }
.update__label {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem .75rem;
  color: var(--note);
  font-family: var(--font-mono);
  font-size: .75rem;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.update__label span:first-child { font-weight: 600; }
.update__label span + span::before {
  content: "·";
  margin-right: .75rem;
}
@media (min-width: 600px) {
  .update { padding: 1.5rem 1.75rem 1.75rem; }
}

/* === TABLES === */
.table-wrap {
  clear: both;
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  color: var(--ink-2);
  font-family: var(--font-sans);
  font-size: .8125rem;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
}
.prose th,
.prose td {
  padding: .5rem .5rem;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}
.prose tbody tr:last-child > * { border-bottom: 0; }
.prose thead th {
  background: var(--paper-2);
  color: var(--ink);
  font-size: .75rem;
  font-weight: 600;
}
@media (min-width: 600px) {
  .prose table { font-size: .9375rem; }
  .prose th,
  .prose td { padding: .55rem .75rem; }
  .prose thead th { font-size: .8125rem; }
}

.spec th[scope="row"],
.spec th[scope="rowgroup"] {
  color: var(--muted);
  font-weight: 500;
}
.spec th[scope="rowgroup"] { border-right: 1px solid var(--rule); }
.spec td { color: var(--ink); }
.spec .spec__group {
  padding-top: 1.125rem;
  background: var(--paper-2);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: .6875rem;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.paint th,
.paint td { vertical-align: middle; }
.paint th[scope="row"] {
  color: var(--ink);
  font-family: var(--font-mono);
  font-weight: 500;
}
.paint code,
.chip code {
  font-family: var(--font-mono);
  font-size: .8125rem;
}
.chips {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .375rem .75rem;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
}
.chip--none,
.paint__unknown {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: .75rem;
}
.swatch {
  display: inline-block;
  flex: none;
  width: 1rem;
  height: 1rem;
  border-radius: 4px;
  background: var(--swatch);
  box-shadow: inset 0 0 0 1px var(--swatch-edge);
  vertical-align: middle;
}

.notes {
  display: grid;
  gap: .25rem;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: .8125rem;
  line-height: 1.5;
}
.notes p { margin: 0; }
.prose > .table-wrap + .notes { margin-top: .75em; }

/* === POST FOOTER === */
.post__footer {
  max-width: var(--measure);
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  display: grid;
  gap: 1rem;
}
.pager {
  display: grid;
  gap: .75rem;
}
.pager__link {
  display: grid;
  gap: .375rem;
  padding: 1rem 1.125rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
  transition: border-color var(--ease);
}
.pager__title {
  color: var(--ink);
  font-weight: 600;
  line-height: 1.3;
}
@media (min-width: 600px) {
  .pager { grid-template-columns: 1fr 1fr; }
  .pager__link--next { text-align: right; }
}

/* === FOOTER === */
.site-footer {
  max-width: var(--page);
  margin-inline: auto;
  padding-block: 2rem 5.5rem;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .5rem 2rem;
  color: var(--muted);
  font-size: .875rem;
}
.site-footer p { margin: 0; }
.site-footer a { color: var(--ink-2); }

/* === LIGHTBOX === */
.lightbox {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--scrim);
  color: var(--scrim-ink);
}
.lightbox[open] {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
}
.lightbox::backdrop { background: transparent; }
html:has(.lightbox[open]) { overflow: hidden; }

.lightbox__stage {
  display: grid;
  place-items: center;
  min-height: 0;
  padding: calc(env(safe-area-inset-top, 0px) + 4rem) max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
  touch-action: pan-y;
}
.lightbox__stage picture { display: contents; }
.lightbox__img {
  max-width: 100%;
  max-height: calc(100vh - 9.5rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  max-height: calc(100dvh - 9.5rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  width: auto;
  height: auto;
  border-radius: var(--radius-sm);
  user-select: none;
  -webkit-user-drag: none;
}
.lightbox__bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem max(16px, env(safe-area-inset-right, 0px)) calc(1.25rem + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  font-size: .875rem;
}
.lightbox__caption { margin: 0; }
.lightbox__count {
  margin: 0;
  font-family: var(--font-mono);
  font-size: .75rem;
  opacity: .75;
  white-space: nowrap;
}
.lightbox__btn {
  position: absolute;
  width: 2.75rem;
  height: 2.75rem;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--scrim-btn);
  color: var(--scrim-ink);
  cursor: pointer;
}
.lightbox__btn svg {
  width: 1.25rem;
  height: 1.25rem;
}
.lightbox__btn--close {
  top: calc(env(safe-area-inset-top, 0px) + .75rem);
  right: max(12px, env(safe-area-inset-right, 0px));
}
.lightbox__btn--prev,
.lightbox__btn--next {
  top: 50%;
  translate: 0 -50%;
}
.lightbox__btn--prev { left: max(12px, env(safe-area-inset-left, 0px)); }
.lightbox__btn--next { right: max(12px, env(safe-area-inset-right, 0px)); }
.lightbox--single .lightbox__btn--prev,
.lightbox--single .lightbox__btn--next,
.lightbox--single .lightbox__count { display: none; }

/* === PAGE HEADER === */
.page-header {
  max-width: 46rem;
  display: grid;
  gap: .75rem;
}
.page-header__title {
  margin: 0;
  font-size: clamp(2rem, 1.4rem + 2.8vw, 3.25rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
  font-weight: 650;
  text-wrap: balance;
}
.page-header__lead {
  margin: 0;
  color: var(--ink-2);
  font-family: var(--font-text);
  font-size: 1.125rem;
  line-height: 1.6;
}
.page-header__lead a { color: var(--accent); }

/* === CATEGORY NAV === */
.cat-nav {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}
@media (min-width: 960px) {
  .cat-nav { flex-direction: column; }
}
.cat-nav__link {
  display: inline-flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .875rem;
  padding: .5rem .875rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-pill);
  color: var(--ink-2);
  font-size: .875rem;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
}
.cat-nav__link span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: .75rem;
}
.cat-nav__link[aria-current="page"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.cat-nav__link[aria-current="page"] span { color: inherit; }

/* === HIGHLIGHT === */
/* Klasy z tempest/highlight, kolory z tokenów, żeby kod działał w obu motywach. */
.code .hl-keyword,
.code .hl-operator { color: var(--code-kw); }
.code .hl-value,
.code .hl-literal { color: var(--code-str); }
.code .hl-comment {
  color: var(--code-com);
  font-style: italic;
}
.code .hl-number { color: var(--code-num); }
.code .hl-variable,
.code .hl-property { color: var(--code-var); }
.code .hl-type,
.code .hl-attribute,
.code .hl-generic { color: var(--code-fn); }
.code .hl-addition { color: var(--code-str); }
.code .hl-deletion { color: var(--code-num); }

/* Logotypy w treści stoją na jasnej płytce, bo większość z nich nie ma wersji na ciemne tło. */
.prose img.logo {
  box-sizing: content-box;
  height: 2.25rem;
  width: auto;
  margin: 0 .5rem .5rem 0;
  padding: .75rem 1rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--plate);
  vertical-align: middle;
}

/* === HOVER === */
@media (hover: hover) {
  .nav__link:hover {
    background: var(--paper-2);
    color: var(--ink);
  }
  .theme-toggle:hover {
    border-color: var(--muted);
    color: var(--ink);
  }
  .teaser__link:hover .teaser__title { color: var(--accent); }
  .teaser__link:hover .teaser__thumb img { transform: scale(1.04); }
  .archive__title:hover {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: .2em;
  }
  .cat-nav__link:hover { border-color: var(--muted); }
  .page-header__lead a:hover { text-decoration-thickness: 2px; }
  .back:hover,
  .toc__item a:hover { color: var(--ink); }
  .prose a:hover {
    text-decoration-thickness: 2px;
    text-decoration-color: var(--accent);
  }
  .gallery__item:hover img { transform: scale(1.03); }
  .code__copy:hover {
    border-color: var(--rule);
    background: var(--paper);
  }
  .pager__link:hover { border-color: var(--accent); }
  .lightbox__btn:hover { background: var(--scrim-btn-hover); }
}

/* === ANIMATIONS === */
/* To samo mrugnięcie co kropka w stopce synektra.pl: dwa szybkie błyski w cyklu 4 s */
.flicker { animation: flicker-1 4s linear infinite both; }

@keyframes flicker-1 {
  0%, 100% { opacity: 1; }
  41.99%   { opacity: 1; }
  42%      { opacity: 0; }
  43%      { opacity: 0; }
  43.01%   { opacity: 1; }
  47.99%   { opacity: 1; }
  48%      { opacity: 0; }
  49%      { opacity: 0; }
  49.01%   { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .flicker { animation: none; }
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}
