/* ============================================================
   UśmiechProsto - Stomatologia dla zwykłych ludzi
   Paleta: "Kliniczna świeżość" - morski teal + mięta + granat
   Typografia: Figtree (display) + Cabin (body)
   ============================================================ */

:root {
  /* Light */
  --bg: #f4f8f8;
  --surface: #ffffff;
  --surface-2: #eaf3f2;
  --text: #132a2e;
  --text-muted: #46636a;
  --accent: #0e7c86;
  --accent-strong: #0a5d66;
  --accent-soft: #dff1ef;
  --mint: #bfe8e4;
  --border: #d8e6e5;
  --success: #1e7a4a;
  --warning: #a65c12;
  --danger: #b3261e;
  --header-h: 64px;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 3px rgba(15, 45, 50, 0.08), 0 4px 16px rgba(15, 45, 50, 0.06);
  --shadow-hover: 0 6px 24px rgba(14, 124, 134, 0.14);
  --font-display: 'Figtree', 'Segoe UI', sans-serif;
  --font-body: 'Cabin', 'Segoe UI', sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1517;
    --surface: #162022;
    --surface-2: #1c2a2c;
    --text: #e3ecea;
    --text-muted: #9db4b3;
    --accent: #35c3d1;
    --accent-strong: #7fdbe4;
    --accent-soft: #1c3a3d;
    --mint: #1c3a3d;
    --border: #26383b;
    --success: #4cc38a;
    --warning: #e0a458;
    --danger: #ef6f66;
    --shadow: 0 1px 3px rgba(0,0,0,0.4), 0 4px 16px rgba(0,0,0,0.3);
    --shadow-hover: 0 6px 24px rgba(53, 195, 209, 0.12);
  }
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 600px 400px at -10% -5%, var(--accent-soft) 0%, transparent 55%),
    radial-gradient(ellipse 500px 380px at 110% 15%, var(--mint) 0%, transparent 50%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s, color 0.3s;
}

/* === HEADER === */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  backdrop-filter: blur(8px);
}
.header-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 18px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  flex-shrink: 0;
}
.brand-icon {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  border-radius: 11px;
  color: #fff;
}
.brand-icon svg { width: 22px; height: 22px; }
.brand-text {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}
.brand-accent { color: var(--accent); }

.search-box {
  position: relative;
  flex: 1;
  max-width: 460px;
  margin-left: auto;
}
.search-icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  width: 17px; height: 17px;
  color: var(--text-muted);
  pointer-events: none;
}
#search-input {
  width: 100%;
  padding: 9px 14px 9px 38px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  outline: none;
  transition: border 0.2s, box-shadow 0.2s;
}
#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: var(--radius-sm);
  box-shadow: var(--shadow-hover);
  max-height: 380px;
  overflow-y: auto;
  z-index: 120;
}
.search-results a {
  display: block;
  padding: 10px 14px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.92rem;
  border-bottom: 1px solid var(--border);
}
.search-results a:hover { background: var(--accent-soft); }
.sr-section {
  padding: 10px 14px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.burger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
.burger span {
  width: 22px; height: 2.5px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.2s;
}
.burger.open span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
.burger.open span:nth-child(2) { opacity: 0; }
.burger.open span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }

/* === LAYOUT === */
.page-wrap {
  display: flex;
  max-width: 1240px;
  margin: 0 auto;
  padding: calc(var(--header-h) + 28px) 20px 40px;
  gap: 32px;
}

.sidebar {
  width: 280px;
  flex-shrink: 0;
  position: sticky;
  top: calc(var(--header-h) + 24px);
  height: calc(100vh - var(--header-h) - 48px);
  overflow-y: auto;
  padding: 6px 14px 20px 0;
  scrollbar-width: thin;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-sec {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 18px 0 6px;
  padding: 0 10px;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6.5px 10px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.35;
  transition: background 0.15s, color 0.15s;
}
.sidebar-link:hover { background: var(--surface-2); color: var(--accent-strong); }
.sidebar-link.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 600;
}
.si { font-size: 0.95rem; flex-shrink: 0; }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 20, 22, 0.5);
  z-index: 90;
}

.main {
  flex: 1;
  min-width: 0;
  max-width: 860px;
}

/* === HERO (home) === */
.home-hero {
  position: relative;
  border-radius: var(--radius);
  padding: 44px 40px 38px;
  background:
    radial-gradient(ellipse 420px 260px at 88% -10%, rgba(255,255,255,0.14), transparent 60%),
    linear-gradient(135deg, var(--accent-strong), var(--accent) 55%, #12959f);
  color: #fff;
  overflow: hidden;
  margin-bottom: 36px;
  box-shadow: var(--shadow-hover);
}
@media (prefers-color-scheme: dark) {
  .home-hero {
    background:
      radial-gradient(ellipse 420px 260px at 88% -10%, rgba(255,255,255,0.08), transparent 60%),
      linear-gradient(135deg, #0a5d66, var(--accent) 60%, #17a3ad);
  }
}
.home-hero::after {
  content: '';
  position: absolute;
  bottom: -60px; right: -40px;
  width: 260px; height: 260px;
  border-radius: 50%;
  border: 34px solid rgba(255,255,255,0.07);
}
.hero-label {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.14);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 16px;
}
.home-hero h1 {
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  max-width: 560px;
  text-wrap: balance;
  margin-bottom: 12px;
}
.home-hero h1 .hl { color: #c9f2ef; }
.home-hero p {
  font-size: 1.06rem;
  line-height: 1.65;
  max-width: 560px;
  color: rgba(255,255,255,0.92);
  margin-bottom: 22px;
}
.hero-cta {
  display: inline-block;
  background: #fff;
  color: var(--accent-strong);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.98rem;
  padding: 12px 22px;
  border-radius: 999px;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(0,0,0,0.18);
  transition: transform 0.2s ease-out, box-shadow 0.2s;
}
.hero-cta:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,0.22); }
.hero-stats {
  display: flex;
  gap: 34px;
  margin-top: 30px;
}
.hero-stat .num {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1.1;
}
.hero-stat .lbl {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.82);
}

/* === HOME SECTIONS === */
.home-section { margin-bottom: 34px; }
.home-section-title {
  font-family: var(--font-display);
  font-size: 1.32rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
  text-wrap: balance;
}
.home-section-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 16px;
}
.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.home-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: transform 0.2s ease-out, box-shadow 0.2s, border-color 0.2s;
}
.home-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: var(--accent);
}
.card-icon { font-size: 1.5rem; }
.home-card h3 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.35;
  text-wrap: balance;
}
.home-card p {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-muted);
  flex: 1;
}
.card-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
}

/* === ARTICLE === */
.content-article { animation: fadeUp 0.28s ease-out; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.article-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 30px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
}
.article-icon { font-size: 2rem; margin-bottom: 8px; }
.article-header h1 {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 10px;
  text-wrap: balance;
}
.article-excerpt {
  font-size: 1.05rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 14px;
}
.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.article-meta span {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 11px;
}

.content-article > h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 30px 0 12px;
  padding-top: 8px;
  text-wrap: balance;
}
.content-article > h3 {
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 700;
  margin: 22px 0 8px;
}
.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 a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.content-article a:hover { color: var(--accent-strong); }
.content-article strong { font-weight: 700; }

/* === TOC === */
.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin-bottom: 24px;
}
.toc-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.92rem;
  margin-bottom: 8px;
}
.toc a {
  display: block;
  padding: 4px 0;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.92rem;
  border-bottom: 1px dashed var(--border);
}
.toc a:last-child { border-bottom: none; }
.toc a:hover { color: var(--accent); }

/* === BOXES === */
.info-box, .warning-box, .success-box {
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin: 18px 0;
  font-size: 0.97rem;
  line-height: 1.6;
}
.info-box {
  background: var(--accent-soft);
  border: 1px solid var(--mint);
}
.info-box strong, .warning-box strong, .success-box strong { display: block; margin-bottom: 4px; }
.warning-box {
  background: #fdf3e3;
  border: 1px solid #f0d9b0;
}
@media (prefers-color-scheme: dark) {
  .warning-box { background: #2a2118; border-color: #4a3a24; }
  .success-box { background: #15261d; border-color: #2c4a39; }
}
.success-box {
  background: #e6f4ec;
  border: 1px solid #bfe0cd;
}

/* === TABLES === */
.table-responsive { overflow-x: auto; margin: 18px 0; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  background: var(--surface);
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}
th, td {
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th {
  background: var(--accent-soft);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--accent-strong);
}
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }

/* === FAQ === */
.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 16px 18px;
  margin-bottom: 12px;
}
.faq-item h3 {
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 700;
  margin-bottom: 6px;
  cursor: pointer;
}
.faq-item p { margin: 0; font-size: 0.96rem; color: var(--text-muted); }

/* === GLOSSARY === */
.glossary dl { margin: 0; }
.glossary dt {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.02rem;
  margin-top: 16px;
  color: var(--accent-strong);
}
.glossary dd {
  margin: 3px 0 0;
  color: var(--text-muted);
  font-size: 0.96rem;
  line-height: 1.6;
}

/* === 404 === */
.notfound {
  text-align: center;
  padding: 70px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.nf-icon { font-size: 3rem; margin-bottom: 12px; }
.notfound h1 { font-family: var(--font-display); font-size: 1.5rem; margin-bottom: 8px; }
.notfound p { color: var(--text-muted); margin-bottom: 20px; }
.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  padding: 11px 22px;
  border-radius: 999px;
  text-decoration: none;
  transition: transform 0.2s, background 0.2s;
}
.btn:hover { transform: translateY(-2px); background: var(--accent-strong); }

/* === FOOTER === */
.app-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  margin-top: 20px;
}
.footer-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 26px 20px;
}
.footer-brand { font-family: var(--font-display); font-weight: 700; margin-bottom: 6px; }
.footer-desc { color: var(--text-muted); font-size: 0.88rem; max-width: 720px; line-height: 1.6; }
.footer-copy { color: var(--text-muted); font-size: 0.82rem; margin-top: 10px; }

/* === RESPONSIVE === */
@media (max-width: 900px) {
  .burger { display: flex; }
  .search-box { max-width: none; }
  .sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    bottom: 0;
    width: 300px;
    max-width: 85vw;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 16px 18px 30px;
    z-index: 95;
    transform: translateX(-102%);
    transition: transform 0.28s ease-out;
    height: auto;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.show { display: block; }
  .page-wrap { padding-top: calc(var(--header-h) + 20px); }
  .home-hero { padding: 32px 24px; }
  .home-hero h1 { font-size: 1.8rem; }
  .hero-stats { gap: 22px; }
}

@media (max-width: 600px) {
  body { font-size: 17px; }
  .header-inner { padding: 0 14px; gap: 10px; }
  .brand-text { font-size: 1.1rem; }
  .search-box { max-width: 46vw; }
  #search-input { padding-left: 32px; font-size: 0.85rem; }
  .home-grid { grid-template-columns: 1fr; }
  .home-hero { padding: 28px 20px; }
  .home-hero h1 { font-size: 1.55rem; }
  .hero-stats { flex-wrap: wrap; gap: 16px; }
  .article-header { padding: 22px 18px; }
  .article-header h1 { font-size: 1.55rem; }
  .page-wrap { padding-left: 14px; padding-right: 14px; }
}

/* === ACCESSIBILITY === */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 8px 0;
  z-index: 200;
}
.skip-link:focus { left: 0; }

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