/* ==========================================================================
   Pingwiny.edu.pl — arkusz stylów głównych
   Paleta: lód (biel/błękit), pingwin (czerń/biel), akcent (pomarańcz)
   ========================================================================== */

/* --- Zmienne motywu ------------------------------------------------------ */
:root {
  --ice-50: #f6fbff;
  --ice-100: #eaf4fd;
  --ice-200: #d3e8fa;
  --ice-300: #b3d6f4;
  --ice-400: #7fb8e8;
  --ice-500: #4b93cc;
  --ice-600: #2f6f9f;
  --ice-700: #1f4f74;
  --ice-800: #173a56;
  --ice-900: #0f2839;

  --accent: #f97316;
  --accent-dark: #c2540a;
  --accent-soft: #ffe6d3;

  --bg: var(--ice-50);
  --surface: #ffffff;
  --surface-2: var(--ice-100);
  --text: #12222e;
  --text-muted: #56697a;
  --border: #d8e6f0;
  --shadow: 0 10px 30px rgba(15, 40, 57, 0.10);
  --shadow-sm: 0 4px 14px rgba(15, 40, 57, 0.08);
  --radius: 16px;
  --radius-sm: 10px;
  --maxw: 1140px;
  --header-h: 68px;
  --focus: #1d6fb8;
}

[data-theme="dark"] {
  --bg: #0b1721;
  --surface: #12222e;
  --surface-2: #0f1d27;
  --text: #eaf4fd;
  --text-muted: #9fb6c8;
  --border: #23394a;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.35);
  --accent-soft: #3a2413;
  --focus: #7fb8e8;
}

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

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

body {
  margin: 0;
  font-family: "Nunito", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a { color: var(--ice-600); text-underline-offset: 3px; }
a:hover { color: var(--accent-dark); }
[data-theme="dark"] a { color: var(--ice-300); }

h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; font-weight: 800; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.2rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; }

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

/* --- Układ --------------------------------------------------------------- */
.container { width: min(100% - 2.4rem, var(--maxw)); margin-inline: auto; }

main { display: block; }

.section { padding: clamp(2.5rem, 6vw, 4.5rem) 0; }
.section--tint { background: var(--surface-2); }

.section-head { max-width: 720px; margin-bottom: 2rem; }
.section-head p { color: var(--text-muted); font-size: 1.05rem; margin-bottom: 0; }

.eyebrow {
  display: inline-block;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent-dark);
  background: var(--accent-soft);
  padding: .3rem .7rem;
  border-radius: 999px;
  margin-bottom: .8rem;
}
[data-theme="dark"] .eyebrow { color: var(--accent); }

.grid { display: grid; gap: 1.4rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--accent);
  color: #fff;
  padding: .7rem 1rem;
  border-radius: 0 0 8px 0;
  font-weight: 700;
}
.skip-link:focus { left: 0; }

/* --- Nagłówek / nawigacja ------------------------------------------------ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  font-weight: 900;
  font-size: 1.15rem;
  color: var(--text);
  text-decoration: none;
  margin-right: auto;
}
.brand svg { width: 34px; height: 34px; flex: none; }
.brand span small { display: block; font-size: .62rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--text-muted); }

.main-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: .2rem;
  margin: 0;
  padding: 0;
}
.main-nav a {
  display: block;
  padding: .5rem .7rem;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: .94rem;
}
.main-nav a:hover { background: var(--surface-2); color: var(--accent-dark); }
.main-nav a[aria-current="page"] {
  color: var(--accent-dark);
  background: var(--accent-soft);
}
[data-theme="dark"] .main-nav a[aria-current="page"] { color: var(--accent); }

.header-actions { display: flex; gap: .5rem; align-items: center; }

.icon-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent-dark); }
.icon-btn svg { width: 20px; height: 20px; }

.nav-toggle { display: none; }

@media (max-width: 900px) {
  .nav-toggle { display: inline-grid; }
  .main-nav {
    position: fixed;
    inset: var(--header-h) 0 auto 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: .6rem 1.2rem 1.2rem;
    transform: translateY(-140%);
    transition: transform .25s ease;
    max-height: calc(100vh - var(--header-h));
    overflow: auto;
  }
  .main-nav.is-open { transform: translateY(0); }
  .main-nav ul { flex-direction: column; gap: .15rem; }
  .main-nav a { padding: .75rem .6rem; font-size: 1rem; }
}

/* --- Przyciski ----------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .8rem 1.35rem;
  border-radius: 999px;
  font-weight: 800;
  font-size: .98rem;
  text-decoration: none;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease, color .15s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-dark); color: #fff; }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent-dark); }
.btn--light { background: #fff; color: var(--ice-800); }
.btn--light:hover { color: var(--accent-dark); }

.btn-row { display: flex; flex-wrap: wrap; gap: .8rem; }

/* --- Hero ---------------------------------------------------------------- */
.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(1200px 600px at 85% -10%, var(--ice-200), transparent 60%),
    linear-gradient(160deg, var(--ice-100), var(--ice-300));
  color: var(--ice-900);
}
[data-theme="dark"] .hero {
  background:
    radial-gradient(1200px 600px at 85% -10%, #14344b, transparent 60%),
    linear-gradient(160deg, #0d1f2c, #102c40);
  color: var(--ice-50);
}
.hero-inner {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 2rem;
  align-items: center;
  padding: clamp(2.5rem, 6vw, 5rem) 0;
}
.hero h1 { margin-bottom: .6rem; }
.hero p.lead { font-size: clamp(1.05rem, 2vw, 1.3rem); color: inherit; opacity: .9; max-width: 52ch; }
.hero .btn--ghost { border-color: rgba(0,0,0,.18); }
[data-theme="dark"] .hero .btn--ghost { border-color: rgba(255,255,255,.25); }
.hero-art { justify-self: center; width: min(100%, 420px); filter: drop-shadow(0 22px 30px rgba(15,40,57,.28)); }

@media (max-width: 820px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-art { order: -1; width: min(78%, 320px); }
}

/* --- Karty --------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  box-shadow: var(--shadow-sm);
}
.card h3 { margin-bottom: .35rem; }
.card p:last-child { margin-bottom: 0; }

.card--species { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.species-art { background: linear-gradient(165deg, var(--ice-100), var(--ice-200)); padding: 1rem; }
[data-theme="dark"] .species-art { background: linear-gradient(165deg, #14344b, #0f2738); }
.species-art svg { width: 100%; height: auto; max-width: 190px; margin-inline: auto; }
.species-body { padding: 1.1rem 1.2rem 1.3rem; display: flex; flex-direction: column; gap: .5rem; flex: 1; }
.species-latin { font-style: italic; color: var(--text-muted); font-size: .92rem; margin: -.4rem 0 .2rem; }
.species-body dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: .2rem .7rem; font-size: .9rem; }
.species-body dt { color: var(--text-muted); }
.species-body dd { margin: 0; font-weight: 700; }

.badge {
  display: inline-block;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .04em;
  padding: .28rem .6rem;
  border-radius: 999px;
  background: var(--ice-200);
  color: var(--ice-800);
}
[data-theme="dark"] .badge { background: #1c3a4f; color: var(--ice-100); }
.badge--iucn { background: #d9f0d9; color: #1f5c2e; }
.iucn-LC { background: #d9f0d9 !important; color: #1f5c2e !important; }
.iucn-NT { background: #e7f3c9 !important; color: #4c6415 !important; }
.iucn-VU { background: #fdf0bf !important; color: #7a5b04 !important; }
.iucn-EN { background: #fcd9b8 !important; color: #8a400b !important; }
.iucn-CR { background: #f9c2c2 !important; color: #8c1616 !important; }

/* --- Filtry -------------------------------------------------------------- */
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.6rem; }
.chip {
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: .5rem .95rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: .9rem;
  cursor: pointer;
}
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* --- Porównywarka -------------------------------------------------------- */
.compare-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.4rem; }
.compare-controls label { font-weight: 700; font-size: .9rem; display: block; margin-bottom: .3rem; }
select, input, textarea {
  width: 100%;
  padding: .7rem .8rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
select:hover, input:hover, textarea:hover { border-color: var(--ice-400); }
.compare-result { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.compare-col { background: var(--surface-2); border-radius: var(--radius-sm); padding: 1rem; }
.compare-col svg { margin-inline: auto; }
.meter { background: var(--ice-200); border-radius: 999px; height: 12px; overflow: hidden; margin: .25rem 0 .9rem; }
[data-theme="dark"] .meter { background: #1c3a4f; }
.meter span { display: block; height: 100%; background: linear-gradient(90deg, var(--ice-400), var(--accent)); border-radius: 999px; }
@media (max-width: 620px) {
  .compare-controls, .compare-result { grid-template-columns: 1fr; }
}

/* --- Siatka informacyjna / infografika ----------------------------------- */
.info-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 2rem; align-items: center; }
@media (max-width: 820px) { .info-grid { grid-template-columns: 1fr; } }

.fact-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.fact-list li { padding-left: 1.6rem; position: relative; }
.fact-list li::before {
  content: "";
  position: absolute; left: 0; top: .55em;
  width: .7rem; height: .7rem;
  background: var(--accent);
  border-radius: 3px;
  transform: rotate(45deg);
}

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; }
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
  text-align: center;
}
.stat b { display: block; font-size: 1.9rem; color: var(--accent-dark); line-height: 1.1; }
[data-theme="dark"] .stat b { color: var(--accent); }
.stat span { font-size: .85rem; color: var(--text-muted); }

/* --- Mapa ---------------------------------------------------------------- */
.map-wrap { position: relative; background: linear-gradient(180deg, var(--ice-100), var(--ice-200)); border-radius: var(--radius); border: 1px solid var(--border); padding: .6rem; }
[data-theme="dark"] .map-wrap { background: linear-gradient(180deg, #102c40, #0c2130); }
.map-pin {
  position: absolute;
  transform: translate(-50%, -100%);
  background: var(--accent);
  color: #fff;
  border: 2px solid #fff;
  border-radius: 999px;
  min-width: 30px;
  height: 30px;
  padding: 0 .5rem;
  font-size: .78rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(0,0,0,.25);
}
.map-pin:hover { background: var(--accent-dark); }
.map-tooltip {
  position: absolute;
  transform: translate(-50%, -130%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .6rem .8rem;
  box-shadow: var(--shadow);
  max-width: 240px;
  font-size: .88rem;
  z-index: 5;
}
.map-tooltip strong { display: block; }

/* --- Tabela -------------------------------------------------------------- */
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; min-width: 560px; }
th, td { text-align: left; padding: .75rem .8rem; border-bottom: 1px solid var(--border); }
th { background: var(--surface-2); font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
tbody tr:hover { background: var(--surface-2); }

/* --- Oś czasu ------------------------------------------------------------ */
.timeline { list-style: none; margin: 0; padding: 0 0 0 1.6rem; border-left: 3px solid var(--ice-300); display: grid; gap: 1.3rem; }
.timeline li { position: relative; }
.timeline li::before {
  content: "";
  position: absolute; left: -2.15rem; top: .45rem;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--surface);
  box-shadow: 0 0 0 2px var(--ice-300);
}
.timeline h3 { margin-bottom: .2rem; font-size: 1.05rem; }

/* --- Galeria ------------------------------------------------------------- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; }
.gallery-item {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  padding: 0;
  text-align: left;
  color: inherit;
  font: inherit;
}
.gallery-item .art { background: linear-gradient(165deg, var(--ice-100), var(--ice-300)); display: grid; place-items: center; padding: 1rem; }
.gallery-item .art svg { width: 100%; height: auto; max-width: 200px; }
[data-theme="dark"] .gallery-item .art { background: linear-gradient(165deg, #14344b, #0f2738); }
.gallery-item figcaption { padding: .75rem .9rem; font-weight: 700; font-size: .95rem; }
.gallery-item p { padding: 0 .9rem .9rem; margin: 0; font-size: .85rem; color: var(--text-muted); }

dialog.lightbox {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 460px;
  width: min(92vw, 460px);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}
dialog.lightbox::backdrop { background: rgba(6, 15, 22, .62); }
dialog.lightbox [data-lightbox-art] { max-width: 230px; margin: 0 auto .6rem; }

/* --- Quiz ---------------------------------------------------------------- */
.quiz { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow-sm); }
.quiz-options { display: grid; gap: .6rem; margin: 1rem 0; }
.quiz-option {
  text-align: left;
  padding: .85rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.quiz-option:hover { border-color: var(--ice-400); }
.quiz-option.is-correct { border-color: #2e8b57; background: #e3f5e8; color: #1f5c2e; }
.quiz-option.is-wrong { border-color: #c0392b; background: #fbe3e0; color: #8c1616; }
.quiz-feedback { font-weight: 700; min-height: 1.5em; }
.quiz-progress { font-size: .85rem; color: var(--text-muted); font-weight: 700; }
.quiz-art { max-width: 170px; margin: 0 auto .5rem; }

/* --- Ciekawostki --------------------------------------------------------- */
.fact-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 5px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow-sm);
}
.fact-card strong { color: var(--accent-dark); }
[data-theme="dark"] .fact-card strong { color: var(--accent); }

/* --- Materiały ----------------------------------------------------------- */
.download-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  box-shadow: var(--shadow-sm);
}
.download-item svg { width: 42px; height: 42px; flex: none; color: var(--accent); }
.download-item h3 { margin: 0 0 .1rem; font-size: 1.05rem; }
.download-item p { margin: 0; font-size: .88rem; color: var(--text-muted); }
.download-item .btn { margin-left: auto; flex: none; }
@media (max-width: 560px) {
  .download-item { flex-wrap: wrap; }
  .download-item .btn { margin-left: 0; }
}

/* --- Formularze ---------------------------------------------------------- */
.form-grid { display: grid; gap: 1rem; }
.field label { display: block; font-weight: 700; margin-bottom: .3rem; font-size: .92rem; }
.field .hint { font-size: .8rem; color: var(--text-muted); }
.checkbox-field { display: flex; gap: .6rem; align-items: flex-start; font-size: .9rem; }
.checkbox-field input { width: auto; margin-top: .35rem; }

.form-message { border-radius: var(--radius-sm); padding: .9rem 1rem; font-weight: 700; display: none; }
.form-message.is-visible { display: block; }
.form-message.is-success { background: #e3f5e8; color: #1f5c2e; }
.form-message.is-error { background: #fbe3e0; color: #8c1616; }

.newsletter-band {
  background: linear-gradient(150deg, var(--ice-600), var(--ice-800));
  color: #fff;
  border-radius: var(--radius);
  padding: clamp(1.6rem, 4vw, 3rem);
}
.newsletter-band h2 { color: #fff; }
.newsletter-band p { color: rgba(255,255,255,.85); max-width: 60ch; }
.newsletter-form { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1rem; }
.newsletter-form input {
  flex: 1 1 260px;
  background: rgba(255,255,255,.12);
  border-color: rgba(255,255,255,.35);
  color: #fff;
}
.newsletter-form input::placeholder { color: rgba(255,255,255,.7); }

/* --- Pasek postępu czytania --------------------------------------------- */
.read-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0;
  background: var(--accent);
  z-index: 60;
  transition: width .1s linear;
}

/* --- Stopka -------------------------------------------------------------- */
.site-footer {
  background: var(--ice-900);
  color: var(--ice-100);
  margin-top: 3rem;
  padding: 3rem 0 1.5rem;
}
[data-theme="dark"] .site-footer { background: #060f16; }
.site-footer a { color: var(--ice-200); text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 1.6rem; }
.footer-grid h3 { font-size: .82rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ice-400); }
.footer-grid ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
.footer-brand p { color: var(--ice-300); font-size: .9rem; max-width: 36ch; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.12);
  margin-top: 2rem;
  padding-top: 1.2rem;
  display: flex;
  flex-wrap: wrap;
  gap: .8rem;
  justify-content: space-between;
  font-size: .84rem;
  color: var(--ice-300);
}
@media (max-width: 820px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .footer-grid { grid-template-columns: 1fr; }
}

/* --- Pomocnicze ---------------------------------------------------------- */
.text-muted { color: var(--text-muted); }
.center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}
.breadcrumbs { font-size: .85rem; color: var(--text-muted); padding: 1rem 0 0; }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; padding: 0; margin: 0; }
.breadcrumbs li + li::before { content: "/"; margin-right: .4rem; color: var(--border); }
.page-hero { padding-top: 2rem; }
.page-hero p { font-size: 1.1rem; color: var(--text-muted); max-width: 65ch; }
.prose { max-width: 70ch; }
.prose h2 { margin-top: 2rem; }
.prose h3 { margin-top: 1.5rem; }
.prose ul li { margin-bottom: .4rem; }

.callout {
  background: var(--accent-soft);
  border-left: 5px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 1.1rem 1.3rem;
  margin: 1.5rem 0;
}
.callout p:last-child { margin-bottom: 0; }

.alert { border-left-color: #c0392b; background: #fbe3e0; }
[data-theme="dark"] .alert { background: #3a1a17; }
