/* ============================================================
   Ginekologia - design system "Malinowy zmierzch"
   Zdrowie kobiety: ciepło, zaufanie, kobiecość (nie lukier)
   ============================================================ */
:root {
  /* Paleta - Malinowy zmierzch */
  --accent: #8a2f5e;          /* głęboka malina - akcent główny */
  --accent-strong: #72264e;   /* malina do hover/tekstu */
  --accent-soft: #f3e4ec;     /* malinowe tło podświetleń */
  --rose: #d95f8e;            /* różany pył - akcent drugorzędny */
  --rose-soft: #fbeaf1;
  --sage: #5f7a6b;            /* szałwia - zdrowie, spokój */
  --sage-soft: #e9f0ec;
  --ink: #2d1b26;             /* śliwkowy atrament - tekst */
  --ink-soft: #5c4653;        /* tekst wtórny */
  --bg: #faf6f1;              /* krem - tło */
  --bg-card: #ffffff;
  --border: #e8ddd6;
  --amber: #8a5a12;
  --amber-soft: #f7f0e0;
  --red: #b03a48;
  --red-soft: #f9e8ea;

  /* Typografia */
  --font-display: 'Newsreader', Georgia, serif;
  --font-body: 'Karla', 'Segoe UI', sans-serif;

  /* Wymiary */
  --header-h: 64px;
  --sidebar-w: 300px;
  --radius: 12px;
  --radius-sm: 8px;
  --transition: all .2s ease-out;

  /* Cienie */
  --shadow-card: 0 1px 2px rgba(45,27,38,.05), 0 4px 16px rgba(45,27,38,.06);
  --shadow-card-hover: 0 2px 4px rgba(45,27,38,.07), 0 10px 28px rgba(138,47,94,.10);
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent: #c65a8e;
    --accent-strong: #e08ab0;
    --accent-soft: #3a2133;
    --rose: #e08ab0;
    --rose-soft: #3a2133;
    --sage: #8fb09e;
    --sage-soft: #24302a;
    --ink: #f2e8ee;
    --ink-soft: #b8a3ae;
    --bg: #191118;
    --bg-card: #241822;
    --border: #3a2c36;
    --amber: #d9a94e;
    --amber-soft: #3a3020;
    --red: #e07a86;
    --red-soft: #3a2226;
    --shadow-card: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
    --shadow-card-hover: 0 2px 4px rgba(0,0,0,.4), 0 10px 28px rgba(198,90,142,.15);
  }
}

/* ============ Reset ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 700px 500px at -10% -10%, var(--rose-soft), transparent 60%),
    radial-gradient(ellipse 700px 500px at 110% 110%, var(--sage-soft), transparent 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  transition: background .3s ease, color .3s ease;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--rose); outline-offset: 2px; border-radius: 4px; }

.skip-link {
  position: absolute; left: -999px; top: 8px; z-index: 100;
  background: var(--accent); color: #fff; padding: 10px 18px; border-radius: var(--radius-sm);
}
.skip-link:focus { left: 8px; }

/* ============ 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);
  backdrop-filter: blur(12px);
}
.app-header::after {
  content: '';
  position: absolute; bottom: -1px; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--rose), transparent);
  opacity: .35; pointer-events: none;
}
.header-inner {
  max-width: 1400px; margin: 0 auto; height: 100%;
  display: flex; align-items: center; gap: 20px; padding: 0 24px;
}
.mark { display: flex; align-items: center; gap: 10px; color: var(--ink); flex-shrink: 0; }
.mark:hover { text-decoration: none; }
.mark-svg { flex-shrink: 0; }
.mark-text {
  font-family: var(--font-display); font-weight: 700; font-size: 1.25rem;
  letter-spacing: -0.01em; white-space: nowrap;
}
.mark-text em { font-style: normal; color: var(--accent); }

.header-search { position: relative; flex: 1; max-width: 460px; margin-left: auto; }
.header-search input {
  width: 100%; padding: 10px 16px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--bg-card); color: var(--ink);
  font-family: var(--font-body); font-size: .95rem;
  transition: var(--transition);
}
.header-search input:focus { outline: none; border-color: var(--rose); box-shadow: 0 0 0 3px var(--rose-soft); }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 60;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-card-hover); max-height: 420px; overflow-y: auto;
}
.search-result {
  display: block; padding: 12px 16px; border-bottom: 1px solid var(--border);
  color: var(--ink); transition: background .15s ease;
}
.search-result:last-child { border-bottom: none; }
.search-result:hover { background: var(--accent-soft); text-decoration: none; }
.search-result strong { display: block; font-size: .95rem; margin-bottom: 2px; }
.search-result span { font-size: .8rem; color: var(--ink-soft); }
.search-empty { padding: 14px 16px; font-size: .9rem; color: var(--ink-soft); }

.burger {
  display: none; flex-direction: column; gap: 5px;
  background: none; border: none; cursor: pointer; padding: 8px; margin-left: auto;
}
.burger span {
  width: 22px; height: 2px; background: var(--ink); border-radius: 2px;
  transition: var(--transition);
}
.burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger.open span:nth-child(2) { opacity: 0; }
.burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============ Layout ============ */
.layout {
  display: flex; max-width: 1400px; margin: 0 auto;
  padding-top: var(--header-h); min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  position: sticky; top: var(--header-h); height: calc(100vh - var(--header-h));
  overflow-y: auto; padding: 24px 20px 40px;
  border-right: 1px solid var(--border);
  background: var(--bg);
}
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-section {
  font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--rose); margin: 20px 0 6px; padding-left: 12px;
}
.sidebar-section:first-child { margin-top: 0; }
.sidebar-link {
  display: block; padding: 6px 12px; border-radius: var(--radius-sm);
  font-size: .9rem; color: var(--ink); line-height: 1.4;
  border-left: 2px solid transparent;
  transition: var(--transition);
}
.sidebar-link:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.sidebar-link.active {
  background: var(--accent-soft); color: var(--accent-strong); font-weight: 600;
  border-left-color: var(--accent);
}
.sidebar-foot {
  margin-top: 28px; padding: 16px 12px; border-top: 1px solid var(--border);
  font-size: .8rem; color: var(--ink-soft); line-height: 1.5;
}

.main {
  flex: 1; min-width: 0; padding: 40px 48px 80px;
}
.overlay {
  position: fixed; inset: var(--header-h) 0 0 0; z-index: 40;
  background: rgba(45,27,38,.5); backdrop-filter: blur(2px);
}

/* ============ Home ============ */
.home-hero {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 55%, #5c1f42 100%);
  border-radius: var(--radius);
  padding: 56px 48px;
  color: #fff;
  margin-bottom: 40px;
}
.home-hero::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(circle 300px at 85% 20%, rgba(255,255,255,.14), transparent 60%),
    radial-gradient(circle 400px at 15% 100%, rgba(255,255,255,.08), transparent 60%);
  pointer-events: none;
}
.home-hero .eyebrow {
  display: inline-block; font-size: .8rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: #f6c8dc; margin-bottom: 12px;
}
.home-hero h1 {
  font-family: var(--font-display); font-size: 2.6rem; font-weight: 600;
  line-height: 1.15; text-wrap: balance; margin-bottom: 14px; max-width: 640px;
}
.home-hero p {
  font-size: 1.1rem; line-height: 1.6; color: rgba(255,255,255,.92);
  max-width: 560px; margin-bottom: 24px;
}
.home-hero .hero-stats { display: flex; gap: 32px; flex-wrap: wrap; }
.home-hero .hero-stat strong { display: block; font-family: var(--font-display); font-size: 1.6rem; }
.home-hero .hero-stat span { font-size: .85rem; color: rgba(255,255,255,.85); }

.home-section { margin-bottom: 44px; }
.home-section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 18px; padding-bottom: 10px; border-bottom: 2px solid var(--border);
}
.home-section-head h2 {
  font-family: var(--font-display); font-size: 1.55rem; font-weight: 600; color: var(--ink);
  text-wrap: balance;
}
.home-section-head .count { font-size: .85rem; color: var(--ink-soft); }

.card-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(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 20px 18px;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
}
.home-card:hover {
  transform: translateY(-2px); box-shadow: var(--shadow-card-hover);
  text-decoration: none; border-color: var(--rose);
}
.home-card .card-icon { font-size: 1.5rem; line-height: 1; }
.home-card h3 { font-size: .95rem; font-weight: 600; color: var(--ink); line-height: 1.4; text-wrap: balance; }
.home-card p { font-size: .85rem; color: var(--ink-soft); line-height: 1.55; }

/* ============ Article ============ */
.article { max-width: 780px; }
.article .article-crumb {
  font-size: .8rem; color: var(--ink-soft); margin-bottom: 12px;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.article .article-crumb a { color: var(--accent); }
.article .article-tag {
  display: inline-block; font-size: .75rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--accent-strong);
  background: var(--accent-soft); padding: 4px 12px; border-radius: 999px; margin-bottom: 14px;
}
.article h1 {
  font-family: var(--font-display); font-size: 2.2rem; font-weight: 600;
  line-height: 1.15; text-wrap: balance; margin-bottom: 12px; color: var(--ink);
}
.article .article-meta {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  font-size: .8rem; color: var(--ink-soft);
  padding-bottom: 16px; margin-bottom: 8px; border-bottom: 1px solid var(--border);
}
.article .article-meta .read-time { display: inline-flex; align-items: center; gap: 5px; }
.article .article-meta .review {
  display: inline-flex; align-items: center; gap: 5px; color: var(--sage);
  font-weight: 600;
}
.article h2 {
  font-family: var(--font-display); font-size: 1.5rem; font-weight: 600;
  color: var(--ink); margin: 36px 0 14px; text-wrap: balance;
  padding-bottom: 6px; border-bottom: 1px solid var(--border);
}
.article h3 {
  font-family: var(--font-display); font-size: 1.2rem; font-weight: 600;
  color: var(--ink); margin: 26px 0 10px; text-wrap: balance;
}
.article p { margin-bottom: 16px; }
.article ul, .article ol { margin: 0 0 18px 24px; }
.article li { margin-bottom: 8px; }
.article strong { color: var(--ink); }

.article .toc {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 24px; margin: 24px 0 8px;
}
.article .toc strong { display: block; margin-bottom: 10px; font-size: .95rem; }
.article .toc ol { margin: 0 0 0 20px; }
.article .toc a { font-size: .9rem; }

.info-box {
  background: var(--accent-soft); border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 16px 20px; margin: 20px 0;
  font-size: .95rem; line-height: 1.6;
}
.info-box::before { content: '💡 '; font-weight: 700; }
.info-box.sage { background: var(--sage-soft); border-left-color: var(--sage); }
.info-box.sage::before { content: '✅ '; }
.info-box.warn { background: var(--amber-soft); border-left-color: var(--amber); }
.info-box.warn::before { content: '⚠️ '; }

.error-table {
  width: 100%; border-collapse: collapse; margin: 20px 0;
  font-size: .92rem; background: var(--bg-card);
  border-radius: var(--radius-sm); overflow: hidden;
  border: 1px solid var(--border);
}
.error-table caption { text-align: left; font-weight: 600; margin-bottom: 8px; font-size: .95rem; }
.error-table th {
  background: var(--accent); color: #fff; text-align: left;
  padding: 10px 14px; font-weight: 600; font-size: .85rem;
}
.error-table td { padding: 10px 14px; border-top: 1px solid var(--border); vertical-align: top; }
.error-table tr:nth-child(even) td { background: var(--accent-soft); }
.error-table tr:nth-child(even) td { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.table-responsive { overflow-x: auto; }

.faq-item { margin-bottom: 14px; }
.faq-item h3 {
  font-size: 1.05rem; font-weight: 700; margin-bottom: 6px; color: var(--ink);
  border-left: 3px solid var(--rose); padding-left: 12px;
}
.faq-item p { margin: 0 0 0 15px; font-size: .97rem; }

.article dl { margin: 16px 0; }
.article dt {
  font-weight: 700; color: var(--accent-strong); margin-top: 14px;
  font-size: 1rem;
}
.article dd { margin: 4px 0 0 0; font-size: .95rem; }

.disclaimer {
  margin-top: 32px; padding: 14px 18px;
  background: var(--sage-soft); border-radius: var(--radius-sm);
  font-size: .85rem; color: var(--ink-soft); line-height: 1.55;
}

.article-nav {
  display: flex; justify-content: space-between; gap: 16px;
  margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--border);
  font-size: .9rem;
}
.article-nav a { max-width: 45%; }
.article-nav .nav-next { text-align: right; }
.article-nav small { display: block; color: var(--ink-soft); font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 2px; }

/* ============ Footer ============ */
.app-footer {
  border-top: 1px solid var(--border);
  background: var(--bg);
  padding: 32px 24px;
}
.footer-inner { max-width: 1400px; margin: 0 auto; }
.app-footer p { font-size: .85rem; color: var(--ink-soft); line-height: 1.6; max-width: 900px; }
.app-footer .footer-meta { margin-top: 12px; font-size: .8rem; }
.app-footer strong em { font-style: normal; color: var(--accent); }

/* ============ Animations ============ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp .25s ease-out both; }
.home-card { animation: fadeUp .25s ease-out both; }
.home-card:nth-child(2) { animation-delay: .03s; }
.home-card:nth-child(3) { animation-delay: .06s; }
.home-card:nth-child(4) { animation-delay: .09s; }

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

/* ============ Responsive ============ */
@media (max-width: 900px) {
  .sidebar {
    position: fixed; top: var(--header-h); left: 0; bottom: 0; z-index: 45;
    transform: translateX(-100%); transition: transform .25s ease-out;
    width: min(320px, 85vw); background: var(--bg);
    box-shadow: 4px 0 24px rgba(45,27,38,.15);
  }
  .sidebar.open { transform: translateX(0); }
  .burger { display: flex; }
  .header-search { max-width: none; }
  .main { padding: 28px 20px 60px; }
  .home-hero { padding: 40px 28px; }
  .home-hero h1 { font-size: 2rem; }
  .article h1 { font-size: 1.8rem; }
  .home-section-head { flex-direction: column; gap: 4px; }
}

@media (max-width: 600px) {
  body { font-size: 17px; }
  .mark-text { font-size: 1.05rem; }
  .header-inner { gap: 12px; padding: 0 16px; }
  .home-hero h1 { font-size: 1.65rem; }
  .card-grid { grid-template-columns: 1fr; }
  .article h2 { font-size: 1.3rem; }
  .home-hero .hero-stats { gap: 20px; }
  .article-nav { flex-direction: column; }
  .article-nav a { max-width: 100%; }
  .error-table { font-size: .85rem; }
}
