/* SLAVIC AI — jasny len, granat i błękit z logotypu, czerwień podlaskiego haftu */
:root {
  --c-bg: #f3f2ec;          /* len */
  --c-panel: rgba(255, 255, 255, .84);
  --c-text: #1d2433;        /* atrament */
  --c-muted: #5c6878;
  --c-navy: #000235;        /* "SLAVIC" w logo */
  --c-sky: #669ebd;         /* "AI" w logo */
  --c-blue: #2f6f98;        /* błękit do tekstu (kontrast na bieli) */
  --c-moss: #4f7436;        /* łąki i puszcza */
  --c-red: #b23a32;         /* haft */
  --c-rule: #d3d9e0;
  --glow-sky: rgba(102, 158, 189, .18);
  --glow-moss: rgba(79, 116, 54, .10);
  --glow-red: rgba(178, 58, 50, .07);
  --nav-h: 3.25rem;
  --mono: ui-monospace, "Cascadia Mono", "JetBrains Mono", "DejaVu Sans Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

/* Grafiki ASCII mają własną czcionkę: systemowe monospace (np. na Androidzie) nie mają
   znaków ramek, więc przeglądarka brała je z innej czcionki o innej szerokości
   i rysunki się rozjeżdżały. Podzbiór DejaVu Sans Mono, licencja: pk-mono-LICENSE.txt */
@font-face {
  font-family: "PK Mono";
  src: url("pk-mono.woff2?v=1") format("woff2");
  font-weight: 400;
  font-display: block;
}
@font-face {
  font-family: "PK Mono";
  src: url("pk-mono-bold.woff2?v=1") format("woff2");
  font-weight: 700;
  font-display: block;
}

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

html {
  background: var(--c-bg);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 1rem);
}
body {
  margin: 0;
  min-height: 100vh;
  color: var(--c-text);
  background: var(--c-bg);
  font-family: var(--mono);
  font-size: 1rem;
  line-height: 1.7;
  text-align: center;
  overflow-x: hidden;
  padding: 0 env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
}

/* poranne światło nad łąką: trzy miękkie poświaty dryfujące bardzo powoli */
body::before {
  content: "";
  position: fixed;
  inset: -20%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(40% 35% at 25% 20%, var(--glow-sky), transparent 70%),
    radial-gradient(35% 30% at 78% 35%, var(--glow-moss), transparent 70%),
    radial-gradient(45% 40% at 55% 90%, var(--glow-red), transparent 70%);
  animation: dawn 40s ease-in-out infinite alternate;
}
@keyframes dawn {
  0%   { transform: translate3d(-4%, -2%, 0) rotate(0deg); }
  50%  { transform: translate3d(3%, 2%, 0) rotate(4deg); }
  100% { transform: translate3d(-2%, 4%, 0) rotate(-3deg); }
}

#tlo {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ---------- menu górne ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--nav-h);
  padding: env(safe-area-inset-top, 0) max(1rem, calc((100% - 92ch) / 2)) 0;
  background: rgba(243, 242, 236, .78);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s, background-color .3s;
}
.topbar.scrolled { border-bottom-color: var(--c-rule); background: rgba(250, 250, 247, .9); }
.brand { display: flex; line-height: 0; opacity: 0; transition: opacity .4s; }
.topbar.scrolled .brand { opacity: 1; }
.brand img { height: 1.6rem; width: auto; }
.topbar ul {
  display: flex;
  gap: .25rem 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: .85rem;
}
.topbar a:not(.brand) {
  color: var(--c-muted);
  text-decoration: none;
  transition: color .2s;
}
.topbar a:not(.brand):hover, .topbar a.active { color: var(--c-navy); }
.topbar a.active::after { content: "_"; color: var(--c-red); animation: blink 1.1s steps(1) infinite; }

main, footer {
  position: relative;
  z-index: 1;
  width: min(100% - 2rem, 92ch);
  margin-inline: auto;
}

/* panele pod tekstem, żeby animacja nie walczyła z czytelnością; każdy panel
   to osobny blok strony (start, misja, projekty, klienci, kontakt) */
.panel {
  position: relative;
  padding: clamp(1.25rem, 4vw, 3rem);
  background: var(--c-panel);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  border: 1px solid var(--c-rule);
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 2, 53, .04), 0 0 80px var(--glow-sky);
}
main { margin-top: clamp(1rem, 4vh, 2.5rem); }
.panel + .panel { margin-top: 2rem; }
.panel > section:first-child { margin-top: 0; }
/* narożniki jak w ramce terminala */
.panel::before, .panel::after {
  position: absolute;
  color: var(--c-sky);
  line-height: 1;
  font-size: .9rem;
}
.panel::before { content: "┌─"; top: -.5em; left: -.3em; }
.panel::after { content: "─┘"; bottom: -.5em; right: -.3em; }

/* grafiki ASCII skalują się do szerokości kolumny tekstu */
.hero, section, footer { container-type: inline-size; }

pre {
  margin: 0 auto;
  width: fit-content;
  max-width: 100%;
  text-align: left;
  font-family: "PK Mono", var(--mono);
  line-height: 1.15;
  overflow: hidden;
}

/* ---------- hero ---------- */
.prompt {
  margin: 0 0 1.75rem;
  max-width: none;
  text-align: left;          /* jak w terminalu */
  font-size: .85rem;
  overflow-wrap: anywhere;
}
.ps1 { color: var(--c-navy); font-weight: 700; }
.pc { color: var(--c-sky); }
.cursor { color: var(--c-red); margin-left: .1ch; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* oryginalny logotyp w naturalnym rozmiarze pliku (296x94), bez skalowania w górę */
.hero-logo {
  display: block;
  width: 296px;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

.logo {
  /* SVG z tools/logo.py (strona 404): wygląda tak samo na każdym ekranie (bloki to prostokąty, nie znaki) */
  display: block;
  margin: 0 auto;
  max-width: 100%;
  height: auto;
  overflow: visible;
  filter: drop-shadow(0 6px 14px var(--glow-sky));
}
.logo-frame { fill: none; stroke: var(--c-sky); opacity: .7; }
.logo-word { fill: var(--c-navy); }
.logo-ai { fill: var(--c-sky); }
.logo-ring { fill: none; stroke: var(--c-sky); stroke-width: 2.2; }
.logo-moon { fill: #fff; stroke: var(--c-sky); stroke-width: 1.6; }
.logo-orbit { transform-box: fill-box; transform-origin: center; animation: orbit 24s linear infinite; }
@keyframes orbit { to { transform: rotate(360deg); } }
.logo-shine {
  transform-box: fill-box;
  animation: shimmer 11s ease-in-out infinite;
}
@keyframes shimmer {
  0%, 20% { transform: translateX(-100%); }
  60%, 100% { transform: translateX(100%); }
}

.lead {
  margin: 1.75rem auto 0;
  max-width: 52ch;
  font-size: 1.08rem;
}
.lead strong { color: var(--c-navy); }

.helix { margin: 2rem 0 0; }
.helix pre {
  /* 64 znaki szerokości, ~0.6em każdy */
  color: var(--c-muted);
  font-size: 7px;
  font-size: min(15px, 100cqi / 39);
  line-height: 1.1;
}
.helix .b { color: var(--c-navy); font-weight: 700; }    /* zasady z przodu */
.helix .bb { color: var(--c-navy); opacity: .3; }        /* zasady z tyłu */
.helix .d { color: var(--c-blue); font-weight: 700; }    /* bity z przodu */
.helix .dd { color: var(--c-sky); opacity: .45; }        /* bity z tyłu */
.helix .r { color: var(--c-moss); opacity: .45; }        /* szczeble */
.helix .m { color: var(--c-red); font-weight: 700; }      /* defekt (mutacja) z przodu */
.helix .mm { color: var(--c-red); opacity: .45; }         /* defekt z tyłu */
.helix figcaption {
  margin-top: .75rem;
  font-size: .8rem;
  color: var(--c-muted);
}
.helix figcaption .b { color: var(--c-navy); font-weight: 700; }
.helix figcaption .d { color: var(--c-blue); font-weight: 700; }

/* pas haftu: czerwień na lnie */
.haft {
  margin: 1.75rem auto 0;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  font-size: .85rem;
  letter-spacing: .05em;
  color: var(--c-red);
  opacity: .75;
}

/* ---------- sekcje ---------- */
section { margin-top: 3.75rem; }

h2 {
  display: flex;
  align-items: center;
  gap: 1.5ch;
  margin: 0 0 1.5rem;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: lowercase;
  color: var(--c-navy);
}
h2::before, h2::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--c-rule) 30%, var(--c-sky));
}
h2::after { background: linear-gradient(90deg, var(--c-sky), var(--c-rule) 70%, transparent); }
h2 span::before { content: "<> "; color: var(--c-red); font-weight: 400; }
h2 span::after { content: " <>"; color: var(--c-red); font-weight: 400; }

p { margin: 0 auto 1rem; max-width: 64ch; }
.hl { color: var(--c-navy); }
.hl-ai { color: var(--c-sky); }
.muted { margin-top: 1.5rem; font-size: .9rem; color: var(--c-muted); }

/* pojawianie się sekcji przy przewijaniu (tylko gdy działa JS) */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .9s ease, transform .9s ease; }
.js .reveal.in { opacity: 1; transform: none; }

/* ---------- o firmie ---------- */
.stats {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22ch), 1fr));
  gap: 1rem;
  margin: 2rem 0;
  padding: 0;
}
/* ikona, nagłówek i opis w stałych wierszach od góry: we wszystkich trzech
   boxach leżą na tych samych liniach, niezależnie od długości opisu */
.stats li {
  position: relative;
  display: grid;
  grid-template-rows: 3.25rem 2.6rem auto;
  row-gap: .6rem;
  justify-items: center;
  align-content: start;
  text-align: center;
  padding: 1.25rem 1rem 1.1rem;
  border: 1px solid var(--c-rule);
  background: rgba(255, 255, 255, .6);
  line-height: 1.45;
  animation: krok 12s ease-in-out infinite;
}
.stats li:nth-child(2) { animation-delay: 4s; }
.stats li:nth-child(3) { animation-delay: 8s; }
@keyframes krok {
  0%, 22%, 100% { border-color: var(--c-rule); box-shadow: none; }
  8% { border-color: var(--c-sky); box-shadow: 0 0 22px var(--glow-sky); }
}
.stats b {
  display: block;
  align-self: center;
  font-size: 1.9rem;
  line-height: 1.2;
  color: var(--c-navy);
}
.stats li:nth-child(2) b { color: var(--c-blue); }
.stats li:nth-child(3) b { color: var(--c-moss); }
.stats span { font-size: .88rem; color: var(--c-muted); max-width: 26ch; }
.stats .ico, .projects .ico {
  display: grid;
  place-items: center;
  width: 3.25rem;
  height: 3.25rem;
  margin-bottom: .6rem;
  font-size: 1.6rem;
  line-height: 1;
  max-width: none;
  border: 1px dashed var(--c-sky);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 18px var(--glow-sky);
}
.stats .ico { margin-bottom: 0; }
.stats span:not(.ico) { align-self: start; }

/* ---------- projekty ---------- */
.projects {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin: 1.5rem 0 0;
  padding: 0;
}
.projects li {
  flex: 1 1 calc((100% - 2rem) / 3);
  max-width: calc((100% - 2rem) / 3);
  min-width: min(100%, 24ch);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.1rem 1rem 1rem;
  border: 1px solid var(--c-rule);
  background: rgba(255, 255, 255, .6);
  font-size: .9rem;
  line-height: 1.55;
  color: var(--c-muted);
  transition: border-color .3s, box-shadow .3s;
}
.projects li:hover { border-color: var(--c-sky); box-shadow: 0 0 22px var(--glow-sky); }
.projects strong { display: block; margin-bottom: .35rem; color: var(--c-navy); font-size: .98rem; }
@media (max-width: 720px) {
  .projects li { flex-basis: calc((100% - 1rem) / 2); max-width: calc((100% - 1rem) / 2); }
}
@media (max-width: 520px) {
  .projects li { flex-basis: 100%; max-width: 100%; }
}


/* ---------- klienci ---------- */
.clients {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
  margin: 1.5rem 0 0;
  padding: 0;
}
@media (min-width: 760px) {
  .clients { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
.client {
  position: relative;
  display: grid;
  grid-template-rows: 5.25rem auto;   /* stały pas na logo: logotypy w rzędzie leżą na jednej linii */
  align-items: center;
  justify-items: center;
  gap: .5rem;
  padding: .9rem .75rem .7rem;
  border: 1px solid var(--c-rule);
  background: #fff;
  transition: border-color .3s, box-shadow .3s;
}
/* narożniki ramki jak w ASCII */
.client::before, .client::after {
  position: absolute;
  font-size: .7rem;
  line-height: 1;
  color: var(--c-sky);
  opacity: 0;
  transition: opacity .3s;
}
.client::before { content: "+"; top: -.4em; left: -.3em; }
.client::after { content: "+"; bottom: -.4em; right: -.3em; }
.client img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 3.4rem;
  object-fit: contain;
  filter: grayscale(1);
  opacity: .78;
  transition: filter .4s, opacity .4s;
}
.client--square img { max-height: 5rem; }
.client-name {
  align-self: start;
  font-size: .68rem;
  line-height: 1.35;
  color: var(--c-muted);
}
.client:hover { border-color: var(--c-sky); box-shadow: 0 0 22px var(--glow-sky); }
.client:hover::before, .client:hover::after { opacity: 1; }
.client:hover img { filter: none; opacity: 1; }
/* na ekranach dotykowych nie ma hover, więc logotypy są od razu w kolorze */
@media (hover: none) {
  .client img { filter: none; opacity: 1; }
}

/* ---------- stopka i kontakt ---------- */
footer {
  margin-top: 2rem;
  margin-bottom: 2.5rem;
}
.mailbox {
  display: inline-grid;
  margin: .75rem auto 1.25rem;
  color: var(--c-sky);
  font-size: clamp(.8rem, 3.6vw, 1.05rem);
}
.mailbox pre { line-height: 1.2; width: auto; }
.mail {
  display: block;
  padding: .5rem 0;
  text-align: center;
  color: var(--c-navy);
  font-weight: 700;
  text-decoration: none;
  border-left: 1px solid var(--c-sky);
  border-right: 1px solid var(--c-sky);
  margin-inline: calc(.5ch - .5px);
  animation: glow 4s ease-in-out infinite;
}
@keyframes glow { 50% { text-shadow: 0 0 14px var(--c-sky); } }
.mail:hover { color: var(--c-blue); }

.actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .5rem 1.5rem; }
.btn {
  font: inherit;
  color: var(--c-blue);
  background: none;
  border: 0;
  padding: .3rem .6rem;
  cursor: pointer;
  text-decoration: none;
  transition: color .2s, background-color .2s;
}
.btn:hover { color: #fff; background: var(--c-navy); }
.status { flex-basis: 100%; color: var(--c-moss); min-height: 1.7em; }

.company {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15ch), 1fr));
  gap: .5rem 1rem;
  max-width: 76ch;
  margin: 1.75rem auto 0;
  padding: 1rem 0 0;
  border-top: 1px dashed var(--c-rule);
  font-size: .88rem;
}
.company dt { color: var(--c-muted); font-size: .75rem; letter-spacing: .06em; }
.company dt::after { content: ":"; }
.company dd { margin: 0; color: var(--c-navy); font-weight: 700; }
.company dd a { color: inherit; }
footer .haft { margin-top: 1.5rem; }
.copy { margin: .5rem auto 0; font-size: .8rem; color: var(--c-muted); }
.copy a { color: var(--c-muted); }

a { color: var(--c-blue); }
a:hover { color: var(--c-navy); }

:focus-visible {
  outline: 2px solid var(--c-red);
  outline-offset: 3px;
}

/* ---------- pomocnicze ---------- */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: 1rem; top: -3rem; z-index: 6;
  padding: .5rem 1rem; background: #fff; color: var(--c-red);
}
.skip:focus { top: 1rem; }

/* na wąskich ekranach menu to same zakładki, logo jest w nagłówku strony */
@media (max-width: 600px) {
  :root { --nav-h: 2.75rem; }
  body { font-size: .95rem; }
  main, footer { width: calc(100% - 1rem); }
  .brand { display: none; }
  .topbar { justify-content: center; }
  .topbar ul { flex-wrap: wrap; justify-content: center; gap: .1rem .5rem; font-size: .72rem; }
  .client { grid-template-rows: 4.5rem auto; }
  .client--square img { max-height: 4.25rem; }
}
/* najwęższe telefony (np. 360 px): sześć zakładek nadal w jednej linii */
@media (max-width: 380px) {
  .topbar ul { gap: .1rem .4rem; font-size: .66rem; }
}
/* przy ograniczonym ruchu zostają tylko łagodne zmiany koloru, bez przesunięć */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  body::before, .logo-shine, .logo-orbit { animation: none; }
  .js .reveal { transform: none; }
}
