/* kamerakanalizacyjna.site — Phase 1
   Mobile-first (base 320–767 px). Enhancements only via min-width.
   Tokeny zgodne z DESIGN-SPEC. Brak obrazów, gradientów i fontów zewnętrznych. */

:root {
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --text: #111827;
  --muted: #4B5563;
  --border: #D1D5DB; /* tylko separatory dekoracyjne i krawędzie kart */
  --control-border: #6B7280; /* krawędzie kontrolek formularza */
  --focus: #1D4ED8;
  --primary: #1D4ED8;
  --primary-hover: #1E40AF;
  --primary-soft: #EFF6FF;
  --success-text: #166534;
  --success-bg: #F0FDF4;
  --warning-text: #92400E;
  --warning-bg: #FFFBEB;
  --danger-text: #991B1B;
  --danger-bg: #FEF2F2;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

.wrap {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 16px;
}

.wrap--text { max-width: 760px; }

/* ——— dostępność ——— */

.skip {
  position: absolute;
  left: 16px;
  top: -200px;
  z-index: 20;
  display: inline-block;
  padding: 12px 16px;
  background: var(--surface);
  color: var(--primary);
  border: 2px solid var(--primary);
  border-radius: 8px;
  font-weight: 700;
  text-decoration: none;
}

.skip:focus { top: 8px; }

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ——— typografia ——— */

h1 {
  font-size: 30px;
  line-height: 1.15;
  font-weight: 700;
  margin: 16px 0 12px;
}

h2 {
  font-size: 24px;
  line-height: 1.2;
  font-weight: 700;
  margin: 32px 0 12px;
}

h3 {
  font-size: 20px;
  line-height: 1.3;
  font-weight: 700;
  margin: 24px 0 8px;
}

h4 {
  font-size: 17px;
  line-height: 1.35;
  font-weight: 700;
  margin: 16px 0 8px;
}

p, ul, ol { margin: 0 0 16px; }

ul, ol { padding-left: 22px; }

li { margin-bottom: 8px; }

a { color: var(--primary); }

a:hover { color: var(--primary-hover); }

.lead { font-size: 17px; }

.meta {
  font-size: 14px;
  line-height: 1.45;
  color: var(--muted);
}

strong { font-weight: 700; }

/* ——— nagłówek ——— */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
}

.wordmark {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.menu-btn {
  flex: 0 0 auto;
  min-height: 48px;
  padding: 0 16px;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--control-border);
  border-radius: 8px;
  cursor: pointer;
}

.site-nav { display: none; }

.site-nav.is-open { display: block; }

.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0 0 8px;
}

.site-nav li { margin: 0; }

.site-nav a {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 0 4px;
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}

.site-nav a:hover { text-decoration: underline; }

/* ——— układ strony ——— */

main { display: block; }

.section { margin: 32px 0; }

.section--first { margin-top: 16px; }

.crumbs {
  padding-top: 12px;
  font-size: 14px;
}

.crumbs ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin: 0;
  padding: 0;
}

.crumbs li { margin: 0; }

.crumbs li + li::before {
  content: "/";
  margin-right: 8px;
  color: var(--muted);
}

/* ——— karty i bloki ——— */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin: 0 0 16px;
}

.card > :last-child { margin-bottom: 0; }

.card h3 { margin-top: 0; }

.linkcard {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin: 0 0 12px;
  color: var(--text);
  text-decoration: none;
}

.linkcard:hover { border-color: var(--primary); }

.linkcard span {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
  text-decoration: underline;
}

.linkcard p {
  margin: 0;
  font-size: 15px;
  color: var(--text);
}

.note {
  border-radius: 8px;
  border: 1px solid;
  padding: 12px;
  margin: 0 0 16px;
  font-size: 15px;
  line-height: 1.5;
}

.note > :last-child { margin-bottom: 0; }

.note--info {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--text);
}

.note--ok {
  background: var(--success-bg);
  border-color: var(--success-text);
  color: var(--success-text);
}

.note--warn {
  background: var(--warning-bg);
  border-color: var(--warning-text);
  color: var(--warning-text);
}

.note--danger {
  background: var(--danger-bg);
  border-color: var(--danger-text);
  color: var(--danger-text);
}

.note strong { font-weight: 700; }

/* ——— przyciski ——— */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 12px 20px;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
}

.btn--primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #FFFFFF;
}

.btn--primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #FFFFFF;
}

.btn--secondary {
  background: var(--surface);
  border-color: var(--control-border);
  color: var(--primary);
}

.btn--secondary:hover {
  border-color: var(--primary);
  color: var(--primary-hover);
}

.btn--block {
  display: flex;
  width: 100%;
}

.actions {
  display: block;
  margin: 24px 0 0;
}

.actions .btn { margin-bottom: 12px; }

.actions .btn:last-child { margin-bottom: 0; }

/* ——— formularze ——— */

.field { margin: 0 0 16px; }

.field > label,
.field > .field-label {
  display: block;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
}

.hint {
  display: block;
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--muted);
}

select,
input[type="text"],
input[type="number"] {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--control-border);
  border-radius: 8px;
}

fieldset {
  margin: 0 0 16px;
  padding: 0;
  border: 0;
}

legend {
  display: block;
  padding: 0;
  margin-bottom: 8px;
  font-size: 16px;
  font-weight: 700;
}

.radio {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  margin-bottom: 8px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--control-border);
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
}

.radio input {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--primary);
}

.radio:last-child { margin-bottom: 0; }

.checkline {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  margin: 12px 0 0;
  font-size: 16px;
  cursor: pointer;
}

.checkline input {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--primary);
}

details.adv,
details.filters {
  margin: 0 0 16px;
  background: var(--surface);
  border: 1px solid var(--control-border);
  border-radius: 8px;
}

details.adv > summary,
details.filters > summary {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 12px;
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  cursor: pointer;
}

details.adv > .details-body,
details.filters > .details-body {
  padding: 0 12px 12px;
  border-top: 1px solid var(--border);
}

details.more {
  margin: 0 0 16px;
  border-left: 3px solid var(--border);
  padding-left: 12px;
}

details.more > summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  font-weight: 700;
  color: var(--primary);
  cursor: pointer;
}

.form-error {
  display: block;
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--danger-text);
}

/* ——— specyfikacje ——— */

.specs { margin: 12px 0 16px; }

.specs dt {
  margin-top: 8px;
  font-size: 14px;
  color: var(--muted);
}

.specs dt:first-child { margin-top: 0; }

.specs dd {
  margin: 0;
  font-weight: 700;
  overflow-wrap: anywhere;
}

/* Wariant listowy dla kart katalogu — ten sam zestaw danych, o połowę mniej węzłów. */
.specs-list {
  margin: 12px 0 16px;
  padding: 0;
  list-style: none;
}

.specs-list li {
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  overflow-wrap: anywhere;
}

.specs-list li:last-child { border-bottom: 0; }

/* ——— produkty ——— */

.product h3 {
  margin: 4px 0 4px;
  font-size: 19px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.match {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
}

.fit {
  display: inline-block;
  margin: 0 0 8px;
  padding: 4px 8px;
  font-size: 14px;
  font-weight: 700;
  border: 1px solid;
  border-radius: 8px;
}

.fit--ok {
  color: var(--success-text);
  background: var(--success-bg);
  border-color: var(--success-text);
}

.fit--partial {
  color: var(--warning-text);
  background: var(--warning-bg);
  border-color: var(--warning-text);
}

.product h4 {
  margin: 16px 0 8px;
  font-size: 16px;
}

.product ul { margin-bottom: 12px; }

.product li { font-size: 15px; }

.source {
  margin: 12px 0;
  font-size: 14px;
}

.stock {
  display: block;
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--muted);
}

/* ——— tabele ——— */

.table-scroll {
  overflow-x: auto;
  margin: 0 0 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: 14px;
}

caption {
  padding: 12px;
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  color: var(--text);
}

th, td {
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

th {
  font-weight: 700;
  background: var(--primary-soft);
}

tbody tr:last-child th,
tbody tr:last-child td { border-bottom: 0; }

.table-hint {
  margin: 0 0 16px;
  font-size: 14px;
  color: var(--muted);
}

/* ——— porównywarka w katalogu ——— */

.compare-row {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.compare-row:last-child { border-bottom: 0; }

.compare-row h4 {
  margin: 0 0 8px;
  font-size: 15px;
  color: var(--muted);
}

.compare-values { margin: 0; }

.compare-values dt {
  font-size: 14px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.compare-values dd {
  margin: 0 0 8px;
  font-weight: 700;
}

/* ——— udostępnianie ——— */

.share-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}

.share-list li { margin: 0; }

.share-list a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 8px;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  color: var(--primary);
  background: var(--surface);
  border: 1px solid var(--control-border);
  border-radius: 8px;
}

.share-list a:hover { border-color: var(--primary); }

/* ——— stopka ——— */

.site-footer {
  margin-top: 48px;
  padding: 24px 0 32px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  font-size: 15px;
}

.site-footer h2 {
  font-size: 16px;
  margin: 24px 0 8px;
}

.site-footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-footer li { margin: 0; }

.site-footer a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.footer-note {
  margin: 24px 0 0;
  font-size: 14px;
  color: var(--muted);
}

/* ——— 480 px: drobne usprawnienia odstępów i siatki specyfikacji ——— */

@media (min-width: 480px) {
  .specs {
    display: grid;
    grid-template-columns: minmax(150px, auto) 1fr;
    column-gap: 16px;
    row-gap: 8px;
    align-items: baseline;
  }

  .specs dt { margin-top: 0; }

  .card { padding: 20px; }
}

/* ——— 768 px: kolumny pomocnicze, akcje w linii, tabela porównania ——— */

@media (min-width: 768px) {
  h1 { font-size: 38px; }

  h2 { font-size: 28px; }

  .wrap { padding: 0 24px; }

  .menu-btn { display: none; }

  .header-row { min-height: 64px; }

  .site-header .wrap:first-child { padding-bottom: 0; }

  .site-nav {
    display: block;
    border-top: 1px solid var(--border);
  }

  .site-nav ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0 24px;
    padding: 0;
  }

  .site-nav a {
    min-height: 48px;
    border-bottom: 0;
  }

  .grid3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
  }

  .grid3 .linkcard { margin-bottom: 0; }

  .actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
  }

  .actions .btn {
    margin-bottom: 0;
    width: auto;
  }

  .actions .btn--block { flex: 0 1 auto; }

  .share-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }

  .compare-row {
    display: grid;
    grid-template-columns: minmax(160px, 1fr) 3fr;
    gap: 16px;
    align-items: start;
  }

  .compare-row h4 { margin: 0; }

  .compare-values {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 8px 16px;
  }

  .footer-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0 24px;
  }

  .footer-grid > div:first-child h2 { margin-top: 0; }
}

/* ——— 1024 px: szersze odstępy w katalogu ——— */

@media (min-width: 1024px) {
  .section { margin: 48px 0; }

  .site-nav ul { gap: 0 32px; }
}

/* ——— 1200 px: ograniczenie szerokości, bez rozciągania ——— */

@media (min-width: 1200px) {
  .wrap { padding: 0 32px; }
}

@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;
  }
}
