/* ============================================================
   WIKI LAYOUT — Shared styles for Identify Inputs pages
   ============================================================ */

/* ---- Scroll progress bar ---- */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--exeter-yellow);
  z-index: 1001;
  width: 0%;
  transition: width 80ms linear;
}

/* ---- Site header (white, aligned with Phase 01/02) ---- */
.wiki-site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  height: var(--header-height);
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border-light);
}
.wiki-site-header__inner {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
}
.wiki-site-header__logo {
  height: 32px;
  width: auto;
}
.wiki-site-header__title {
  font-family: var(--font-heading);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-left: var(--space-md);
  white-space: nowrap;
}
.wiki-site-header__hub {
  margin-left: auto;
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.wiki-site-header__hub:hover { color: var(--text-primary); }

/* ---- Two-column wiki grid ---- */
.wiki-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: calc(100vh - var(--header-height));
}

/* ---- Sidebar ---- */
.wiki-sidebar {
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  border-right: 1px solid var(--grey-100);
  background: var(--grey-50, #FCFCFB);
  padding: var(--space-lg) 0;
  scrollbar-width: thin;
  scrollbar-color: var(--grey-200) transparent;
}
.wiki-sidebar::-webkit-scrollbar { width: 4px; }
.wiki-sidebar::-webkit-scrollbar-thumb { background: var(--grey-200); border-radius: 2px; }

.wiki-toc { list-style: none; padding: 0; margin: 0; }
.wiki-toc__heading {
  font-family: var(--font-heading);
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--grey-400);
  padding: var(--space-md) var(--space-lg) var(--space-xs);
}
.wiki-toc__link {
  display: block;
  padding: 6px var(--space-lg);
  font-size: 0.8125rem;
  color: var(--charcoal);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: all 0.15s ease;
  line-height: 1.4;
}
.wiki-toc__link:hover {
  background: rgba(0,0,0,0.03);
  color: var(--near-black);
}
.wiki-toc__link--active {
  border-left-color: var(--exeter-yellow);
  color: var(--near-black);
  font-weight: 600;
  background: rgba(255, 237, 0, 0.06);
}
.wiki-toc__link--nested {
  padding-left: calc(var(--space-lg) + 14px);
  font-size: 0.75rem;
  color: var(--grey-400);
}
.wiki-toc__link--nested:hover { color: var(--charcoal); }
.wiki-toc__link--nested.wiki-toc__link--active {
  color: var(--near-black);
  font-weight: 600;
}
.wiki-toc__divider {
  height: 1px;
  background: var(--grey-100);
  margin: var(--space-sm) var(--space-lg);
}

/* Mobile sidebar toggle */
.wiki-sidebar-toggle {
  display: none;
  position: fixed;
  bottom: var(--space-lg);
  left: var(--space-lg);
  z-index: 200;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--near-black);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
  font-size: 1.2rem;
  line-height: 1;
  align-items: center;
  justify-content: center;
}
.wiki-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 149;
  background: rgba(0,0,0,0.4);
}

/* ---- Content area ---- */
.wiki-content {
  min-width: 0;
  padding: 0 var(--space-2xl) var(--space-3xl);
  max-width: 960px;
}

/* ---- Compact page header ---- */
.wiki-header {
  padding: var(--space-2xl) 0 var(--space-xl);
  border-bottom: 1px solid var(--grey-100);
  margin-bottom: var(--space-2xl);
}
.wiki-header__breadcrumb {
  font-family: var(--font-heading);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--grey-400);
  text-decoration: none;
}
.wiki-header__breadcrumb:hover { color: var(--charcoal); }
.wiki-header__title {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 900;
  color: var(--near-black);
  margin: var(--space-sm) 0 var(--space-xs);
  line-height: 1.2;
}
.wiki-header__subtitle {
  font-size: 1.1rem;
  font-weight: 300;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ---- Section headings with yellow left border ---- */
.wiki-section {
  padding-top: var(--space-2xl);
  margin-top: var(--space-xl);
}
.wiki-section:first-of-type {
  margin-top: 0;
  padding-top: 0;
}
.wiki-section__heading {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--near-black);
  padding-left: var(--space-md);
  border-left: 4px solid var(--exeter-yellow);
  margin-bottom: var(--space-lg);
  line-height: 1.3;
  scroll-margin-top: 72px;
}
.wiki-section__intro {
  font-size: 1rem;
  font-weight: 300;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 680px;
  margin-bottom: var(--space-xl);
}

/* ---- Stat row (static) ---- */
.wiki-stat-row {
  display: flex;
  gap: var(--space-xl);
  flex-wrap: wrap;
  margin: var(--space-xl) 0;
  padding: var(--space-lg) 0;
  border-top: 1px solid var(--grey-100);
  border-bottom: 1px solid var(--grey-100);
}
.wiki-stat-row__item { text-align: center; min-width: 100px; }
.wiki-stat-row__number {
  font-family: var(--font-heading);
  font-size: 2.25rem;
  font-weight: 900;
  color: var(--near-black);
  line-height: 1;
}
.wiki-stat-row__label {
  font-family: var(--font-heading);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--grey-400);
  margin-top: var(--space-xs);
}

/* ---- Collapsible table groups ---- */
.wiki-details {
  border: 1px solid var(--grey-100);
  border-radius: 4px;
  margin-bottom: var(--space-md);
  background: #fff;
  scroll-margin-top: 72px;
}
.wiki-details[open] {
  border-color: var(--grey-200);
}
.wiki-details__summary {
  padding: var(--space-md) var(--space-lg);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  user-select: none;
}
.wiki-details__summary::-webkit-details-marker { display: none; }
.wiki-details__summary::before {
  content: '\25B6';
  font-size: 0.55rem;
  color: var(--grey-300);
  transition: transform 0.15s ease;
  flex-shrink: 0;
}
.wiki-details[open] > .wiki-details__summary::before {
  transform: rotate(90deg);
}
.wiki-details__title {
  font-family: var(--font-heading);
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--charcoal);
}
.wiki-details__count {
  font-size: 0.6875rem;
  color: var(--grey-400);
  margin-left: auto;
}
.wiki-details__body {
  padding: 0 var(--space-lg) var(--space-lg);
}

/* ---- Compact comparison-table ---- */
.comparison-table--compact { font-size: 0.8125rem; }
.comparison-table--compact thead th {
  padding: var(--space-sm) var(--space-md);
  font-size: 0.7rem;
}
.comparison-table--compact tbody td {
  padding: var(--space-sm) var(--space-md);
  font-size: 0.8125rem;
  line-height: 1.5;
}
.comparison-table--compact tbody td:first-child {
  font-weight: 600;
  white-space: nowrap;
}

/* ---- Table scroll wrapper ---- */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ---- Root cause cards ---- */
.root-cause-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
  margin-top: var(--space-xl);
}
.root-cause-card {
  background: var(--grey-50, #FCFCFB);
  border-radius: 4px;
  padding: var(--space-lg);
  border: 1px solid var(--grey-100);
  border-top: 3px solid var(--exeter-yellow);
}
.root-cause-card__title {
  font-family: var(--font-heading);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--near-black);
  margin-bottom: var(--space-sm);
}
.root-cause-card__list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.root-cause-card__list li {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  padding: 4px 0;
  border-bottom: 1px solid var(--grey-100);
}
.root-cause-card__list li:last-child { border-bottom: none; }

/* ---- Insight callout override ---- */
.insight-callout { margin-top: var(--space-xl); }

/* ---- Key finding (light theme) ---- */
.wiki-key-finding {
  background: var(--grey-50, #FCFCFB);
  border-left: 4px solid var(--exeter-yellow);
  border-radius: 4px;
  padding: var(--space-xl);
  margin: var(--space-xl) 0;
}
.wiki-key-finding__text {
  font-size: 1.05rem;
  font-weight: 400;
  color: var(--near-black);
  line-height: 1.6;
  max-width: 700px;
}

/* ---- Text blocks ---- */
.wiki-text p {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: var(--space-md);
  max-width: 680px;
}

/* ---- Process Related tables ---- */
.wiki-rc-tables {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
  margin-top: var(--space-xl);
}
.wiki-rc-table__title {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--charcoal);
  margin-bottom: var(--space-sm);
}

/* ---- Footer ---- */
.wiki-footer {
  padding: var(--space-2xl) 0;
  border-top: 1px solid var(--grey-100);
  margin-top: var(--space-3xl);
  text-align: center;
}
.wiki-footer__link {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--charcoal);
  text-decoration: none;
}
.wiki-footer__link:hover { color: var(--near-black); }

/* ---- Page nav (prev/next) ---- */
.wiki-page-nav {
  display: flex;
  justify-content: space-between;
  gap: var(--space-lg);
  padding: var(--space-xl) 0;
  border-top: 1px solid var(--grey-100);
  margin-top: var(--space-3xl);
}
.wiki-page-nav__item {
  text-decoration: none;
  color: inherit;
}
.wiki-page-nav__item--next {
  margin-left: auto;
  text-align: right;
}
.wiki-page-nav__label {
  font-family: var(--font-heading);
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--grey-400);
  margin-bottom: 4px;
}
.wiki-page-nav__title {
  font-family: var(--font-heading);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--near-black);
}
.wiki-page-nav__item:hover .wiki-page-nav__title {
  color: var(--charcoal);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .wiki-layout {
    grid-template-columns: 1fr;
  }
  .wiki-sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: 280px;
    z-index: 150;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 2px 0 12px rgba(0,0,0,0.15);
  }
  .wiki-sidebar--open {
    transform: translateX(0);
  }
  .wiki-sidebar-toggle {
    display: flex;
  }
  .wiki-sidebar-overlay--visible {
    display: block;
  }
  .wiki-content {
    padding: 0 var(--space-lg) var(--space-2xl);
  }
}
@media (max-width: 768px) {
  .root-cause-grid { grid-template-columns: 1fr; }
  .wiki-rc-tables { grid-template-columns: 1fr; }
  .wiki-header__title { font-size: 1.5rem; }
  .wiki-stat-row { gap: var(--space-lg); }
}
