/* ============================================================
   MEDYCYNAESTETYCZNAPROSTO - design system
   Paleta: szmaragdowa zieleń (zaufanie, medycyna) + róż złoty (piękno) + krem
   Typografia: Prata (display) + Karla (body)
   ============================================================ */

:root {
  /* Paleta główna */
  --primary: #14504a;        /* głęboka zieleń szmaragdowa */
  --primary-deep: #0d3834;   /* ciemniejsza zieleń */
  --primary-soft: #e2efec;   /* bardzo jasna zieleń (tła sekcji) */
  --accent: #b76e79;         /* róż złoty */
  --accent-strong: #9a4f5a;  /* ciemniejszy róż - tekst/linki (4.5:1+) */
  --accent-soft: #f7e9ea;    /* jasny róż (tła, podświetlenia) */
  --gold: #c9a227;           /* złoty detal (prestiż) */

  /* Neutralne */
  --bg: #faf7f2;             /* krem */
  --bg-alt: #f3eee4;         /* ciemniejszy krem */
  --card-bg: #ffffff;
  --text: #222b29;           /* ciemna zieleń-szarość */
  --muted: #5c6b67;          /* tekst drugorzędny */
  --border: #e2dcd0;
  --header-bg: rgba(250, 247, 242, 0.92);

  /* Dark mode */
  --dark-bg: #0c1211;
  --dark-bg-alt: #101a18;
  --dark-card: #15201e;
  --dark-text: #e8e4da;
  --dark-muted: #a8b4b0;
  --dark-border: #26332f;

  /* Typografia */
  --font-display: 'Prata', 'Georgia', serif;
  --font-body: 'Karla', 'Segoe UI', sans-serif;
  --font-size: 17px;
  --line-height: 1.7;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(20, 40, 36, 0.06), 0 4px 14px rgba(20, 40, 36, 0.05);
  --shadow-hover: 0 4px 12px rgba(20, 40, 36, 0.1), 0 10px 28px rgba(20, 40, 36, 0.09);
  --transition: all 0.2s ease-out;
  --header-height: 60px;
}

/* === Reset === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: var(--font-size);
  line-height: var(--line-height);
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 700px 500px at 95% -10%, rgba(183, 110, 121, 0.10), transparent 60%),
    radial-gradient(ellipse 700px 500px at -5% 105%, rgba(20, 80, 74, 0.08), transparent 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 1000;
  background: var(--primary); color: #fff; padding: 10px 18px;
  border-radius: 0 0 var(--radius-sm) 0; text-decoration: none;
}
.skip-link:focus { left: 0; }

/* === Header === */
.app-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  height: var(--header-height);
}
.app-header::after {
  content: '';
  position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, transparent, rgba(20, 80, 74, 0.28), transparent);
  opacity: 0.5; pointer-events: none;
}
.header-inner {
  max-width: 1400px; margin: 0 auto; height: 100%;
  display: flex; align-items: center; gap: 18px;
  padding: 0 20px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--primary);
  flex-shrink: 0;
}
.brand-mark { color: var(--accent); display: flex; }
.brand-text {
  font-family: var(--font-display); font-size: 1.12rem; letter-spacing: 0.01em;
  white-space: nowrap;
}
.brand-text em { font-style: normal; color: var(--accent-strong); }

/* === Search === */
.search-wrap { position: relative; flex: 1; max-width: 460px; margin-left: auto; }
#search-input {
  width: 100%; padding: 9px 16px; font-size: 0.95rem;
  font-family: var(--font-body); color: var(--text);
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 999px; outline: none;
  transition: var(--transition);
}
#search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(183, 110, 121, 0.15); }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-hover);
  max-height: 420px; overflow-y: auto; z-index: 200;
}
.search-results a {
  display: block; padding: 10px 16px; text-decoration: none;
  color: var(--text); border-bottom: 1px solid var(--border);
  transition: var(--transition);
}
.search-results a:last-child { border-bottom: none; }
.search-results a:hover, .search-results a:focus { background: var(--primary-soft); }
.search-results .sr-title { font-weight: 600; font-size: 0.92rem; }
.search-results .sr-section { font-size: 0.78rem; color: var(--accent-strong); text-transform: uppercase; letter-spacing: 0.04em; }
.search-results .sr-empty { padding: 14px 16px; color: var(--muted); font-size: 0.9rem; }

/* === Burger === */
.burger {
  display: none; flex-direction: column; justify-content: center; gap: 5px;
  width: 42px; height: 42px; padding: 10px;
  background: none; border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; flex-shrink: 0;
}
.burger span { display: block; height: 2px; background: var(--primary); border-radius: 2px; transition: var(--transition); }
.burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* === Layout === */
.layout {
  max-width: 1400px; margin: 0 auto;
  display: grid; grid-template-columns: 290px 1fr; gap: 36px;
  padding: calc(var(--header-height) + 26px) 20px 40px;
}

/* === Sidebar === */
.sidebar {
  position: sticky; top: calc(var(--header-height) + 20px);
  max-height: calc(100vh - var(--header-height) - 40px);
  overflow-y: auto; padding: 6px 4px 20px 0;
  scrollbar-width: thin;
}
.sidebar-links { display: flex; flex-direction: column; gap: 2px; }
.sidebar-section {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.09em; color: var(--muted);
  padding: 18px 12px 6px; margin-top: 4px;
}
.sidebar-section:first-child { padding-top: 8px; margin-top: 0; }
.sidebar-link {
  display: block; padding: 7px 12px; font-size: 0.9rem; line-height: 1.35;
  color: var(--text); text-decoration: none; border-radius: var(--radius-sm);
  border-left: 3px solid transparent; transition: var(--transition);
}
.sidebar-link:hover { background: var(--primary-soft); color: var(--primary); }
.sidebar-link.active {
  background: var(--primary-soft); color: var(--primary);
  border-left-color: var(--accent); font-weight: 600;
}
.sidebar-overlay {
  display: none; position: fixed; inset: 0; z-index: 90;
  background: rgba(12, 18, 17, 0.5);
}

/* === Main === */
.main { min-width: 0; }

/* === Home hero === */
.home-hero {
  position: relative;
  background: linear-gradient(135deg, var(--primary-deep) 0%, var(--primary) 55%, #1e6b62 100%);
  border-radius: var(--radius);
  padding: 48px 44px;
  color: #f2efe6;
  overflow: hidden;
  margin-bottom: 34px;
}
.home-hero::before {
  content: '';
  position: absolute; top: -80px; right: -60px; width: 340px; height: 340px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(183, 110, 121, 0.35), transparent 65%);
  pointer-events: none;
}
.home-hero h1 {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(1.7rem, 3.4vw, 2.5rem);
  line-height: 1.25; margin-bottom: 14px;
  text-wrap: balance;
  max-width: 620px;
}
.home-hero h1 .hl { color: #e5b8bd; }
.home-hero p {
  font-size: 1.05rem; color: rgba(242, 239, 230, 0.88);
  max-width: 620px; margin-bottom: 24px;
}
.hero-cta {
  display: inline-block; padding: 12px 28px; margin-bottom: 26px;
  background: linear-gradient(135deg, var(--accent), #c98a94);
  color: #fff; text-decoration: none; font-weight: 700; font-size: 0.95rem;
  border-radius: 999px; transition: var(--transition);
  box-shadow: 0 4px 16px rgba(183, 110, 121, 0.35);
}
.hero-cta:hover {
  transform: translateY(-2px); box-shadow: 0 8px 24px rgba(183, 110, 121, 0.45);
}
.hero-stats {
  display: flex; gap: 34px; flex-wrap: wrap;
  padding-top: 20px; border-top: 1px solid rgba(242, 239, 230, 0.18);
}
.hero-stat { display: flex; flex-direction: column; }
.hero-stat strong {
  font-family: var(--font-display); font-weight: 400;
  font-size: 1.6rem; color: #e5b8bd;
}
.hero-stat span { font-size: 0.82rem; color: rgba(242, 239, 230, 0.75); text-transform: uppercase; letter-spacing: 0.05em; }

/* === Home sections === */
.home-section { margin-bottom: 34px; }
.home-section-head {
  display: flex; align-items: baseline; gap: 12px;
  margin-bottom: 16px; padding-bottom: 8px; border-bottom: 2px solid var(--border);
}
.home-section-head h2 {
  font-family: var(--font-display); font-weight: 400;
  font-size: 1.35rem; color: var(--primary);
}
.home-section-head .sec-count {
  font-size: 0.78rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.05em;
}

/* === Home cards === */
.home-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.home-card {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
  text-decoration: none; color: var(--text);
  transition: var(--transition);
  position: relative; overflow: hidden;
}
.home-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  opacity: 0; transition: var(--transition);
}
.home-card:hover, .home-card:focus-visible {
  transform: translateY(-2px); box-shadow: var(--shadow-hover);
  border-color: rgba(183, 110, 121, 0.4);
}
.home-card:hover::before, .home-card:focus-visible::before { opacity: 1; }
.home-card .card-icon { font-size: 1.5rem; line-height: 1; }
.home-card h3 { font-size: 0.9rem; line-height: 1.4; font-weight: 700; color: var(--primary); }
.home-card p { font-size: 0.85rem; line-height: 1.5; color: var(--muted); }
.home-card .card-meta {
  margin-top: auto; font-size: 0.76rem; color: var(--accent-strong);
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
}

/* === Article page === */
.content-article {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 40px 44px;
  box-shadow: var(--shadow);
}
.content-article h1 {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  line-height: 1.3; margin-bottom: 10px; color: var(--primary);
  text-wrap: balance;
}
.article-excerpt {
  font-size: 1.08rem; color: var(--muted);
  margin-bottom: 24px; padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.article-toc {
  background: var(--primary-soft); border-radius: var(--radius-sm);
  padding: 18px 22px; margin-bottom: 28px;
}
.article-toc h2 {
  font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--primary); margin-bottom: 10px;
}
.article-toc ol { padding-left: 20px; display: flex; flex-direction: column; gap: 5px; }
.article-toc a { color: var(--primary); text-decoration: none; font-size: 0.92rem; }
.article-toc a:hover { text-decoration: underline; }

.content-article h2 {
  font-family: var(--font-display); font-weight: 400;
  font-size: 1.4rem; color: var(--primary);
  margin: 34px 0 12px; padding-top: 8px;
  scroll-margin-top: calc(var(--header-height) + 16px);
  text-wrap: balance;
}
.content-article h3 {
  font-size: 1.08rem; font-weight: 700; color: var(--text);
  margin: 24px 0 10px;
  scroll-margin-top: calc(var(--header-height) + 16px);
}
.content-article p { margin-bottom: 14px; }
.content-article ul, .content-article ol { margin: 0 0 16px 22px; }
.content-article li { margin-bottom: 6px; }
.content-article strong { color: var(--primary); }
.content-article a { color: var(--accent-strong); text-decoration: underline; text-underline-offset: 3px; }
.content-article a:hover { color: var(--primary); }

/* === Tables === */
.table-responsive { overflow-x: auto; margin: 18px 0; border-radius: var(--radius-sm); }
.compare-table, .error-table {
  width: 100%; border-collapse: collapse; font-size: 0.92rem;
  background: var(--card-bg); border: 1px solid var(--border);
}
.compare-table caption, .error-table caption {
  text-align: left; font-weight: 700; padding: 10px 12px;
  background: var(--primary); color: #f2efe6; font-size: 0.95rem;
}
.compare-table th, .error-table th {
  text-align: left; padding: 10px 12px; font-size: 0.85rem;
  text-transform: uppercase; letter-spacing: 0.04em;
  background: var(--primary-soft); color: var(--primary);
  border-bottom: 2px solid var(--border); white-space: nowrap;
}
.compare-table td, .error-table td {
  padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top;
}
.compare-table tr:last-child td, .error-table tr:last-child td { border-bottom: none; }
.compare-table tr:hover td, .error-table tr:hover td { background: var(--primary-soft); }
.compare-table .yes { color: #1d7a5f; font-weight: 700; }
.compare-table .no { color: var(--accent-strong); font-weight: 700; }

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

/* === FAQ === */
.faq-item {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  margin-bottom: 12px; overflow: hidden;
}
.faq-item summary {
  padding: 14px 18px; font-weight: 600; cursor: pointer;
  color: var(--primary); background: var(--card-bg);
  list-style: none; position: relative; padding-right: 44px;
  transition: var(--transition);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '+'; position: absolute; right: 16px; top: 50%;
  transform: translateY(-50%); font-size: 1.3rem; color: var(--accent);
  transition: var(--transition);
}
.faq-item[open] summary::after { transform: translateY(-50%) rotate(45deg); }
.faq-item summary:hover { background: var(--primary-soft); }
.faq-item .faq-a { padding: 4px 18px 16px; font-size: 0.95rem; }

/* === Glossary === */
.glossary { margin: 18px 0; }
.glossary dt {
  font-weight: 700; color: var(--primary);
  padding: 10px 0 2px; border-top: 1px solid var(--border);
}
.glossary dt:first-child { border-top: none; }
.glossary dd { padding: 0 0 8px; color: var(--text); font-size: 0.95rem; }

/* === 404 === */
.not-found { text-align: center; padding: 80px 20px; }
.not-found h1 { font-family: var(--font-display); font-size: 2.4rem; color: var(--primary); margin-bottom: 12px; }
.not-found p { color: var(--muted); margin-bottom: 24px; }
.btn {
  display: inline-block; padding: 12px 26px;
  background: var(--primary); color: #f2efe6; text-decoration: none;
  border-radius: 999px; font-weight: 600; font-size: 0.95rem;
  transition: var(--transition); border: none; cursor: pointer;
}
.btn:hover { background: var(--primary-deep); transform: translateY(-1px); box-shadow: var(--shadow-hover); }

/* === Footer === */
.app-footer {
  border-top: 1px solid var(--border); margin-top: 40px;
  background: var(--bg-alt);
}
.footer-inner {
  max-width: 1400px; margin: 0 auto; padding: 28px 20px 34px;
  display: flex; flex-direction: column; gap: 8px;
}
.footer-inner p { font-size: 0.9rem; color: var(--muted); }
.foot-note { font-size: 0.8rem !important; color: var(--muted); max-width: 760px; }
.foot-bottom { font-size: 0.78rem !important; color: var(--muted); }

/* === Page transition === */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
#content-wrapper > * { animation: fadeUp 0.25s ease-out; }

/* === Responsive === */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; padding-top: calc(var(--header-height) + 18px); }
  .sidebar {
    position: fixed; top: var(--header-height); bottom: 0; left: 0; z-index: 95;
    width: 290px; max-height: none; background: var(--bg);
    border-right: 1px solid var(--border);
    transform: translateX(-100%); transition: transform 0.25s ease-out;
    padding: 12px 16px 24px;
  }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-hover); }
  .sidebar-overlay.show { display: block; }
  .burger { display: flex; }
  .search-wrap { max-width: none; }
  .content-article { padding: 28px 22px; }
  .home-hero { padding: 34px 26px; }
}

@media (max-width: 600px) {
  body { font-size: 17px; }
  .header-inner { gap: 10px; padding: 0 14px; }
  .brand-text { font-size: 1rem; }
  .home-grid { grid-template-columns: 1fr; }
  .hero-stats { gap: 20px; }
  .layout { padding-left: 14px; padding-right: 14px; }
  .compare-table { font-size: 0.85rem; }
}

/* === Dark mode === */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: var(--dark-bg);
    --bg-alt: var(--dark-bg-alt);
    --card-bg: var(--dark-card);
    --text: var(--dark-text);
    --muted: var(--dark-muted);
    --border: var(--dark-border);
    --header-bg: rgba(12, 18, 17, 0.92);
    --primary-soft: #1a2a27;
    --accent-soft: #2a1e20;
  }
  body {
    background-image:
      radial-gradient(ellipse 700px 500px at 95% -10%, rgba(183, 110, 121, 0.14), transparent 60%),
      radial-gradient(ellipse 700px 500px at -5% 105%, rgba(20, 80, 74, 0.18), transparent 60%);
  }
  .home-card, .content-article { box-shadow: 0 1px 2px rgba(0,0,0,0.3); }
  .search-results { background: var(--dark-card); }
  #search-input { background: var(--dark-bg-alt); color: var(--dark-text); }
  .sidebar-link:hover { background: #1a2a27; }
}
