.docs-hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border-soft);
  background:
    linear-gradient(90deg, rgba(4, 11, 19, 0.98), rgba(4, 11, 19, 0.78)),
    url("assets/backgrounds/tlo_granatowe.png") center / cover no-repeat;
}

.docs-hero-inner {
  width: min(var(--content), calc(100% - 48px));
  margin: 0 auto;
  padding: 96px 0 72px;
}

.docs-hero h1 {
  max-width: 980px;
  margin-bottom: 18px;
  font-size: clamp(2.8rem, 6vw, 5.6rem);
}

.docs-lead {
  max-width: 820px;
  color: var(--text-2);
  font-size: 1.12rem;
}

.docs-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.docs-meta span {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: rgba(12, 24, 40, 0.76);
  color: var(--text-2);
  font-size: 0.82rem;
}

.docs-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 42px;
  width: min(var(--content), calc(100% - 48px));
  margin: 0 auto;
  padding: 56px 0 96px;
}

.docs-toc {
  position: sticky;
  top: 94px;
  align-self: start;
  max-height: calc(100vh - 118px);
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  background: var(--panel);
  scrollbar-color: var(--blue-deep) var(--input);
  scrollbar-width: thin;
}

.docs-toc strong {
  display: block;
  margin-bottom: 12px;
  color: var(--text);
  font-size: 0.82rem;
  text-transform: uppercase;
}

.docs-toc a {
  display: block;
  padding: 8px 10px;
  border-left: 2px solid transparent;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.docs-toc a:hover,
.docs-toc a:focus-visible {
  border-left-color: var(--blue-2);
  background: var(--hover);
  color: var(--text);
}

.docs-content {
  min-width: 0;
}

.docs-section {
  padding: 0 0 64px;
  scroll-margin-top: 94px;
}

.docs-section + .docs-section {
  padding-top: 56px;
  border-top: 1px solid var(--border-soft);
}

.docs-section h2 {
  max-width: 920px;
  font-size: clamp(2rem, 4vw, 3.15rem);
}

.docs-section h3 {
  margin-top: 34px;
  color: var(--text);
  font-size: 1.35rem;
}

.docs-section h4 {
  margin: 26px 0 8px;
  font-size: 1rem;
}

.docs-section p,
.docs-section li {
  color: var(--text-2);
}

.docs-section p {
  max-width: 980px;
}

.docs-section ul,
.docs-section ol {
  max-width: 980px;
  padding-left: 22px;
}

.docs-section li + li {
  margin-top: 7px;
}

.docs-kicker {
  color: var(--green) !important;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.docs-note,
.docs-warning,
.docs-safe {
  max-width: 1060px;
  margin: 24px 0;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: 5px;
  background: var(--panel);
}

.docs-note {
  border-left-color: var(--blue-2);
}

.docs-warning {
  border-left-color: var(--amber);
}

.docs-safe {
  border-left-color: var(--green);
}

.docs-note strong,
.docs-warning strong,
.docs-safe strong {
  display: block;
  margin-bottom: 4px;
}

.docs-shot {
  margin: 30px 0;
}

.docs-shot button {
  display: block;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--input);
  cursor: zoom-in;
}

.docs-shot button:hover {
  border-color: var(--blue-2);
}

.docs-shot img {
  width: 100%;
  height: auto;
}

.docs-shot figcaption {
  padding: 12px 2px 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.docs-grid,
.metric-grid,
.button-grid,
.modal-grid {
  display: grid;
  gap: 14px;
  margin: 24px 0;
}

.docs-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metric-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.modal-grid {
  grid-template-columns: minmax(280px, 0.8fr) minmax(380px, 1.2fr);
  align-items: start;
}

.docs-card,
.metric-card,
.button-card {
  padding: 20px;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  background: var(--panel);
}

.docs-card h3,
.metric-card h3,
.button-card h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.docs-card p,
.metric-card p,
.button-card p {
  margin-bottom: 0;
  font-size: 0.88rem;
}

.metric-card strong {
  display: block;
  margin-bottom: 8px;
  color: var(--blue-2);
  font-size: 1.7rem;
}

.metric-card:nth-child(2) strong {
  color: var(--amber);
}

.metric-card:nth-child(3) strong {
  color: var(--green);
}

.metric-card:nth-child(4) strong {
  color: var(--violet);
}

.docs-table-wrap {
  margin: 26px 0;
  overflow-x: auto;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
}

.docs-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  background: var(--panel);
  font-size: 0.88rem;
}

.docs-table th,
.docs-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-soft);
  text-align: left;
  vertical-align: top;
}

.docs-table th {
  background: var(--input);
  color: var(--text);
}

.docs-table td {
  color: var(--text-2);
}

.docs-table tr:last-child td {
  border-bottom: 0;
}

.docs-formula {
  max-width: 920px;
  margin: 22px 0;
  padding: 18px 20px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #060d16;
  color: var(--cyan);
  font-family: Consolas, "Cascadia Mono", monospace;
  font-size: 0.92rem;
  white-space: pre;
}

.docs-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.docs-actions .button {
  min-height: 44px;
}

.docs-footer-link {
  color: var(--blue-2);
  font-weight: 700;
}

@media (max-width: 1080px) {
  .docs-shell {
    grid-template-columns: 1fr;
  }

  .docs-toc {
    position: static;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-height: none;
  }

  .docs-toc strong {
    grid-column: 1 / -1;
  }

  .metric-grid,
  .button-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .docs-hero-inner,
  .docs-shell {
    width: min(100% - 36px, var(--content));
  }

  .docs-hero-inner {
    padding: 70px 0 52px;
  }

  .docs-toc,
  .docs-grid,
  .metric-grid,
  .button-grid,
  .modal-grid {
    grid-template-columns: 1fr;
  }

  .docs-section {
    padding-bottom: 48px;
  }

  .docs-section + .docs-section {
    padding-top: 42px;
  }
}
