/* ========================================
   DTNR Documentation – Sand & Dust Theme
   ======================================== */

/* --- Language Toggle (i18n) --- */
html:not([lang="en"]) .i18n-en { display: none; }
html[lang="en"] .i18n-de { display: none; }
html[lang="en"] .docs-tip::before { content: '\1F4A1  Tip'; }
html[lang="en"] .docs-note::before { content: '\1F4DD  Note'; }

/* --- Layout --- */
.docs-layout {
  display: flex;
  min-height: calc(100vh - var(--nav-height));
  padding-top: var(--nav-height);
  max-width: 1200px;
  margin: 0 auto;
}

/* --- Sidebar --- */
.docs-sidebar {
  position: sticky;
  top: var(--nav-height);
  width: 280px;
  min-width: 280px;
  height: calc(100vh - var(--nav-height));
  overflow-y: auto;
  padding: 32px 20px;
  background: rgba(15, 13, 9, 0.95);
  border-right: 1px solid var(--dust-card-border);
  scrollbar-width: thin;
  scrollbar-color: var(--sand-dim) transparent;
  z-index: 10;
}

.docs-sidebar::-webkit-scrollbar { width: 4px; }
.docs-sidebar::-webkit-scrollbar-track { background: transparent; }
.docs-sidebar::-webkit-scrollbar-thumb { background: var(--sand-dim); border-radius: 2px; }

.docs-sidebar-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--dust-card-border);
}

.docs-sidebar-title {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--sand);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.docs-sidebar-version {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--white-muted);
}

.docs-toc-section {
  margin-bottom: 8px;
}

.docs-toc-link {
  display: block;
  padding: 6px 12px;
  font-size: 0.9rem;
  color: var(--white-dim);
  text-decoration: none;
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
  line-height: 1.4;
}

.docs-toc-link:hover {
  color: var(--sand);
  background: var(--sand-glow);
}

.docs-toc-link.active {
  color: var(--sand);
  background: var(--sand-glow);
  font-weight: 600;
}

.docs-toc-link.toc-sub {
  padding-left: 28px;
  font-size: 0.82rem;
  color: var(--white-muted);
}

.docs-toc-link.toc-sub:hover {
  color: var(--white-dim);
}

/* --- Main Content --- */
.docs-main {
  flex: 1;
  min-width: 0;
  padding: 48px 56px 80px;
  max-width: 900px;
}

.docs-main h1 {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--sand);
  margin-bottom: 8px;
  letter-spacing: 1px;
}

.docs-main .docs-subtitle {
  font-size: 1.1rem;
  color: var(--white-dim);
  margin-bottom: 48px;
}

/* Chapter divider */
.docs-chapter-divider {
  position: relative;
  height: 120px;
  margin: 56px -56px 40px;
  overflow: hidden;
  border-radius: 0;
}

.docs-chapter-divider img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.35) saturate(0.7);
}

.docs-chapter-divider span {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--sand);
  letter-spacing: 4px;
  text-transform: uppercase;
  text-shadow: 0 2px 12px rgba(0,0,0,0.7);
}

/* Sections */
.docs-section {
  margin-bottom: 48px;
  scroll-margin-top: calc(var(--nav-height) + 24px);
}

.docs-main h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--sand);
  margin-bottom: 20px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--dust-card-border);
  letter-spacing: 0.5px;
}

.docs-main h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--white);
  margin-top: 28px;
  margin-bottom: 12px;
  letter-spacing: 0.3px;
}

.docs-main p {
  line-height: 1.7;
  color: var(--white-dim);
  margin-bottom: 16px;
}

.docs-main ul,
.docs-main ol {
  margin: 0 0 16px 24px;
  color: var(--white-dim);
  line-height: 1.7;
}

.docs-main li {
  margin-bottom: 4px;
}

.docs-main li strong {
  color: var(--white);
}

/* --- Tables --- */
.docs-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 24px;
  font-size: 0.9rem;
}

.docs-table th {
  background: rgba(212, 169, 84, 0.15);
  color: var(--sand);
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 600;
  text-align: left;
  padding: 10px 14px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--sand-dim);
}

.docs-table td {
  padding: 9px 14px;
  color: var(--white-dim);
  border-bottom: 1px solid rgba(212, 169, 84, 0.06);
}

.docs-table tr:nth-child(odd) td {
  background: rgba(26, 21, 16, 0.5);
}

.docs-table tr:nth-child(even) td {
  background: rgba(26, 21, 16, 0.3);
}

.docs-table tr:hover td {
  background: var(--sand-glow);
}

/* --- Tip & Note boxes --- */
.docs-tip,
.docs-note {
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 16px 0 24px;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--white-dim);
}

.docs-tip {
  background: rgba(212, 169, 84, 0.08);
  border-left: 3px solid var(--sand);
}

.docs-tip::before {
  content: '💡 Tipp';
  display: block;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--sand);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.docs-note {
  background: rgba(140, 160, 184, 0.08);
  border-left: 3px solid var(--sky-pale);
}

.docs-note::before {
  content: '📝 Hinweis';
  display: block;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--sky-pale);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

/* --- Code --- */
.docs-code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: rgba(26, 21, 16, 0.7);
  color: var(--sand);
  padding: 2px 7px;
  border-radius: 3px;
  border: 1px solid var(--dust-card-border);
}

/* --- Screenshots --- */
.docs-screenshot {
  margin: 20px 0 28px;
}

.docs-screenshot img {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--dust-card-border);
}

.docs-screenshot figcaption {
  font-size: 0.82rem;
  color: var(--white-muted);
  margin-top: 8px;
  text-align: center;
  font-style: italic;
}

/* --- Back to top --- */
.docs-back-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--dust-card);
  border: 1px solid var(--sand-dim);
  color: var(--sand);
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 50;
}

.docs-back-top.visible {
  opacity: 1;
  pointer-events: all;
}

.docs-back-top:hover {
  transform: translateY(-3px);
  background: var(--sand-glow-strong);
}

/* --- Mobile sidebar toggle --- */
.docs-sidebar-toggle {
  display: none;
  position: fixed;
  bottom: 32px;
  left: 32px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--dust-card);
  border: 1px solid var(--sand-dim);
  color: var(--sand);
  font-size: 1.1rem;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 50;
}

/* --- Portal page --- */
.docs-portal {
  min-height: calc(100vh - var(--nav-height));
  padding: calc(var(--nav-height) + 80px) 24px 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.docs-portal-header {
  text-align: center;
  margin-bottom: 56px;
}

.docs-portal-tag {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--sand-dim);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.docs-portal-title {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--sand);
  margin-bottom: 16px;
  letter-spacing: 1px;
}

.docs-portal-desc {
  font-size: 1.1rem;
  color: var(--white-dim);
  max-width: 600px;
  margin: 0 auto;
}

.docs-portal-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px;
  max-width: 900px;
  width: 100%;
}

.docs-portal-card {
  position: relative;
  background: var(--dust-card);
  border: 1px solid var(--dust-card-border);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  text-decoration: none;
  transition: transform 0.3s, border-color 0.3s, box-shadow 0.3s;
}

.docs-portal-card:hover {
  transform: translateY(-4px);
  border-color: var(--sand-dim);
  box-shadow: 0 12px 40px rgba(212, 169, 84, 0.08);
}

.docs-portal-card-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 20px;
  color: var(--sand);
}

.docs-portal-card-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 10px;
}

.docs-portal-card-desc {
  font-size: 0.95rem;
  color: var(--white-dim);
  line-height: 1.6;
  margin-bottom: 20px;
}

.docs-portal-card-meta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--white-muted);
}

.docs-portal-card-arrow {
  position: absolute;
  top: 40px;
  right: 32px;
  color: var(--sand-dim);
  font-size: 1.4rem;
  transition: transform 0.3s, color 0.3s;
}

.docs-portal-card:hover .docs-portal-card-arrow {
  color: var(--sand);
  transform: translateX(4px);
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  .docs-sidebar {
    position: fixed;
    left: -300px;
    top: var(--nav-height);
    transition: left 0.3s;
    box-shadow: 4px 0 24px rgba(0,0,0,0.4);
  }

  .docs-sidebar.open {
    left: 0;
  }

  .docs-sidebar-toggle {
    display: flex;
  }

  .docs-main {
    padding: 32px 24px 80px;
  }

  .docs-chapter-divider {
    margin-left: -24px;
    margin-right: -24px;
  }

  .docs-portal-grid {
    max-width: 800px;
  }
}

@media (max-width: 768px) {
  .docs-portal-grid {
    grid-template-columns: 1fr;
  }

  .docs-portal-title {
    font-size: 1.8rem;
  }

  .docs-main h1 {
    font-size: 1.5rem;
  }
}
