/* Dobrze Śpię: jasny „poranny” motyw (krem + błękit nocy + złoto), tryb nocny pod przełącznikiem.
   Layout: wąska kolumna do czytania + przyklejony spis treści; strona główna z siatką kart. */
:root {
  --bg: #f7f3ec;
  --surface: #fffdf9;
  --surface-2: #f0eadf;
  --ink: #1b2440;
  --muted: #5a6380;
  --night: #1f2a4d;
  --night-ink: #f4efe4;
  --gold: #c9973a;
  --gold-ink: #8a6114;
  --line: #e4dccd;
  --ok: #2f7a55;
  --shadow: 0 1px 2px rgba(27, 36, 64, .06), 0 8px 24px rgba(27, 36, 64, .06);
  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 14px;
  --wrap: 1160px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0e1427;
  --surface: #151d38;
  --surface-2: #1b2547;
  --ink: #ebe6dc;
  --muted: #a3abc6;
  --night: #0a0f1f;
  --night-ink: #ebe6dc;
  --gold: #e2b35d;
  --gold-ink: #e2b35d;
  --line: #27315a;
  --ok: #6cc497;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 84px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.7 var(--body); }
img, svg { max-width: 100%; }
a { color: var(--gold-ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.2; text-wrap: balance; letter-spacing: -.01em; }
h1 { font-size: clamp(32px, 5vw, 50px); margin: 0 0 12px; }
h2 { font-size: clamp(24px, 3vw, 30px); margin: 44px 0 12px; }
h3 { font-size: 21px; margin: 28px 0 8px; }
.eyebrow { font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--gold-ink); }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 100; }

/* Pasek postępu czytania */
.progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--gold); z-index: 60; transition: width .1s linear; }

/* Nagłówek */
.site-head { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.site-head .wrap { display: flex; align-items: center; gap: 16px; min-height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-family: var(--display); font-size: 21px; font-weight: 700; }
.logo svg { width: 30px; height: 30px; flex: none; }
.nav { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.nav a { color: var(--muted); text-decoration: none; font-size: 15px; font-weight: 500; padding: 8px 12px; border-radius: 999px; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); background: var(--surface-2); }
.nav a.nav-cta { color: var(--night-ink); background: var(--night); }
.nav a.nav-cta:hover { background: var(--ink); color: var(--bg); }
.theme-btn { flex: none; width: 40px; height: 40px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; display: grid; place-items: center; }
.theme-btn svg { width: 20px; height: 20px; }
.theme-btn .sun { display: none; }
:root[data-theme="dark"] .theme-btn .sun { display: block; }
:root[data-theme="dark"] .theme-btn .moon { display: none; }
.menu-btn { display: none; }
@media (max-width: 860px) {
  .nav { position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; align-items: stretch; background: var(--surface); border-bottom: 1px solid var(--line); padding: 8px max(16px, env(safe-area-inset-right, 0px)) 16px max(16px, env(safe-area-inset-left, 0px)); display: none; box-shadow: var(--shadow); }
  .nav.open { display: flex; }
  .nav a { padding: 12px; }
  .menu-btn { display: grid; place-items: center; margin-left: auto; width: 40px; height: 40px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
  .menu-btn svg { width: 20px; height: 20px; }
}

/* Przyciski */
.btn { display: inline-flex; align-items: center; gap: 8px; font: 600 16px var(--body); padding: 13px 20px; border-radius: 999px; text-decoration: none; border: 1px solid transparent; cursor: pointer; }
.btn-primary { background: var(--gold); color: #1b1407; }
.btn-primary:hover { background: var(--gold-ink); color: #fff; }
:root[data-theme="dark"] .btn-primary:hover { background: #f0c97b; color: #1b1407; }
.btn-ghost { border-color: var(--line); color: var(--ink); background: var(--surface); }
.btn-ghost:hover { border-color: var(--gold); color: var(--ink); }

/* Hero */
.hero { background: var(--night); color: var(--night-ink); overflow: hidden; }
.hero .wrap { display: grid; grid-template-columns: 1.1fr .9fr; gap: 32px; align-items: center; padding-block: 56px 64px; }
.hero h1 { color: var(--night-ink); }
.hero h1 em { font-style: italic; color: var(--gold); }
.hero p.lead { font-size: 19px; color: color-mix(in srgb, var(--night-ink) 80%, transparent); max-width: 34em; margin: 0 0 24px; }
.hero .eyebrow { color: var(--gold); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero .btn-ghost { background: transparent; color: var(--night-ink); border-color: color-mix(in srgb, var(--night-ink) 30%, transparent); }
.hero .btn-ghost:hover { border-color: var(--gold); color: var(--night-ink); }
.hero-art { width: 100%; max-width: 440px; justify-self: end; }
.hero-art .star { animation: twinkle 3.6s ease-in-out infinite; }
.hero-art .star:nth-child(2n) { animation-delay: 1.2s; }
.hero-art .star:nth-child(3n) { animation-delay: 2.1s; }
@keyframes twinkle { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.hero-facts { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 28px; font-size: 14px; color: color-mix(in srgb, var(--night-ink) 75%, transparent); }
.hero-facts span::before { content: "✓ "; color: var(--gold); }
@media (max-width: 820px) {
  .hero .wrap { grid-template-columns: 1fr; padding-block: 40px 48px; }
  .hero-art { max-width: 300px; justify-self: center; order: -1; }
}

/* Sekcje strony głównej */
.section { padding-block: 56px; }
.section-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.section-head h2 { margin: 4px 0 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font: 500 14px var(--body); padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--night); color: var(--night-ink); border-color: var(--night); }
:root[data-theme="dark"] .chip[aria-pressed="true"] { background: var(--gold); color: #1b1407; border-color: var(--gold); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.card { display: flex; flex-direction: column; gap: 10px; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; min-width: 0; }
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--gold); color: var(--ink); }
.card .icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--gold-ink); }
.card .icon svg { width: 24px; height: 24px; }
.card h3 { margin: 0; font-size: 20px; }
.card p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.55; }
.card .meta { margin-top: auto; font-size: 13px; color: var(--muted); display: flex; gap: 12px; }
.card[hidden] { display: none; }

.trust { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.trust > div { padding: 24px; border-radius: var(--radius); background: var(--surface-2); }
.trust h3 { margin: 10px 0 6px; font-size: 19px; }
.trust p { margin: 0; color: var(--muted); font-size: 15px; }
.trust svg { width: 28px; height: 28px; color: var(--gold-ink); }
@media (max-width: 820px) { .trust { grid-template-columns: 1fr; } }

.cta-band { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 32px; display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: center; }
.cta-band h2 { margin: 0 0 6px; }
.cta-band p { margin: 0; color: var(--muted); }
@media (max-width: 700px) { .cta-band { grid-template-columns: 1fr; padding: 24px; } }

/* FAQ */
.faq { display: grid; gap: 10px; max-width: 820px; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0 20px; }
.faq summary { cursor: pointer; list-style: none; padding: 16px 0; font-weight: 600; display: flex; justify-content: space-between; gap: 16px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 22px; line-height: 1; color: var(--gold-ink); transition: transform .2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin: 0 0 16px; color: var(--muted); }

/* Artykuł */
.crumbs { font-size: 14px; color: var(--muted); padding-top: 28px; }
.crumbs a { color: var(--muted); }
.art-head { padding-block: 8px 24px; max-width: 820px; }
.art-head .lede { font-size: 19px; color: var(--muted); margin: 0; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--gold-ink); text-decoration: none; }
.pill svg { width: 15px; height: 15px; }
.art-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; color: var(--muted); margin-top: 14px; }
.art-grid { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 48px; align-items: start; padding-bottom: 32px; }
.art-body { min-width: 0; max-width: 760px; }
.art-body > p, .art-body li { max-width: 68ch; }
.art-body table { border-collapse: collapse; width: 100%; font-size: 15px; }
.art-body th, .art-body td { padding: 10px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.art-body th { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-2); }
.table-card { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin: 20px 0; }
.table-card table { min-width: 560px; }
.art-body blockquote { margin: 20px 0; padding: 14px 20px; border-left: 3px solid var(--gold); background: var(--surface); border-radius: 0 10px 10px 0; }
.tldr { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 22px; margin: 0 0 28px; }
.tldr .eyebrow { display: block; margin-bottom: 6px; }
.tldr ul { margin: 0; padding-left: 20px; }
.tldr li { margin: 4px 0; }
.disclosure { font-size: 14px; color: var(--muted); border: 1px dashed var(--line); border-radius: 10px; padding: 10px 14px; margin: 0 0 24px; }
.toc { position: sticky; top: 88px; font-size: 14px; }
.toc .eyebrow { display: block; margin-bottom: 10px; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.toc a { display: block; padding: 6px 0 6px 14px; margin-left: -2px; border-left: 2px solid transparent; color: var(--muted); text-decoration: none; line-height: 1.4; }
.toc a:hover { color: var(--ink); }
.toc a.active { color: var(--ink); border-left-color: var(--gold); font-weight: 600; }
.toc-mobile { display: none; }
@media (max-width: 1000px) {
  .art-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .toc { display: none; }
  .toc-mobile { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0 16px; margin-bottom: 24px; }
  .toc-mobile summary { cursor: pointer; padding: 12px 0; font-weight: 600; }
  .toc-mobile ol { margin: 0 0 12px; padding-left: 20px; }
}
.related { border-top: 1px solid var(--line); padding-block: 40px 16px; }
.related h2 { margin-top: 0; }

/* Przyciski do sklepów */
.shop-btn { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 14px; font-weight: 600; padding: 7px 12px; border-radius: 999px; background: var(--night); color: var(--night-ink); text-decoration: none; }
.shop-btn:hover { background: var(--gold); color: #1b1407; }
:root[data-theme="dark"] .shop-btn { background: var(--surface-2); }
.shop-btn small { font-weight: 500; font-size: 11px; opacity: .75; }
.shop-list { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }

/* Ranking */
.rank-tools { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: end; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin: 16px 0 0; }
.field { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); min-width: 0; }
.field select, .field input[type="number"] { font: 15px var(--body); padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.field input[type="range"] { accent-color: var(--gold); width: 200px; max-width: 100%; }
.field output { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.rank-count { margin-left: auto; font-size: 14px; color: var(--muted); }
.rank-table th button { all: unset; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
.rank-table th button:focus-visible { outline: 2px solid var(--gold); }
.rank-table th[aria-sort="ascending"] button::after { content: "▲"; font-size: 10px; }
.rank-table th[aria-sort="descending"] button::after { content: "▼"; font-size: 10px; }
.rank-table td.num { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.rank-table .model b { font-family: var(--display); font-size: 17px; }
.rank-table .model span { display: block; color: var(--muted); font-size: 13px; }
.rank-table tr[hidden] { display: none; }
.rank-empty { padding: 20px; color: var(--muted); }

/* Quiz */
.quiz { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; margin: 16px 0 8px; }
.quiz form, .quiz .result { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.quiz fieldset { border: 0; padding: 0; margin: 0 0 18px; min-width: 0; }
.quiz legend { font-weight: 600; margin-bottom: 8px; padding: 0; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; }
.seg span { display: inline-block; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); font-size: 15px; cursor: pointer; }
.seg input:checked + span { background: var(--night); color: var(--night-ink); border-color: var(--night); }
:root[data-theme="dark"] .seg input:checked + span { background: var(--gold); color: #1b1407; border-color: var(--gold); }
.seg input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: 2px; }
.range-row { display: flex; align-items: center; gap: 12px; }
.range-row input { flex: 1; accent-color: var(--gold); min-width: 0; }
.range-row output { min-width: 80px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.result { position: sticky; top: 88px; align-self: start; }
.result .big { font-family: var(--display); font-size: 44px; line-height: 1; color: var(--gold-ink); margin: 6px 0 4px; }
.scale { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 14px 0; }
.scale i { height: 10px; border-radius: 4px; background: var(--surface-2); }
.scale i.on { background: var(--gold); }
.scale-labels { display: grid; grid-template-columns: repeat(4, 1fr); font-size: 12px; color: var(--muted); text-align: center; margin-top: -8px; }
.result ul { padding-left: 18px; margin: 8px 0; }
.result .models { display: grid; gap: 8px; margin-top: 10px; }
.result .models a { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: var(--ink); font-size: 15px; }
.result .models a:hover { border-color: var(--gold); }
.result .note { font-size: 13px; color: var(--muted); margin-top: 12px; }
@media (max-width: 820px) { .quiz { grid-template-columns: 1fr; } .result { position: static; } }

/* Stopka */
.site-foot { background: var(--night); color: color-mix(in srgb, var(--night-ink) 75%, transparent); margin-top: 48px; font-size: 14px; }
.site-foot .wrap { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 28px; padding-block: 40px; }
.site-foot a { color: var(--night-ink); text-decoration: none; display: block; padding: 3px 0; }
.site-foot a:hover { color: var(--gold); }
.site-foot strong { color: var(--night-ink); font-family: var(--display); font-size: 19px; display: block; margin-bottom: 6px; }
.site-foot .fine { grid-column: 1 / -1; border-top: 1px solid color-mix(in srgb, var(--night-ink) 15%, transparent); padding-top: 16px; }
@media (max-width: 700px) { .site-foot .wrap { grid-template-columns: 1fr; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
:root[data-theme="dark"] .nav a.nav-cta { background: var(--gold); color: #1b1407; }
:root[data-theme="dark"] .nav a.nav-cta:hover { background: #f0c97b; color: #1b1407; }
