/* ============================================================
   Złoto - design system "Skarbiec"
   Paleta: ciepły krem + złoto + granat + głęboka zieleń
   Typografia: Cormorant Garamond (display) + Outfit (body)
   ============================================================ */

:root {
  /* Kolory - jasny motyw */
  --bg: #faf6ee;
  --surface: #ffffff;
  --surface-2: #f3edde;
  --text: #262215;
  --muted: #6f6753;
  --accent: #7a5c10;
  --accent-strong: #5c430c;
  --gold: #c9a227;
  --gold-soft: #f0d878;
  --green: #2f5233;
  --green-soft: #e7efe4;
  --navy: #1b2a4a;
  --navy-soft: #e8ecf3;
  --border: #e2dac6;
  --border-strong: #cdc09e;
  --shadow: 0 1px 2px rgba(38,34,21,.06), 0 8px 24px rgba(38,34,21,.07);
  --shadow-hover: 0 2px 4px rgba(38,34,21,.08), 0 14px 34px rgba(38,34,21,.12);
  --header-bg: rgba(250,246,238,.92);
  --accent-light: rgba(201,162,39,.14);
  --accent-subtle: rgba(201,162,39,.35);

  /* Typografia */
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'Outfit', system-ui, sans-serif;
  --body-size: 17px;
  --line-body: 1.7;

  /* Wymiary */
  --header-height: 64px;
  --sidebar-width: 280px;
  --radius: 10px;
  --radius-sm: 6px;
  --content-max: 760px;
  --transition: .2s ease-out;

  /* Gradienty */
  --hero-gradient: linear-gradient(140deg, #1b2a4a 0%, #24395f 42%, #2c4a3a 100%);
  --gold-gradient: linear-gradient(135deg, #c9a227, #e8c95a);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14110b;
    --surface: #1e1a12;
    --surface-2: #262117;
    --text: #f0e9d6;
    --muted: #b7ad93;
    --accent: #d4af37;
    --accent-strong: #e8c95a;
    --gold: #c9a227;
    --gold-soft: #8a7322;
    --green: #7fae84;
    --green-soft: #1f2d20;
    --navy: #232f52;
    --navy-soft: #1c2438;
    --border: #38321f;
    --border-strong: #4d452b;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
    --shadow-hover: 0 2px 4px rgba(0,0,0,.4), 0 14px 34px rgba(0,0,0,.5);
    --header-bg: rgba(20,17,11,.9);
    --accent-light: rgba(201,162,39,.16);
    --accent-subtle: rgba(201,162,39,.3);
    --hero-gradient: linear-gradient(140deg, #101a30 0%, #182642 42%, #1e3529 100%);
  }
}

/* ---------- Reset i baza ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: var(--body-size);
  line-height: var(--line-body);
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(60% 45% at 8% 0%, var(--accent-light), transparent 60%),
    radial-gradient(50% 40% at 100% 100%, var(--accent-light), transparent 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

img { max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); }
strong { font-weight: 600; }

.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  background: var(--accent);
  color: #fff;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  z-index: 200;
}
.skip-link:focus { left: 8px; color: #fff; }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- Header ---------- */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-height);
  background: var(--header-bg);
  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: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-subtle), transparent);
  opacity: .3;
  pointer-events: none;
}
.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  height: 100%;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  flex-shrink: 0;
}
.brand:hover { color: var(--text); }
.brand-seal {
  width: 34px; height: 34px;
  color: var(--gold);
  filter: drop-shadow(0 1px 3px rgba(201,162,39,.4));
}
.brand-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: .01em;
  line-height: 1;
}
.brand-accent { color: var(--accent); }

.search-wrap { 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(--muted);
  pointer-events: none;
}
#searchInput {
  width: 100%;
  font-family: var(--font-body);
  font-size: .9rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 9px 16px 9px 38px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
#searchInput::placeholder { color: var(--muted); }
#searchInput:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
  max-height: 380px;
  overflow-y: auto;
  z-index: 120;
}
.search-result {
  display: block;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: .88rem;
}
.search-result:last-child { border-bottom: none; }
.search-result:hover { background: var(--surface-2); color: var(--text); }
.search-result .sr-title { font-weight: 600; }
.search-result .sr-section { color: var(--muted); font-size: .75rem; }

.menu-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px; height: 42px;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 10px;
}
.menu-btn span {
  display: block;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}
.menu-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-btn.open span:nth-child(2) { opacity: 0; }
.menu-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Layout ---------- */
.layout {
  max-width: 1280px;
  margin: 0 auto;
  padding: calc(var(--header-height) + 24px) 20px 40px;
  display: flex;
  gap: 40px;
  align-items: flex-start;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  position: sticky;
  top: calc(var(--header-height) + 24px);
  max-height: calc(100vh - var(--header-height) - 48px);
  overflow-y: auto;
  padding: 6px 16px 12px 0;
  scrollbar-width: thin;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-section-label {
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--muted);
  padding: 14px 12px 4px;
}
.sidebar-link {
  display: block;
  font-size: .9rem;
  line-height: 1.35;
  color: var(--text);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  border-left: 2px solid transparent;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.sidebar-link:hover { background: var(--accent-light); color: var(--text); }
.sidebar-link.active {
  background: var(--accent-light);
  border-left-color: var(--gold);
  color: var(--accent-strong);
  font-weight: 600;
}
.sidebar-foot {
  margin-top: 18px;
  padding: 14px 12px 4px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: .85rem;
}

/* ---------- Main ---------- */
.main {
  flex: 1;
  min-width: 0;
  max-width: 900px;
}

/* ---------- Hero (home) ---------- */
.home-hero {
  position: relative;
  background: var(--hero-gradient);
  border-radius: 16px;
  color: #f4ecd8;
  padding: 44px 40px 36px;
  overflow: hidden;
  box-shadow: var(--shadow-hover);
}
.home-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(46% 70% at 88% 12%, rgba(201,162,39,.28), transparent 65%),
    radial-gradient(40% 60% at 4% 96%, rgba(127,174,132,.16), transparent 60%);
  pointer-events: none;
}
.home-hero::after {
  content: '';
  position: absolute;
  right: -60px; top: -60px;
  width: 280px; height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201,162,39,.18), transparent 65%);
  pointer-events: none;
}
.hero-ingot {
  position: absolute;
  top: 40px; right: 44px;
  width: 150px; height: auto;
  opacity: .95;
  filter: drop-shadow(0 12px 28px rgba(0,0,0,.4));
  pointer-events: none;
}
.hero-ingot .sheen {
  animation: sheen 5.5s ease-in-out infinite;
  transform-origin: center;
}
@keyframes sheen {
  0%, 55% { transform: translateX(-140%); }
  80%, 100% { transform: translateX(180%); }
}
.home-hero h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 4.4vw, 2.9rem);
  line-height: 1.12;
  margin-bottom: 14px;
  max-width: 640px;
  text-wrap: balance;
  position: relative;
}
.home-hero .hero-sub {
  font-size: 1.05rem;
  line-height: 1.6;
  color: #d9d2bd;
  max-width: 560px;
  margin-bottom: 22px;
  position: relative;
}
.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--gold-gradient);
  color: #2b2108;
  font-weight: 600;
  font-size: .95rem;
  padding: 11px 22px;
  border-radius: 999px;
  transition: transform var(--transition), box-shadow var(--transition);
  position: relative;
}
.hero-cta:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(201,162,39,.4); color: #2b2108; }
.hero-price-note {
  margin-top: 18px;
  font-size: .8rem;
  color: #b9b2a0;
  position: relative;
}

/* ---------- Ticker ceny (pasek) ---------- */
.price-ticker {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  background: var(--navy);
  color: #e8ecf3;
  border-radius: var(--radius);
  padding: 10px 18px;
  margin-top: 14px;
  font-size: .82rem;
  box-shadow: var(--shadow);
}
.price-ticker .ticker-label {
  font-weight: 600;
  color: var(--gold-soft);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: .72rem;
}
.price-ticker .ticker-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.price-ticker .ticker-item .t-name { color: #b9c2d4; }
.price-ticker .ticker-item .t-val { font-weight: 600; color: #fff; font-variant-numeric: tabular-nums; }
.price-ticker .ticker-note { color: #9aa3b8; font-size: .74rem; margin-left: auto; }

/* ---------- Sekcje home ---------- */
.home-sections { margin-top: 48px; display: flex; flex-direction: column; gap: 44px; }
.home-section h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.6rem;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-wrap: balance;
}
.home-section h2::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--gold-gradient);
  transform: rotate(45deg);
  flex-shrink: 0;
}
.home-section h2::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--gold), transparent);
  opacity: .5;
}
.home-section .section-note {
  color: var(--muted);
  font-size: .88rem;
  margin-bottom: 16px;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.home-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  position: relative;
  overflow: hidden;
}
.home-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gold), var(--green));
  opacity: 0;
  transition: opacity var(--transition);
}
.home-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: var(--border-strong);
  color: var(--text);
}
.home-card:hover::before { opacity: 1; }
.card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.card-icon { font-size: 1.25rem; line-height: 1; }
.home-card h3 { font-size: .95rem; font-weight: 600; line-height: 1.3; }
.home-card p {
  font-size: .85rem;
  color: var(--muted);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-arrow {
  position: absolute;
  right: 14px; bottom: 12px;
  color: var(--gold);
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity var(--transition), transform var(--transition);
  width: 16px; height: 16px;
}
.home-card:hover .card-arrow { opacity: 1; transform: translateX(0); }

/* ---------- Artykuł ---------- */
.content-article {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 38px 42px 46px;
  box-shadow: var(--shadow);
  animation: fadeUp .28s ease-out;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}

.article-kicker {
  font-size: .74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--accent);
  margin-bottom: 8px;
}
.content-article h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.9rem, 3.6vw, 2.5rem);
  line-height: 1.15;
  margin-bottom: 10px;
  text-wrap: balance;
}
.article-excerpt {
  font-size: 1.06rem;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 22px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.content-article h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.6rem;
  margin: 34px 0 12px;
  padding-top: 6px;
  text-wrap: balance;
  scroll-margin-top: calc(var(--header-height) + 20px);
}
.content-article h2::before {
  content: '';
  display: inline-block;
  width: 26px;
  height: 3px;
  background: var(--gold-gradient);
  border-radius: 2px;
  margin-right: 12px;
  vertical-align: middle;
}
.content-article h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.22rem;
  margin: 26px 0 10px;
  text-wrap: balance;
  scroll-margin-top: calc(var(--header-height) + 20px);
}
.content-article p { margin-bottom: 16px; }
.content-article ul, .content-article ol { margin: 0 0 18px 24px; }
.content-article li { margin-bottom: 7px; }
.content-article li::marker { color: var(--gold); }

.content-article table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0 22px;
  font-size: .9rem;
}
.content-article th {
  background: var(--navy);
  color: #e8ecf3;
  text-align: left;
  padding: 10px 12px;
  font-weight: 600;
}
.content-article td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.content-article tr:nth-child(even) td { background: var(--surface-2); }
.table-responsive { overflow-x: auto; }

.info-box {
  background: var(--green-soft);
  border-left: 4px solid var(--green);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 14px 18px;
  margin: 18px 0;
  font-size: .93rem;
  line-height: 1.6;
}
.info-box strong { color: var(--green); }
.info-box.warn {
  background: var(--accent-light);
  border-left-color: var(--gold);
}
.info-box.warn strong { color: var(--accent-strong); }

.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 12px;
  background: var(--surface);
}
.faq-q {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 8px;
  color: var(--text);
}
.faq-q::before { content: 'P: '; color: var(--accent); }
.faq-a { color: var(--text); font-size: .95rem; }
.faq-a::before { content: 'O: '; color: var(--green); font-weight: 600; }

.glossary-list { margin: 10px 0 0; }
.glossary-list dt {
  font-weight: 600;
  color: var(--accent-strong);
  margin-top: 16px;
  border-bottom: 1px dashed var(--border-strong);
  padding-bottom: 3px;
}
.glossary-list dd { margin: 4px 0 0 0; font-size: .95rem; }

.article-toc {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 0 0 24px;
  font-size: .9rem;
}
.article-toc strong { display: block; margin-bottom: 8px; color: var(--muted); text-transform: uppercase; font-size: .72rem; letter-spacing: .08em; }
.article-toc ol { margin: 0 0 0 20px; }
.article-toc li { margin-bottom: 4px; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .88rem;
  margin-bottom: 18px;
  color: var(--muted);
}
.back-link:hover { color: var(--accent); }

.article-footer-note {
  margin-top: 30px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: .8rem;
  color: var(--muted);
  line-height: 1.6;
}

/* ---------- Footer ---------- */
.app-footer {
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  margin-top: 30px;
}
.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 30px 20px 36px;
  font-size: .86rem;
  color: var(--muted);
}
.footer-inner p { margin-bottom: 8px; line-height: 1.6; }
.footer-links a { margin-right: 4px; }
.footer-muted { font-size: .78rem; }

/* ---------- Druk ---------- */
@media print {
  .app-header, .sidebar, .sidebar-overlay, .search-wrap, .menu-btn, .back-link, .article-toc, .app-footer { display: none !important; }
  .layout { display: block; padding: 0; }
  .content-article { border: none; box-shadow: none; padding: 0; }
  body { background: #fff; color: #000; }
  a { color: #000; }
}

/* ---------- Overlay mobilny ---------- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20,17,11,.55);
  z-index: 90;
}

/* ---------- Responsywność ---------- */
@media (max-width: 900px) {
  .menu-btn { display: flex; }
  .sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: min(320px, 86vw);
    background: var(--bg);
    border-right: 1px solid var(--border);
    padding: 16px 18px 24px;
    max-height: none;
    transform: translateX(-105%);
    transition: transform .25s ease-out;
    z-index: 95;
    overflow-y: auto;
  }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-hover); }
  .sidebar-overlay.show { display: block; }
  .layout { padding-left: 16px; padding-right: 16px; }
  .search-wrap { max-width: none; }
  .home-hero { padding: 32px 26px 28px; }
  .hero-ingot { width: 96px; right: 22px; bottom: 20px; }
}

@media (max-width: 600px) {
  :root { --header-height: 58px; }
  .header-inner { gap: 10px; padding: 0 12px; }
  .brand-text { font-size: 1.25rem; }
  .brand-seal { width: 30px; height: 30px; }
  #searchInput { padding: 8px 12px 8px 34px; font-size: .85rem; }
  .home-grid { grid-template-columns: 1fr; }
  .content-article { padding: 24px 20px 34px; border-radius: 12px; }
  .home-hero h1 { font-size: 1.8rem; }
  .hero-ingot { display: none; }
  .price-ticker { font-size: .76rem; gap: 10px; }
  .footer-inner { padding: 24px 16px 30px; }
}
