/* ============================================================
   Stopy - design system
   Podologia / zdrowe stopy: świeża zieleń + medyczny błękit + krem
   Typografia: Spectral (display) + Nunito Sans (body)
   ============================================================ */

:root {
  /* --- palette: light (default) --- */
  --bg: #f5f2ea;            /* ciepły krem */
  --bg-soft: #ede8db;
  --panel: #ffffff;
  --panel-border: #e2dccb;
  --text: #1f2a25;          /* ciemna zieleń-sadza, ~13:1 na kremie */
  --muted: #5d665f;         /* 7.4:1 na kremie */
  --accent: #176a4f;        /* ciemna mięta (tekst akcentowy na jasnym) */
  --accent-strong: #0f5c42;
  --accent-soft: #dcefe6;   /* tło info-box */
  --blue: #2f6f96;          /* linki na jasnym */
  --blue-soft: #e2eef5;
  --headline: #12382b;
  --header-bg: rgba(245, 242, 234, 0.92);
  --shadow: 0 1px 2px rgba(18, 56, 43, 0.05), 0 6px 24px rgba(18, 56, 43, 0.06);
  --shadow-hover: 0 2px 4px rgba(18, 56, 43, 0.06), 0 12px 32px rgba(18, 56, 43, 0.10);
  --hero-grad: linear-gradient(150deg, #0e2b20 0%, #12382b 55%, #1a4a38 100%);
  --card-bg: #ffffff;
  --table-stripe: #f1ede1;
  --code-bg: #f1ede1;

  /* --- typography --- */
  --font-display: 'Spectral', Georgia, serif;
  --font-body: 'Nunito Sans', 'Segoe UI', sans-serif;
  --base-size: 17px;
  --sidebar-w: 300px;
  --header-h: 60px;
  --radius: 14px;
  --radius-sm: 8px;
  --transition: all 0.2s ease-out;
}

/* --- dark mode --- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1f1a;            /* głęboka zieleń-sadza */
    --bg-soft: #12241e;
    --panel: #162b24;
    --panel-border: #244038;
    --text: #e9e6da;          /* ~13.8:1 */
    --muted: #a8a294;         /* 6.8:1 */
    --accent: #3aa982;        /* świeża mięta na ciemnym */
    --accent-strong: #4fc39a;
    --accent-soft: #18352b;
    --blue: #4d8fb8;
    --blue-soft: #172c38;
    --headline: #f2efe4;
    --header-bg: rgba(14, 31, 26, 0.92);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 24px rgba(0, 0, 0, 0.35);
    --shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.3), 0 12px 32px rgba(0, 0, 0, 0.45);
    --hero-grad: linear-gradient(150deg, #0a1712 0%, #0e1f1a 55%, #16352a 100%);
    --card-bg: #162b24;
    --table-stripe: #132820;
    --code-bg: #132820;
  }
}

/* ============ RESET / BASE ============ */
*, *::before, *::after { box-sizing: border-box; }
html { overflow-x: clip; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--base-size);
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(900px 480px at -10% -10%, rgba(58, 169, 130, 0.10), transparent 60%),
    radial-gradient(900px 520px at 110% 110%, rgba(77, 143, 184, 0.10), transparent 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s ease, color 0.3s ease;
}
h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--headline);
  line-height: 1.25;
  text-wrap: balance;
  margin: 0 0 0.6em;
}
h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); font-weight: 700; }
h2 { font-size: clamp(1.4rem, 2.6vw, 1.75rem); font-weight: 600; margin-top: 1.6em; }
h3 { font-size: 1.18rem; font-weight: 600; margin-top: 1.3em; }
p { margin: 0 0 1em; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
::selection { background: var(--accent); color: #fff; }
: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: 8px 16px; z-index: 200;
  border-radius: 0 0 8px 0; font-weight: 700;
}
.skip-link:focus { left: 0; }

/* ============ HEADER ============ */
.app-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--header-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 20px;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--panel-border);
}
.app-header::after {
  content: '';
  position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.35;
  pointer-events: none;
}
.logo-mark { font-size: 1.5rem; line-height: 1; }
.logo-text a {
  font-family: var(--font-display);
  font-weight: 700; font-size: 1.35rem; letter-spacing: 0.01em;
  color: var(--headline); text-decoration: none;
}
.logo-text a:hover { text-decoration: none; }
.logo-text { margin-right: auto; }

.header-search { position: relative; width: min(340px, 40vw); }
.header-search .search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  font-size: 0.9rem; opacity: 0.6; pointer-events: none;
}
#search-input {
  width: 100%; padding: 9px 14px 9px 36px;
  border: 1px solid var(--panel-border); border-radius: 999px;
  background: var(--panel); color: var(--text);
  font-family: var(--font-body); font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
#search-input::placeholder { color: var(--muted); }
#search-input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(58, 169, 130, 0.18);
}

.search-results {
  position: fixed; top: calc(var(--header-h) + 6px); right: 20px;
  width: min(420px, calc(100vw - 40px));
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: var(--radius); box-shadow: var(--shadow-hover);
  overflow: hidden; z-index: 150;
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: all 0.18s ease-out;
}
.search-results.visible { opacity: 1; visibility: visible; transform: translateY(0); }
.search-results a {
  display: block; padding: 10px 16px; text-decoration: none;
  color: var(--text); border-bottom: 1px solid var(--panel-border);
}
.search-results a:last-child { border-bottom: none; }
.search-results a:hover { background: var(--bg-soft); }
.sr-title { font-weight: 700; font-size: 0.95rem; }
.sr-excerpt { font-size: 0.85rem; color: var(--muted); line-height: 1.4; }

.mobile-menu-btn {
  display: none;
  background: none; border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm); color: var(--text);
  font-size: 1.2rem; width: 40px; height: 40px; cursor: pointer;
  align-items: center; justify-content: center;
  transition: var(--transition);
}
.mobile-menu-btn:hover { border-color: var(--accent); }

/* ============ SIDEBAR ============ */
.sidebar {
  position: fixed; top: var(--header-h); left: 0; bottom: 0;
  width: var(--sidebar-w);
  overflow-y: auto;
  background: var(--bg-soft);
  border-right: 1px solid var(--panel-border);
  padding: 18px 14px 40px;
  scrollbar-width: thin;
  scrollbar-color: var(--panel-border) transparent;
}
.sidebar-nav { list-style: none; margin: 0; padding: 0; }
.sidebar-nav li { margin: 0; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 12px;
  color: var(--text);
  font-size: 0.9rem; font-weight: 500; line-height: 1.35;
  border-radius: var(--radius-sm);
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.sidebar-nav a:hover {
  background: var(--panel); color: var(--accent-strong);
  text-decoration: none; transform: translateX(2px);
}
.sidebar-nav a.active {
  background: var(--accent-soft); color: var(--accent-strong);
  font-weight: 700;
}
.sidebar-nav a.active::before { content: '●'; font-size: 0.55rem; color: var(--accent); }
.nav-section {
  font-size: 0.7rem; font-weight: 800; letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 18px 12px 6px;
}

/* ============ MAIN LAYOUT ============ */
.main-content {
  margin-left: var(--sidebar-w);
  padding: calc(var(--header-h) + 28px) 40px 60px;
  max-width: 920px;
  min-height: 100vh;
}
.main-footer {
  margin-top: 48px; padding-top: 18px;
  border-top: 1px solid var(--panel-border);
  font-size: 0.85rem; color: var(--muted);
}

/* ============ PAGE TRANSITION ============ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.content-article, .home-hero { animation: fadeUp 0.25s ease-out; }

/* ============ HOME HERO ============ */
.home-hero {
  display: grid; grid-template-columns: 1.25fr 0.75fr;
  gap: 32px; align-items: center;
  background: var(--hero-grad);
  border-radius: 20px;
  padding: 44px 46px;
  margin-bottom: 34px;
  color: #f2efe4;
  box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.home-hero::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(520px 300px at 88% 12%, rgba(58, 169, 130, 0.22), transparent 65%),
    radial-gradient(420px 260px at 8% 96%, rgba(77, 143, 184, 0.18), transparent 60%);
  pointer-events: none;
}.hero-copy { position: relative; z-index: 2; }
.hero-eyebrow {
  display: inline-block;
  font-size: 0.75rem; font-weight: 800; letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #7fd4b0;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(127, 212, 176, 0.35);
  padding: 5px 12px; border-radius: 999px;
  margin-bottom: 16px;
}
.home-hero h1 {
  color: #ffffff; font-size: clamp(1.9rem, 4.4vw, 2.7rem);
  margin-bottom: 14px; letter-spacing: 0.005em;
}
.home-hero p {
  color: #d8e4dd; font-size: 1.05rem; max-width: 46ch;
  margin-bottom: 24px;
}
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.btn {
  display: inline-block;
  padding: 12px 24px; border-radius: 999px;
  font-family: var(--font-body); font-weight: 700; font-size: 0.98rem;
  text-decoration: none;
  transition: transform 0.18s ease-out, box-shadow 0.18s ease-out, background 0.18s;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }
.btn-primary {
  background: #3aa982; color: #0a1712;
  box-shadow: 0 4px 14px rgba(58, 169, 130, 0.35);
}
.btn-primary:hover { background: #4fc39a; box-shadow: 0 6px 18px rgba(58, 169, 130, 0.45); }
.btn-ghost {
  background: transparent; color: #e9f5ee;
  border: 1px solid rgba(233, 245, 238, 0.4);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.08); border-color: #e9f5ee; }

/* ============ FOOT DIAGRAM (signature) ============ */
.foot-diagram { position: relative; z-index: 2; text-align: center; }
.foot-diagram svg { width: 100%; max-width: 300px; height: auto; display: block; margin: 0 auto; }
.foot-shape { fill: rgba(255, 255, 255, 0.10); stroke: rgba(233, 245, 238, 0.55); stroke-width: 2; }
.foot-toe { fill: rgba(255, 255, 255, 0.12); stroke: rgba(233, 245, 238, 0.5); stroke-width: 1.5; }
.hotspot {
  cursor: pointer;
  transition: r 0.2s ease;
}
.hotspot circle.main { fill: #3aa982; stroke: #0a1712; stroke-width: 2; }
.hotspot circle.pulse {
  fill: none; stroke: #7fd4b0; stroke-width: 2;
  transform-box: fill-box;
  transform-origin: center;
  pointer-events: none;
  animation: hotspotPulse 2.4s ease-out infinite;
}
.hotspot:hover circle.main, .hotspot:focus circle.main { fill: #4fc39a; }
.hotspot-label {
  font-family: var(--font-body); font-size: 13px; font-weight: 700;
  fill: #ffffff; pointer-events: none;
  text-anchor: middle; dominant-baseline: central;
}
@keyframes hotspotPulse {
  0% { transform: scale(1); opacity: 0.9; }
  70% { transform: scale(2.1); opacity: 0; }
  100% { transform: scale(2.1); opacity: 0; }
}
.foot-caption { margin-top: 10px; font-size: 0.85rem; color: #b9cfc4; }
.foot-legend {
  margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px 14px;
  justify-content: center;
}
.foot-legend a {
  color: #d8e4dd; font-size: 0.8rem; font-weight: 600;
  border-bottom: 1px dashed rgba(216, 228, 221, 0.4);
}
.foot-legend a:hover { color: #7fd4b0; text-decoration: none; border-bottom-color: #7fd4b0; }

/* ============ STATS STRIP ============ */
.hero-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 14px; margin-bottom: 34px;
}
.hero-stat {
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: var(--radius); padding: 18px 16px;
  text-align: center;
  transition: var(--transition);
}
.hero-stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.hero-stat strong {
  display: block; font-family: var(--font-display);
  font-size: 1.7rem; color: var(--accent-strong); line-height: 1.1;
}
.hero-stat span { font-size: 0.8rem; color: var(--muted); font-weight: 600; }

/* ============ HOME SECTIONS / CARDS ============ */
.home-section { margin-bottom: 38px; }
.home-section > h2 {
  font-size: 1.45rem;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--accent-soft);
  display: flex; align-items: center; gap: 10px;
}
.home-section > h2::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
  opacity: 0.25;
}
.card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.home-card {
  display: block;
  background: var(--card-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 20px 18px;
  color: var(--text); text-decoration: none;
  transition: transform 0.2s ease-out, box-shadow 0.2s ease-out, border-color 0.2s;
  position: relative;
}
.home-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: var(--accent);
  text-decoration: none;
}
.card-icon { font-size: 1.5rem; margin-bottom: 10px; }
.home-card h3 { font-size: 0.95rem; font-weight: 700; margin: 0 0 8px; color: var(--headline); }
.home-card p { font-size: 0.85rem; color: var(--muted); margin: 0; line-height: 1.5; }

/* reveal on scroll */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.5s ease-out, transform 0.5s ease-out; }
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ============ ARTICLE ============ */
.content-article { background: var(--panel); border: 1px solid var(--panel-border); border-radius: 18px; padding: 38px 42px; box-shadow: var(--shadow); }
.content-article h1 { font-size: clamp(1.8rem, 3.6vw, 2.4rem); margin-bottom: 0.3em; }
.article-meta { font-size: 0.92rem; color: var(--muted); margin-bottom: 18px; }
.content-article > h2:first-of-type { margin-top: 0.4em; }
.content-article ul, .content-article ol { margin: 0 0 1em; padding-left: 1.4em; }
.content-article li { margin-bottom: 0.45em; }
.content-article strong { color: var(--headline); }
.content-article blockquote {
  margin: 1em 0; padding: 10px 18px;
  border-left: 3px solid var(--accent);
  background: var(--bg-soft); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--muted); font-style: italic;
}

/* TOC */
.article-toc {
  background: var(--bg-soft);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 16px 20px; margin: 18px 0 26px;
}
.article-toc h3 { font-size: 0.95rem; margin: 0 0 10px; font-family: var(--font-body); font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.78rem; color: var(--muted); }
.article-toc a {
  display: block; padding: 4px 0;
  font-size: 0.92rem; color: var(--blue);
}
.article-toc a:hover { text-decoration: underline; }
.article-toc a.toc-h3 { padding-left: 16px; font-size: 0.88rem; }

/* info box */
.info-box {
  background: var(--accent-soft);
  border: 1px solid rgba(58, 169, 130, 0.35);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 14px 18px; margin: 1.1em 0;
  font-size: 0.95rem;
  color: var(--text);
}
.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(--panel-border); }
.error-table {
  width: 100%; border-collapse: collapse; font-size: 0.92rem;
  background: var(--panel);
}
.error-table th {
  background: var(--accent-soft); color: var(--accent-strong);
  text-align: left; padding: 11px 14px; font-weight: 800;
  border-bottom: 2px solid var(--accent);
}
.error-table td {
  padding: 10px 14px; border-bottom: 1px solid var(--panel-border);
  vertical-align: top;
}
.error-table tr:nth-child(even) td { background: var(--table-stripe); }
.error-table tr:last-child td { border-bottom: none; }

/* FAQ */
.faq-item { margin-bottom: 10px; }
.faq-item details {
  background: var(--bg-soft);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  padding: 4px 18px;
  transition: border-color 0.2s;
}
.faq-item details[open] { border-color: var(--accent); }
.faq-item summary {
  cursor: pointer; font-weight: 700; color: var(--headline);
  padding: 12px 0; list-style: none;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '+'; font-size: 1.2rem; color: var(--accent);
  font-weight: 700; transition: transform 0.2s;
}
.faq-item details[open] summary::after { transform: rotate(45deg); }
.faq-a { padding: 0 0 14px; color: var(--text); font-size: 0.95rem; }
.faq-a p { margin: 0 0 8px; }
.faq-a p:last-child { margin-bottom: 0; }

/* glossary */
.content-article dl { margin: 1em 0; }
.content-article dt {
  font-weight: 800; color: var(--accent-strong);
  margin-top: 14px; font-size: 1rem;
}
.content-article dd { margin: 2px 0 0; padding-left: 18px; color: var(--text); font-size: 0.95rem; }

/* 404 */
.not-found { text-align: center; padding: 60px 20px; }
.not-found h1 { font-size: 2rem; }

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease-out;
    z-index: 120;
    box-shadow: var(--shadow-hover);
    width: min(300px, 84vw);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay {
    position: fixed; inset: 0; z-index: 110;
    background: rgba(10, 20, 16, 0.5);
    opacity: 0; visibility: hidden; transition: opacity 0.25s;
  }
  .sidebar-overlay.visible { opacity: 1; visibility: visible; }
  .mobile-menu-btn { display: flex; }
  .main-content { margin-left: 0; padding: calc(var(--header-h) + 22px) 18px 50px; }
  .home-hero { grid-template-columns: 1fr; padding: 32px 26px; gap: 26px; }
  .foot-diagram svg { max-width: 240px; }
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
  .content-article { padding: 26px 22px; }
  .header-search { width: auto; flex: 1; max-width: 240px; }
}

@media (max-width: 600px) {
  .logo-text a { font-size: 1.1rem; }
  .header-search { max-width: 170px; }
  .home-hero { border-radius: 16px; }
  .hero-cta .btn { width: 100%; text-align: center; }
  .card-grid { grid-template-columns: 1fr; }
  .content-article { padding: 22px 18px; border-radius: 14px; }
}

/* ============ REDUCED MOTION ============ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .hotspot circle.pulse { animation: none; }
  html { scroll-behavior: auto; }
}
