/* ============================================================
   KID — Konto Inwestycyjne Dziecka
   styles.css
   ============================================================ */

:root {
  --navy:     #1a2a4a;
  --blue:     #4a90d9;
  --red:      #d4231d;
  --gray:     #8a93a6;
  --gold:     #f0a91a;
  --bg-light: #f3f4f6;
  --ink:      #1d1d1b;
  --white:    #ffffff;

  --container: 1200px;
  /* spacing scale — jeden rytm pionowy dla całej strony */
  --space-sm: .75rem;
  --space-md: 1.25rem;
  --space-lg: 2rem;
  --space-xl: 2.5rem;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.04);
  --shadow-hover: 0 2px 6px rgba(0,0,0,.08), 0 16px 40px rgba(0,0,0,.08);
  --header-h: 84px;
  --ease: cubic-bezier(.22,.61,.36,1);
}

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

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

body {
  margin: 0;
  font-family: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { display: block; max-width: 100%; height: auto; }

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { color: var(--navy); line-height: 1.15; }

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

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--navy);
  color: var(--white);
  padding: .75rem 1.25rem;
  z-index: 200;
  border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ---------- Layout helpers ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: clamp(1.1rem, 4vw, 2.5rem);
}

.section {
  padding-block: clamp(4rem, 10vh, 8rem);
}
.section-alt { background: var(--bg-light); }

.section-title {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 700;
  margin: 0 0 var(--space-md);
  letter-spacing: -.01em;
}
.section-title.centered { text-align: center; }
.section-title .accent { color: var(--blue); }

.lead {
  font-size: clamp(1.1rem, 1.6vw, 1.25rem);
  max-width: 70ch;
  color: var(--ink);
  margin: 0 0 var(--space-xl);
}

/* jeden rytm dla akapitów płynących w treści */
main p { margin: 0; }
.subsec > p:not([class]) { margin-top: var(--space-md); max-width: 78ch; }

.note { margin: var(--space-md) 0 0; max-width: 78ch; color: var(--ink); }
.source {
  font-size: .875rem;
  color: var(--gray);
  margin: var(--space-sm) 0 0;
}
.callout {
  margin: var(--space-md) 0 0;
  border-left: 4px solid var(--gold);
  background: rgba(240,169,26,.07);
  padding: 1rem 1.25rem;
  border-radius: 0 10px 10px 0;
  max-width: 78ch;
}

.red  { color: var(--red); }
.gold { color: var(--gold); }

section[id] { scroll-margin-top: calc(var(--header-h) + 16px); }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,.6);
  transition: background .3s var(--ease), box-shadow .3s var(--ease), backdrop-filter .3s var(--ease);
}
.site-header.scrolled {
  background: rgba(255,255,255,.85);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  box-shadow: 0 1px 0 rgba(26,42,74,.08), 0 6px 20px rgba(0,0,0,.04);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-h);
  gap: 1rem;
}
.brand { display: inline-flex; align-items: center; }
.brand-logo { height: 58px; width: auto; }

.logo-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  min-width: 124px;
  padding: 0 .85rem;
  border: 1px dashed var(--gray);
  border-radius: 8px;
  background: repeating-linear-gradient(135deg, var(--white), var(--white) 8px, var(--bg-light) 8px, var(--bg-light) 16px);
  color: var(--navy);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .01em;
  white-space: nowrap;
}
.logo-placeholder--white {
  border-color: rgba(255,255,255,.5);
  background: rgba(255,255,255,.06);
  color: var(--white);
}

.primary-nav { display: flex; gap: clamp(1rem, 2vw, 2rem); align-items: center; }
.primary-nav a {
  color: var(--navy);
  font-weight: 600;
  font-size: .95rem;
  padding: .35rem 0;
  position: relative;
}
.primary-nav a::after {
  content: "";
  position: absolute;
  left: 0; bottom: -2px;
  width: 0; height: 2px;
  background: var(--blue);
  transition: width .25s var(--ease);
}
.primary-nav a:hover { text-decoration: none; }
.primary-nav a:hover::after { width: 100%; }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  width: 44px; height: 44px;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.nav-toggle-bar {
  display: block;
  width: 24px; height: 2px;
  background: var(--navy);
  transition: transform .3s var(--ease), opacity .2s var(--ease);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding-block: clamp(3rem, 8vh, 6rem);
  overflow: hidden;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}
.hero-title {
  font-size: clamp(2.5rem, 4vw, 3rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -.02em;
  margin: 0 0 1.5rem;
}
.hero-title span { display: block; }
.hero-title .l-navy { color: var(--navy); }
.hero-title .l-blue { color: var(--blue); }
.hero-title .l-gold { color: var(--gold); }

.hero-sub {
  font-size: clamp(1.1rem, 1.7vw, 1.3rem);
  color: var(--ink);
  max-width: 48ch;
  margin: 0 0 2rem;
}
.hero-meta { font-size: .875rem; color: var(--gray); margin: 0; }

.hero-img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  /* wtopienie lewej (i delikatnie górnej/dolnej) krawędzi w tło */
  -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 30%),
                      linear-gradient(to bottom, transparent 0%, #000 8%, #000 92%, transparent 100%);
  -webkit-mask-composite: source-in;
          mask-image: linear-gradient(to right, transparent 0%, #000 30%),
                      linear-gradient(to bottom, transparent 0%, #000 8%, #000 92%, transparent 100%);
          mask-composite: intersect;
}
.hero-accent {
  position: absolute;
  top: 0; right: 0;
  width: 6px; height: 100%;
  background: var(--red);
  opacity: .9;
}

/* ---------- Cards grid ---------- */
.cards { display: grid; gap: clamp(1rem, 2vw, 1.6rem); }
.cards-1 { grid-template-columns: minmax(0, 720px); justify-content: center; }
.cards-stack { grid-template-columns: minmax(0, 960px); justify-content: center; }
.cards-2 { grid-template-columns: repeat(2, 1fr); }
.cards-3 { grid-template-columns: repeat(3, 1fr); }
.cards-4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: var(--white);
  border: 1px solid var(--bg-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.card:hover { transform: scale(1.01); box-shadow: var(--shadow-hover); }
.card h3 { font-size: 1.25rem; font-weight: 600; margin: .25rem 0 .6rem; }
.card h4 { font-size: 1.05rem; font-weight: 600; margin: 0 0 .5rem; }
.card p { margin: 0; }

.num-card .num {
  display: inline-block;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--blue);
  letter-spacing: .05em;
}
.badge-card { text-align: left; }
.badge-card .badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(74,144,217,.12);
  color: var(--gold);
  font-size: 1.4rem;
  margin-bottom: .75rem;
}
.mini-card { padding: 1.25rem; }
.mini-card h4 { color: var(--navy); }

/* ---------- Subsections ---------- */
.subsec { margin-top: clamp(2.5rem, 5vh, 4rem); }
.subsec:first-of-type { margin-top: 0; }
.subsec-title {
  font-size: clamp(1.35rem, 2.2vw, 1.8rem);
  font-weight: 700;
  margin: 0 0 var(--space-md);
}
.subsec-title .accent { color: var(--blue); }

/* ---------- Chart cards ---------- */
.chart-card {
  margin: 0;
  background: var(--white);
  border: 1px solid var(--bg-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.chart-card:hover { transform: scale(1.01); box-shadow: var(--shadow-hover); }
.chart-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 .9rem;
}
.chart-card img { border-radius: 8px; width: 100%; }

/* Placeholder injected when an image fails to load */
.img-placeholder {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  background: repeating-linear-gradient(135deg, var(--white), var(--white) 12px, var(--bg-light) 12px, var(--bg-light) 24px);
  border: 1px dashed var(--gray);
  border-radius: 8px;
  color: var(--gray);
  text-align: center;
  padding: 1.5rem;
}
.img-placeholder .ph-mark { font-size: 1.8rem; color: var(--gray); opacity: .6; line-height: 1; }
.img-placeholder .ph-name { font-weight: 600; color: var(--navy); font-size: .9rem; word-break: break-all; }
.img-placeholder .ph-hint { font-size: .78rem; }

/* ---------- Data lists ---------- */
.data-list { max-width: 78ch; margin: var(--space-md) 0 0; padding-left: 1.2rem; }
.data-list > li { margin-bottom: .6rem; }
.data-list > li:last-child { margin-bottom: 0; }
.data-list ul { margin: .5rem 0 0; }

/* ---------- Tables ---------- */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--bg-light);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  font-variant-numeric: tabular-nums;
  min-width: 540px;
}
.data-table th, .data-table td {
  padding: .85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--bg-light);
}
.data-table thead th {
  background: var(--navy);
  color: var(--white);
  font-weight: 600;
  font-size: .95rem;
}
.data-table tbody th { color: var(--navy); font-weight: 600; }
.data-table tbody td { color: var(--ink); }
.data-table tr:last-child th, .data-table tr:last-child td { border-bottom: none; }
.data-table .row-highlight th, .data-table .row-highlight td {
  background: rgba(240,169,26,.10);
  font-weight: 700;
}

.sim-table thead .col-red  { background: var(--red); }
.sim-table thead .col-blue { background: var(--blue); }
.sim-table thead .col-gold { background: var(--gold); color: var(--navy); }

/* ---------- Stat blocks ---------- */
.stats { display: grid; gap: clamp(1rem, 2vw, 1.6rem); margin-bottom: var(--space-xl); }
.stats-4 { grid-template-columns: repeat(4, 1fr); }
.stat {
  background: var(--white);
  border: 1px solid var(--bg-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  text-align: center;
}
.stat-num {
  display: block;
  font-size: clamp(1.6rem, 2.6vw, 2.2rem);
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -.02em;
}
.stat-num.red { color: var(--red); }
.stat-label { display: block; margin-top: .5rem; font-size: .9rem; color: var(--gray); }

/* ---------- Lessons ---------- */
.lessons { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.lesson {
  background: var(--white);
  border: 1px solid var(--bg-light);
  border-left: 4px solid var(--blue);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem;
}
.lesson-head { margin-bottom: .35rem; }
.lesson-head strong { color: var(--navy); font-size: 1.1rem; }
.lesson-name { color: var(--gray); font-style: italic; margin-left: .4rem; }
.lesson p { margin: 0; }
.tag {
  display: inline-block;
  font-size: .78rem;
  font-weight: 600;
  padding: .15rem .55rem;
  border-radius: 999px;
  margin-left: .25rem;
}
.tag-ok { background: rgba(240,169,26,.18); color: var(--navy); }

/* ---------- Manifesto ---------- */
.manifesto-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(1rem, 3vw, 2.5rem) clamp(2rem, 5vw, 4rem);
  max-width: 1000px;
  margin: 0 auto;
}
.m-line {
  font-size: clamp(1.2rem, 2vw, 1.6rem);
  font-weight: 600;
  line-height: 1.15;
  color: var(--navy);
  margin: 0.5rem 0;
}
.m-line.strong { font-weight: 600; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--navy);
  color: rgba(255,255,255,.82);
  padding-block: clamp(2.5rem, 6vh, 4rem);
  font-size: .9rem;
}
.legal { max-width: 90ch; margin-bottom: 1.5rem; }
.legal summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--white);
  padding: .5rem 0;
}
.legal summary:hover { color: var(--gold); }
.legal p { color: rgba(255,255,255,.72); line-height: 1.7; }
.legal strong { color: var(--white); }
.footer-meta { margin: .35rem 0; color: rgba(255,255,255,.6); }

/* ---------- Reveal animation ---------- */
.reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .45s var(--ease), transform .45s var(--ease);
  will-change: opacity, transform;
}
.reveal.is-visible { opacity: 1; transform: none; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1024px) {
  .cards-4 { grid-template-columns: repeat(2, 1fr); }
  .cards-3 { grid-template-columns: repeat(2, 1fr); }
  .stats-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  body { font-size: 1rem; }

  .nav-toggle { display: flex; }
  .primary-nav {
    position: absolute;
    top: var(--header-h);
    left: 0; right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    background: var(--white);
    box-shadow: var(--shadow);
    padding: .5rem clamp(1.1rem, 4vw, 2.5rem) 1rem;
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s var(--ease), transform .25s var(--ease);
  }
  .primary-nav.open { opacity: 1; transform: none; pointer-events: auto; }
  .primary-nav a { width: 100%; padding: .75rem 0; border-bottom: 1px solid var(--bg-light); }

  .hero-grid { grid-template-columns: 1fr; }
  .hero-media { order: -1; }
  .hero-img {
    -webkit-mask-image: none;
            mask-image: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
  }

  .cards-2, .cards-3, .cards-4 { grid-template-columns: 1fr; }
  .cards-1 { grid-template-columns: 1fr; }
  .stats-4 { grid-template-columns: 1fr; }
  .manifesto-grid { grid-template-columns: 1fr; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}