/* ============================================================
   Skóra - design system
   Paleta: głęboka teal-zieleń + błękit + krem (zdrowie, natura,
   zaufanie medyczne - inspiracja: Healthline biel+teal, cieplejsza
   i mniej kliniczna niż DermNet).
   Typografia: Lora (display serif) + Figtree (body).
   ============================================================ */

:root {
  /* Light theme */
  --bg: #f7f5ef;
  --bg-soft: #eef2ec;
  --bg-card: #ffffff;
  --text: #1d2b27;
  --muted: #5d6b66;
  --border: #e2ded2;
  --border-strong: #cfcabe;

  --accent: #0e7a6b;
  --accent-strong: #0a5d52;
  --accent-soft: #dcefe9;
  --accent-faint: #eef6f3;
  --blue: #1f7fae;
  --blue-soft: #e3f0f7;
  --warn: #9a4b2f;

  --hero-grad: linear-gradient(135deg, #0e7a6b 0%, #157a8c 55%, #1f7fae 100%);
  --hero-glow-1: rgba(140, 220, 200, 0.35);
  --hero-glow-2: rgba(120, 190, 230, 0.25);

  --font-display: 'Lora', Georgia, 'Times New Roman', serif;
  --font-body: 'Figtree', system-ui, -apple-system, sans-serif;

  --radius: 14px;
  --radius-sm: 9px;
  --header-h: 62px;
  --sidebar-w: 300px;
  --shadow-card: 0 1px 2px rgba(29, 43, 39, 0.05), 0 6px 20px -8px rgba(29, 43, 39, 0.10);
  --shadow-card-hover: 0 3px 6px rgba(29, 43, 39, 0.06), 0 14px 32px -10px rgba(14, 122, 107, 0.22);
  --transition: 0.2s ease-out;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1412;
    --bg-soft: #101a17;
    --bg-card: #131d1a;
    --text: #dde6e2;
    --muted: #9fb1aa;
    --border: #24322d;
    --border-strong: #32443d;

    --accent: #43c9a8;
    --accent-strong: #6fe0c0;
    --accent-soft: #1a2e28;
    --accent-faint: #16241f;
    --blue: #6ab8e0;
    --blue-soft: #142630;
    --warn: #e08a66;

    --hero-grad: linear-gradient(135deg, #0d5c51 0%, #0e5a68 55%, #14506e 100%);
    --hero-glow-1: rgba(67, 201, 168, 0.28);
    --hero-glow-2: rgba(106, 184, 224, 0.22);

    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px -10px rgba(0, 0, 0, 0.5);
    --shadow-card-hover: 0 4px 8px rgba(0, 0, 0, 0.45), 0 16px 36px -12px rgba(67, 201, 168, 0.25);
  }
}

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 55% 45% at 100% 0%, var(--hero-glow-1), transparent 70%),
    radial-gradient(ellipse 50% 42% at 0% 100%, var(--hero-glow-2), transparent 70%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
em { font-family: var(--font-display); }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.25; text-wrap: balance; margin: 0 0 0.5em; }
p { margin: 0 0 1em; }
ul, ol { margin: 0 0 1em; padding-left: 1.3em; }
li { margin-bottom: 0.35em; }

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

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

/* ---------- Header ---------- */
.app-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  height: var(--header-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.app-header::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-soft), transparent);
  opacity: 0.9;
  pointer-events: none;
}
.header-inner {
  max-width: 1280px; margin: 0 auto; height: 100%;
  padding: 0 20px;
  display: flex; align-items: center; gap: 18px;
}
.brand {
  display: flex; align-items: center; gap: 9px;
  color: var(--text); font-size: 1.18rem; font-weight: 800; letter-spacing: -0.01em;
  white-space: nowrap; flex-shrink: 0;
}
.brand:hover { text-decoration: none; }
.brand-mark { color: var(--accent); display: inline-flex; }
.brand-name em { font-style: italic; color: var(--accent); font-weight: 600; }

.search-wrap { position: relative; flex: 1; max-width: 460px; margin-left: auto; }
.search-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
#search-input {
  width: 100%; height: 40px;
  padding: 0 38px 0 40px;
  font-family: var(--font-body); font-size: 0.95rem; color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border); border-radius: 999px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
#search-input::placeholder { color: var(--muted); }
#search-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 60;
  background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card-hover);
  max-height: 380px; overflow-y: auto;
}
.search-result {
  display: block; padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text); font-size: 0.93rem; line-height: 1.4;
}
.search-result:last-child { border-bottom: none; }
.search-result small { display: block; color: var(--muted); font-size: 0.78rem; margin-top: 2px; }
.search-result:hover, .search-result.active { background: var(--accent-faint); text-decoration: none; }
.search-empty { padding: 14px 16px; color: var(--muted); font-size: 0.9rem; }

.menu-toggle {
  display: none;
  background: none; border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); width: 42px; height: 40px; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
}
.menu-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Layout ---------- */
.layout {
  max-width: 1280px; margin: 0 auto;
  padding: calc(var(--header-h) + 26px) 20px 40px;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  gap: 34px;
  align-items: start;
}
.sidebar {
  position: sticky; top: calc(var(--header-h) + 24px);
  max-height: calc(100vh - var(--header-h) - 48px);
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 14px 20px;
  scrollbar-width: thin;
}
.sidebar-nav-section { margin-bottom: 16px; }
.sidebar-nav-section:last-child { margin-bottom: 0; }
.sidebar-section-label {
  display: block;
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--muted);
  padding: 0 10px; margin: 14px 0 6px;
}
.sidebar-link {
  display: block;
  font-size: 0.9rem; font-weight: 500; line-height: 1.35;
  color: var(--text);
  padding: 6px 10px; border-radius: 8px;
  transition: background var(--transition), color var(--transition);
}
.sidebar-link:hover { background: var(--accent-faint); color: var(--accent); text-decoration: none; }
.sidebar-link.active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
.sidebar-overlay {
  position: fixed; inset: 0; z-index: 39;
  background: rgba(12, 20, 18, 0.55);
  backdrop-filter: blur(2px);
}

.main { min-width: 0; }

/* ---------- Page transition ---------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.page-enter { animation: fadeUp 0.24s ease-out; }

/* ---------- Home: hero ---------- */
.home-hero {
  position: relative; overflow: hidden;
  background: var(--hero-grad);
  border-radius: var(--radius);
  color: #fff;
  padding: 44px 46px 40px;
  margin-bottom: 34px;
  box-shadow: 0 10px 34px -12px rgba(14, 122, 107, 0.45);
}
.home-hero::before, .home-hero::after {
  content: ''; position: absolute; border-radius: 50%; pointer-events: none;
  filter: blur(60px);
}
.home-hero::before { width: 340px; height: 340px; background: var(--hero-glow-1); top: -140px; right: 120px; }
.home-hero::after { width: 280px; height: 280px; background: var(--hero-glow-2); bottom: -140px; left: -80px; }
.hero-inner { position: relative; display: flex; gap: 40px; align-items: center; }
.hero-copy { flex: 1 1 auto; min-width: 0; }
.hero-kicker {
  display: inline-block;
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.35);
  padding: 5px 12px; border-radius: 999px; margin-bottom: 16px;
}
.home-hero h1 {
  font-size: clamp(1.7rem, 3.4vw, 2.5rem);
  color: #fff; margin-bottom: 10px;
}
.home-hero .hero-sub { font-size: 1.04rem; color: rgba(255, 255, 255, 0.92); max-width: 34em; margin-bottom: 22px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-body); font-size: 0.95rem; font-weight: 600;
  padding: 11px 20px; border-radius: 999px; border: none; cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: #fff; color: var(--accent-strong); }
.btn-primary:hover { background: var(--accent-faint); transform: translateY(-2px); box-shadow: 0 8px 18px -8px rgba(0, 0, 0, 0.35); text-decoration: none; }
.btn-ghost { background: rgba(255, 255, 255, 0.14); color: #fff; border: 1.5px solid rgba(255, 255, 255, 0.7); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.22); transform: translateY(-2px); text-decoration: none; }

/* Skin layers graphic (signature element) */
.skin-layers { flex: 0 0 240px; position: relative; }
.skin-layers svg { width: 100%; height: auto; display: block; }
.layer-label {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.05em;
  fill: rgba(255, 255, 255, 0.92);
}

/* ---------- Home: A-Z index ---------- */
.az-index {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px 20px;
  margin-bottom: 34px;
}
.az-index h2 { font-size: 1.05rem; margin-bottom: 4px; }
.az-index p.az-hint { font-size: 0.85rem; color: var(--muted); margin-bottom: 12px; }
.az-strip { display: flex; flex-wrap: wrap; gap: 5px; }
.az-letter {
  min-width: 37px; height: 37px; padding: 0 7px;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-body); font-size: 0.82rem; font-weight: 600;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px; cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition), transform var(--transition);
}
.az-letter:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.az-letter.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.az-letter.az-all { font-weight: 700; }

/* ---------- Home: sections & cards ---------- */
.home-section { margin-bottom: 36px; }
.home-section h2 {
  font-size: 1.45rem; display: flex; align-items: baseline; gap: 10px;
  padding-bottom: 8px; margin-bottom: 16px;
  border-bottom: 2px solid var(--border);
}
.home-section h2 .section-count {
  font-family: var(--font-body); font-size: 0.8rem; font-weight: 600; color: var(--muted);
}
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.home-card {
  position: relative;
  display: flex; flex-direction: column; gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  color: var(--text);
  box-shadow: var(--shadow-card);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  overflow: hidden;
}
.home-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--blue));
  opacity: 0; transition: opacity var(--transition);
}
.home-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-card-hover); border-color: var(--border-strong); text-decoration: none; }
.home-card:hover::before { opacity: 1; }
.home-card .card-icon { font-size: 1.5rem; line-height: 1; }
.home-card h3 { font-size: 0.95rem; font-weight: 600; margin: 0; color: var(--text); }
.home-card p { font-size: 0.85rem; color: var(--muted); line-height: 1.55; margin: 0; }
.home-card.hidden { display: none; }

/* ---------- Article page ---------- */
.article { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 38px 44px 44px; box-shadow: var(--shadow-card); }
.article-head { margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.article-kicker { display: inline-flex; align-items: center; gap: 7px; font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--accent); margin-bottom: 10px; }
.article h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); margin-bottom: 10px; }
.article-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 0.82rem; color: var(--muted); margin-bottom: 4px; }
.trust-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent-faint); color: var(--accent-strong);
  border: 1px solid var(--accent-soft);
  font-size: 0.78rem; font-weight: 600;
  padding: 4px 12px; border-radius: 999px;
}
.article h2 {
  font-size: 1.35rem; margin-top: 1.6em; margin-bottom: 0.55em;
  scroll-margin-top: calc(var(--header-h) + 20px);
}
.article h3 { font-size: 1.05rem; margin-top: 1.2em; margin-bottom: 0.4em; }
.article ul, .article ol { padding-left: 1.4em; }
.article strong { font-weight: 700; }

/* TOC */
.toc {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin: 0 0 22px;
  font-size: 0.9rem;
}
.toc-title { font-weight: 700; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 8px; }
.toc ol { margin: 0; padding-left: 1.25em; }
.toc li { margin-bottom: 4px; }
.toc a { color: var(--text); }
.toc a:hover { color: var(--accent); }

/* info-box */
.info-box {
  background: var(--accent-faint);
  border: 1px solid var(--accent-soft);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin: 1.2em 0;
  font-size: 0.95rem;
}
.info-box strong { color: var(--accent-strong); }

/* Tables */
.table-responsive { overflow-x: auto; margin: 1.2em 0; border-radius: var(--radius-sm); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; background: var(--bg-card); }
caption { caption-side: top; text-align: left; font-size: 0.85rem; color: var(--muted); padding: 8px 12px; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--accent-faint); font-weight: 700; color: var(--accent-strong); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--accent-faint); }

/* FAQ */
.faq-item { border-bottom: 1px solid var(--border); padding: 18px 2px; }
.faq-item:first-of-type { padding-top: 8px; }
.faq-item:last-child { border-bottom: none; }
.faq-item h3 { font-family: var(--font-body); font-size: 1.02rem; font-weight: 700; margin: 0 0 8px; color: var(--text); }
.faq-item h3::before { content: 'Q: '; color: var(--accent); font-weight: 800; }
.faq-item p { margin: 0; color: var(--text); }
.faq-item p::first-letter { color: var(--accent); font-weight: 700; }

/* Glossary */
.glossary dl { margin: 0; }
.glossary dt { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; color: var(--accent-strong); margin-top: 1em; }
.glossary dt::before { content: '• '; color: var(--accent); }
.glossary dd { margin: 0.2em 0 0 1.1em; color: var(--text); }

/* Article footer note */
.article-note {
  margin-top: 34px; padding: 14px 18px;
  background: var(--blue-soft); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.88rem; color: var(--muted);
}

/* Prev/next */
.article-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 26px; }
.article-nav a {
  flex: 1; max-width: 48%;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 16px; font-size: 0.88rem; color: var(--text);
  transition: border-color var(--transition), background var(--transition);
}
.article-nav a:hover { border-color: var(--accent); background: var(--accent-faint); text-decoration: none; }
.article-nav a.next { text-align: right; }
.article-nav small { display: block; color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 2px; }

/* ---------- 404 ---------- */
.notfound { text-align: center; padding: 70px 20px; }
.notfound h1 { font-size: 1.8rem; }
.notfound p { color: var(--muted); }

/* ---------- Footer ---------- */
.app-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  margin-top: 20px;
}
.footer-inner { max-width: 1280px; margin: 0 auto; padding: 26px 20px 34px; }
.footer-brand { font-family: var(--font-display); font-weight: 600; font-size: 1rem; margin-bottom: 6px; }
.footer-brand em { color: var(--accent); }
.disclaimer { font-size: 0.8rem; color: var(--muted); max-width: 62em; line-height: 1.6; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 40;
    width: min(320px, 86vw);
    max-height: none;
    border-radius: 0 16px 16px 0;
    transform: translateX(-105%);
    transition: transform 0.25s ease-out;
    padding-top: calc(var(--header-h) + 14px);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: inline-flex; }
  .search-wrap { max-width: none; }
  .home-hero { padding: 34px 28px 30px; }
  .skin-layers { display: none; }
}

@media (max-width: 620px) {
  body { font-size: 16.5px; }
  .header-inner { padding: 0 14px; gap: 10px; }
  .brand-name { font-size: 1.05rem; }
  .article { padding: 26px 20px 30px; }
  .article-nav { flex-direction: column; }
  .article-nav a { max-width: none; }
  .card-grid { grid-template-columns: 1fr; }
  .home-hero h1 { font-size: 1.55rem; }
  .hero-cta .btn { width: 100%; justify-content: center; }
}

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