/* ============================================================================
   base.css — reset, document defaults, typography, layout utilities.

   Element rules are wrapped in :where() so they carry zero specificity and
   any class rule wins over them. Classes below have normal specificity and
   are what templates use.
   ========================================================================== */

/* ── Reset ─────────────────────────────────────────────────────────────── */
:where(*, *::before, *::after) { box-sizing: border-box; }

:where(html) {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-gutter: stable;
  /* Anchors land below the pinned header (topbar + maintenance strip). */
  scroll-padding-top: calc(var(--head-h) + 1rem);
  background-color: var(--bg);
}

:where(body) {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  color: var(--text-1);
  font-family: var(--font-main);
  font-size: var(--fs-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* clip, not hidden: hidden would turn body into a scroll container and
     break the sticky topbar. */
  overflow-x: clip;
}

:where(h1, h2, h3, h4, h5, h6) {
  margin: 0;
  color: var(--text-strong);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
:where(h1) { font-size: var(--fs-h1); letter-spacing: -0.025em; }
:where(h2) { font-size: var(--fs-h2); letter-spacing: -0.02em; }
:where(h3) { font-size: var(--fs-h3); }
:where(h4, h5, h6) { font-size: 1rem; }

:where(p, ul, ol, dl, dd, figure, blockquote, pre) { margin: 0; }
/* A list with a class is a component, not prose. */
:where(ul[class], ol[class]) { list-style: none; padding: 0; }

:where(a) {
  color: var(--accent-text);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-standard);
}
:where(a:hover) { color: var(--accent-300); }

:where(img, video, canvas) { display: block; max-width: 100%; height: auto; }
:where(svg) { flex-shrink: 0; vertical-align: -0.08em; }

:where(button, input, select, textarea) {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}
:where(button) {
  margin: 0;
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
}
:where(button:disabled) { cursor: not-allowed; }

:where(hr) { height: 0; margin: 0; border: 0; border-top: 1px solid var(--line); }

:where(strong, b) { font-weight: 600; }
:where(code, kbd, samp) { font-family: var(--font-mono); font-size: 0.9em; }

[hidden] { display: none !important; }

/* ── Focus, selection, scrollbar ───────────────────────────────────────── */
:where(:focus-visible) {
  outline: 2px solid var(--focus-outline);
  outline-offset: 2px;
}
:where(:focus:not(:focus-visible)) { outline: none; }
/* Containers that only receive focus programmatically (skip link / anchor
   targets, dialogs) do not draw a ring around a whole section. */
:where([tabindex="-1"]:focus) { outline: none; }

::selection { background: var(--selection); color: var(--text-strong); }

html { scrollbar-color: var(--surface-4) var(--bg); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: var(--surface-4);
  border: 2px solid var(--bg);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-disabled); }

/* ── Typography classes ────────────────────────────────────────────────── */
.display,
.h2,
.h3 {
  margin: 0;
  color: var(--text-strong);
  font-family: var(--font-main);
  font-weight: 600;
  text-wrap: balance;
}
.display { font-size: var(--fs-display); line-height: 1.05; letter-spacing: -0.03em; }
.h2      { font-size: var(--fs-h2);      line-height: 1.15; letter-spacing: -0.02em; }
.h3      { font-size: var(--fs-h3);      line-height: 1.3;  letter-spacing: -0.01em; }

.lead {
  margin: 0;
  color: var(--text-2);
  font-size: var(--fs-lead);
  font-weight: 400;
  line-height: 1.65;
  text-wrap: pretty;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  color: var(--accent-text);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
/* The same mono label without the accent: panel / card / column headings
   ("W tym wpisie", "Spis treści", "Wsparcie", a facts list title) —
   --muted in secondary text, --strong in heading text (footer columns).
   An icon inside keeps the accent. */
.eyebrow--muted  { color: var(--text-2); }
.eyebrow--strong { color: var(--text-strong); }
.eyebrow--muted svg,
.eyebrow--strong svg { color: var(--accent-text); }

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.text-accent { color: var(--accent-text); }

/* Links inside running text: colour alone does not separate them from body
   text (1.9:1), so they carry an underline. */
.link {
  color: var(--accent-text);
  text-decoration: underline;
  text-decoration-color: var(--accent-line);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color var(--dur-fast) var(--ease-standard),
              text-decoration-color var(--dur-fast) var(--ease-standard);
}
.link:hover { color: var(--accent-300); text-decoration-color: currentColor; }

/* ── Container & sections ──────────────────────────────────────────────── */
/* Page container. */
.wrap {
  width: 100%;
  max-width: calc(var(--container) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  position: relative;
  padding-block: var(--section-y);
}
.section--alt   { background-color: var(--bg-alt); }
.section--tight { padding-block: calc(var(--section-y) * 0.6); }

/* ── Grid ──────────────────────────────────────────────────────────────── */
/* One column; .grid--2 two from 768px. */
.grid {
  display: grid;
  gap: var(--grid-gap);
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 768px) {
  .grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Inline row that wraps — button rows, chip rows, meta lines. */
.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

/* ── Accessibility helpers ─────────────────────────────────────────────── */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ── Reveal on scroll ──────────────────────────────────────────────────────
   Add .reveal to a card or block; main.js adds .is-revealed once it enters
   the viewport. The hidden start state only applies once main.js has
   tagged <html> with .ls-js, so content never stays invisible without JS.
   An animation (not a transition) is used so a component's own hover
   transitions are not overridden. Put .reveal on blocks, not on buttons.

   Home only (body[data-page="home"]): fades up 12px from 0, 60ms sibling
   stagger (main.js sets --reveal-delay). Every other page shows .reveal
   content as is — no hidden start state, no animation (owner); do not put
   .reveal / [data-reveal-group] on subpage markup at all.
   Firefox: a fade only (the rise ending would re-snap the text). */
.ls-js .reveal:not(.is-revealed) { opacity: 0; }
.ls-js .reveal.is-revealed {
  animation: ls-reveal var(--dur-slow) var(--ease-out) var(--reveal-delay, 0ms) both;
}
@supports (-moz-appearance: none) {
  .ls-js .reveal.is-revealed { animation-name: ls-fade-in; }
}
.ls-js .reveal.is-revealed.is-instant { opacity: 1; animation: none; }
.ls-js :where(body:not([data-page="home"])) .reveal:not(.is-revealed),
.ls-js :where(body:not([data-page="home"])) .reveal.is-revealed { opacity: 1; animation: none; }
@keyframes ls-reveal {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

/* Shared keyframes (ls-rise-in moves its element: pair it with the
   Firefox ls-fade-in fallback, tokens.css). */
@keyframes ls-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes ls-rise-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
@keyframes ls-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.45; }
}
@keyframes ls-spin {
  to { transform: rotate(360deg); }
}

/* ── Reduced motion: one switch for everything ─────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
    scroll-behavior: auto !important;
  }
}
