/* ============================================================
   goruk.pl — „żywy system"
   Statyczny HTML + nowoczesny CSS + odrobina vanilla JS.
   Zero zależności, zero śledzenia, zero webfontów.

   Spis:
   0.  Tokeny (oklch + light-dark())
   1.  Reset i baza
   2.  Tło systemowe (siatka, aurora, ziarno) — parallaks scroll-driven
   3.  Nagłówek, nawigacja, pasek postępu
   4.  Panele HUD i chipy statusów
   5.  Hero + obserwatorium
   6.  Sekcje, kickery, siatki
   7.  Karty projektów + glify
   8.  Podstrony: page-head, prose, metryczka, kroki, not-block
   9.  Wizualizacje (viz)
   10. Przyciski, callout, kontakt, stopka
   11. Animacje wejścia (scroll-driven + fallback)
   12. View Transitions
   13. Utilities, a11y, reduced motion
   ============================================================ */

/* 0. TOKENY ------------------------------------------------- */
:root {
  color-scheme: light dark;

  /* powierzchnie */
  --bg0:    light-dark(oklch(97.6% 0.005 100), oklch(14.5% 0.018 256));
  --bg1:    light-dark(oklch(99% 0.003 100),   oklch(17.5% 0.02 254));
  --panel:  light-dark(oklch(99.4% 0.002 100 / .82), oklch(20% 0.022 252 / .55));
  --panel-solid: light-dark(oklch(99.2% 0.003 100), oklch(19% 0.021 253));

  /* atrament */
  --ink:      light-dark(oklch(24% 0.02 258),  oklch(93.5% 0.008 250));
  --ink-soft: light-dark(oklch(45% 0.015 258), oklch(74% 0.014 250));
  --ink-dim:  light-dark(oklch(58% 0.012 258), oklch(58% 0.014 250));

  /* linie */
  --line:      light-dark(oklch(86% 0.008 100), oklch(32% 0.02 252 / .55));
  --line-soft: light-dark(oklch(90% 0.006 100), oklch(28% 0.02 252 / .4));

  /* akcenty */
  --accent:   light-dark(oklch(51% 0.115 225), oklch(80% 0.125 205));
  --accent-2: light-dark(oklch(62% 0.13 75),   oklch(83% 0.125 85));
  --ok:       light-dark(oklch(56% 0.14 155),  oklch(78% 0.15 155));
  --warn:     light-dark(oklch(62% 0.13 75),   oklch(80% 0.13 80));
  --violet:   light-dark(oklch(55% 0.12 300),  oklch(68% 0.14 300));

  --glow: color-mix(in oklch, var(--accent) 55%, transparent);

  /* typografia — bez webfontów */
  --sans: ui-sans-serif, system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", "Fira Code", Consolas, monospace;

  --fs-hero: clamp(2.05rem, 1.15rem + 3.5vw, 3.6rem);
  --fs-h1:   clamp(1.9rem, 1.2rem + 3vw, 3.1rem);
  --fs-h2:   clamp(1.35rem, 1.05rem + 1.4vw, 2rem);
  --fs-h3:   1.12rem;
  --fs-lead: clamp(1.02rem, .95rem + .35vw, 1.2rem);
  --fs-sm:   .9rem;
  --fs-xs:   .78rem;

  --sp-2xs: .375rem; --sp-xs: .625rem; --sp-sm: 1rem; --sp-md: 1.6rem;
  --sp-lg: 2.6rem; --sp-xl: 4.2rem; --sp-2xl: 6.4rem;

  --r-sm: 8px; --r-md: 14px; --r-lg: 20px;
  --container: 1180px;
  --header-h: 64px;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
}

/* przełącznik motywu = jedna właściwość */
html[data-theme="light"] { color-scheme: light; }
html[data-theme="dark"]  { color-scheme: dark; }

/* kąt animowanej obwódki paneli */
@property --spin {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

/* 1. RESET I BAZA ------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg0);
  min-height: 100svh;
  text-rendering: optimizeLegibility;
}

img, svg, canvas { display: block; max-width: 100%; }
input, button, select { font: inherit; color: inherit; }

h1, h2, h3, h4 {
  line-height: 1.15;
  font-weight: 650;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
p { text-wrap: pretty; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

::selection { background: color-mix(in oklch, var(--accent) 30%, transparent); }

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

.skip-link {
  position: absolute; left: -999px; top: 8px; z-index: 100;
  background: var(--accent); color: var(--bg0);
  padding: .5rem 1rem; border-radius: var(--r-sm); font-weight: 600;
}
.skip-link:focus { left: 8px; }

.container {
  width: min(100% - 2.5rem, var(--container));
  margin-inline: auto;
}

/* 2. TŁO SYSTEMOWE ------------------------------------------ */
/* trzy stałe warstwy: siatka inżynierska, aurora, ziarno */
body::before {
  content: "";
  position: fixed; inset: -10% 0;
  z-index: -2;
  pointer-events: none;
  background:
    repeating-linear-gradient(to right,
      color-mix(in oklch, var(--ink) 6%, transparent) 0 1px, transparent 1px 72px),
    repeating-linear-gradient(to bottom,
      color-mix(in oklch, var(--ink) 6%, transparent) 0 1px, transparent 1px 72px);
  mask-image: radial-gradient(120% 90% at 50% 0%, black 30%, transparent 78%);
  opacity: .5;
}

body::after {
  content: "";
  position: fixed; inset: -20%;
  z-index: -3;
  pointer-events: none;
  background:
    radial-gradient(46% 38% at 16% 6%,
      color-mix(in oklch, var(--accent) 9%, transparent), transparent 70%),
    radial-gradient(42% 36% at 88% 18%,
      color-mix(in oklch, var(--violet) 7%, transparent), transparent 70%),
    radial-gradient(50% 44% at 60% 108%,
      color-mix(in oklch, var(--accent-2) 5%, transparent), transparent 72%);
}

/* delikatny parallaks warstw sterowany przewijaniem — czysty CSS */
@supports (animation-timeline: scroll()) {
  body::before {
    animation: bg-drift linear both;
    animation-timeline: scroll(root);
  }
  body::after {
    animation: aurora-drift linear both;
    animation-timeline: scroll(root);
  }
  @keyframes bg-drift   { to { translate: 0 -140px; } }
  @keyframes aurora-drift{ to { translate: 0 6%; rotate: 1.2deg; } }
}

/* ziarno */
.grain {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  opacity: light-dark(.30, .42);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='linear' slope='0.05'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* 3. NAGŁÓWEK ----------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  border-bottom: 1px solid transparent;
  transition: border-color .3s, background-color .3s;
}
html[data-scrolled="true"] .site-header {
  background: color-mix(in oklch, var(--bg0) 72%, transparent);
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  border-bottom-color: var(--line-soft);
}

/* pasek postępu czytania — scroll-driven, bez JS */
.progress {
  position: absolute; left: 0; bottom: -1px; height: 2px; width: 100%;
  transform-origin: 0 50%; scale: 0 1;
  background: linear-gradient(90deg, var(--accent), var(--violet));
}
@supports (animation-timeline: scroll()) {
  .progress {
    animation: grow linear both;
    animation-timeline: scroll(root);
  }
  @keyframes grow { to { scale: 1 1; } }
}

.nav {
  display: flex; align-items: center; gap: var(--sp-md);
  min-height: var(--header-h);
}

.brand {
  display: flex; flex-direction: column; line-height: 1.15;
  color: var(--ink); text-decoration: none;
  view-transition-name: brand;
}
.brand:hover { text-decoration: none; }
.brand b { font-weight: 700; letter-spacing: -0.01em; }
.brand span {
  font-family: var(--mono); font-size: var(--fs-xs); color: var(--ink-dim);
  display: inline-flex; align-items: center; gap: .45em;
}
.brand span::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 8px color-mix(in oklch, var(--ok) 70%, transparent);
  animation: pulse 2.6s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .35; } }

.nav-links {
  display: flex; gap: .25rem; margin-left: auto;
}
.nav-links a {
  color: var(--ink-soft); font-size: var(--fs-sm); font-weight: 500;
  padding: .45rem .8rem; border-radius: 999px;
  transition: color .2s, background-color .2s;
}
.nav-links a:hover { color: var(--ink); text-decoration: none;
  background: color-mix(in oklch, var(--ink) 7%, transparent); }
.nav-links a[aria-current="page"] {
  color: var(--accent);
  background: color-mix(in oklch, var(--accent) 12%, transparent);
}

.nav-actions { display: flex; align-items: center; gap: .4rem; }

.theme-toggle, .nav-toggle {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line); background: transparent;
  color: var(--ink-soft); cursor: pointer;
  transition: color .2s, border-color .2s, transform .2s;
}
.theme-toggle:hover, .nav-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle:active { transform: rotate(40deg); }
.theme-toggle svg, .nav-toggle svg { width: 18px; height: 18px; }
.icon-sun { display: none; }
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .icon-sun { display: block; }
  html:not([data-theme="light"]) .icon-moon { display: none; }
}
html[data-theme="dark"] .icon-sun { display: block; }
html[data-theme="dark"] .icon-moon { display: none; }

.nav-toggle { display: none; }

@media (max-width: 860px) {
  .nav-toggle { display: inline-grid; }
  .nav-links {
    position: absolute; top: calc(100% + 10px); right: 1.25rem;
    flex-direction: column; min-width: 230px;
    padding: .6rem; border-radius: var(--r-md);
    background: var(--panel-solid);
    border: 1px solid var(--line);
    box-shadow: 0 18px 50px -12px rgb(0 0 0 / .45);
    display: none;
  }
  [data-nav-open="true"] .nav-links {
    display: flex;
    transition: opacity .25s var(--ease-out), translate .25s var(--ease-out);
    @starting-style { opacity: 0; translate: 0 -8px; }
  }
  .nav-links a { padding: .6rem .9rem; border-radius: var(--r-sm); }
}

/* 4. PANELE HUD --------------------------------------------- */
.panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
/* narożne znaczniki HUD */
.panel.corners::before, .panel.corners::after {
  content: ""; position: absolute; width: 14px; height: 14px;
  border: 1.5px solid color-mix(in oklch, var(--accent) 75%, transparent);
  pointer-events: none;
}
.panel.corners::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; border-radius: 6px 0 0 0; }
.panel.corners::after  { bottom: -1px; right: -1px; border-left: 0; border-top: 0; border-radius: 0 0 6px 0; }

.tick {
  font-family: var(--mono); font-size: var(--fs-xs);
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-dim);
}

/* chip statusu z pulsującą diodą */
.status {
  display: inline-flex; align-items: center; gap: .5em;
  font-family: var(--mono); font-size: var(--fs-xs);
  letter-spacing: .05em;
  padding: .3rem .7rem; border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--ink-soft); white-space: nowrap;
}
.status::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--dot, var(--ink-dim));
  box-shadow: 0 0 8px color-mix(in oklch, var(--dot, var(--ink-dim)) 70%, transparent);
  animation: pulse 2.4s ease-in-out infinite;
}
.status[data-kind="active"] { --dot: var(--ok); color: color-mix(in oklch, var(--ok) 70%, var(--ink)); border-color: color-mix(in oklch, var(--ok) 35%, var(--line)); }
.status[data-kind="edu"]    { --dot: var(--accent); color: color-mix(in oklch, var(--accent) 70%, var(--ink)); border-color: color-mix(in oklch, var(--accent) 35%, var(--line)); }
.status[data-kind="demo"]   { --dot: var(--violet); color: color-mix(in oklch, var(--violet) 70%, var(--ink)); border-color: color-mix(in oklch, var(--violet) 35%, var(--line)); }
.status[data-kind="bono"]   { --dot: var(--warn); color: color-mix(in oklch, var(--warn) 75%, var(--ink)); border-color: color-mix(in oklch, var(--warn) 35%, var(--line)); }

/* 5. HERO + OBSERWATORIUM ----------------------------------- */
.hero { padding: clamp(3rem, 8vh, 5.5rem) 0 var(--sp-xl); }

.hero-grid {
  display: grid; gap: var(--sp-lg);
  grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
  align-items: center;
}
@media (max-width: 940px) { .hero-grid { grid-template-columns: 1fr; } }

.sysline {
  display: inline-flex; flex-wrap: wrap; align-items: center; gap: .7em;
  font-family: var(--mono); font-size: var(--fs-xs);
  color: var(--ink-dim); letter-spacing: .08em;
  border: 1px solid var(--line); border-radius: 999px;
  padding: .4rem .9rem; margin-bottom: var(--sp-md);
}
.sysline b { color: var(--ok); font-weight: 600; }
.sysline .sep { opacity: .4; }
.sysline::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 10px color-mix(in oklch, var(--ok) 80%, transparent);
  animation: pulse 2.2s ease-in-out infinite;
}

.hero h1 {
  font-size: var(--fs-hero);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: var(--sp-md);
}
.hero h1 .grad {
  background: linear-gradient(92deg, var(--accent), var(--violet) 90%);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}

.kicker {
  font-family: var(--mono); font-size: var(--fs-xs);
  letter-spacing: .16em; text-transform: uppercase;
  color: var(--accent); margin-bottom: var(--sp-xs);
}
.kicker .section-num { color: var(--ink-dim); margin-right: .6em; }

.lead {
  font-size: var(--fs-lead); color: var(--ink-soft);
  max-width: 62ch;
}

.hero-note { margin-top: var(--sp-md); font-size: var(--fs-sm); color: var(--ink-dim); max-width: 58ch; }

/* obserwatorium — panel z canvasem */
.observatory { padding: var(--sp-sm); }
.observatory .obs-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: .2rem .4rem .7rem;
}
.observatory canvas { width: 100%; height: auto; border-radius: var(--r-sm); cursor: crosshair; }
.obs-fallback { padding: .4rem; }
.obs-fallback ul { list-style: none; padding: 0; display: grid; gap: .45rem; }
.obs-fallback li { display: flex; justify-content: space-between; gap: 1rem; font-family: var(--mono); font-size: var(--fs-sm); }
.obs-legend {
  display: flex; justify-content: space-between; align-items: center;
  padding: .7rem .4rem .2rem;
  font-family: var(--mono); font-size: var(--fs-xs); color: var(--ink-dim);
}
.obs-legend output { color: var(--accent); }
html.js .obs-fallback { display: none; }

/* 6. SEKCJE ------------------------------------------------- */
.section { padding: var(--sp-xl) 0; }
.section-head { max-width: 70ch; margin-bottom: var(--sp-lg); }
.section-head h2 { font-size: var(--fs-h2); margin-bottom: var(--sp-xs); }

.grid { display: grid; gap: var(--sp-sm); }
.features-grid { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 940px) { .features-grid, .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .features-grid, .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.feature {
  position: relative; padding: var(--sp-md);
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: clip;
}
.feature .num {
  font-family: var(--mono); font-size: var(--fs-xs);
  color: var(--accent); letter-spacing: .1em;
}
.feature h3 { font-size: var(--fs-h3); margin: .5rem 0 .45rem; }
.feature p { font-size: var(--fs-sm); color: var(--ink-soft); }
.feature-secondary-action { display: grid; place-items: center; background: transparent; border-style: dashed; }

/* 7. KARTY PROJEKTÓW ---------------------------------------- */
.card {
  container-type: inline-size;
  position: relative;
  display: flex; flex-direction: column; gap: .6rem;
  padding: var(--sp-md);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--ink); text-decoration: none;
  overflow: clip;
  transition: transform .35s var(--ease-out), border-color .35s, box-shadow .35s;
}
.card:hover {
  text-decoration: none;
  transform: translateY(-4px);
  border-color: color-mix(in oklch, var(--accent) 45%, var(--line));
  box-shadow:
    0 20px 50px -18px rgb(0 0 0 / .5),
    0 0 0 1px color-mix(in oklch, var(--accent) 25%, transparent) inset;
}
/* skan przelatujący po karcie */
.card::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 42%,
    color-mix(in oklch, var(--accent) 13%, transparent) 50%, transparent 58%);
  translate: -120% 0;
  pointer-events: none;
}
.card:hover::after { transition: translate .9s var(--ease-out); translate: 120% 0; }

.card-top { display: flex; justify-content: space-between; align-items: center; gap: .6rem; }
.card-index { font-family: var(--mono); font-size: var(--fs-xs); color: var(--ink-dim); letter-spacing: .12em; }
.card h3 { font-size: 1.3rem; }
.card > p { font-size: var(--fs-sm); color: var(--ink-soft); flex: 1; }

.card-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  border-top: 1px dashed var(--line); padding-top: .8rem; margin-top: .4rem;
}
.card-domain { font-family: var(--mono); font-size: var(--fs-xs); color: var(--ink-dim); }
.card-go {
  display: inline-flex; align-items: center; gap: .4em;
  font-size: var(--fs-sm); font-weight: 600; color: var(--accent);
}
.card-go svg { width: 15px; height: 15px; transition: translate .25s var(--ease-out); }
.card:hover .card-go svg { translate: 4px 0; }

@container (max-width: 330px) {
  .card-foot { flex-direction: column; align-items: flex-start; gap: .4rem; }
}

.more-card { border-style: dashed; background: transparent; }

/* glify projektów — mini-diagramy CSS, bez JS */
.glyph { height: 46px; margin-top: .2rem; color: var(--accent); }
.glyph svg { height: 100%; width: auto; overflow: visible; }

.g-seq rect { opacity: .25; animation: g-seq 3.2s infinite; }
.g-seq rect:nth-child(2) { animation-delay: .4s; }
.g-seq rect:nth-child(3) { animation-delay: .8s; }
.g-seq rect:nth-child(4) { animation-delay: 1.2s; }
.g-seq rect:nth-child(5) { animation-delay: 1.6s; }
@keyframes g-seq { 0%,100% { opacity: .25; } 18% { opacity: 1; } }

.g-bars rect { transform-box: fill-box; transform-origin: bottom; animation: g-bars 3s ease-in-out infinite; }
.g-bars rect:nth-child(2) { animation-delay: .5s; }
.g-bars rect:nth-child(3) { animation-delay: 1s; }
@keyframes g-bars { 0%,100% { transform: scaleY(.45); } 50% { transform: scaleY(1); } }

.g-flow circle { animation: g-flow 3s linear infinite; }
.g-flow circle:nth-child(2) { animation-delay: 1s; }
.g-flow circle:nth-child(3) { animation-delay: 2s; }
@keyframes g-flow { to { transform: translateX(98px); opacity: 0; } }

.g-orbit .orb { transform-origin: 33px 23px; animation: g-orbit 4.5s linear infinite; }
@keyframes g-orbit { to { transform: rotate(360deg); } }

.g-merge circle { animation: g-merge 3.4s ease-in-out infinite; }
.g-merge circle:nth-child(2) { animation-delay: .3s; }
.g-merge circle:nth-child(3) { animation-delay: .6s; }
@keyframes g-merge { 0%,100% { opacity: .3; } 40% { opacity: 1; } }

/* 8. PODSTRONY ---------------------------------------------- */
.page-head { padding: clamp(2.5rem, 6vh, 4rem) 0 var(--sp-md); }
.page-head h1 { font-size: var(--fs-h1); margin-bottom: var(--sp-sm); }

.breadcrumb {
  font-family: var(--mono); font-size: var(--fs-xs);
  color: var(--ink-dim); margin-bottom: var(--sp-md);
}
.breadcrumb a { color: var(--ink-dim); }
.breadcrumb a:hover { color: var(--accent); }

.project-layout {
  display: grid; gap: var(--sp-lg);
  grid-template-columns: minmax(0, 1.6fr) minmax(260px, .8fr);
  align-items: start;
  padding-bottom: var(--sp-xl);
}
@media (max-width: 860px) { .project-layout { grid-template-columns: 1fr; } }

.prose { max-width: 68ch; }
.prose p + p, .prose p + h2, .prose h2 + p { margin-top: var(--sp-sm); }
.prose h2 { font-size: 1.35rem; margin-top: var(--sp-lg); }
.prose-wide { max-width: 80ch; }
.prose-wide > p + p { margin-top: var(--sp-sm); }

.bullets { padding-left: 1.2rem; }
.bullets li { margin: .3rem 0; color: var(--ink-soft); }
.bullets li::marker { color: var(--accent); }

.metryczka {
  position: sticky; top: calc(var(--header-h) + 20px);
  padding: var(--sp-md);
  font-size: var(--fs-sm);
}
.metryczka h2 {
  font-family: var(--mono); font-size: var(--fs-xs);
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-dim); font-weight: 600; margin-bottom: var(--sp-sm);
}
.metryczka dl { display: grid; gap: .7rem; }
.metryczka div { display: grid; grid-template-columns: 86px 1fr; gap: .8rem; }
.metryczka dt { font-family: var(--mono); font-size: var(--fs-xs); color: var(--ink-dim); padding-top: .15em; }
.metryczka dd { color: var(--ink-soft); }
.metryczka .tags { display: flex; flex-wrap: wrap; gap: .35rem; }
.metryczka .tags span {
  font-family: var(--mono); font-size: var(--fs-xs);
  border: 1px solid var(--line); border-radius: 999px; padding: .12rem .55rem;
  color: var(--ink-soft);
}

.steps { display: grid; gap: 0; counter-reset: step; }
.step {
  position: relative;
  display: grid; grid-template-columns: 52px 1fr; gap: var(--sp-sm);
  padding: var(--sp-md) 0;
  border-bottom: 1px dashed var(--line);
}
.step:last-child { border-bottom: 0; }
.step::before {
  counter-increment: step;
  content: counter(step, decimal-leading-zero);
  font-family: var(--mono); color: var(--accent); font-size: var(--fs-sm);
  border: 1px solid color-mix(in oklch, var(--accent) 40%, var(--line));
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
}
.step h3 { font-size: var(--fs-h3); margin-bottom: .3rem; }
.step p { font-size: var(--fs-sm); color: var(--ink-soft); }

.not-block {
  border: 1px solid color-mix(in oklch, var(--warn) 40%, var(--line));
  background: color-mix(in oklch, var(--warn) 6%, transparent);
  border-radius: var(--r-md);
  padding: var(--sp-md);
  margin-top: var(--sp-lg);
}
.not-block h3 {
  display: flex; align-items: center; gap: .5em;
  font-size: 1.02rem; color: color-mix(in oklch, var(--warn) 80%, var(--ink));
  margin-bottom: .6rem;
}
.not-block ul { padding-left: 1.2rem; }
.not-block li { margin: .3rem 0; color: var(--ink-soft); font-size: var(--fs-sm); }
.not-block li::marker { color: var(--warn); }

.project-nav {
  display: flex; justify-content: space-between; gap: var(--sp-sm);
  margin-top: var(--sp-lg); padding-top: var(--sp-md);
  border-top: 1px solid var(--line);
}
.project-nav a {
  display: flex; flex-direction: column; gap: .15rem;
  color: var(--ink); max-width: 46%;
}
.project-nav a small { font-family: var(--mono); font-size: var(--fs-xs); color: var(--ink-dim); }
.project-nav a strong { color: var(--accent); }
.pn-next { text-align: right; margin-left: auto; }

/* 9. WIZUALIZACJE ------------------------------------------- */
.viz {
  padding: var(--sp-md);
  margin-bottom: var(--sp-lg);
}
.viz-head {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  margin-bottom: var(--sp-sm); flex-wrap: wrap;
}
.viz-head .tick b { color: var(--accent); font-weight: 600; }
.viz svg { width: 100%; height: auto; }
.viz svg text { font-family: var(--mono); fill: var(--ink-soft); }
.viz .lbl { font-size: 11px; letter-spacing: .04em; }
.viz [data-step] rect, .viz .hubbox {
  fill: var(--panel-solid); stroke: var(--line); stroke-width: 1.25;
  transition: stroke .35s;
}
.viz [data-step] text { transition: fill .35s; }
.viz [data-step].on rect { stroke: var(--accent); }
.viz [data-step].on text { fill: var(--ink); }
.viz .wire { stroke: var(--line); stroke-width: 1.5; fill: none; transition: stroke .35s; }
.viz .wire.on { stroke: var(--accent); }
.viz .src-dot { fill: var(--accent); opacity: .75; }
.viz .pulse-dot { fill: var(--accent); filter: drop-shadow(0 0 5px var(--glow)); }

/* Cooperatives — agregacja z progiem */
.agg-row .bar-track { position: relative; overflow: visible; }
.agg-row .bar { position: relative; z-index: 1; background: linear-gradient(90deg, color-mix(in oklch, var(--warn) 75%, transparent), var(--warn)); }
.agg-row .threshold {
  position: absolute; top: -5px; bottom: -5px; left: 66.6%; width: 2px;
  border-radius: 2px; background: var(--warn); z-index: 2;
}
#viz-coop.done .agg-row .bar {
  background: linear-gradient(90deg, var(--ok), var(--accent));
  box-shadow: 0 0 12px color-mix(in oklch, var(--ok) 45%, transparent);
}

.viz-btn {
  font-family: var(--mono); font-size: var(--fs-xs); letter-spacing: .08em;
  padding: .4rem .9rem; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: transparent; color: var(--ink-soft);
  transition: border-color .2s, color .2s;
}
.viz-btn:hover { border-color: var(--accent); color: var(--accent); }
.viz-btn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }

.viz-note { margin-top: var(--sp-xs); font-family: var(--mono); font-size: var(--fs-xs); color: var(--ink-dim); min-height: 1.4em; }
.viz-note b { color: var(--accent); font-weight: 600; }

/* suwaki MCDA */
.viz-controls { display: grid; gap: .7rem; margin-bottom: var(--sp-sm); }
.viz-slider { display: grid; grid-template-columns: 92px 1fr 52px; align-items: center; gap: .8rem; }
.viz-slider label { font-family: var(--mono); font-size: var(--fs-xs); color: var(--ink-soft); }
.viz-slider output { font-family: var(--mono); font-size: var(--fs-xs); color: var(--accent); text-align: right; }
.viz input[type="range"] {
  -webkit-appearance: none; appearance: none;
  height: 4px; border-radius: 999px;
  background: color-mix(in oklch, var(--accent) 25%, var(--line));
  outline-offset: 6px;
}
.viz input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--glow);
  cursor: grab; border: 0;
}
.viz input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 10px var(--glow);
  cursor: grab; border: 0;
}

.rank { display: grid; gap: .55rem; }
.rank-row {
  display: grid; grid-template-columns: 30px minmax(140px, 180px) 1fr 54px;
  align-items: center; gap: .8rem;
  transition: transform .5s var(--ease-out);
}
.rank-row .pos { font-family: var(--mono); color: var(--ink-dim); font-size: var(--fs-sm); }
.rank-row .name { font-size: var(--fs-sm); color: var(--ink-soft); }
.rank-row .bar-track { height: 10px; border-radius: 999px; background: color-mix(in oklch, var(--ink) 8%, transparent); overflow: hidden; }
.rank-row .bar {
  height: 100%; border-radius: 999px; width: 0%;
  background: linear-gradient(90deg, color-mix(in oklch, var(--accent) 70%, transparent), var(--accent));
  transition: width .6s var(--ease-out);
}
.rank-row .val { font-family: var(--mono); font-size: var(--fs-xs); color: var(--accent); text-align: right; }
.rank-row.top .name { color: var(--ink); font-weight: 600; }
.rank-row.top .bar { background: linear-gradient(90deg, var(--accent), var(--violet)); box-shadow: 0 0 12px var(--glow); }

/* 10. PRZYCISKI, CALLOUT, KONTAKT, STOPKA ------------------- */
.btn-row { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: var(--sp-md); }

.btn {
  display: inline-flex; align-items: center; gap: .5em;
  padding: .7rem 1.3rem; border-radius: 999px;
  font-weight: 600; font-size: var(--fs-sm);
  text-decoration: none; border: 1px solid transparent;
  transition: transform .2s var(--ease-out), box-shadow .3s, border-color .2s, background-color .2s;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }
.btn svg { width: 16px; height: 16px; }

.btn-primary {
  background: var(--accent);
  color: light-dark(white, oklch(16% 0.02 255));
  box-shadow: 0 6px 22px -8px var(--glow);
}
.btn-primary:hover { box-shadow: 0 10px 30px -8px var(--glow); }

.btn-ghost { border-color: var(--line); color: var(--ink-soft); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.arrow-link {
  display: inline-flex; align-items: center; gap: .45em;
  font-weight: 600; color: var(--accent);
}
.arrow-link svg { width: 16px; height: 16px; transition: translate .25s var(--ease-out); }
.arrow-link:hover svg { translate: 4px 0; }

.callout {
  padding: clamp(1.6rem, 4vw, 3rem);
  border-radius: var(--r-lg);
  position: relative; overflow: clip;
}
.callout h2 { font-size: var(--fs-h2); max-width: 30ch; }
.callout h4 { margin-bottom: .3rem; }

/* obwódka konikowa — animowana na hover (:has + @property) */
.callout, .viz, .observatory {
  --spin: 0deg;
}

.contact-cards { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-sm); margin: var(--sp-md) 0; }
@media (max-width: 640px) { .contact-cards { grid-template-columns: 1fr; } }
.contact-card {
  display: flex; flex-direction: column; gap: .2rem;
  padding: var(--sp-md); text-decoration: none; color: var(--ink);
  transition: transform .3s var(--ease-out), border-color .3s;
}
.contact-card:hover { text-decoration: none; transform: translateY(-3px);
  border-color: color-mix(in oklch, var(--accent) 45%, var(--line)); }
.contact-card small { font-family: var(--mono); font-size: var(--fs-xs); color: var(--ink-dim); letter-spacing: .1em; text-transform: uppercase; }
.contact-card strong { color: var(--accent); font-size: 1.05rem; word-break: break-all; }

.site-footer {
  border-top: 1px solid var(--line);
  padding: var(--sp-lg) 0 var(--sp-md);
  margin-top: var(--sp-xl);
  background: color-mix(in oklch, var(--bg1) 60%, transparent);
}
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: var(--sp-lg); }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-brand p { font-size: var(--fs-sm); color: var(--ink-dim); margin-top: .7rem; max-width: 44ch; }
.site-footer h4 {
  font-family: var(--mono); font-size: var(--fs-xs);
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-dim); margin-bottom: .7rem;
}
.site-footer ul { list-style: none; padding: 0; display: grid; gap: .4rem; }
.site-footer ul a { color: var(--ink-soft); font-size: var(--fs-sm); }
.site-footer ul a:hover { color: var(--accent); }
.footer-bottom {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: .6rem;
  border-top: 1px dashed var(--line);
  margin-top: var(--sp-lg); padding-top: var(--sp-sm);
  font-family: var(--mono); font-size: var(--fs-xs); color: var(--ink-dim);
}

/* 11. ANIMACJE WEJŚCIA -------------------------------------- */
.reveal { opacity: 1; }
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .reveal {
      animation: rise .9s var(--ease-out) both;
      animation-timeline: view();
      animation-range: entry 0% entry 46%;
    }
    @keyframes rise {
      from { opacity: 0; translate: 0 26px; filter: blur(3px); }
      to   { opacity: 1; translate: 0 0;   filter: blur(0); }
    }
  }
}

/* 12. VIEW TRANSITIONS -------------------------------------- */
@view-transition { navigation: auto; }
@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(root) { animation: vt-out .22s ease both; }
  ::view-transition-new(root) { animation: vt-in .34s var(--ease-out) both; }
  @keyframes vt-out { to { opacity: 0; translate: 0 -8px; } }
  @keyframes vt-in  { from { opacity: 0; translate: 0 10px; } }
}

/* 13. UTILITIES, A11Y --------------------------------------- */
.pt-0 { padding-top: 0; }
.mt-0 { margin-top: 0; }
.mt-2xs { margin-top: var(--sp-2xs); }
.mt-xs { margin-top: var(--sp-xs); }
.mt-sm { margin-top: var(--sp-sm); }
.mt-md { margin-top: var(--sp-md); }
.mt-lg { margin-top: var(--sp-lg); }
.text-soft { color: var(--ink-soft); }
.text-dim { color: var(--ink-dim); }
.text-sm-readable { font-size: var(--fs-sm); line-height: 1.6; }
.mono { font-family: var(--mono); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  html { scroll-behavior: auto; }
}
