/* ============================================================
   PORADNIK URODY - Design system (premium beauty editorial)
   Paleta: głęboka malina + krem + złoto + blush
   Typografia: Cormorant Garamond (display) + Figtree (body)
   ============================================================ */

:root {
  /* Light */
  --bg: #faf6f1;
  --bg-soft: #f3ece3;
  --surface: #ffffff;
  --text: #2c2226;
  --text-muted: #6b5a60;
  --accent: #8a2440;
  --accent-bright: #b03052;
  --accent-soft: #e9c9c4;
  --gold: #b9895a;
  --gold-soft: #ead9c3;
  --border: rgba(44, 34, 38, 0.09);
  --header-bg: rgba(250, 246, 241, 0.92);
  --shadow-card: 0 2px 10px rgba(44, 34, 38, 0.06);
  --shadow-card-hover: 0 8px 24px rgba(44, 34, 38, 0.1);
  --glow-a: rgba(233, 201, 196, 0.5);
  --glow-b: rgba(234, 217, 195, 0.4);
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'Figtree', system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1f161b;
    --bg-soft: #261a20;
    --surface: #2a1f25;
    --text: #f0e6e2;
    --text-muted: #b6a5ab;
    --accent: #e08aa0;
    --accent-bright: #f2a9bb;
    --accent-soft: #4a2b36;
    --gold: #d4b48a;
    --gold-soft: #4a3b28;
    --border: rgba(240, 230, 226, 0.09);
    --header-bg: rgba(31, 22, 27, 0.92);
    --shadow-card: 0 2px 10px rgba(0, 0, 0, 0.3);
    --shadow-card-hover: 0 8px 24px rgba(0, 0, 0, 0.45);
    --glow-a: rgba(224, 138, 160, 0.12);
    --glow-b: rgba(212, 180, 138, 0.1);
  }
}

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

html { scroll-behavior: smooth; scroll-padding-top: 76px; }

body {
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(ellipse 40% 35% at 100% 0%, var(--glow-a) 0%, transparent 60%),
    radial-gradient(ellipse 40% 35% at 0% 100%, var(--glow-b) 0%, transparent 60%);
  background-attachment: fixed;
}

::selection { background: var(--accent); color: var(--bg); }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 300;
  background: var(--accent); color: var(--bg);
  padding: 10px 18px; border-radius: 0 0 8px 0; font-weight: 600;
}
.skip-link:focus { left: 0; }

/* ===== TYPOGRAPHY ===== */
h1, h2, h3 { font-family: var(--font-display); color: var(--text); line-height: 1.15; text-wrap: balance; }
h1 { font-size: clamp(2rem, 4.5vw, 3.1rem); font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); font-weight: 600; letter-spacing: -0.005em; }
h3 { font-size: 1.2rem; font-weight: 600; }
p { line-height: 1.7; }
.label {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.14em; color: var(--accent); margin-bottom: 0.5em;
  font-family: var(--font-body);
}

/* ===== HEADER ===== */
.app-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: 60px;
  background: var(--header-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  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.5;
  pointer-events: none;
}
.header-inner {
  max-width: 1280px; margin: 0 auto; height: 100%;
  display: flex; align-items: center; gap: 24px; padding: 0 24px;
}
.mark { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.mark-dot { color: var(--gold); font-size: 1.1rem; }
.mark-text {
  font-family: var(--font-display); font-weight: 700; font-size: 1.35rem;
  letter-spacing: 0.01em; color: var(--text);
}
.mark-text em { font-style: italic; color: var(--accent); }

.header-search { position: relative; margin-left: auto; max-width: 340px; width: 100%; }
.header-search input {
  width: 100%; padding: 9px 16px; font-size: 0.9rem; font-family: var(--font-body);
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 999px;
  outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
.header-search input:focus { 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;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-card-hover);
  max-height: 380px; overflow-y: auto; z-index: 200; padding: 6px;
}
.search-results a {
  display: block; padding: 10px 12px; border-radius: 8px; font-size: 0.88rem;
  color: var(--text); transition: background 0.15s;
}
.search-results a:hover, .search-results a:focus { background: var(--bg-soft); }
.search-results a small { display: block; color: var(--text-muted); font-size: 0.78rem; }
.search-empty { padding: 12px; font-size: 0.85rem; color: var(--text-muted); }

.burger {
  display: none; flex-direction: column; gap: 4px;
  background: none; border: none; cursor: pointer; padding: 6px; margin-left: auto;
}
.burger span { display: block; width: 22px; height: 2px; background: var(--text); border-radius: 2px; transition: transform 0.2s, opacity 0.2s; }

/* ===== SIDEBAR ===== */
.page-wrap { display: flex; min-height: 100vh; padding-top: 60px; }
.sidebar {
  width: 268px; position: fixed; top: 60px; left: 0; bottom: 0;
  border-right: 1px solid var(--border); overflow-y: auto;
  padding: 16px 0 40px; z-index: 50; background: var(--bg);
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--accent-soft); border-radius: 4px; }
.sidebar-sec {
  padding: 16px 20px 5px; font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.13em; color: var(--gold);
}
.sidebar-link {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 20px; font-size: 0.9rem; font-weight: 400; color: var(--text-muted);
  border-left: 2px solid transparent; transition: all 0.15s;
}
.sidebar-link:hover { color: var(--text); background: var(--bg-soft); border-left-color: var(--accent-soft); }
.sidebar-link.active {
  color: var(--accent); border-left-color: var(--accent);
  background: var(--bg-soft); font-weight: 600;
}
.sidebar-link .ico { font-size: 0.85rem; opacity: 0.8; }

/* ===== MAIN ===== */
.main { margin-left: 268px; padding: 36px 44px 70px; min-height: 100vh; max-width: 980px; width: 100%; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeUp 0.28s ease-out; }

/* ===== HOME HERO ===== */
.home-hero { padding: 26px 0 10px; position: relative; }
.home-hero .label { color: var(--gold); }
.home-hero h1 { margin-bottom: 0.35em; }
.home-hero h1 em { font-style: italic; color: var(--accent); }
.home-hero .lede { max-width: 540px; font-size: 1.05rem; color: var(--text-muted); margin-bottom: 1.2em; }
.hero-stats { display: flex; gap: 28px; flex-wrap: wrap; margin-top: 1.4em; }
.hero-stat { border-left: 2px solid var(--accent-soft); padding-left: 14px; }
.hero-stat b { display: block; font-family: var(--font-display); font-size: 1.5rem; color: var(--accent); line-height: 1.1; }
.hero-stat span { font-size: 0.8rem; color: var(--text-muted); }

.home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; margin-top: 2em; }
.home-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 20px 22px; transition: transform 0.2s ease-out, box-shadow 0.2s ease-out, border-color 0.2s;
  display: block;
}
.home-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-card-hover); border-color: var(--accent-soft); }
.home-card .ico { font-size: 1.4rem; display: block; margin-bottom: 0.4em; }
.home-card h3 { font-size: 0.95rem; font-family: var(--font-body); font-weight: 600; margin-bottom: 0.2em; color: var(--text); }
.home-card h3 .arrow { color: var(--accent); opacity: 0; transform: translateX(-6px); display: inline-block; transition: all 0.2s; }
.home-card:hover h3 .arrow { opacity: 1; transform: translateX(0); }
.home-card p { font-size: 0.85rem; color: var(--text-muted); margin: 0; line-height: 1.55; }

.section-block { margin-top: 2.6em; }
.section-block > h2 {
  font-size: 1.6rem; margin-bottom: 0.15em;
  display: flex; align-items: baseline; gap: 12px;
}
.section-block > h2 .sec-num { font-size: 0.9rem; color: var(--gold); font-weight: 600; }
.section-block > p { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 1em; }

/* ===== ARTICLE ===== */
.content-article h1 { margin-bottom: 0.2em; }
.article-meta { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 1.6em; padding-bottom: 1em; border-bottom: 1px solid var(--border); }
.content-article h2 { margin-top: 1.9em; margin-bottom: 0.5em; padding-bottom: 0.3em; border-bottom: 1px solid var(--border); }
.content-article h2::before { content: ''; display: inline-block; width: 6px; height: 1.15em; background: var(--accent); margin-right: 10px; vertical-align: -2px; border-radius: 2px; }
.content-article h3 { margin-top: 1.5em; margin-bottom: 0.3em; }
.content-article p { margin-bottom: 0.9em; }
.content-article ul, .content-article ol { margin-bottom: 0.9em; padding-left: 1.3em; }
.content-article li { margin-bottom: 0.35em; }
.content-article strong { color: var(--text); font-weight: 600; }
.content-article a { color: var(--accent); border-bottom: 1px solid var(--accent-soft); transition: border-color 0.15s; }
.content-article a:hover { border-bottom-color: var(--accent); }

/* TOC */
.article-toc {
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 12px;
  padding: 18px 22px; margin: 0 0 1.6em;
}
.article-toc h3 { font-family: var(--font-body); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--gold); margin-bottom: 0.7em; }
.article-toc a { display: block; padding: 4px 0; font-size: 0.9rem; color: var(--text-muted); border: none; transition: color 0.15s; }
.article-toc a:hover { color: var(--accent); }
.article-toc a.toc-h3 { padding-left: 16px; font-size: 0.85rem; }

/* Tables */
.table-responsive { overflow-x: auto; margin: 1.2em 0; }
.content-article table { width: 100%; border-collapse: collapse; font-size: 0.9rem; min-width: 480px; }
.content-article th, .content-article td { padding: 11px 14px; text-align: left; border: 1px solid var(--border); vertical-align: top; }
.content-article th { background: var(--accent-soft); color: var(--text); font-weight: 600; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.05em; }
.content-article tr:nth-child(even) td { background: var(--bg-soft); }

/* Info box */
.info-box {
  background: var(--gold-soft); border: 1px solid var(--border);
  border-left: 4px solid var(--gold); border-radius: 10px;
  padding: 16px 20px; margin: 1.2em 0; font-size: 0.95rem;
}
.info-box b { color: var(--text); }

/* Error table (porównania) */
.error-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; margin: 1.2em 0; }
.error-table th, .error-table td { padding: 11px 14px; text-align: left; border: 1px solid var(--border); }
.error-table th { background: var(--accent); color: var(--bg); font-weight: 600; }
.error-table tr:nth-child(even) td { background: var(--bg-soft); }

/* FAQ */
.faq-item { border-bottom: 1px solid var(--border); padding: 1.1em 0; }
.faq-item:last-child { border: none; }
.faq-item h3 { font-family: var(--font-body); font-size: 1.02rem; font-weight: 600; cursor: pointer; color: var(--text); display: flex; gap: 10px; align-items: baseline; }
.faq-item h3::before { content: 'Q'; color: var(--accent); font-weight: 700; font-size: 0.85rem; }
.faq-item p { font-size: 0.93rem; margin-top: 0.4em; color: var(--text-muted); }
.faq-item p::before { content: 'A'; color: var(--gold); font-weight: 700; font-size: 0.85rem; margin-right: 8px; }

/* Glossary */
.glossary dt { font-weight: 600; color: var(--text); margin-top: 1.1em; font-size: 1rem; }
.glossary dt::before { content: '◆'; color: var(--accent); font-size: 0.7rem; margin-right: 8px; vertical-align: 1px; }
.glossary dd { color: var(--text-muted); font-size: 0.93rem; margin: 0.2em 0 0 1.1em; }

/* Prev/Next */
.article-nav { display: flex; justify-content: space-between; gap: 16px; margin-top: 2.6em; padding-top: 1.4em; border-top: 1px solid var(--border); }
.article-nav a {
  font-size: 0.88rem; color: var(--text-muted); padding: 10px 16px;
  border: 1px solid var(--border); border-radius: 10px; transition: all 0.2s;
  max-width: 48%;
}
.article-nav a:hover { border-color: var(--accent); color: var(--accent); }
.article-nav a small { display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--gold); }

/* 404 */
.notfound { text-align: center; padding: 70px 20px; }
.notfound .big { font-family: var(--font-display); font-size: 4rem; color: var(--accent); line-height: 1; }
.notfound p { color: var(--text-muted); margin: 0.6em 0 1.4em; }

/* ===== RESPONSIVE ===== */
.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: 90; }
@media (max-width: 900px) {
  .header-search { max-width: 200px; }
  .main { padding: 28px 24px 60px; }
}
@media (max-width: 600px) {
  .burger { display: flex; }
  .header-search { display: none; }
  .mark-text { font-size: 1.2rem; }
  .sidebar { left: -280px; transition: left 0.3s ease; z-index: 99; width: 280px; background: var(--bg); }
  .sidebar.open { left: 0; box-shadow: var(--shadow-card-hover); }
  .main { margin-left: 0; padding: 24px 18px 50px; }
  .home-grid { grid-template-columns: 1fr; }
  .hero-stats { gap: 16px; }
  .article-nav { flex-direction: column; }
  .article-nav a { max-width: 100%; }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
