/* ============================================
   App Shell — Header, Stage, Footer, Overview
   Persistent UI around the active slide.
   ============================================ */

.app {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100dvh;
  overflow: hidden;
}

/* ===== Header ===== */
.app-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--space-6);
  padding: var(--space-4) var(--space-8);
  background: var(--surface-0);
  border-block-end: 1px solid var(--border-soft);
  z-index: 10;
}

.app-header__brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  justify-self: start;
}
.app-header__center  {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}
.app-header__actions { justify-self: end; display: inline-flex; gap: var(--space-2); }

/* Sub-section breadcrumb shown next to the chapter chip */
.section-breadcrumb {
  font-size: var(--text-small);
  color: var(--ink-900);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.section-breadcrumb:empty { display: none; }
.section-breadcrumb::before {
  content: "/";
  color: var(--slate-300);
  margin-inline-end: var(--space-2);
  font-weight: 400;
}

.brand-mark { height: 22px; width: auto; opacity: 0.95; }
.brand-mark--solugen { height: 20px; }
.brand-mark--tmura   { height: 26px; }
.brand-sep {
  color: var(--slate-300);
  font-size: 1.1rem;
  font-weight: 300;
  user-select: none;
}

/* Chapter chip (always visible, changes color per chapter) */
.chapter-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--chapter-tint);
  border-radius: var(--radius-full);
  font-size: var(--text-small);
  font-weight: 500;
  color: var(--ink-900);
  transition: background var(--duration-medium) var(--ease-out);
  white-space: nowrap;
}
.chapter-chip__dot {
  width: 8px;
  height: 8px;
  background: var(--chapter-accent);
  border-radius: 50%;
  transition: background var(--duration-medium) var(--ease-out);
}
.chapter-chip__eyebrow {
  color: var(--chapter-accent);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.chapter-chip__eyebrow:empty { display: none; }
.chapter-chip__eyebrow:not(:empty)::after {
  content: " ·";
  color: var(--slate-300);
}

/* Icon button (header) */
.icon-button {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--ink-900);
  border-radius: var(--radius-full);
  transition: all var(--duration-fast) var(--ease-out);
}
.icon-button:hover {
  background: var(--surface-50);
  color: var(--chapter-accent);
}

/* ===== Stage ===== */
.slide-stage {
  position: relative;
  overflow: hidden;
  background: var(--surface-50);
  contain: layout paint;
}
.slide-container {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

/* ===== Footer ===== */
.app-footer {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--space-6);
  padding: var(--space-3) var(--space-8);
  background: var(--surface-0);
  border-block-start: 1px solid var(--border-soft);
  z-index: 10;
}

.app-footer__nav {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.nav-arrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: transparent;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-full);
  color: var(--ink-900);
  font-size: var(--text-small);
  font-weight: 500;
  transition: all var(--duration-fast) var(--ease-out);
}
.nav-arrow:hover:not([disabled]) {
  background: var(--chapter-accent);
  border-color: var(--chapter-accent);
  color: var(--surface-0);
}
.nav-arrow[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Progress: one segment per chapter, fill ratio = slides passed in that chapter */
.app-footer__progress {
  width: 100%;
}
.progress-track {
  display: flex;
  gap: 4px;
  height: 4px;
  width: 100%;
}
.progress-track__segment {
  flex: 1;
  height: 100%;
  background: var(--overlay-08);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
  transition: background var(--duration-medium) var(--ease-out);
}
.progress-track__fill {
  height: 100%;
  width: 0%;
  /* each segment has data-chapter, which sets its own --chapter-accent
     via tokens.css. We just inherit that, so passed segments keep
     their own color and don't all turn green. */
  background: var(--chapter-accent);
  transition: width var(--duration-medium) var(--ease-out);
}

.app-footer__meta {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
}
.slide-counter {
  font-size: var(--text-small);
  color: var(--slate-500);
  font-variant-numeric: tabular-nums;
}

/* ===== Overview Panel ===== */
.overview-panel {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade-in var(--duration-medium) var(--ease-out);
}
.overview-panel__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 25, 49, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.overview-panel__content {
  position: relative;
  background: var(--surface-0);
  border-radius: var(--radius-xl);
  padding: var(--space-10) var(--space-12);
  max-width: 1100px;
  max-height: 85vh;
  width: 92%;
  overflow-y: auto;
  box-shadow: var(--shadow-strong);
  animation: lift-in var(--duration-medium) var(--ease-out);
}
.overview-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-block-end: var(--space-8);
}
.overview-panel__title {
  font-size: var(--text-h2);
  font-weight: 600;
}
.overview-panel__list {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

.overview-group__title {
  font-size: var(--text-small);
  font-weight: 600;
  color: var(--chapter-accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-block-end: var(--space-3);
  padding-block-end: var(--space-2);
  border-block-end: 1px solid var(--border-soft);
}
.overview-group__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-3);
}
.overview-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--surface-50);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  text-align: start;
  transition: all var(--duration-fast) var(--ease-out);
  cursor: pointer;
}
.overview-card:hover {
  background: var(--surface-0);
  border-color: var(--chapter-accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-soft);
}
.overview-card.is-current {
  background: var(--chapter-tint);
  border-color: var(--chapter-accent);
}
.overview-card__num {
  font-family: var(--font-display);
  font-size: var(--text-small);
  font-weight: 600;
  color: var(--chapter-accent);
  font-variant-numeric: tabular-nums;
  min-width: 24px;
}
.overview-card__title {
  font-size: var(--text-small);
  font-weight: 500;
}

/* Keyboard hint */
.kbd-hint {
  position: fixed;
  inset-block-end: var(--space-20);
  inset-inline-start: 50%;
  transform: translateX(50%);
  background: var(--ink-900);
  color: var(--surface-0);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-full);
  font-size: var(--text-small);
  display: flex;
  gap: var(--space-2);
  align-items: center;
  box-shadow: var(--shadow-medium);
  animation: fade-in var(--duration-slow) var(--ease-out);
}
.kbd-hint kbd {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: none;
  color: var(--mint-500);
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes lift-in {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== Responsive ===== */
@media (max-width: 720px) {
  .app-header { grid-template-columns: 1fr auto; padding: var(--space-3) var(--space-4); }
  .app-header__center { display: none; }   /* chip moves into footer on mobile */
  .app-footer { grid-template-columns: 1fr; gap: var(--space-2); padding: var(--space-3) var(--space-4); }
  .app-footer__nav { justify-self: center; }
  .app-footer__meta { justify-self: center; }
  .nav-arrow span { display: none; }       /* icon-only on mobile */
  .nav-arrow { width: 40px; height: 40px; padding: 0; justify-content: center; }
}
