/* ============================================================
   WnętrzaProsto - design system
   Koncepcja: "Salon o zmierzchu" - ciepły magazyn wnętrzarski
   Paleta: zieleń szałwiowa + mosiądz + owies + głęboki orzech
   Typografia: Gilda Display (display) + Onest (body)
   ============================================================ */

:root {
  --bg: #f4eee2;
  --bg-soft: #ece3d0;
  --ink: #1f1a15;
  --panel: #2a231c;
  --text: #241e17;
  --muted: #76684f;
  --accent: #3d6b5e;
  --accent-deep: #2f5147;
  --accent-soft: #e2e9df;
  --brass: #8a642f;
  --brass-bright: #b8863d;
  --border: #d8ccb2;
  --header-bg: rgba(244, 238, 226, 0.92);
  --shadow: rgba(31, 26, 21, 0.12);
  --shadow-lg: rgba(31, 26, 21, 0.18);
  --font-display: 'Gilda Display', Georgia, serif;
  --font-body: 'Onest', system-ui, sans-serif;
  --radius: 14px;
  --radius-sm: 9px;
  --header-h: 64px;
  --sidebar-w: 290px;
  --transition: all .2s ease-out;
  --body-grad: radial-gradient(900px 500px at -10% -10%, rgba(61, 107, 94, 0.14), transparent 60%),
               radial-gradient(800px 500px at 110% 110%, rgba(201, 160, 94, 0.16), transparent 60%);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1f1a15;
    --bg-soft: #2a231c;
    --text: #f0e9db;
    --muted: #b3a68d;
    --accent: #7fa392;
    --accent-deep: #9bb8a8;
    --accent-soft: #2e3a33;
    --brass: #c9a05e;
    --brass-bright: #d9b577;
    --border: #3a322a;
    --header-bg: rgba(31, 26, 21, 0.92);
    --shadow: rgba(0, 0, 0, 0.35);
    --shadow-lg: rgba(0, 0, 0, 0.5);
    --body-grad: radial-gradient(900px 500px at -10% -10%, rgba(127, 163, 146, 0.10), transparent 60%),
                 radial-gradient(800px 500px at 110% 110%, rgba(201, 160, 94, 0.10), transparent 60%);
  }
}

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

html { scroll-behavior: smooth; overflow-x: clip; }

body {
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  background-image: var(--body-grad);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

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

/* ---------- Skip link ---------- */
.skip-link {
  position: fixed; top: -60px; left: 12px; z-index: 300;
  background: var(--accent-deep); color: var(--bg);
  padding: 10px 18px; border-radius: 0 0 10px 10px;
  font-weight: 600; text-decoration: none; transition: top .2s ease-out;
}
.skip-link:focus { top: 0; }

/* ---------- Header ---------- */
.app-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  height: var(--header-h);
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.app-header::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--brass-bright), transparent);
  opacity: .35; pointer-events: none;
}
.header-inner {
  max-width: 1240px; height: 100%; margin: 0 auto; padding: 0 20px;
  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-text {
  font-family: var(--font-display); font-size: 1.35rem; letter-spacing: .01em;
}
.brand-text em { font-style: normal; color: var(--accent); }
.brand-mark svg rect { fill: var(--ink); transition: var(--transition); }
.brand:hover .brand-mark svg rect { fill: var(--accent-deep); }

/* Search */
.search-wrap { position: relative; flex: 1; max-width: 460px; margin-left: auto; }
.search-icon {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  color: var(--muted); pointer-events: none;
}
#search-input {
  width: 100%; height: 40px;
  padding: 0 16px 0 38px;
  font-family: var(--font-body); font-size: .95rem;
  color: var(--text); background: var(--bg-soft);
  border: 1px solid var(--border); border-radius: 999px;
  outline: none; transition: var(--transition);
}
#search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(61, 107, 94, .18); }
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 210;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); overflow: hidden; max-height: 420px; overflow-y: auto;
}
.search-results a {
  display: block; padding: 10px 14px; text-decoration: none; color: var(--text);
  border-bottom: 1px solid var(--border); transition: var(--transition);
}
.search-results a:last-child { border-bottom: none; }
.search-results a:hover, .search-results a:focus { background: var(--accent-soft); }
.search-results .sr-title { font-weight: 600; font-size: .92rem; }
.search-results .sr-section { font-size: .78rem; color: var(--muted); }
.search-empty { padding: 14px; color: var(--muted); font-size: .9rem; }

/* Menu toggle */
.menu-toggle {
  display: none; align-items: center; justify-content: center;
  width: 42px; height: 42px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg-soft); color: var(--text); cursor: pointer;
  transition: var(--transition);
}
.menu-toggle:hover { border-color: var(--accent); color: var(--accent); }
.menu-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed; top: var(--header-h); bottom: 0; left: 0; z-index: 150;
  width: var(--sidebar-w);
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
  overflow-y: auto; padding: 20px 16px 40px;
  scrollbar-width: thin;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 16px; }
.side-group { display: flex; flex-direction: column; gap: 2px; }
.side-group-label {
  font-size: .7rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--brass); padding: 0 10px 4px;
}
.sidebar-link {
  display: flex; align-items: center; gap: 9px;
  font-size: .9rem; font-weight: 500; line-height: 1.35;
  color: var(--text); text-decoration: none;
  padding: 6px 10px; border-radius: 8px;
  border-left: 2px solid transparent;
  transition: var(--transition);
}
.sidebar-link:hover { background: var(--accent-soft); color: var(--accent-deep); }
.sidebar-link.active {
  background: var(--accent-soft); color: var(--accent-deep);
  border-left-color: var(--accent); font-weight: 600;
}
.sidebar-link .sl-icon { font-size: .85rem; opacity: .85; flex-shrink: 0; }
.sidebar-link .sl-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot {
  margin-top: 28px; padding: 14px 10px; font-size: .8rem; color: var(--muted);
  border-top: 1px solid var(--border); line-height: 1.5;
}

.sidebar-overlay {
  position: fixed; inset: var(--header-h) 0 0 0; z-index: 140;
  background: rgba(0, 0, 0, .45); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}

/* ---------- Main ---------- */
.main-content {
  margin-left: var(--sidebar-w);
  padding: calc(var(--header-h) + 8px) 24px 60px;
  max-width: 1240px;
}
#content { min-height: 70vh; animation: fadeUp .28s ease-out; }

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

/* ---------- Home: hero ---------- */
.home-hero {
  position: relative; overflow: hidden;
  border-radius: var(--radius);
  margin: 18px 0 34px;
  background: var(--ink);
  color: #f4eee2;
  border: 1px solid var(--border);
}
.home-hero::before {
  content: ''; position: absolute; inset: 0;
  background: url('../assets/hero.webp') center/cover no-repeat;
  opacity: .42;
}
.home-hero::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(100deg, rgba(31, 26, 21, .96) 8%, rgba(31, 26, 21, .72) 45%, rgba(31, 26, 21, .38) 78%);
}
.hero-inner {
  position: relative; z-index: 2;
  display: grid; grid-template-columns: 1.15fr .85fr; gap: 26px; align-items: center;
  padding: 52px 48px 46px;
}
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: .78rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: #c9a05e; margin-bottom: 14px;
}
.hero-eyebrow::before { content: ''; width: 26px; height: 2px; background: #c9a05e; }
.hero-inner h1 {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(2.1rem, 4.4vw, 3.4rem); line-height: 1.12;
  color: #f4eee2; text-wrap: balance; margin-bottom: 14px;
}
.hero-inner h1 em { font-style: normal; color: #9bb8a8; }
.hero-lead {
  font-size: 1.05rem; line-height: 1.65; color: #d8cfbd;
  max-width: 54ch; margin-bottom: 24px;
}
.hero-cta {
  display: inline-flex; align-items: center; gap: 8px;
  background: #2f5147; color: #f4eee2;
  font-family: var(--font-body); font-weight: 700; font-size: .98rem;
  text-decoration: none; padding: 13px 24px; border-radius: 999px;
  border: 1px solid rgba(244, 238, 226, .25);
  transition: var(--transition);
}
.hero-cta:hover { background: #3d6b5e; transform: translateY(-2px); box-shadow: 0 8px 22px rgba(0, 0, 0, .35); }
.hero-cta:focus-visible { outline: 2px solid #c9a05e; outline-offset: 3px; }
.hero-stats {
  display: flex; gap: 28px; margin-top: 30px; flex-wrap: wrap;
}
.hero-stats .hs {
  font-size: .85rem; color: #d8cfbd; line-height: 1.4;
}
.hero-stats .hs strong {
  display: block; font-family: var(--font-display); font-size: 1.7rem; font-weight: 400;
  color: #c9a05e;
}

/* Hero signature: rzut mieszkania */
.hero-plan { position: relative; z-index: 2; display: flex; justify-content: center; }
.hero-plan svg {
  width: 100%; max-width: 380px; height: auto;
  filter: drop-shadow(0 10px 30px rgba(0, 0, 0, .45));
}
.plan-path {
  fill: none; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 1400; stroke-dashoffset: 1400;
  transition: stroke-dashoffset 2.4s cubic-bezier(.3, .6, .2, 1);
}
.plan-visible .plan-path { stroke-dashoffset: 0; }
.plan-path.d1 { transition-delay: .05s; }
.plan-path.d2 { transition-delay: .35s; }
.plan-path.d3 { transition-delay: .65s; }
.plan-path.d4 { transition-delay: .95s; }
.plan-path.d5 { transition-delay: 1.25s; }
.plan-label {
  font-family: var(--font-body); font-size: 11px; font-weight: 600; letter-spacing: .06em;
  opacity: 0; transition: opacity .5s ease .9s;
}
.plan-visible .plan-label { opacity: 1; }

/* ---------- Home: sections grid ---------- */
.home-section { margin-bottom: 40px; }
.home-section-head {
  display: flex; align-items: baseline; gap: 14px; margin-bottom: 18px;
  padding-bottom: 10px; border-bottom: 1px solid var(--border);
}
.home-section-head h2 {
  font-family: var(--font-display); font-weight: 400;
  font-size: 1.55rem; color: var(--text);
}
.home-section-head .hs-count {
  font-size: .78rem; color: var(--muted); font-weight: 600; letter-spacing: .05em;
}
.home-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 14px;
}
.home-card {
  position: relative;
  display: flex; flex-direction: column; gap: 6px;
  background: var(--bg-soft);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 16px 16px 14px;
  text-decoration: none; color: var(--text);
  transition: var(--transition);
}
.home-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 6px 18px var(--shadow);
}
.home-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.home-card .hc-icon { font-size: 1.25rem; line-height: 1; }
.home-card h3 { font-size: .9rem; font-weight: 700; line-height: 1.4; }
.home-card p { font-size: .85rem; color: var(--muted); line-height: 1.5; }
.home-card .hc-arrow {
  position: absolute; right: 12px; top: 14px;
  color: var(--accent); opacity: 0; transform: translateX(-6px);
  transition: var(--transition);
}
.home-card:hover .hc-arrow { opacity: 1; transform: translateX(0); }

/* ---------- Article ---------- */
.article { max-width: 780px; margin: 0 auto; }
.article-header { margin: 22px 0 8px; }
.article-header .art-section {
  display: inline-block; font-size: .78rem; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; color: var(--brass);
  margin-bottom: 10px;
}
.article-header h1 {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(1.9rem, 3.6vw, 2.7rem); line-height: 1.15;
  color: var(--text); text-wrap: balance; margin-bottom: 12px;
}
.article-header .art-excerpt {
  font-size: 1.08rem; line-height: 1.6; color: var(--muted);
  max-width: 62ch;
}
.art-meta {
  display: flex; gap: 10px; align-items: center; margin: 16px 0 6px;
  font-size: .8rem; color: var(--muted);
}
.art-meta .chip {
  background: var(--accent-soft); color: var(--accent-deep);
  padding: 3px 10px; border-radius: 999px; font-weight: 600;
}

.article-body { margin-top: 20px; }
.article-body h2 {
  font-family: var(--font-display); font-weight: 400;
  font-size: 1.5rem; line-height: 1.25; color: var(--text);
  margin: 36px 0 12px; padding-top: 8px;
  scroll-margin-top: calc(var(--header-h) + 16px);
  text-wrap: balance;
}
.article-body h3 {
  font-size: 1.12rem; font-weight: 700; margin: 26px 0 8px; color: var(--text);
  scroll-margin-top: calc(var(--header-h) + 16px);
}
.article-body p { margin-bottom: 15px; }
.article-body ul, .article-body ol { margin: 0 0 15px 22px; }
.article-body li { margin-bottom: 7px; }
.article-body a { color: var(--accent-deep); text-decoration-color: var(--brass); text-underline-offset: 3px; }
.article-body a:hover { text-decoration-thickness: 2px; }
.article-body strong { font-weight: 700; }

/* TOC */
.toc {
  background: var(--bg-soft); border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm); padding: 16px 18px; margin: 24px 0;
}
.toc-title { font-weight: 700; font-size: .85rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.toc ol { list-style: none; margin: 0; counter-reset: toc; }
.toc li { margin-bottom: 5px; counter-increment: toc; }
.toc a {
  color: var(--text); text-decoration: none; font-size: .92rem;
  display: inline-flex; gap: 8px; align-items: baseline;
  transition: var(--transition);
}
.toc a::before { content: counter(toc, decimal-leading-zero); font-size: .75rem; color: var(--brass); font-weight: 700; }
.toc a:hover { color: var(--accent-deep); }

/* Info box */
.info-box {
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 14px 18px; margin: 18px 0;
  color: var(--text); line-height: 1.6;
}
.info-box strong { color: var(--accent-deep); }

/* Tables */
.table-responsive { overflow-x: auto; margin: 18px 0; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.table-responsive table { width: 100%; border-collapse: collapse; font-size: .92rem; min-width: 520px; }
.table-responsive th, .table-responsive td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.table-responsive thead th { background: var(--bg-soft); font-weight: 700; font-size: .84rem; letter-spacing: .03em; }
.table-responsive tbody tr:last-child td { border-bottom: none; }
.table-responsive tbody tr:hover { background: var(--accent-soft); }
.table-responsive td:first-child { font-weight: 600; }

.error-table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: .92rem; border-radius: var(--radius-sm); overflow: hidden; }
.error-table th { background: var(--ink); color: var(--bg); padding: 10px 14px; text-align: left; font-size: .84rem; letter-spacing: .03em; }
.error-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.error-table tr:nth-child(even) td { background: var(--bg-soft); }

/* FAQ */
.faq-item {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 16px 18px; margin: 12px 0; background: var(--bg-soft);
}
.faq-item h3 { font-size: 1.02rem; font-weight: 700; margin: 0 0 8px; color: var(--text); }
.faq-item p { margin: 0; font-size: .95rem; }
.faq-item h3::before { content: '?'; display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; margin-right: 8px; background: var(--accent); color: var(--bg); border-radius: 50%; font-size: .8rem; }

/* Glossary */
.glossary dl { margin: 0; }
.glossary dt {
  font-weight: 700; font-size: 1.02rem; color: var(--text);
  margin-top: 18px; padding: 8px 0 4px; border-bottom: 2px solid var(--accent);
  display: inline-block;
}
.glossary dd { margin: 6px 0 0; color: var(--muted); font-size: .95rem; }

/* Prev/next */
.art-nav {
  display: flex; justify-content: space-between; gap: 14px; margin-top: 44px;
  padding-top: 22px; border-top: 1px solid var(--border);
}
.art-nav a {
  text-decoration: none; color: var(--text);
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 16px;
  font-size: .88rem; max-width: 46%; transition: var(--transition);
}
.art-nav a:hover { border-color: var(--accent); color: var(--accent-deep); }
.art-nav .an-label { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 3px; }
.art-nav a.next { text-align: right; margin-left: auto; }

/* 404 */
.notfound { text-align: center; padding: 90px 20px; }
.notfound h1 { font-family: var(--font-display); font-weight: 400; font-size: 2.4rem; margin-bottom: 10px; }
.notfound p { color: var(--muted); margin-bottom: 22px; }

/* ---------- Footer ---------- */
.app-footer {
  margin-left: var(--sidebar-w);
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
}
.footer-inner {
  max-width: 1240px; margin: 0 auto; padding: 22px 24px;
  display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap;
}
.footer-brand { font-family: var(--font-display); font-size: 1.1rem; color: var(--text); }
.footer-brand em { font-style: normal; color: var(--accent); }
.footer-note { font-size: .8rem; color: var(--muted); }

/* ---------- Focus & reduced motion ---------- */
a:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .plan-path { stroke-dashoffset: 0; }
  .plan-label { opacity: 1; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s ease-out; box-shadow: none; }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .main-content { margin-left: 0; }
  .app-footer { margin-left: 0; }
  .menu-toggle { display: inline-flex; }
  .search-wrap { max-width: none; }
  .hero-inner { grid-template-columns: 1fr; padding: 38px 26px; }
  .hero-plan { display: none; }
}

@media (max-width: 600px) {
  body { font-size: 16.5px; }
  .header-inner { padding: 0 14px; gap: 10px; }
  .brand-text { font-size: 1.15rem; }
  #search-input { font-size: .88rem; }
  .main-content { padding: calc(var(--header-h) + 4px) 14px 48px; }
  .hero-inner { padding: 30px 20px; }
  .hero-stats { gap: 18px; }
  .home-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .home-card { padding: 13px 13px 12px; }
  .article-header h1 { font-size: 1.7rem; }
  .footer-inner { flex-direction: column; text-align: center; }
}
