/* Barwy z grafik marki na X i Facebooku: granatowa czern + jaskrawy niebieski. */
:root {
  --bg: #020f22;
  --bg-deep: #000c19;
  --surface: #071a33;
  --text: #f2f6fc;
  --muted: #9fb2cc;
  --line: #15305a;
  --accent: #0091fe;
  --accent-deep: #006ce8;
  --accent-soft: rgba(0, 145, 254, 0.14);
  --radius: 12px;
  --max: 720px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.6;
}

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

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }

/* Header */
.site-header { border-bottom: 1px solid var(--line); background: var(--bg-deep); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 14px; padding-bottom: 14px; }
.logo { display: inline-flex; align-items: center; gap: 6px; font-weight: 900; font-size: 22px; letter-spacing: -0.03em; color: var(--text); text-decoration: none; }
.logo b { color: var(--accent); font-weight: inherit; }
.logo svg { width: 16px; height: 16px; color: var(--accent); margin-left: -4px; align-self: flex-start; }

/* Baner marki (ta sama grafika co tło na X i Facebooku) */
.banner { background: var(--bg-deep); border-bottom: 1px solid var(--line); }
.banner img { display: block; width: 100%; max-width: 1536px; height: auto; margin: 0 auto; }
.site-nav { display: flex; gap: 20px; font-size: 15px; }
.site-nav a { color: var(--muted); text-decoration: none; white-space: nowrap; }
.site-nav a:hover { color: var(--text); }

/* Hero */
.hero { padding: 48px 0 32px; }
.hero .eyebrow { color: var(--accent); font-weight: 700; font-size: 14px; letter-spacing: 0.12em; text-transform: uppercase; margin: 0 0 14px; }
.hero h1 { font-size: clamp(34px, 7vw, 52px); font-weight: 900; line-height: 1.08; letter-spacing: -0.03em; margin: 0 0 20px; }
.hero h1 em { font-style: normal; color: var(--accent); }
.lead { font-size: 20px; color: var(--muted); margin: 0; }
.hero-bars { display: block; width: 100%; height: auto; margin-top: 36px; }

/* Sections */
section { padding: 32px 0; }
h2 { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 16px; }
h3 { font-size: 19px; margin: 0 0 6px; line-height: 1.35; }

.story {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 20px 24px;
}
.story p { margin: 0 0 12px; }
.story p:last-child { margin-bottom: 0; }

.cards { display: grid; gap: 16px; }
.intro-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); margin-top: 24px; }
#start > p, #mission > p { margin: 0 0 14px; }
.card p a { color: var(--accent); }
.card p a.term { color: var(--text); }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.card p { margin: 0; color: var(--muted); font-size: 16px; }
.tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 2px 10px;
  margin-bottom: 10px;
}

.rules { margin: 0; padding-left: 22px; }
.rules li { margin-bottom: 8px; }
.rules li::marker { color: var(--accent); }

.follow { display: flex; flex-wrap: wrap; gap: 12px; }
.follow a {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 18px;
  text-decoration: none;
  color: var(--text);
  background: var(--surface);
}
.follow a:hover { border-color: var(--accent); background: var(--accent-soft); }

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: var(--bg-deep); margin-top: 48px; padding: 24px 0 40px; font-size: 14px; color: var(--muted); }
.site-footer p { margin: 0 0 8px; }

/* Article */
.article h2 { margin-top: 40px; }
.article .hero { padding-bottom: 8px; }
.article p { margin: 0 0 16px; }
.noob-box p:last-child { margin-bottom: 0; }
.table-wrap { overflow-x: auto; margin: 8px 0 24px; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 16px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--surface); color: var(--muted); font-weight: 600; font-size: 14px; }
tr:last-child td { border-bottom: 0; }
td:nth-child(n+2) { white-space: nowrap; }
td:first-child { min-width: 9em; }
a.term { color: inherit; text-decoration: underline dotted var(--accent); text-decoration-thickness: 2px; text-underline-offset: 4px; }
a.term:hover { color: var(--accent); text-decoration-style: solid; }
.eyebrow a { color: inherit; text-decoration: none; }
.card-link { display: block; text-decoration: none; color: inherit; }
.card-link:hover .card { border-color: var(--accent); }
.card-link h3 { color: var(--text); }
.read-more { display: inline-block; margin-top: 10px; color: var(--accent); font-weight: 600; font-size: 15px; }
.article-meta { color: var(--muted); font-size: 15px; margin: 0 0 24px; }
.verdict {
  border-radius: var(--radius);
  background: var(--accent-soft);
  border: 1px solid var(--accent-deep);
  padding: 16px 20px;
  font-weight: 600;
  margin: 0 0 32px;
}
.noob-box {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 16px 20px;
  background: var(--surface);
}
.disclaimer { font-size: 15px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 16px; }

@media (max-width: 520px) {
  body { font-size: 17px; }
  .site-nav { gap: 14px; font-size: 14px; }
  .hero { padding: 40px 0 24px; }
}

/* Ikony w kartach "New here?" (wyciete z grafik marki) */
.card-icon { display: block; width: 64px; height: 64px; border-radius: 12px; border: 1px solid var(--line); margin-bottom: 14px; }

/* Karta graficzna artykulu (tools/make_cards.py) */
.hero-card { display: block; width: 100%; height: auto; border-radius: var(--radius); border: 1px solid var(--line); margin: 8px 0 28px; }

/* Waskie ekrany: menu pod logo, zawija sie w kolejny rzad zamiast lamac slowa */
@media (max-width: 900px) {
  .site-header .wrap { flex-wrap: wrap; row-gap: 6px; }
  .site-nav { width: 100%; flex-wrap: wrap; justify-content: flex-start; gap: 6px 18px; }
}

/* Etykieta ostrzegawcza na stronie glownej */
.warning-label { border: 2px dashed var(--accent-deep); border-radius: var(--radius); padding: 24px; margin: 8px 0 24px; background: var(--surface); }
.warning-label h2 { margin-bottom: 12px; }
.warning-label p { margin: 0 0 12px; }
.warning-label .eyebrow { color: var(--accent); font-weight: 700; font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 8px; }
.warning-label .side-effects { font-size: 15px; color: var(--muted); font-style: italic; margin-bottom: 0; }

/* Kurs: nawigacja lekcji, ukryte odpowiedzi, lekcje w przygotowaniu */
.lesson-nav { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin: 32px 0 8px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 16px; }
.muted { color: var(--muted); }
details { margin-top: 8px; }
summary { cursor: pointer; color: var(--accent); font-weight: 600; }
details p { margin-top: 10px; }
.card-soon { opacity: 0.7; }

/* Pasek udostepniania (share.js) */
.share { margin: 32px 0 8px; padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.share-title { margin: 0 0 12px; font-weight: 700; }
.share-row { display: flex; flex-wrap: wrap; gap: 10px; }
.share-row a, .share-row button {
  font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
  color: var(--text); background: var(--bg-deep); text-decoration: none;
  border: 1px solid var(--line); border-radius: 999px; padding: 8px 16px;
}
.share-row a:hover, .share-row button:hover { border-color: var(--accent); background: var(--accent-soft); }
.share-note { margin: 10px 0 0; min-height: 1.2em; font-size: 14px; color: var(--accent); }

/* Przelacznik jezyka: countryballe (tools/i18n.py, obrazki od WP) */
.site-nav { margin-left: auto; }
.lang-switch { flex: none; position: relative; display: inline-flex; width: 34px; height: 34px; text-decoration: none; }
.lang-switch span { display: block; width: 100%; height: 100%; background: center / contain no-repeat; transition: transform 0.15s; }
.lang-pl span { background-image: url("/img/lang-pl.webp"); }
.lang-en { width: 40px; height: 40px; margin: -4px 0; }
.lang-en span { background-image: url("/img/lang-en.webp"); }
.lang-en.us { width: 34px; height: 34px; margin: 0; }
.lang-en.us span { background-image: url("/img/lang-en-us.webp"); }
.lang-es { width: 40px; height: 40px; margin: -4px 0; }
.lang-es span { background-image: url("/img/lang-es.webp"); }
.lang-switch + .lang-switch { margin-left: 8px; }
.lang-es::after { width: max-content; }
.lang-switch:hover span, .lang-switch:focus-visible span { transform: rotate(-12deg) scale(1.08); }
.lang-switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 50%; }
.lang-switch::after { content: attr(data-tip); position: absolute; top: calc(100% + 12px); right: -6px; z-index: 10; width: 172px; padding: 8px 12px; border: 2px solid #0b0b0b; border-radius: 14px; background: #ffffff; color: #0b0b0b; font-size: 13px; font-weight: 700; line-height: 1.3; text-align: center; opacity: 0; transform: translateY(-4px); pointer-events: none; transition: opacity 0.15s, transform 0.15s; }
.lang-switch::before { content: ""; position: absolute; top: calc(100% + 3px); right: 10px; z-index: 11; border: 6px solid transparent; border-bottom: 9px solid #0b0b0b; border-top: 0; opacity: 0; transition: opacity 0.15s; pointer-events: none; }
.lang-en::after { width: max-content; }
.lang-switch:hover::after, .lang-switch:focus-visible::after { opacity: 1; transform: none; }
.lang-switch:hover::before, .lang-switch:focus-visible::before { opacity: 1; }
@media (max-width: 900px) {
  .lang-switch { order: 2; margin-left: auto; }
  .lang-switch + .lang-switch { margin-left: 8px; }
  .site-nav { order: 3; margin-left: 0; }
}

/* Wykresy i ilustracje w artykulach (tools/charts.py). Slupki w HTML, krzywe i kropki w SVG. */
.chart-figure { margin: 8px 0 28px; padding: 18px 18px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.chart-figure svg { display: block; width: 100%; height: auto; }
.chart-figure figcaption { margin-top: 12px; font-size: 14px; line-height: 1.45; color: var(--muted); }
.ch-head { margin: 0 0 14px !important; font-weight: 700; font-size: 16px; line-height: 1.35; }
.ch-sub { margin: 0 0 8px !important; font-size: 14px; color: var(--muted); }
.ch-rows { display: grid; gap: 10px; }
.ch-group { margin-top: 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
.ch-row { display: grid; grid-template-columns: minmax(96px, 36%) 1fr; gap: 12px; align-items: center; font-size: 15px; }
.ch-name { color: var(--muted); line-height: 1.3; }
.ch-track { position: relative; height: 28px; border-radius: 6px; background: rgba(255, 255, 255, 0.035); }
.ch-fill { position: absolute; top: 0; bottom: 0; border-radius: 6px; }
.ch-zero { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--muted); opacity: 0.6; }
.ch-val { position: absolute; top: 50%; transform: translateY(-50%); padding: 0 6px; font-size: 14px; font-weight: 700; white-space: nowrap; color: var(--text); }
.ch-val.in { color: #ffffff; }
.ch-seg { position: absolute; top: 0; bottom: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; font-size: 13px; font-weight: 700; color: #ffffff; white-space: nowrap; }
.ch-seg:first-child { border-radius: 6px 0 0 6px; }
.ch-ticks { position: relative; height: 18px; font-size: 12px; color: var(--muted); }
.ch-ticks span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.ch-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: 14px; color: var(--muted); }
.ch-key { display: inline-block; width: 12px; height: 12px; margin-right: 6px; border-radius: 3px; vertical-align: -1px; }
.ch-split { display: grid; grid-template-columns: 2fr 3fr; gap: 18px; align-items: end; }
.c-a { background: var(--accent); }
.c-b { background: #3d6496; }
.c-c { background: #6f86a6; }
.c-d { background: #1d3a63; }
.c-e { background: #9fb2cc; }
.c-o { background: transparent; border: 2px dashed #6f86a6; }
.chart-figure .s-a { fill: var(--accent); }
.chart-figure .s-b { fill: #3d6496; }
.chart-figure .s-c { fill: #6f86a6; }
.chart-figure .s-o { fill: none; stroke: #6f86a6; stroke-width: 1.5; }
.chart-figure .l-a { fill: none; stroke: var(--accent); stroke-width: 3.5; stroke-linejoin: round; stroke-linecap: round; }
.chart-figure .l-b { fill: none; stroke: #6f86a6; stroke-width: 3; stroke-dasharray: 7 6; stroke-linejoin: round; stroke-linecap: round; }
.chart-figure .l-c { fill: none; stroke: #3d6496; stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.chart-figure .l-d { fill: none; stroke: #9fb2cc; stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.chart-figure .g-line { stroke: var(--line); stroke-width: 1; }
.chart-figure .g-axis { stroke: #3a5784; stroke-width: 1.5; }
.chart-figure .g-ref { stroke: #9fb2cc; stroke-width: 1.5; stroke-dasharray: 4 5; }
.chart-figure .t-tick { fill: var(--muted); font-size: 15px; }
.chart-figure .t-mark { fill: var(--text); font-size: 16px; font-weight: 700; }
.chart-figure .t-note { fill: var(--muted); font-size: 15px; }
.chart-figure .m-dot { fill: var(--accent); stroke: var(--bg); stroke-width: 3; }
@media (max-width: 520px) {
  .chart-figure { padding: 14px 12px 12px; }
  .ch-row { grid-template-columns: 1fr; gap: 4px; }
  .ch-split { grid-template-columns: 1fr; }
  .chart-figure .t-tick { font-size: 21px; }
  .chart-figure .t-mark { font-size: 22px; }
  .chart-figure .t-note { font-size: 20px; }
}

/* Czytaj dalej (tools/read_next.py) */
.read-next { margin: 32px 0 8px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.read-next h2 { margin: 0 0 10px; font-size: 18px; }
.read-next ul { list-style: none; margin: 0; padding: 0; }
.read-next li { margin: 8px 0; }
.read-next .tag { margin-right: 6px; }
