/*
 * Silent Heroes — LEGAL pages (regulamin, polityka prywatności, cookies, zwroty, faktury VAT, formularz odstąpienia).
 *
 * Reset długiego content w sh-container/sh-section, ciemne hero z meta-row,
 * 2-kolumnowy layout (TOC + treść) na desktop, single-col z collapsible TOC na mobile.
 *
 * Body class: .sh-legal-page (dodawana przez sh_legal_body_class w inc/setup.php).
 * JS: assets/js/legal-toc.js (auto-buduje TOC + slug id na h2).
 */

/* ========== HERO (override sh-hero dla stron prawnych) ========== */
.sh-legal-page .sh-hero {
  padding: 64px 24px 56px;
  border-bottom: 2px solid var(--sh-red);
}
.sh-legal-page .sh-hero-inner {
  max-width: 880px;
  text-align: left;
}
.sh-legal-page .sh-hero h1 {
  font-family: var(--sh-font-sans);
  font-size: clamp(1.9rem, 3.6vw, 2.8rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0;
  color: #fff;
  text-transform: none;
  text-wrap: balance;
  word-break: keep-all;
  hyphens: none;
}
.sh-legal-page .sh-hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--sh-red);
  font-family: var(--sh-font-sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.sh-legal-page .sh-hero-kicker::before {
  content: "";
  width: 28px;
  height: 2px;
  background: var(--sh-red);
  display: inline-block;
}
.sh-legal-page .sh-hero-meta {
  margin-top: 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.sh-legal-page .sh-hero-meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(248, 247, 244, 0.88);
  font-family: var(--sh-font-sans);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 7px 14px;
  border-radius: 999px;
}
.sh-legal-page .sh-hero-meta-pill strong {
  color: #fff;
  font-weight: 700;
}

/* ========== LAYOUT KONTENERA (override sh-container/sh-section) ========== */
.sh-legal-page article.sh-container {
  max-width: 1120px;
  padding: 56px 24px 96px;
}
.sh-legal-page .sh-entry-content {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 64px;
  align-items: start;
}
.sh-legal-page .sh-entry-content.sh-legal-no-toc {
  grid-template-columns: 1fr;
  gap: 0;
}
.sh-legal-page .sh-entry-content.sh-legal-no-toc .sh-legal-body {
  max-width: 72ch;
  margin: 0 auto;
}

/* TOC po lewej (desktop ≥ 1024px) */
.sh-legal-toc {
  position: sticky;
  top: 96px;
  align-self: start;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
}
.sh-legal-toc-title {
  font-family: var(--sh-font-sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--sh-red);
  margin: 0 0 14px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--sh-red);
  list-style: none;
  cursor: default;
}
.sh-legal-toc summary { list-style: none; cursor: default; }
.sh-legal-toc summary::-webkit-details-marker { display: none; }
.sh-legal-toc summary::after { display: none; }
.sh-legal-toc ol {
  list-style: none;
  counter-reset: toc;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sh-legal-toc li {
  margin: 0;
  padding: 0;
}
.sh-legal-toc a {
  display: block;
  padding: 7px 0 7px 14px;
  border-left: 2px solid transparent;
  color: var(--sh-muted);
  text-decoration: none;
  font-family: var(--sh-font-sans);
  font-size: 13px;
  line-height: 1.4;
  font-weight: 500;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.sh-legal-toc a:hover {
  color: var(--sh-black);
  border-left-color: var(--sh-border);
  background: var(--sh-offwhite-2);
}
.sh-legal-toc a.is-active {
  color: var(--sh-black);
  border-left-color: var(--sh-red);
  font-weight: 600;
}

/* Wrapper treści — wszystko poza TOC */
.sh-legal-body {
  min-width: 0;
  max-width: 72ch;
}

/* ========== TYPOGRAFIA TREŚCI ========== */
.sh-legal-body > * { max-width: 100%; }

.sh-legal-body p {
  font-family: var(--sh-font-sans);
  font-size: 16px;
  line-height: 1.75;
  color: var(--sh-ink);
  margin: 0 0 1.15em;
}
.sh-legal-body p:last-child { margin-bottom: 0; }

.sh-legal-body h2,
.sh-legal-body .wp-block-heading.h2,
.sh-legal-body h2.wp-block-heading {
  font-family: var(--sh-font-sans);
  font-size: clamp(1.35rem, 2.2vw, 1.65rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--sh-black);
  margin: 56px 0 18px;
  padding: 0 0 0 18px;
  border-left: 3px solid var(--sh-red);
  scroll-margin-top: 110px;
  text-wrap: balance;
}
.sh-legal-body h2:first-child { margin-top: 0; }

.sh-legal-body h3,
.sh-legal-body h3.wp-block-heading {
  font-family: var(--sh-font-sans);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--sh-black);
  margin: 32px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--sh-border);
  scroll-margin-top: 110px;
}

.sh-legal-body h4 {
  font-family: var(--sh-font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--sh-black);
  margin: 22px 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Lead po H2 — pierwszy paragraf */
.sh-legal-body h2 + p {
  font-size: 16.5px;
  color: var(--sh-gray-700);
}

/* Listy */
.sh-legal-body ul,
.sh-legal-body ol {
  margin: 0 0 1.15em;
  padding-left: 1.5em;
  font-family: var(--sh-font-sans);
  font-size: 16px;
  line-height: 1.7;
  color: var(--sh-ink);
}
.sh-legal-body ul li,
.sh-legal-body ol li {
  margin: 0 0 8px;
  padding-left: 4px;
}
.sh-legal-body ul li::marker { color: var(--sh-red); }
.sh-legal-body ol li::marker { color: var(--sh-red); font-weight: 700; }
.sh-legal-body li > ul,
.sh-legal-body li > ol { margin-top: 8px; margin-bottom: 4px; }
.sh-legal-body li p { margin-bottom: 8px; }

/* Linki w treści */
.sh-legal-body a:not(.sh-btn) {
  color: var(--sh-red);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  font-weight: 500;
  word-break: break-word;
  overflow-wrap: anywhere;
  transition: color .15s ease;
}
.sh-legal-body a:not(.sh-btn):hover { color: var(--sh-red-dark); }

/* strong / em */
.sh-legal-body strong { font-weight: 700; color: var(--sh-black); }
.sh-legal-body em { font-style: italic; color: var(--sh-gray-700); }

/* hr */
.sh-legal-body hr {
  border: 0;
  border-top: 1px solid var(--sh-border);
  margin: 40px 0;
}

/* Blockquote — np. cytat ustawy */
.sh-legal-body blockquote {
  margin: 24px 0;
  padding: 20px 24px;
  background: var(--sh-offwhite-2);
  border-left: 3px solid var(--sh-red);
  border-radius: 0 8px 8px 0;
  font-style: italic;
  color: var(--sh-gray-700);
  font-size: 15px;
  line-height: 1.65;
}
.sh-legal-body blockquote p:last-child { margin-bottom: 0; }
.sh-legal-body blockquote cite {
  display: block;
  margin-top: 10px;
  font-size: 13px;
  font-style: normal;
  font-weight: 600;
  color: var(--sh-muted);
  letter-spacing: 0.02em;
}

/* Code (np. numer ID, RODO art.) — rzadko, ale niech jest */
.sh-legal-body code {
  font-family: var(--sh-font-mono);
  font-size: 0.92em;
  background: var(--sh-offwhite-2);
  border: 1px solid var(--sh-border);
  border-radius: 3px;
  padding: 1px 6px;
  color: var(--sh-black);
}

/* ========== TABELE (np. § Cele, podstawy prawne RODO) ========== */
.sh-legal-body .wp-block-table,
.sh-legal-body figure.wp-block-table {
  margin: 28px 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.sh-legal-body table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sh-font-sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--sh-ink);
  background: #fff;
  border: 1px solid var(--sh-border);
  border-radius: 8px;
  overflow: hidden;
}
.sh-legal-body table thead { background: var(--sh-black); color: #fff; }
.sh-legal-body table thead th {
  text-align: left;
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 12px 16px;
  border-right: 1px solid rgba(255,255,255,.1);
}
.sh-legal-body table thead th:last-child { border-right: 0; }
.sh-legal-body table thead th strong,
.sh-legal-body table thead th b { color: #fff; font-weight: 600; }
.sh-legal-body table tbody td {
  padding: 14px 16px;
  border-top: 1px solid var(--sh-border);
  border-right: 1px solid var(--sh-border);
  vertical-align: top;
}
.sh-legal-body table tbody td:last-child { border-right: 0; }
.sh-legal-body table tbody tr:nth-child(even) { background: var(--sh-offwhite-2); }
.sh-legal-body table tbody tr:hover { background: rgba(204, 27, 27, 0.04); }
.sh-legal-body table strong { color: var(--sh-black); }

/* ========== TOC — MOBILE (collapsed details) ========== */
.sh-legal-toc-mobile {
  display: none;
  margin: 0 0 32px;
  background: var(--sh-offwhite-2);
  border: 1px solid var(--sh-border);
  border-radius: 10px;
  overflow: hidden;
}
.sh-legal-toc-mobile summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 18px;
  font-family: var(--sh-font-sans);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sh-black);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.sh-legal-toc-mobile summary::-webkit-details-marker { display: none; }
.sh-legal-toc-mobile summary::after {
  content: "+";
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 400;
  color: var(--sh-red);
  border: 1px solid var(--sh-border);
  border-radius: 50%;
  background: #fff;
  transition: transform .2s ease, background .2s ease, color .2s ease;
  line-height: 1;
}
.sh-legal-toc-mobile[open] summary::after {
  content: "−";
  background: var(--sh-red);
  color: #fff;
  border-color: var(--sh-red);
}
.sh-legal-toc-mobile ol {
  list-style: none;
  margin: 0;
  padding: 4px 0 12px;
  background: #fff;
  border-top: 1px solid var(--sh-border);
}
.sh-legal-toc-mobile li { margin: 0; }
.sh-legal-toc-mobile a {
  display: block;
  padding: 11px 18px;
  color: var(--sh-ink);
  text-decoration: none;
  font-family: var(--sh-font-sans);
  font-size: 14px;
  line-height: 1.4;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.sh-legal-toc-mobile a:hover,
.sh-legal-toc-mobile a:focus-visible {
  background: var(--sh-offwhite-2);
  border-left-color: var(--sh-red);
  color: var(--sh-black);
}

/* ========== BREAKPOINTS ========== */
@media (max-width: 1024px) {
  .sh-legal-page .sh-entry-content {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .sh-legal-toc { display: none; }
  .sh-legal-toc-mobile { display: block; }
  .sh-legal-body { max-width: 100%; }
}

@media (max-width: 768px) {
  .sh-legal-page .sh-hero { padding: 44px 20px 36px; }
  .sh-legal-page article.sh-container { padding: 36px 20px 64px; }
  .sh-legal-page .sh-hero-meta-pill { font-size: 12px; padding: 6px 12px; }
  .sh-legal-body { font-size: 15.5px; }
  .sh-legal-body p,
  .sh-legal-body ul,
  .sh-legal-body ol { font-size: 15.5px; line-height: 1.7; }
  .sh-legal-body h2 {
    margin-top: 44px;
    margin-bottom: 14px;
    padding-left: 14px;
  }
  .sh-legal-body table { font-size: 13px; }
  .sh-legal-body table thead th,
  .sh-legal-body table tbody td { padding: 10px 12px; }
  .sh-legal-toc-mobile summary { padding: 12px 16px; font-size: 12px; }
}

@media (max-width: 480px) {
  .sh-legal-page .sh-hero h1 { font-size: clamp(1.6rem, 7vw, 2.1rem); }
  .sh-legal-page .sh-hero-kicker { font-size: 10px; }
}

/* ========== PRINT ========== */
@media print {
  .sh-legal-toc,
  .sh-legal-toc-mobile,
  .site-navbar,
  .site-footer,
  .sh-cookie-bar { display: none !important; }
  .sh-legal-page .sh-hero {
    background: #fff !important;
    color: #000 !important;
    padding: 0 0 20px;
    border-bottom: 2px solid #000;
  }
  .sh-legal-page .sh-hero h1 { color: #000 !important; }
  .sh-legal-page .sh-hero-kicker { color: #000 !important; }
  .sh-legal-page .sh-hero-meta-pill {
    background: transparent !important;
    border: 1px solid #000 !important;
    color: #000 !important;
  }
  .sh-legal-page .sh-entry-content { grid-template-columns: 1fr; }
  .sh-legal-body { max-width: 100%; }
  .sh-legal-body a { color: #000 !important; text-decoration: underline; }
  .sh-legal-body h2 {
    border-left: 0;
    padding-left: 0;
    border-bottom: 2px solid #000;
    padding-bottom: 4px;
  }
}
