/* ==========================================================================
   Uzależnienia - design system "Nowy dzień"
   Lora (display) + Mulish (body) | teal + krem + bursztyn
   WCAG 2.1 AA: kontrast min 4.5:1, body 17px, sidebar 15px
   ========================================================================== */

:root {
  /* Light - "wschód słońca nad spokojnym morzem" */
  --ink: #14201e;
  --panel: #ffffff;
  --paper: #f6f2ea;
  --paper-deep: #efe9dc;
  --teal: #115e59;
  --teal-soft: #e4f1ee;
  --amber: #a85107;
  --amber-soft: #fdf0dd;
  --dim: #6b6154;
  --line: #e3dccd;
  --ok: #1a7f4b;
  --danger: #b91c1c;
  --header-bg: rgba(246, 242, 234, 0.94);
  --shadow-card: 0 1px 2px rgba(20, 32, 30, 0.05), 0 4px 14px rgba(20, 32, 30, 0.06);
  --shadow-card-hover: 0 2px 4px rgba(20, 32, 30, 0.06), 0 10px 26px rgba(20, 32, 30, 0.12);
  --accent-glow: rgba(17, 94, 89, 0.18);
  --hero-overlay: linear-gradient(180deg, rgba(11, 18, 20, 0.55) 0%, rgba(11, 18, 20, 0.42) 45%, rgba(11, 18, 20, 0.78) 100%);
  --cta-bg: #b45309;
  --cta-text: #ffffff;
  --cta-hover: #92400e;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e6e2d5;
    --panel: #101b1d;
    --paper: #0e1618;
    --paper-deep: #0b1214;
    --teal: #5eead4;
    --teal-soft: #122b2c;
    --amber: #fbbf24;
    --amber-soft: #2c2413;
    --dim: #a3b1ac;
    --line: #22302f;
    --ok: #4ade80;
    --danger: #f87171;
    --header-bg: rgba(14, 22, 24, 0.94);
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 14px rgba(0, 0, 0, 0.35);
    --shadow-card-hover: 0 2px 4px rgba(0, 0, 0, 0.35), 0 10px 26px rgba(0, 0, 0, 0.5);
    --accent-glow: rgba(94, 234, 212, 0.12);
    --hero-overlay: linear-gradient(180deg, rgba(5, 9, 10, 0.6) 0%, rgba(5, 9, 10, 0.45) 45%, rgba(5, 9, 10, 0.82) 100%);
    --cta-bg: #fbbf24;
    --cta-text: #231a05;
    --cta-hover: #fcd34d;
  }
}

* { box-sizing: border-box; }

html {
  overflow-x: clip;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Mulish", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.7;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(52rem 32rem at 88% -6rem, var(--accent-glow), transparent 62%),
    radial-gradient(46rem 30rem at -12% 108%, var(--accent-glow), transparent 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: "Lora", Georgia, serif;
  line-height: 1.25;
  text-wrap: balance;
  margin: 0 0 0.6em;
}

h1 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); font-weight: 600; }
h2 { font-size: 1.45rem; font-weight: 600; }
h3 { font-size: 1.15rem; font-weight: 600; }
p { margin: 0 0 1em; }

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

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

.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  z-index: 300;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 16px;
  border-radius: 8px;
}
.skip-link:focus { left: 8px; }

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

/* ---------- header ---------- */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 150;
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.app-header::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(180, 83, 9, 0.55), rgba(17, 94, 89, 0.55), transparent);
  opacity: 0.6;
  pointer-events: none;
}
.header-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 22px;
  height: 62px;
  display: flex;
  align-items: center;
  gap: 18px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-size: 1.06rem;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-flex;
  color: var(--amber);
}
.brand-text strong { font-family: "Lora", Georgia, serif; font-weight: 700; }
.brand-text strong::after { content: ""; }

.header-search {
  position: relative;
  flex: 1;
  max-width: 460px;
  margin-left: auto;
}
.search-icon {
  position: absolute;
  left: 13px; top: 50%;
  transform: translateY(-50%);
  color: var(--dim);
  pointer-events: none;
}
.header-search input {
  width: 100%;
  padding: 9px 14px 9px 38px;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.header-search input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-soft);
}
.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-card-hover);
  overflow: hidden;
  z-index: 160;
}
.search-results a {
  display: block;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}
.search-results a:last-child { border-bottom: none; }
.search-results a:hover { background: var(--paper-deep); text-decoration: none; }
.sr-title { display: block; font-weight: 600; font-size: 0.92rem; }
.sr-excerpt { display: block; font-size: 0.8rem; color: var(--dim); }

.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  padding: 10px;
  cursor: pointer;
  border-radius: 8px;
}
.menu-toggle span {
  width: 22px; height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

/* ---------- layout ---------- */
.layout {
  max-width: 1240px;
  margin: 0 auto;
  padding: 62px 22px 0;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 40px;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 78px;
  align-self: start;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  padding: 6px 14px 14px 2px;
}
.sidebar nav { display: flex; flex-direction: column; }
.sidebar-home {
  font-weight: 700;
  margin-bottom: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.sidebar-section {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--dim);
  margin: 16px 0 6px;
  padding-left: 10px;
}
.sidebar-link {
  font-size: 0.9rem;
  color: var(--ink);
  padding: 5px 10px;
  border-radius: 7px;
  line-height: 1.35;
}
.sidebar-link:hover { background: var(--paper-deep); text-decoration: none; }
.sidebar-link.active {
  background: var(--teal-soft);
  color: var(--teal);
  font-weight: 600;
}
.sidebar-foot {
  margin-top: 22px;
  padding: 12px 10px;
  font-size: 0.8rem;
  color: var(--dim);
  border-top: 1px solid var(--line);
  line-height: 1.5;
}
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 18, 20, 0.55);
  z-index: 140;
}

.main {
  min-width: 0;
  padding: 30px 0 70px;
}

/* ---------- home: hero ---------- */
.home-hero {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  padding: 64px 56px 54px;
  margin-bottom: 46px;
  color: #f2efe4;
  background-image: var(--hero-overlay), url("https://images.unsplash.com/photo-1495616811223-4d98c6e9c869?w=1600&q=80");
  background-size: cover;
  background-position: center 38%;
  box-shadow: var(--shadow-card-hover);
}
.home-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(40rem 22rem at 78% 110%, rgba(251, 191, 36, 0.22), transparent 60%);
  pointer-events: none;
}
.hero-eyebrow {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fbbf24;
  margin-bottom: 14px;
}
.home-hero h1 {
  font-size: clamp(1.9rem, 4.2vw, 2.9rem);
  color: #fff;
  margin-bottom: 14px;
  max-width: 16em;
}
.home-hero > p {
  font-size: 1.06rem;
  color: #e6e2d5;
  max-width: 40em;
  margin-bottom: 24px;
}
.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--cta-bg);
  color: var(--cta-text);
  font-weight: 700;
  font-size: 1rem;
  padding: 13px 26px;
  border-radius: 12px;
  transition: background 0.2s ease, transform 0.2s ease;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}
.hero-cta:hover { background: var(--cta-hover); text-decoration: none; transform: translateY(-1px); }
.cta-arrow { transition: transform 0.2s ease; }
.hero-cta:hover .cta-arrow { transform: translateX(3px); }
.hero-stats {
  display: flex;
  gap: 34px;
  margin-top: 38px;
  flex-wrap: wrap;
}
.hero-stat b {
  display: block;
  font-family: "Lora", Georgia, serif;
  font-size: 1.7rem;
  color: #fbbf24;
  line-height: 1.1;
}
.hero-stat span { font-size: 0.8rem; color: #cfcabc; }

/* ---------- home: section headings + cards ---------- */
.section-heading {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 42px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.section-heading h2 { margin: 0; font-size: 1.35rem; }
.sec-count { font-size: 0.8rem; color: var(--dim); white-space: nowrap; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
}
.home-card {
  position: relative;
  display: block;
  padding: 18px 18px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: var(--shadow-card);
  color: var(--ink);
  transition: transform 0.2s ease-out, box-shadow 0.2s ease-out, border-color 0.2s ease;
}
.home-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--teal);
  text-decoration: none;
}
.card-icon {
  display: inline-flex;
  font-size: 1.35rem;
  margin-bottom: 8px;
  line-height: 1;
}
.home-card h3 {
  font-size: 0.9rem;
  font-family: "Mulish", system-ui, sans-serif;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--ink);
}
.home-card p {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--dim);
  margin: 0 28px 0 0;
}
.card-arrow {
  position: absolute;
  right: 15px; bottom: 15px;
  color: var(--amber);
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  font-weight: 700;
}
.home-card:hover .card-arrow { opacity: 1; transform: translateX(0); }

/* ---------- article ---------- */
.content-article { animation: fadeUp 0.26s ease-out both; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.article-head { margin-bottom: 26px; }
.article-section {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--teal);
  background: var(--teal-soft);
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 12px;
}
.article-head h1 { margin-bottom: 10px; }
.article-excerpt {
  font-size: 1.08rem;
  color: var(--dim);
  max-width: 46em;
}
.article-meta {
  font-size: 0.8rem;
  color: var(--dim);
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.toc-box {
  background: var(--paper-deep);
  border: 1px solid var(--line);
  border-left: 3px solid var(--amber);
  border-radius: 10px;
  padding: 14px 18px;
  margin: 0 0 28px;
  font-size: 0.9rem;
}
.toc-box strong { display: block; margin-bottom: 6px; font-family: "Lora", Georgia, serif; }
.toc-box ol { margin: 0; padding-left: 20px; }
.toc-box li { margin: 3px 0; }
.toc-box a { color: var(--ink); }
.toc-box a:hover { color: var(--teal); }

.article-body { max-width: 46em; }
.article-body h2 {
  margin-top: 2em;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  scroll-margin-top: 84px;
}
.article-body h3 { margin-top: 1.6em; scroll-margin-top: 84px; }
.article-body ul, .article-body ol { padding-left: 22px; margin: 0 0 1em; }
.article-body li { margin: 4px 0; }
.article-body strong { font-weight: 700; }

.info-box, .warning-box, .help-box {
  border-radius: 11px;
  padding: 15px 18px;
  margin: 1.2em 0;
  font-size: 0.95rem;
}
.info-box {
  background: var(--teal-soft);
  border: 1px solid rgba(17, 94, 89, 0.35);
  border-left: 4px solid var(--teal);
}
.info-box strong { color: var(--teal); }
.warning-box {
  background: var(--amber-soft);
  border: 1px solid rgba(180, 83, 9, 0.35);
  border-left: 4px solid var(--amber);
}
.warning-box strong { color: var(--amber); }
.help-box {
  background: var(--paper-deep);
  border: 1px solid var(--line);
  border-left: 4px solid var(--amber);
}
.help-box strong { font-family: "Lora", Georgia, serif; display: block; margin-bottom: 4px; }
.help-box .help-tel { font-weight: 700; color: var(--amber); white-space: nowrap; }

/* tabele */
.table-responsive { overflow-x: auto; margin: 1.2em 0; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
th, td {
  padding: 10px 13px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  background: var(--paper-deep);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--teal-soft); }

/* FAQ */
.faq-item { margin: 0 0 10px; }
.faq-item h3 { margin: 0; font-family: "Mulish", system-ui, sans-serif; font-size: 1rem; }
.faq-item h3 button {
  width: 100%;
  text-align: left;
  font: inherit;
  font-weight: 700;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 13px 16px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  transition: border-color 0.2s ease;
}
.faq-item h3 button:hover { border-color: var(--teal); }
.faq-item h3 button::after {
  content: "+";
  font-size: 1.25rem;
  color: var(--amber);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}
.faq-item.open h3 button::after { transform: rotate(45deg); }
.faq-a {
  display: none;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-top: none;
  border-radius: 0 0 10px 10px;
  background: var(--paper-deep);
  font-size: 0.95rem;
}
.faq-item.open .faq-a { display: block; }

/* słownik */
dl.glossary { margin: 1.2em 0; }
.glossary dt {
  font-family: "Lora", Georgia, serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--teal);
  margin-top: 1.1em;
}
.glossary dd { margin: 2px 0 0; }

/* nawigacja między artykułami */
.article-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 44px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.article-nav a {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 13px 16px;
  color: var(--ink);
  font-size: 0.92rem;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.article-nav a:hover { border-color: var(--teal); text-decoration: none; transform: translateY(-1px); }
.nav-label {
  display: block;
  font-size: 0.75rem;
  color: var(--dim);
  margin-bottom: 3px;
}

/* ---------- footer ---------- */
.app-footer {
  border-top: 1px solid var(--line);
  background: var(--paper-deep);
  margin-top: 20px;
}
.footer-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 30px 22px 34px;
  font-size: 0.88rem;
  color: var(--dim);
}
.footer-inner p { margin: 0 0 8px; }
.footer-inner strong { color: var(--ink); }
.footer-note { font-size: 0.8rem; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; padding-top: 62px; gap: 0; }
  .sidebar {
    position: fixed;
    top: 62px; bottom: 0; left: 0;
    width: min(320px, 86vw);
    background: var(--paper);
    border-right: 1px solid var(--line);
    padding: 18px 20px 30px;
    transform: translateX(-105%);
    transition: transform 0.24s ease-out;
    z-index: 145;
    max-height: none;
    box-shadow: var(--shadow-card-hover);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: flex; margin-left: 4px; }
  .header-search { max-width: none; }
  .main { padding: 22px 0 50px; }
  .home-hero { padding: 46px 28px 40px; }
  .hero-stats { gap: 24px; }
}

@media (max-width: 600px) {
  body { font-size: 16.5px; }
  .layout { padding-left: 14px; padding-right: 14px; }
  .header-inner { padding: 0 14px; gap: 10px; }
  .header-search input { font-size: 0.9rem; padding-left: 34px; }
  .home-hero { padding: 38px 22px 34px; border-radius: 14px; }
  .home-hero h1 { font-size: 1.7rem; }
  .card-grid { grid-template-columns: 1fr; }
  .article-nav { grid-template-columns: 1fr; }
}

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