/* ============================================================
   Shared components
   ============================================================ */

.site-header {
  border-bottom: 1px solid var(--rule);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-decoration: none;
  color: var(--text);
  order: 1;
}

.brand-title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 17px;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  order: 2;
}

.main-nav a {
  font-size: 14px;
  text-decoration: none;
  color: var(--text-secondary);
  padding: 8px 12px;
  border-radius: var(--r-xs);
  transition:
    color var(--dur) var(--ease),
    background var(--dur) var(--ease);
  white-space: nowrap;
}

.main-nav a:hover {
  color: var(--text);
  background: var(--bg);
}

.main-nav a[aria-current="page"] {
  color: var(--accent);
  font-weight: 500;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  order: 3;
}

.nav-toggle {
  display: none;
  width: 36px;
  height: 36px;
  border: 1px solid var(--rule);
  border-radius: var(--r-xs);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 16px;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--rule);
  border-radius: var(--r-xs);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  transition:
    border-color var(--dur) var(--ease),
    color var(--dur) var(--ease);
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.search-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--rule);
  border-radius: var(--r-xs);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  transition:
    border-color var(--dur) var(--ease),
    color var(--dur) var(--ease);
}

.search-toggle:hover,
.search-toggle[aria-expanded="true"] {
  border-color: var(--accent);
  color: var(--accent);
}

.site-search-panel {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
  box-shadow: 0 12px 24px -12px rgba(0, 0, 0, 0.2);
}

.site-search-panel-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 24px 20px;
}

.site-search-input {
  width: 100%;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: var(--r-xs);
  padding: 10px 14px;
}

.site-search-input:focus {
  outline: none;
  border-color: var(--accent);
}

.site-search-results {
  margin-top: 12px;
  max-height: 60vh;
  overflow-y: auto;
}

.site-search-result {
  display: flex;
  gap: 12px;
  align-items: baseline;
  padding: 10px 4px;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
  color: inherit;
}

.site-search-result:last-child {
  border-bottom: none;
}

.site-search-result:hover {
  background: var(--bg);
}

.site-search-result-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.site-search-result-title {
  font-size: 14px;
  color: var(--text);
}

.site-search-result-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.site-search-empty {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 4px;
}

.theme-toggle .icon-sun {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: inline;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

@media (max-width: 860px) {
  .main-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--surface);
    border-bottom: 1px solid var(--rule);
    padding: 8px;
    display: none;
  }

  .main-nav.open {
    display: flex;
  }

  .main-nav a {
    padding: 12px 14px;
  }

  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

.ecg-divider {
  width: 100%;
  height: 22px;
  display: block;
  margin: 24px 0;
}

.ecg-divider path {
  fill: none;
  stroke: var(--rule);
  stroke-width: 1.5;
}

.hero {
  padding: 64px 0 48px;
}

.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  display: block;
  margin-bottom: 14px;
}

.hero h1 {
  font-size: 44px;
  max-width: 820px;
}

.hero p {
  font-size: 17px;
  color: var(--text-secondary);
  max-width: 640px;
}

.index-list {
  border-top: 1px solid var(--rule);
  margin: 40px 0 64px;
}

.index-row {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 26px 16px;
  border-bottom: 1px solid var(--rule);
  border-left: 3px solid transparent;
  text-decoration: none;
  color: var(--text);
  transition: border-color var(--dur) var(--ease);
}

.index-row:hover,
.index-row:focus-visible {
  border-left-color: var(--accent);
}

.index-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.index-num {
  flex-shrink: 0;
  width: 2.6ch;
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--text-secondary);
  transition: color var(--dur) var(--ease);
}

.index-row:hover .index-num {
  color: var(--accent);
}

.index-body {
  flex: 1 1 auto;
  min-width: 0;
}

.index-title {
  display: block;
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 6px;
}

.index-desc {
  display: block;
  font-size: 15px;
  color: var(--text-secondary);
}

.index-arrow {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 20px;
  color: var(--rule);
  transition:
    color var(--dur) var(--ease),
    transform var(--dur) var(--ease);
}

.index-row:hover .index-arrow {
  color: var(--accent);
  transform: translateX(4px);
}

@media (max-width: 480px) {
  .index-row {
    gap: 14px;
    padding: 20px 12px;
  }

  .index-title {
    font-size: 19px;
  }

  .index-arrow {
    display: none;
  }
}

.page-header {
  padding: 48px 0 8px;
}

.page-eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  display: block;
  margin-bottom: 10px;
}

.page-header h1 {
  font-size: 30px;
}

.page-intro {
  color: var(--text-secondary);
  font-size: 15px;
}

.image-carousel,
.assessment-gallery {
  position: relative;
  max-width: 480px;
  margin: 20px auto 28px;
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(26, 29, 27, 0.04);
}

.image-carousel-stage,
.assessment-gallery-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: linear-gradient(
    135deg,
    rgba(47, 111, 78, 0.08),
    rgba(47, 111, 78, 0.02)
  );
}

.image-carousel-stage img,
.assessment-gallery-stage img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease;
  background: rgba(255, 255, 255, 0.02);
  cursor: zoom-in;
}

.image-carousel-stage img.is-active,
.assessment-gallery-stage img.is-active {
  opacity: 1;
  pointer-events: auto;
}

.image-carousel-btn,
.gallery-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  background: rgba(21, 24, 26, 0.45);
  color: #fff;
  font-size: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
}

.image-carousel-btn:hover,
.gallery-btn:hover {
  background: rgba(21, 24, 26, 0.7);
}

.image-carousel-btn-prev,
.gallery-btn-prev {
  left: 16px;
}

.image-carousel-btn-next,
.gallery-btn-next {
  right: 16px;
}

.image-carousel-dots,
.gallery-dots {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 2;
}

.gallery-dot {
  width: 9px;
  height: 9px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  padding: 0;
}

.gallery-dot.is-active {
  background: #fff;
  box-shadow: 0 0 0 2px rgba(21, 24, 26, 0.2);
}

.gallery-section {
  margin: 28px 0 24px;
}

.gallery-section-label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  display: block;
  margin-bottom: 8px;
}

.gallery-section h2 {
  margin-bottom: 16px;
}

.gallery-legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.gallery-legend-item {
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
}

.gallery-legend-item h3 {
  font-size: 15px;
  margin-bottom: 8px;
}

.gallery-legend-item p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
}

.outline-nav {
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  background: var(--surface);
  padding: 20px 24px;
  margin: 24px 0 8px;
}

.outline-label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 10px;
}

.outline-nav ol {
  list-style: none;
  margin: 0;
  padding: 0;
  columns: 2;
  column-gap: 24px;
}

@media (max-width: 640px) {
  .outline-nav ol {
    columns: 1;
  }
}

.outline-nav li {
  break-inside: avoid;
  padding: 5px 0;
  font-size: 13.5px;
}

.outline-nav a {
  color: var(--text-secondary);
  text-decoration: none;
}

.outline-nav a:hover {
  color: var(--accent);
}

.topic-section {
  padding-top: 8px;
  margin-top: 48px;
  scroll-margin-top: 88px;
}

.topic-section > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.topic-section > summary::-webkit-details-marker {
  display: none;
}

.topic-section > summary h2 {
  margin: 0;
}

.topic-section > summary::after {
  content: "\2212";
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 20px;
  line-height: 1;
  color: var(--accent);
}

.topic-section:not([open]) > summary::after {
  content: "+";
}

.topic-section > summary:hover h2 {
  color: var(--accent);
}

.refs {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
}

.refs li {
  display: flex;
  gap: 14px;
  align-items: baseline;
  padding: 14px 0;
  border-bottom: 1px solid var(--rule);
}

.refs li:last-child {
  border-bottom: none;
}

.grade {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  padding: 3px 7px;
  border-radius: var(--r-xs);
  color: var(--surface);
  background: var(--accent);
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.grade.b {
  background: var(--amber);
}

.grade.c {
  background: var(--text-secondary);
}

.ref-text {
  font-size: 14px;
}

.ref-text a {
  text-decoration-color: var(--rule);
}

.resource-list {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
}

.resource-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 14px;
}

.resource-list li:last-child {
  border-bottom: none;
}

.resource-type {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--surface);
  background: var(--text-secondary);
  padding: 2px 6px;
  border-radius: var(--r-xs);
}

.resource-list a,
.resource-list span.resource-name {
  flex: 1;
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--rule);
}

.resource-list span.resource-name {
  text-decoration: none;
  color: var(--text-secondary);
  font-style: italic;
}

.pdf-preview {
  margin: 28px 0 32px;
}

.pdf-preview h3 {
  font-size: 16px;
  margin-bottom: 10px;
}

.pdf-preview iframe {
  display: block;
  width: 100%;
  height: 620px;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: var(--surface);
}

.pdf-fallback {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 8px 0 0;
}

.content-figure {
  margin: 32px 0;
}

.content-figure img {
  width: 100%;
  height: auto;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: var(--surface);
}

.content-figure figcaption {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.content-figure--narrow {
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.content-figure-zoom {
  display: block;
  cursor: zoom-in;
}

.interactive-deck {
  margin: 32px 0 40px;
}

.interactive-deck-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.interactive-deck-header h3 {
  font-size: 17px;
  margin: 0;
}

.interactive-deck iframe {
  display: block;
  width: 100%;
  height: min(620px, 70vh);
  min-height: 420px;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: var(--surface);
}

.notice-banner {
  display: flex;
  gap: 14px;
  align-items: baseline;
  border-left: 3px solid var(--amber);
  background: var(--surface);
  padding: 14px 18px;
  margin: 16px 0 24px;
}

.notice-tag {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--amber);
  flex-shrink: 0;
}

.notice-banner p {
  margin: 0;
  font-size: 14px;
}

.video-frame {
  position: relative;
  padding-top: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: var(--r-md);
  border: 1px solid var(--rule);
  margin: 20px 0 32px;
  background: var(--rule);
}

.video-frame iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-caption {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: -20px;
  margin-bottom: 32px;
}

.faculty-card {
  max-width: 320px;
}

.faculty-name {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 600;
}

.faculty-role {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

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