/* ========== Research Page Layout (refined) ========== */

/* Page shell */
.documentation-page {
  --page-max: 1200px;
  --gap: 24px;
  width: min(92%, var(--page-max));
  margin: 0 auto;
  padding-top: 110px;                /* space for fixed navbar */
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: var(--gap);
  overflow-x: hidden;                /* prevent stray horiz scroll */
}

/* Header */
.doc-header {
  grid-column: 1 / -1;
  padding: 28px;
  border: 1px solid rgba(100,255,218,0.12);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(100,255,218,.07), rgba(100,255,218,.03)),
    rgba(10,25,47,.6);
  backdrop-filter: blur(6px);
  animation: fadeIn 300ms ease-in-out;
}
.doc-header h1 { letter-spacing: .2px; line-height: 1.2; }
.doc-header .subtitle { color: var(--text-secondary); margin-top: 6px; font-size: .95rem; }

/* Tabs (vertical sticky on desktop) */
.tabs-container { position: relative; }
.tabs {
  position: sticky;
  top: 86px;                          /* below navbar */
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.06);
  background: rgba(10,25,47,.55);
  backdrop-filter: blur(8px);
}
.tabs button {
  all: unset;
  cursor: pointer;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  transition: background .16s ease, color .16s ease, transform .12s ease, border-color .16s ease;
}
.tabs button:hover {
  color: var(--text-primary);
  background: rgba(100,255,218,.07);
  border-color: rgba(100,255,218,.20);
  transform: translateX(2px);
}
.tabs button.active {
  color: var(--primary-color);
  background: var(--secondary-color);
  font-weight: 600;
}

/* Right content column */
.tab-content { display: block; }      /* JS toggles inline styles */
.tab-panel {
  padding: 24px;
  border-radius: 16px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.06);
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
  animation: fadeIn 250ms ease;
  max-width: 100%;
  overflow-x: hidden;
}

/* Overview */
.overview-content { display: grid; gap: 18px; }
.key-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.key-stats .stat {
  padding: 16px 14px;
  border-radius: 12px;
  border: 1px dashed rgba(100,255,218,.25);
  background: linear-gradient(180deg, rgba(100,255,218,.05), rgba(100,255,218,.02));
  text-align: center;
  transition: transform .14s ease, border-color .14s ease, background .14s ease;
}
.key-stats .stat:hover {
  transform: translateY(-2px);
  border-color: rgba(100,255,218,.35);
  background: rgba(100,255,218,.06);
}
.key-stats .stat h3 { margin-bottom: 4px; font-size: 1.25rem; }

/* Methods */
.features-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
}
.feature-card {
  grid-column: span 6; /* 2-up desktop */
  padding: 18px;
  border-radius: 14px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.07);
  transition: transform .14s ease, border-color .14s ease, background .14s ease;
}
.feature-card:hover {
  transform: translateY(-2px);
  border-color: rgba(100,255,218,.28);
  background: rgba(100,255,218,.05);
}
.feature-card h3 { margin-bottom: 8px; }

/* Technical */
.tech-specs .tech-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 12px;
}
.tech-specs .tech-item {
  grid-column: span 3; /* 4-up */
  padding: 16px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.06);
  background: rgba(255,255,255,.02);
}
.tech-specs .tech-item h3 {
  font-size: .95rem;
  color: var(--secondary-color);
  margin-bottom: 6px;
}

/* Results */
.installation-guide h2 { margin: 10px 0 6px; color: var(--secondary-color); }
.installation-guide ul,
.installation-guide ol { margin-left: 1.25rem; margin-top: 8px; }
.installation-guide li { margin: 6px 0; }

/* Back button */
.centered-button-wrapper {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  margin: 18px 0 80px;
}
.back-to-projects-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(100,255,218,.28);
  background: rgba(100,255,218,.06);
  color: var(--text-primary);
  transition: transform .14s ease, background .14s ease, border-color .14s ease, box-shadow .14s ease;
}
.back-to-projects-btn:hover {
  transform: translateY(-2px);
  background: rgba(100,255,218,.12);
  border-color: rgba(100,255,218,.45);
  box-shadow: 0 8px 22px rgba(0,0,0,.25);
}

/* ========== Mobile / Responsive ========== */
@media (max-width: 1100px) {
  .documentation-page { grid-template-columns: 240px 1fr; }
  .tech-specs .tech-item { grid-column: span 4; } /* 3-up */
}

@media (max-width: 900px) {
  .documentation-page {
    grid-template-columns: 1fr;     /* stack */
    width: min(96%, var(--page-max));
  }
  .doc-header { order: -1; }
  .tabs {
    position: static;
    flex-direction: row;
    gap: 10px;
    padding: 10px;
    overflow-x: auto;                /* swipeable tabs */
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;           /* Firefox hide */
  }
  .tabs::-webkit-scrollbar { display: none; } /* WebKit hide */
  .tabs button {
    white-space: nowrap;
    flex: 0 0 auto;
    max-width: 100%;
    transform: none;                 /* avoid hover nudge on touch */
  }
  .tab-panel { width: 100%; max-width: 100%; overflow-x: hidden; }
}

@media (max-width: 700px) {
  .feature-card { grid-column: span 12; } /* 1-up */
  .tech-specs .tech-item { grid-column: span 6; } /* 2-up */
  .key-stats { grid-template-columns: 1fr; }
  .doc-header,
  .tab-panel,
  .centered-button-wrapper {
    padding-left: 16px;              /* safe gutters */
    padding-right: 16px;
  }
}

/* Accessibility focus */
.tabs button:focus-visible,
.back-to-projects-btn:focus-visible,
.feature-card:focus-within {
  outline: 2px dashed var(--secondary-color);
  outline-offset: 3px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .doc-header,
  .tab-panel,
  .feature-card,
  .key-stats .stat,
  .back-to-projects-btn {
    animation: none !important;
    transition: none !important;
  }
}

/* Simple fade keyframe (used above) */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
