/* ═══════════════════════════════════════════════
   HORIZONTAL OVERFLOW GUARD (added Faza 2.7)
   Zapobiega horizontal scroll na całej stronie.
   `clip` zamiast `hidden` - nie psuje position: sticky w children.
   ═══════════════════════════════════════════════ */

html {
  overflow-x: clip;
  /* Ink fallback bg: footer ma matching --kotler-ink, więc overscroll na dół
     (trackpad bounce) pokazuje dark zamiast browser default white pasek. */
  background: var(--kotler-ink, #0a1628);
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  overflow-x: clip;
  max-width: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--kotler-bg, #fafaf7);
}

/* Page wrapper pushes footer to bottom (kills white bar pod footerem) */
#page,
.site {
  display: flex;
  flex-direction: column;
  flex: 1 0 auto;
  min-height: 100vh;
}

#main,
main.site-main,
.site-content {
  flex: 1 0 auto;
}

.kotler-footer {
  flex-shrink: 0;
}

/* Fallback dla starszych przeglądarek (overflow-x: clip = Chrome 90+, Firefox 81+, Safari 16+) */
@supports not (overflow-x: clip) {
  html, body {
    overflow-x: hidden;
  }
}

/* Sanity: top-level kontenery nie generują horizontal overflow */
main, section, header, footer, nav {
  max-width: 100%;
}

/* Common culprit: media bez max-width */
img, svg, video, iframe {
  max-width: 100%;
}

/* ═══════════════════════════════════════════════
   CENNIK TAB PANES EXCLUSIVITY (added Faza 3.1.6)
   Globalna definicja przed inline styles content-* zeby uniknac FOUC
   i race condition gdy 2 panele beda widoczne jednoczesnie.
   ═══════════════════════════════════════════════ */

[data-pane] {
  display: none;
}

[data-pane].is-active {
  display: block;
}

/* ═══════════════════════════════════════════════
   DEFENSIVE TYPOGRAPHY GUARD (added Faza 3.1.7)
   Zapobiega pionowemu renderowaniu tekstu (Robert raportował na /realizacje/).
   Splitting.js + splitting-cells.css sa enqueued globalnie - jesli ktos doda
   data-splitting przez pomylke lub Splitting auto-init na elemencie, ten guard
   zapewnia ze headings/akapity zostaja horizontal-tb i nie lamia per znak.
   `:where()` ma specificity 0 - nie nadpisuje swiadomych reguł CSS.
   ═══════════════════════════════════════════════ */

:where(h1, h2, h3, h4, h5, h6, p) {
  writing-mode: horizontal-tb;
  word-break: normal;
  overflow-wrap: break-word;
}

/* Splitting.js cells/chars - upewnij sie ze sa inline (nie block per znak) */
:where(.splitting .char, .splitting .word, .splitting .line) {
  display: inline-block;
}

/* @font-face — Plus Jakarta Sans variable font */
@font-face {
  font-family: 'Plus Jakarta Sans';
  src: url('../fonts/PlusJakartaSans-Variable.woff2') format('woff2-variations');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0100-017F, U+0180-024F; /* Latin + Latin Extended */
}

/* @font-face — Geist variable font */
@font-face {
  font-family: 'Geist';
  src: url('../fonts/Geist-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0100-017F, U+0180-024F;
}

/* @font-face — Malking display font (watermark dekoracyjny only) */
@font-face {
  font-family: 'Malking';
  src: url('../fonts/Malking.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* === TYPOGRAPHY DEFAULTS === */

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 400;
  line-height: 1.6;
  color: var(--kotler-text);
  background-color: var(--kotler-bg);
}

/* Headings */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  color: var(--kotler-text);
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

/* Body text */

p {
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--kotler-text-soft);
}

p.lead {
  font-size: var(--text-lg);
  line-height: 1.65;
  color: var(--kotler-text);
}

/* Links — global reset (kills browser :visited purple) */

a,
a:link,
a:visited {
  color: var(--kotler-ink);
  text-decoration: none;
  transition: color 200ms ease;
}

a:hover,
a:focus-visible {
  color: var(--kotler-blue);
}

/* Lists */

ul, ol {
  padding-left: var(--space-6);
}

li {
  margin-bottom: var(--space-1);
}

/* === FOCUS STATES — WCAG 2.1 AA === */

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

/* Remove focus ring for mouse users */
:focus:not(:focus-visible) {
  outline: none;
}
