/* ==========================================================================
   ARCHETYPE CHATGPT (Long-Text / GEO / AEO / AI Search)
   Inspirowany interfejsem ChatGPT — maksymalna czytelność, czysty tekst,
   subtelne obramowania, bogata semantyka wiedzy (BLUF, E-E-A-T, encje).
   ========================================================================== */

:root {
  /* Kolory domyślne (Jasne) */
  --bg-page: #ffffff;
  --bg-subtle: #f7f7f7;
  --bg-hover: #f3f3f3;

  --text-primary: #1f1f1f;
  --text-secondary: #606060;
  --text-muted: #7a7a7a;

  --border-light: #ececec;
  --border-default: #e1e1e1;
  --border-strong: #d0d0d0;

  --content-width: 780px;
  --wide-content-width: 1000px;

  --radius-sm: 5px;
  --radius-md: 8px;
  --radius-lg: 10px;

  --font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

[data-theme="dark"] {
  --bg-page: #212121;
  --bg-subtle: #2a2a2a;
  --bg-hover: #303030;

  --text-primary: #ececec;
  --text-secondary: #c6c6c6;
  --text-muted: #9b9b9b;

  --border-light: #333333;
  --border-default: #3d3d3d;
  --border-strong: #4b4b4b;
}

/* Base resets & global page */
body {
  background-color: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  letter-spacing: -0.005em;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

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

/* Header */
.gpt-header {
  height: 58px;
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-page);
  border-bottom: 1px solid var(--border-light);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.gpt-header-logo {
  font-weight: 600;
  font-size: 16px;
  color: var(--text-primary);
  text-decoration: none;
}

.gpt-header-nav {
  display: flex;
  gap: 20px;
  align-items: center;
}

.gpt-header-nav a {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
}

.gpt-header-nav a:hover {
  color: var(--text-primary);
}

.gpt-search-input {
  height: 42px;
  border: 1px solid var(--border-default);
  border-radius: 9px;
  background: var(--bg-subtle);
  padding: 0 14px;
  font-size: 14px;
  color: var(--text-primary);
  width: 220px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.gpt-search-input:focus {
  border-color: var(--border-strong);
  background: var(--bg-page);
  outline: none;
}

/* Theme toggle button */
.theme-toggle-btn {
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.15s ease;
}

.theme-toggle-btn:hover {
  background: var(--bg-hover);
}

/* Layout Containers */
.page {
  width: 100%;
}

.article-container {
  max-width: 1160px;
  margin: 0 auto;
  display: flex;
  gap: 48px;
  padding-inline: 24px;
}

.article {
  width: 100%;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 48px 0 96px;
}

/* Wide Content (1000px) for images/diagrams */
.article-wide {
  width: min(var(--wide-content-width), calc(100vw - 32px));
  max-width: none;
  margin-left: 50%;
  transform: translateX(-50%);
}

/* Typografia & Nagłówki */
h1, h2, h3, h4 {
  color: var(--text-primary);
  font-weight: 600;
}

h1 {
  font-size: clamp(34px, 4vw, 46px);
  line-height: 1.12;
  letter-spacing: -0.03em;
  margin-top: 0;
  margin-bottom: 20px;
}

h2 {
  font-size: 26px;
  line-height: 1.3;
  letter-spacing: -0.02em;
  margin-top: 48px;
  margin-bottom: 16px;
  scroll-margin-top: 80px;
}

h3 {
  font-size: 21px;
  line-height: 1.4;
  margin-top: 34px;
  margin-bottom: 12px;
  scroll-margin-top: 80px;
}

h4 {
  font-size: 17px;
  line-height: 1.45;
  margin-top: 26px;
  margin-bottom: 8px;
}

p {
  margin-top: 0;
  margin-bottom: 18px;
  max-width: 72ch;
}

.lead {
  font-size: 19px;
  line-height: 1.55;
  color: var(--text-secondary);
  margin-top: 0;
  margin-bottom: 36px;
}

strong {
  font-weight: 600;
}

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.15s ease;
}

a:hover {
  text-decoration-color: currentColor;
}

/* Breadcrumbs & Meta */
.breadcrumbs {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 22px;
}

.breadcrumbs a {
  text-decoration: none;
  color: var(--text-muted);
}

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

.article-meta {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.trust-strip {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: var(--text-secondary);
  padding: 10px 14px;
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 32px;
  flex-wrap: wrap;
}

/* 58. BLUF – Szybka odpowiedź */
.answer-block {
  margin: 16px 0 24px;
  padding: 14px 18px;
  background: var(--bg-subtle);
  border-left: 3px solid var(--border-strong);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-size: 16px;
  line-height: 1.6;
}

.answer-block-label {
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

/* 65. Najważniejsze informacje */
.key-points {
  margin: 28px 0 36px;
  padding: 18px 20px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  background: var(--bg-subtle);
}

.key-points-title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 12px;
}

.key-points ul {
  margin: 0;
  padding-left: 20px;
}

.key-points li {
  margin-bottom: 6px;
}

/* 66. Definicja (<dl>) */
dl.definition {
  margin: 24px 0;
  padding: 16px 18px;
  border-left: 3px solid var(--border-strong);
  background: var(--bg-subtle);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

dl.definition dt {
  font-weight: 600;
  font-size: 17px;
  margin-bottom: 4px;
}

dl.definition dd {
  margin-left: 0;
  color: var(--text-secondary);
}

/* 68. Blok Faktu */
.fact-block {
  margin: 24px 0;
  padding: 16px 18px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary) !important;
}

.fact-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  background: var(--accent, #10a37f);
  color: #ffffff !important;
  border-radius: 4px;
  margin-bottom: 8px;
}

/* 69. Data Block (Licznik/Wskaźnik) */
.data-block {
  margin: 24px 0;
  padding: 18px 20px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
}

.data-num {
  font-size: 32px;
  font-weight: 800;
  color: var(--accent, #10a37f);
  display: block;
  line-height: 1.1;
  margin-bottom: 4px;
}

.fact-source {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* 69. Blok Danych */
.data-block {
  display: inline-flex;
  flex-direction: column;
  padding: 18px 22px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  margin: 20px 0;
  min-width: 180px;
}

.data-number {
  font-size: 36px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text-primary);
}

.data-label {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.data-source {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* 71. Doświadczenie / Z praktyki */
.experience-block {
  margin: 24px 0;
  padding: 18px 20px;
  background: var(--bg-subtle);
  border-left: 3px solid var(--text-primary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.experience-title {
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

/* 73. Metodologia */
.methodology-block {
  margin: 24px 0;
  padding: 18px 20px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--text-secondary);
}

.methodology-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

/* 81. Uwaga & 82. Błąd */
.notice {
  padding: 16px 18px;
  border-left: 3px solid var(--border-strong);
  background: var(--bg-subtle);
  margin: 24px 0;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.notice-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.mistake-block {
  padding: 16px 18px;
  border-left: 3px solid #dc2626;
  background: var(--bg-subtle);
  margin: 24px 0;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.mistake-title {
  font-weight: 600;
  color: #dc2626;
  margin-bottom: 4px;
}

/* 85. Zalety i ograniczenia */
.pros-cons-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 24px 0;
}

.pros-box, .cons-box {
  padding: 18px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
}

.pros-box-title {
  font-weight: 600;
  color: #16a34a;
  margin-bottom: 10px;
}

.cons-box-title {
  font-weight: 600;
  color: #dc2626;
  margin-bottom: 10px;
}

.pros-box ul, .cons-box ul {
  margin: 0;
  padding-left: 18px;
}

/* 80. Kroki proceduralne */
ol.steps-list {
  margin: 24px 0;
  padding-left: 0;
  list-style: none;
  counter-reset: step-counter;
}

ol.steps-list > li {
  position: relative;
  padding-left: 40px;
  margin-bottom: 18px;
}

ol.steps-list > li::before {
  counter-increment: step-counter;
  content: counter(step-counter);
  position: absolute;
  left: 0;
  top: 2px;
  width: 26px;
  height: 26px;
  background: var(--text-primary);
  color: var(--bg-page);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
}

/* Spisy i Tabele */
ul, ol {
  margin: 16px 0 22px;
  padding-left: 26px;
}

li {
  margin-bottom: 8px;
  padding-left: 3px;
}

hr {
  border: 0;
  border-top: 1px solid var(--border-light);
  margin: 40px 0;
}

blockquote {
  margin: 24px 0;
  padding-left: 18px;
  border-left: 3px solid var(--border-strong);
  color: var(--text-secondary);
}

/* Kod */
:not(pre) > code {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 5px;
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 0.9em;
  color: var(--text-primary);
}

pre {
  background: var(--bg-subtle);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.6;
  margin: 24px 0;
}

/* Tabele */
.table-wrapper {
  overflow-x: auto;
  margin: 24px 0;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

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

th {
  font-weight: 600;
  background: var(--bg-subtle);
}

/* Spis Treści (TOC) Desktop Sidebar */
.toc-sidebar {
  width: 220px;
  position: sticky;
  top: 90px;
  height: fit-content;
  font-size: 14px;
  border-left: 2px solid var(--border-light);
  padding-left: 18px;
  align-self: flex-start;
}

.toc-title {
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-list li {
  margin-bottom: 8px;
  padding-left: 0;
}

.toc-list a {
  text-decoration: none;
  color: var(--text-secondary);
  transition: color 0.15s ease;
}

.toc-list a:hover, .toc-list a.active {
  color: var(--text-primary);
  font-weight: 600;
}

/* FAQ */
.faq-list {
  margin: 32px 0;
  border-top: 1px solid var(--border-light);
}

.faq-item {
  border-bottom: 1px solid var(--border-light);
  padding: 18px 0;
}

.faq-question {
  font-weight: 600;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

.faq-answer {
  margin-top: 10px;
  color: var(--text-secondary);
}

/* Author Box & Reviewer Box */
.author-box, .reviewer-box {
  display: flex;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  background: var(--bg-subtle);
  margin: 36px 0;
  align-items: center;
}

.author-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--bg-page);
  flex-shrink: 0;
}

.author-info-title {
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 2px;
}

.author-bio {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
}

/* Navigation Clusters & Sources */
.sources-section {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
  font-size: 14px;
  color: var(--text-secondary);
}

.sources-section ol {
  padding-left: 20px;
  margin-top: 8px;
}

.cluster-nav {
  display: flex;
  justify-content: space-between;
  padding: 20px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  margin: 36px 0;
  gap: 16px;
}

.cluster-nav-item {
  flex: 1;
}

.cluster-nav-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.cluster-nav-title {
  font-weight: 600;
  font-size: 15px;
}

/* Figures & Captions */
figure {
  margin: 32px 0;
}

figure img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
  display: block;
}

figcaption {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
  margin-top: 8px;
  text-align: center;
}

/* Responsywność */
@media (max-width: 1100px) {
  .toc-sidebar {
    display: none;
  }
  .article-container {
    justify-content: center;
  }
}

@media (max-width: 768px) {
  .article {
    padding-inline: 18px;
    padding-top: 28px;
  }

  h1 { font-size: 32px; line-height: 1.15; }
  h2 { font-size: 24px; }
  h3 { font-size: 20px; }

  .pros-cons-grid {
    grid-template-columns: 1fr;
  }

  .gpt-header {
    padding: 0 16px;
  }

  .gpt-search-input {
    width: 140px;
  }

  .cluster-nav {
    flex-direction: column;
  }
}
