/* ============================================================
   PodrozeProsto - design system
   Paleta "mapa i horyzont": głęboki granat nieba i oceanu
   (zaufanie, głębia) + morski turkus (woda, świeżość) +
   piasek/krem (plaże, mapa, papier) + koral zachodu słońca
   (energia przygody, CTA).
   Typografia: Spectral (display, edytorialny serif magazynu
   podróżniczego) + Mulish (body).
   Signature: trasa podróży w hero - mapa w kropki, łuk trasy,
   samolot papierowy, piny i stempel.
   ============================================================ */

:root {
  --teal-900: #0c2230;
  --teal-800: #0f2b3d;
  --teal-700: #143a52;
  --teal-600: #1b4a63;
  --teal-500: #2a6a85;
  --teal-100: #d8e7ee;
  --teal-50: #edf4f7;

  --amber-600: #c2491f;
  --amber-500: #d95f2b;
  --amber-400: #ef8a4d;
  --amber-100: #fdeadd;

  --sage-700: #2c6b63;
  --sage-500: #3f8a80;
  --sage-100: #dcece9;

  --cream: #faf7f0;
  --cream-2: #f2ede3;
  --paper: #ffffff;

  --ink: #1b2a33;
  --ink-soft: #33454f;
  --muted: #5b6e78;

  --dark-bg: #0d1b24;
  --dark-surface: #12232e;
  --dark-surface-2: #172b38;
  --dark-text: #e6edf0;
  --dark-muted: #9fb0b9;

  --border: #e4dccd;
  --border-dark: #1f3a49;

  --radius: 14px;
  --radius-sm: 9px;
  --header-h: 64px;
  --sidebar-w: 300px;

  --font-display: "Spectral", Georgia, serif;
  --font-body: "Mulish", "Segoe UI", sans-serif;

  --shadow-card: 0 1px 2px rgba(27, 42, 51, 0.05), 0 4px 16px rgba(27, 42, 51, 0.06);
  --shadow-card-hover: 0 2px 4px rgba(27, 42, 51, 0.06), 0 10px 28px rgba(20, 58, 82, 0.14);

  --transition: all 0.2s ease-out;
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
  color: var(--ink);
  background-color: var(--cream);
  background-image:
    radial-gradient(ellipse 60% 45% at 88% -5%, rgba(217, 95, 43, 0.07), transparent 60%),
    radial-gradient(ellipse 55% 40% at -5% 105%, rgba(31, 106, 120, 0.08), transparent 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; }
a { color: var(--teal-700); }
a:hover { color: var(--teal-600); }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.25;
  text-wrap: balance;
  color: var(--ink);
}

::selection { background: var(--amber-100); color: var(--ink); }

:focus-visible {
  outline: 3px solid var(--amber-500);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--teal-700);
  color: #fff;
  padding: 10px 16px;
  z-index: 200;
  border-radius: 0 0 var(--radius-sm) 0;
  font-weight: 600;
}
.skip-link:focus { left: 0; color: #fff; }

/* ---------- Header ---------- */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  background: rgba(250, 247, 242, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}
.app-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(20, 58, 82, 0.25), transparent);
  opacity: 0.6;
  pointer-events: none;
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  height: 100%;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.menu-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  padding: 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}
.menu-btn span {
  display: block;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: var(--transition);
}
.menu-btn:hover { border-color: var(--teal-600); }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--teal-700), var(--teal-500));
  font-size: 19px;
  box-shadow: 0 2px 8px rgba(20, 58, 82, 0.28);
}
.brand-name {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.brand-name em {
  font-style: normal;
  color: var(--teal-700);
}

.search-wrap {
  position: relative;
  flex: 1;
  max-width: 420px;
  margin-left: auto;
}

.search-input {
  width: 100%;
  height: 40px;
  padding: 0 14px 0 38px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: var(--transition);
}
.search-input::placeholder { color: var(--muted); }
.search-input:focus {
  outline: none;
  border-color: var(--teal-600);
  box-shadow: 0 0 0 3px rgba(20, 58, 82, 0.15);
}
.search-wrap::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 50%;
  width: 14px;
  height: 14px;
  transform: translateY(-55%);
  border: 2px solid var(--muted);
  border-radius: 50%;
}
.search-wrap::after {
  content: "";
  position: absolute;
  left: 24px;
  top: 50%;
  width: 7px;
  height: 2px;
  transform: translateY(4px) rotate(45deg);
  background: var(--muted);
}

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card-hover);
  overflow: hidden;
  display: none;
  z-index: 120;
}
.search-results.open { display: block; }
.search-item {
  display: block;
  padding: 11px 16px;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s ease;
}
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: var(--teal-50); }
.si-title { font-weight: 600; font-size: 0.95rem; color: var(--ink); }
.si-section { font-size: 0.78rem; color: var(--muted); margin-top: 1px; }
.search-empty { padding: 14px 16px; color: var(--muted); font-size: 0.9rem; }

.header-tagline {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
  border-left: 1px solid var(--border);
  padding-left: 16px;
}

/* ---------- Layout ---------- */
.layout {
  max-width: 1400px;
  margin: 0 auto;
  padding: calc(var(--header-h) + 24px) 20px 40px;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  gap: 32px;
}

.sidebar {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  align-self: start;
  max-height: calc(100vh - var(--header-h) - 48px);
  overflow-y: auto;
  padding: 6px 16px 16px 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.side-group { margin-bottom: 6px; }
.side-group-title {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 10px 6px;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}
.side-group-title::-webkit-details-marker { display: none; }
.side-group-title::before {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--teal-600);
  border-bottom: 2px solid var(--teal-600);
  transform: rotate(45deg);
  transition: transform 0.2s ease;
  opacity: 0.7;
}
.side-group[open] > .side-group-title::before { transform: rotate(-135deg); }

.side-group-items { padding-bottom: 6px; }
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 10px;
  font-size: 0.9rem;
  line-height: 1.35;
  color: var(--ink-soft);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.sidebar-link .s-icon { font-size: 0.85rem; opacity: 0.85; flex-shrink: 0; }
.sidebar-link:hover {
  background: var(--teal-50);
  color: var(--teal-700);
  transform: translateX(2px);
}
.sidebar-link.active {
  background: var(--teal-100);
  color: var(--teal-800);
  font-weight: 600;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(13, 27, 36, 0.5);
  z-index: 90;
}

.main-content { min-width: 0; }
.app-content { animation: fadeUp 0.25s ease-out; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Hero ---------- */
.home-hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--teal-900) 0%, var(--teal-700) 55%, var(--teal-600) 100%);
  border-radius: 18px;
  padding: 56px 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  box-shadow: 0 8px 32px rgba(6, 18, 26, 0.3);
}
.home-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 50% 60% at 85% 15%, rgba(239, 138, 77, 0.16), transparent 65%),
    radial-gradient(ellipse 45% 55% at 8% 95%, rgba(63, 138, 128, 0.32), transparent 60%);
  pointer-events: none;
}

.hero-inner { position: relative; z-index: 2; max-width: 640px; }
.hero-eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--amber-400);
  background: rgba(250, 247, 242, 0.08);
  border: 1px solid rgba(239, 138, 77, 0.4);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 18px;
}
.home-hero h1 {
  color: #fff;
  font-size: clamp(1.9rem, 4vw, 2.7rem);
  margin: 0 0 14px;
}
.home-hero h1 .accent-word {
  color: var(--amber-400);
  font-style: italic;
}
.hero-sub {
  color: rgba(250, 247, 242, 0.92);
  font-size: 1.05rem;
  line-height: 1.7;
  margin: 0 0 26px;
  max-width: 580px;
}
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 22px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 999px;
  transition: var(--transition);
  cursor: pointer;
}
.btn-primary {
  background: var(--amber-500);
  color: #0d1b24;
  box-shadow: 0 2px 10px rgba(217, 95, 43, 0.35);
}
.btn-primary:hover {
  background: var(--amber-400);
  color: #0d1b24;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(217, 95, 43, 0.45);
}
.btn-ghost {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
}
.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  transform: translateY(-2px);
}

/* Trasa podrozy - signature element */
.hero-visual {
  position: relative;
  z-index: 1;
  width: 310px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.route-map {
  position: relative;
  width: 290px;
  height: 220px;
  border-radius: 16px;
  background:
    radial-gradient(rgba(250, 247, 240, 0.16) 1.2px, transparent 1.6px);
  background-size: 17px 17px;
  border: 1px solid rgba(250, 247, 240, 0.22);
  box-shadow: 0 10px 34px rgba(6, 18, 26, 0.35);
  overflow: hidden;
}
.route-map::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 55% 65% at 78% 12%, rgba(239, 138, 77, 0.16), transparent 62%),
    radial-gradient(ellipse 50% 60% at 12% 90%, rgba(63, 138, 128, 0.22), transparent 60%);
  pointer-events: none;
}
.route-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.route-path {
  fill: none;
  stroke: var(--amber-400);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-dasharray: 7 9;
  animation: routeDash 5.5s linear infinite;
}
.route-path-soft {
  fill: none;
  stroke: rgba(250, 247, 240, 0.28);
  stroke-width: 5;
  stroke-linecap: round;
}
.route-pin {
  fill: var(--amber-400);
}
.route-pin-ring {
  fill: none;
  stroke: var(--amber-400);
  stroke-width: 1.6;
  opacity: 0.85;
  animation: pinPulse 2.6s ease-out infinite;
  transform-origin: center;
  transform-box: fill-box;
}
.route-label {
  fill: rgba(250, 247, 240, 0.92);
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
}
.route-stamp {
  animation: stampIn 0.9s cubic-bezier(0.2, 1.6, 0.4, 1) both;
  transform-origin: center;
  transform-box: fill-box;
}
.route-stamp rect {
  fill: rgba(250, 247, 240, 0.06);
  stroke: rgba(239, 138, 77, 0.75);
  stroke-width: 1.6;
  rx: 5;
}
.route-stamp text {
  fill: rgba(239, 138, 77, 0.95);
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.16em;
}
@keyframes routeDash {
  to { stroke-dashoffset: -64; }
}
@keyframes pinPulse {
  0% { transform: scale(0.6); opacity: 0.9; }
  70% { transform: scale(2.1); opacity: 0; }
  100% { transform: scale(2.1); opacity: 0; }
}
@keyframes stampIn {
  0% { transform: scale(1.9) rotate(-14deg); opacity: 0; }
  60% { transform: scale(0.94) rotate(-7deg); opacity: 1; }
  100% { transform: scale(1) rotate(-7deg); opacity: 1; }
}
.route-caption {
  margin-top: 12px;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  color: rgba(250, 247, 240, 0.9);
  text-align: center;
  white-space: nowrap;
}

/* ---------- Home sections ---------- */
.home-section { margin-top: 44px; }
.home-section h2 {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 1.5rem;
  margin: 0 0 6px;
  color: var(--teal-900);
}
.sec-count {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--teal-100);
  color: var(--teal-700);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
}
.sec-desc {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0 0 18px 52px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

.home-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 20px 16px;
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow-card);
  transition: var(--transition);
}
.home-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 20px;
  right: 20px;
  height: 3px;
  background: linear-gradient(90deg, var(--teal-600), var(--amber-500));
  border-radius: 0 0 3px 3px;
  opacity: 0;
  transition: opacity 0.2s ease-out;
}
.home-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-card-hover);
  border-color: #d8cdba;
  color: var(--ink);
}
.home-card:hover::before { opacity: 1; }

.hc-icon {
  font-size: 1.7rem;
  line-height: 1;
  margin-bottom: 12px;
  display: inline-block;
  transition: transform 0.2s ease-out;
}
.home-card:hover .hc-icon { transform: scale(1.12) rotate(-4deg); }

.home-card h3 {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.4;
  margin: 0 0 8px;
  color: var(--teal-900);
}
.home-card p {
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0 0 14px;
  flex-grow: 1;
}
.hc-more {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--teal-700);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.hc-more .arrow { transition: transform 0.2s ease-out; }
.home-card:hover .hc-more .arrow { transform: translateX(4px); }

/* ---------- Article ---------- */
.article-header { margin-bottom: 30px; }
.breadcrumbs {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 12px;
}
.breadcrumbs a { color: var(--teal-700); text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }
.breadcrumbs .sep { margin: 0 7px; color: var(--border); }

.article-header h1 {
  font-size: clamp(1.7rem, 3.4vw, 2.35rem);
  color: var(--teal-900);
  margin: 0 0 12px;
}
.article-excerpt {
  font-size: 1.06rem;
  line-height: 1.65;
  color: var(--ink-soft);
  margin: 0 0 16px;
  max-width: 760px;
}
.article-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--muted);
}
.tag {
  background: var(--teal-100);
  color: var(--teal-800);
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
}

.article-body {
  max-width: 780px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 40px;
  box-shadow: var(--shadow-card);
}

.article-body h2 {
  font-size: 1.45rem;
  color: var(--teal-900);
  margin: 34px 0 14px;
  padding-top: 6px;
  scroll-margin-top: calc(var(--header-h) + 20px);
}
.article-body h2:first-child { margin-top: 0; }
.article-body h3 {
  font-size: 1.1rem;
  font-weight: 700;
  font-family: var(--font-body);
  color: var(--teal-800);
  margin: 24px 0 10px;
  scroll-margin-top: calc(var(--header-h) + 20px);
}
.article-body p { margin: 0 0 16px; }
.article-body ul, .article-body ol { margin: 0 0 18px; padding-left: 24px; }
.article-body li { margin-bottom: 6px; }
.article-body strong { color: var(--ink); }
.article-body a { text-decoration: underline; text-underline-offset: 2px; }

.article-toc {
  background: var(--teal-50);
  border: 1px solid var(--teal-100);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin-bottom: 26px;
}
.article-toc summary {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--teal-800);
  cursor: pointer;
  user-select: none;
}
.article-toc ol {
  margin: 10px 0 0;
  padding-left: 20px;
}
.article-toc li { margin-bottom: 4px; font-size: 0.9rem; }
.article-toc a { color: var(--teal-700); text-decoration: none; }
.article-toc a:hover { text-decoration: underline; }

.info-box {
  background: var(--amber-100);
  border-left: 4px solid var(--amber-500);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 14px 18px;
  margin: 18px 0;
  font-size: 0.95rem;
  line-height: 1.6;
}
.info-box strong { color: var(--teal-800); }

.compare-table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0 22px;
  font-size: 0.92rem;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.compare-table th {
  background: var(--teal-700);
  color: #fff;
  text-align: left;
  padding: 11px 14px;
  font-weight: 600;
  font-size: 0.88rem;
}
.compare-table td {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  vertical-align: top;
}
.compare-table tr:nth-child(even) td { background: var(--cream-2); }
.compare-table td:first-child { font-weight: 600; color: var(--teal-800); white-space: nowrap; }

.faq-item {
  border: 1px solid var(--border);
  border-left: 4px solid var(--teal-600);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  margin: 0 0 14px;
  background: var(--paper);
}
.faq-item h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: var(--teal-900);
}
.faq-item p { margin: 0; font-size: 0.95rem; }

.article-body dl {
  margin: 0 0 20px;
}
.article-body dt {
  font-weight: 700;
  color: var(--teal-800);
  margin-top: 14px;
  font-size: 1rem;
}
.article-body dd {
  margin: 3px 0 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

/* prev / next */
.article-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.article-nav a {
  display: block;
  text-decoration: none;
  background: var(--cream-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  transition: var(--transition);
}
.article-nav a:hover {
  background: var(--teal-50);
  border-color: var(--teal-100);
  transform: translateY(-2px);
}
.article-nav a.next { text-align: right; }
.an-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}
.an-title { font-weight: 600; font-size: 0.92rem; color: var(--teal-800); }

/* ---------- Footer ---------- */
.app-footer {
  margin-top: 48px;
  background: var(--teal-900);
  color: rgba(250, 247, 242, 0.85);
}
.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 36px 20px;
  font-size: 0.9rem;
  line-height: 1.6;
}
.footer-inner p { margin: 0 0 10px; }
.footer-inner strong { color: #fff; font-family: var(--font-display); font-weight: 500; }
.footer-note { color: rgba(250, 247, 242, 0.68); font-size: 0.82rem; }
.footer-copy { color: rgba(250, 247, 242, 0.5); font-size: 0.8rem; }

/* ---------- Responsive ---------- */
@media (max-width: 1020px) {
  .header-tagline { display: none; }
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
    padding-top: calc(var(--header-h) + 16px);
  }
  .menu-btn { display: flex; }
  .sidebar {
    position: fixed;
    top: var(--header-h);
    bottom: 0;
    left: 0;
    width: min(320px, 85vw);
    max-height: none;
    background: var(--cream);
    border-right: 1px solid var(--border);
    padding: 12px 16px 24px;
    transform: translateX(-105%);
    transition: transform 0.25s ease-out;
    z-index: 95;
    box-shadow: 8px 0 24px rgba(13, 27, 36, 0.12);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.show { display: block; }
  .search-wrap { max-width: none; }
  .home-hero {
    flex-direction: column;
    padding: 40px 28px;
    text-align: left;
  }
  .hero-visual { width: 100%; height: 250px; }
  .sec-desc { margin-left: 0; }
  .article-body { padding: 28px 24px; }
}

@media (max-width: 600px) {
  body { font-size: 16.5px; }
  .header-inner { padding: 0 12px; gap: 10px; }
  .brand-name { font-size: 1.1rem; }
  .brand-mark { width: 34px; height: 34px; font-size: 17px; }
  .home-hero { padding: 32px 20px; border-radius: 14px; }
  .home-hero h1 { font-size: 1.65rem; }
  .hero-cta { flex-direction: column; }
  .btn { width: 100%; }
  .card-grid { grid-template-columns: 1fr; }
  .article-nav { grid-template-columns: 1fr; }
  .article-nav a.next { text-align: left; }
  .compare-table { font-size: 0.85rem; }
  .compare-table th, .compare-table td { padding: 8px 10px; }
}

/* ---------- Dark mode ---------- */
@media (prefers-color-scheme: dark) {
  body {
    color: var(--dark-text);
    background-color: var(--dark-bg);
    background-image:
      radial-gradient(ellipse 60% 45% at 88% -5%, rgba(217, 95, 43, 0.05), transparent 60%),
      radial-gradient(ellipse 55% 40% at -5% 105%, rgba(63, 138, 128, 0.12), transparent 60%);
  }
  h1, h2, h3 { color: var(--dark-text); }
  a { color: #63b3c4; }
  a:hover { color: #7fc4d0; }
  ::selection { background: rgba(217, 95, 43, 0.32); color: var(--dark-text); }

  .app-header {
    background: rgba(13, 27, 36, 0.92);
    border-bottom-color: var(--border-dark);
  }
  .brand-name { color: var(--dark-text); }
  .menu-btn span { background: var(--dark-text); }
  .menu-btn { border-color: var(--border-dark); }
  .search-input {
    background: var(--dark-surface);
    color: var(--dark-text);
    border-color: var(--border-dark);
  }
  .search-input::placeholder { color: var(--dark-muted); }
  .search-results {
    background: var(--dark-surface);
    border-color: var(--border-dark);
  }
  .search-item { border-bottom-color: var(--border-dark); }
  .search-item:hover { background: var(--dark-surface-2); }
  .si-title { color: var(--dark-text); }
  .si-section { color: var(--dark-muted); }
  .header-tagline { color: var(--dark-muted); border-left-color: var(--border-dark); }

  .sidebar { background: var(--dark-bg); }
  .side-group-title { color: var(--dark-muted); }
  .sidebar-link { color: #c2ccd2; }
  .sidebar-link:hover { background: var(--dark-surface); color: #7fc4d0; }
  .sidebar-link.active { background: rgba(63, 138, 128, 0.2); color: #7fc4d0; }

  .home-section h2 { color: #d7e7ec; }
  .sec-count { background: rgba(63, 138, 128, 0.2); color: #7fc4d0; }
  .sec-desc { color: var(--dark-muted); }

  .home-card {
    background: var(--dark-surface);
    border-color: var(--border-dark);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.2);
  }
  .home-card:hover {
    border-color: #2d4a52;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
  }
  .home-card h3 { color: #d7e7ec; }
  .home-card p { color: #a9b8c0; }
  .hc-more { color: #7fc4d0; }

  .article-header h1 { color: #d7e7ec; }
  .article-excerpt { color: #a9b8c0; }
  .article-meta { color: var(--dark-muted); }
  .tag { background: rgba(63, 138, 128, 0.2); color: #7fc4d0; }

  .article-body {
    background: var(--dark-surface);
    border-color: var(--border-dark);
  }
  .article-body h2 { color: #d7e7ec; }
  .article-body h3 { color: #7fc4d0; }
  .article-body strong { color: var(--dark-text); }
  .article-body a { color: #63b3c4; }

  .article-toc { background: rgba(63, 138, 128, 0.12); border-color: rgba(63, 138, 128, 0.28); }
  .article-toc summary { color: #7fc4d0; }
  .article-toc a { color: #63b3c4; }

  .info-box {
    background: rgba(217, 95, 43, 0.12);
    border-left-color: var(--amber-500);
  }
  .info-box strong { color: var(--amber-400); }

  .compare-table { background: var(--dark-surface); border-color: var(--border-dark); }
  .compare-table th { background: var(--teal-800); }
  .compare-table td { border-top-color: var(--border-dark); }
  .compare-table tr:nth-child(even) td { background: var(--dark-surface-2); }
  .compare-table td:first-child { color: #7fc4d0; }

  .faq-item { background: var(--dark-surface); border-color: var(--border-dark); }
  .faq-item h3 { color: #d7e7ec; }
  .faq-item p { color: #a9b8c0; }

  .article-body dt { color: #7fc4d0; }
  .article-body dd { color: #a9b8c0; }

  .article-nav { border-top-color: var(--border-dark); }
  .article-nav a { background: var(--dark-surface-2); border-color: var(--border-dark); }
  .article-nav a:hover { background: rgba(63, 138, 128, 0.18); }
  .an-label { color: var(--dark-muted); }
  .an-title { color: #7fc4d0; }

  .app-footer { background: #0a1720; }
  .footer-note { color: rgba(250, 247, 242, 0.45); }

  @media (max-width: 900px) {
    .sidebar { background: var(--dark-bg); border-right-color: var(--border-dark); }
  }
}

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