/* =========================================================
   loremipsumgen — arkusz stylów
   ========================================================= */

:root {
  --ink: #1d2433;
  --ink-soft: #4a5263;
  --muted: #6f7787;
  --paper: #f6f5f1;
  --card: #ffffff;
  --line: #dedbd3;
  --line-strong: #c7c3b8;
  --accent: #3b5bdb;
  --accent-dark: #2f49b3;
  --accent-soft: #e7ecfd;
  --ok: #2b7a4b;
  --header: #1d2433;
  --on-accent: #ffffff;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace;
  --radius: 8px;
  --container: 1120px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e6e8ee;
    --ink-soft: #b9becb;
    --muted: #9298a7;
    --paper: #14171f;
    --card: #1c2029;
    --line: #2c313d;
    --line-strong: #3a404e;
    --accent: #7d95f5;
    --accent-dark: #a3b4ff;
    --accent-soft: #232b45;
    --header: #0d1016;
    --on-accent: #0f1320;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
html, body { overflow-x: clip; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
}

a { color: var(--accent-dark); text-underline-offset: 2px; }
a:hover { color: var(--ink); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .6em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); }
h2 { font-size: clamp(1.25rem, 3vw, 1.55rem); margin-top: 1.8em; }
p { margin: 0 0 1em; }
kbd { font-family: var(--mono); font-size: .8em; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; background: var(--card); }
code { font-family: var(--mono); font-size: .9em; background: var(--accent-soft); padding: 1px 5px; border-radius: 4px; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 20px; }
.skip-link { position: absolute; left: -9999px; top: 0; background: var(--ink); color: var(--paper); padding: 8px 14px; z-index: 100; }
.skip-link:focus { left: 10px; top: 10px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Header ---------- */

.site-header { background: var(--header); color: #fff; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 58px; }
.logo { display: flex; align-items: center; gap: 9px; color: #fff; text-decoration: none; white-space: nowrap; }
.logo:hover { color: #fff; }
.logo-mark {
  width: 30px; height: 30px; border-radius: 6px;
  background: #3b5bdb; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-size: 1.25rem; font-weight: 700;
}
.logo-text { font-size: 1.05rem; }
.logo-text strong { color: #a9b8ff; }

.nav-list { list-style: none; margin: 0; padding: 0; display: flex; gap: 2px; }
.nav-list a { display: block; color: #d9deea; text-decoration: none; padding: 7px 11px; border-radius: 6px; font-size: .95rem; }
.nav-list a:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-list a[aria-current="page"] { background: rgba(255,255,255,.14); color: #fff; }
.nav-lang-start { margin-left: 6px; padding-left: 8px; border-left: 1px solid rgba(255,255,255,.2); }

/* ---------- Intro ---------- */

.page-intro { padding: 26px 0 12px; max-width: 800px; }
.page-intro .lead { font-size: 1.12rem; color: var(--ink-soft); margin-bottom: 0; }
.breadcrumbs { font-size: .88rem; color: var(--muted); padding-top: 14px; }
.breadcrumbs a { color: var(--muted); }

/* ---------- Narzędzie ---------- */

.tool { margin: 16px 0 28px; }
.tool-grid {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}

.tool-controls { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.tool-output { display: flex; flex-direction: column; gap: 10px; min-width: 0; }

.quick { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font: inherit; font-size: .88rem;
  border: 1px solid var(--line-strong);
  background: var(--paper);
  color: var(--ink);
  border-radius: 999px;
  padding: 5px 12px;
  cursor: pointer;
}
.chip:hover { border-color: var(--accent); color: var(--accent-dark); }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; border: 0; padding: 0; margin: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
label, legend { font-weight: 600; font-size: .9rem; }
legend { padding: 0; margin-bottom: 5px; }

input[type="number"], select, textarea {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 8px 10px;
  min-height: 42px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }

.stepper { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; }
.stepper input { border-radius: 0; text-align: center; font-size: 1.15rem; font-weight: 700; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.step {
  font: inherit; font-size: 1.3rem; line-height: 1;
  border: 1px solid var(--line-strong);
  background: var(--paper); color: var(--ink);
  cursor: pointer;
}
.step:first-child { border-radius: var(--radius) 0 0 var(--radius); border-right: 0; }
.step:last-child { border-radius: 0 var(--radius) var(--radius) 0; border-left: 0; }
.step:hover { background: var(--accent-soft); }

.segmented { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; }
.segmented label { position: relative; font-weight: 500; font-size: .88rem; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; text-align: center; padding: 8px 4px; border-left: 1px solid var(--line); }
.segmented label:first-child span { border-left: 0; }
.segmented input:checked + span { background: var(--accent); color: var(--on-accent); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -3px; }

.checkbox { display: flex; align-items: center; gap: 8px; font-weight: 400; font-size: .95rem; cursor: pointer; }
.checkbox input { width: 18px; height: 18px; accent-color: var(--accent); flex-shrink: 0; }

.more { border-top: 1px dashed var(--line-strong); padding-top: 10px; }
.more summary { cursor: pointer; font-size: .92rem; color: var(--accent-dark); font-weight: 600; margin-bottom: 10px; }
.more[open] { display: flex; flex-direction: column; gap: 12px; }

.output-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
#g-out {
  min-height: 300px;
  flex: 1;
  resize: vertical;
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.7;
  padding: 14px 16px;
  background: var(--paper);
}
.stats { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0; font-size: .9rem; color: var(--ink-soft); }
.stats strong { color: var(--ink); }
.hint { font-size: .82rem; color: var(--muted); margin: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font: inherit; font-size: .97rem; font-weight: 600;
  padding: 9px 16px; min-height: 42px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s;
}
.btn-primary { background: var(--accent); color: var(--on-accent); min-width: 150px; }
.btn-primary:hover { background: var(--accent-dark); color: var(--on-accent); }
.btn-secondary { background: var(--card); color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { border-color: var(--accent); }
.btn-link { background: none; color: var(--accent-dark); text-decoration: underline; padding: 9px 6px; }
.btn.is-done { background: var(--ok); color: #fff; border-color: var(--ok); }

/* ---------- Treść ---------- */

.layout-content { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 40px; align-items: start; padding-bottom: 40px; }
.content { max-width: 760px; min-width: 0; }
.content ul, .content ol { padding-left: 1.3em; }
.content li { margin-bottom: .35em; }
.example-box { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius); padding: 14px 18px; margin: 16px 0; }
.example-box p:last-child { margin: 0; }
.sample { font-family: var(--serif); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin: 12px 0 18px; }

table { border-collapse: collapse; width: 100%; font-size: .95rem; background: var(--card); margin: 12px 0 18px; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--paper); font-size: .85rem; color: var(--ink-soft); }

.sidebar { position: sticky; top: 20px; min-width: 0; }
.side-box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; font-size: .95rem; }
.side-box h2 { font-size: 1rem; margin: 0 0 10px; }
.side-box ul { list-style: none; margin: 0; padding: 0; }
.side-box li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.side-box li:last-child { border-bottom: none; }

.faq-item { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 8px; }
.faq-item summary { cursor: pointer; padding: 12px 42px 12px 16px; font-weight: 600; list-style: none; position: relative; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-size: 1.3rem; color: var(--accent); }
.faq-item[open] summary::after { content: "−"; }
.faq-answer { padding: 0 16px 4px; color: var(--ink-soft); }

/* ---------- Reklamy ---------- */

.ad-slot { display: none; }
.ad-slot.is-active { display: block; margin: 24px 0; min-height: 100px; text-align: center; }
.ad-label { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 4px; }

/* ---------- Stopka ---------- */

.site-footer { background: var(--header); color: #c3c9d6; font-size: .93rem; padding-top: 34px; margin-top: 20px; }
.site-footer a { color: #e3e7f0; text-decoration: none; }
.site-footer a:hover { color: #a9b8ff; text-decoration: underline; }
.footer-inner { display: grid; grid-template-columns: 1.5fr 1fr; gap: 26px; }
.footer-logo { color: #fff; font-size: 1.1rem; }
.footer-logo strong { color: #a9b8ff; }
.footer-links { list-style: none; margin: 0; padding: 0; }
.footer-links li { margin-bottom: 6px; }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; border-top: 1px solid rgba(255,255,255,.1); margin-top: 24px; padding-top: 16px; padding-bottom: 24px; font-size: .85rem; color: #969eae; }
.footer-bottom p { margin: 0; }
.footer-credit a { color: #a9b8ff; }

/* ---------- Tablet ---------- */

@media (max-width: 900px) {
  /* Na węższych ekranach wynik od razu pod liczbą — reszta ustawień niżej */
  .tool-grid { display: flex; flex-direction: column; }
  .tool-controls, .tool-output { display: contents; }
  .tool-grid .quick { order: 1; }
  .tool-grid .field-count { order: 2; }
  .tool-grid .output-bar { order: 3; }
  .tool-grid #g-out { order: 4; }
  .tool-grid .stats { order: 5; }
  .tool-controls > .field-row { order: 6; }
  .tool-grid .field-format { order: 7; }
  .tool-controls > .checkbox { order: 8; }
  .tool-grid .more { order: 9; }
  .tool-grid .hint { order: 10; }
  .layout-content { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .sidebar { position: static; }
  #g-out { min-height: 240px; }
}

/* ---------- Telefony (od 360 px, bez przewijania w poziomie) ---------- */

@media (max-width: 600px) {
  body { font-size: 1rem; }
  .container { padding: 0 14px; }
  .header-inner { flex-direction: column; align-items: stretch; gap: 0; padding-top: 8px; }
  .logo { justify-content: center; padding: 4px 0 6px; }
  .nav-list { justify-content: center; flex-wrap: wrap; border-top: 1px solid rgba(255,255,255,.08); }
  .nav-list a { padding: 9px 8px; font-size: .88rem; }
  .nav-lang-start { margin-left: 4px; padding-left: 4px; }
  .tool-grid { padding: 14px; border-radius: 10px; gap: 14px; }
  .output-bar .btn { flex: 1 1 auto; }
  .btn-primary { min-width: 0; }
  .segmented span { font-size: .82rem; padding: 8px 2px; }
  .footer-inner { grid-template-columns: minmax(0, 1fr); }
  th, td { padding: 6px 8px; font-size: .88rem; }
}

@media (max-width: 380px) {
  .field-row { grid-template-columns: minmax(0, 1fr); }
  .chip { font-size: .82rem; padding: 4px 10px; }
  .nav-list a { padding: 9px 5px; font-size: .84rem; }
}

@media print {
  .site-header, .site-footer, .tool-controls, .output-bar, .hint, .sidebar, .ad-slot { display: none !important; }
}
