/* ═══════════ PAGE TRACK (stacked pages, click-navigated) ═══════════ */
html, body {
  overflow: hidden;
  height: 100vh;
  width: 100%;
}
.page-track {
  position: relative;
  overflow: hidden;
  height: 100vh;
  width: 100%;
}

/* ═══════════ INDIVIDUAL PAGES (stacked, only active visible) ═══════════ */
.page {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100vh;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  overflow: hidden;
}
.page.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.page::after {
  content: "Reasoner Confidential";
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: .6875rem;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--t3);
  pointer-events: none;
}

/* ═══════════ PAGE INNER (vertical centering) ═══════════ */
.page-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 48px 24px 80px;
}

/* ═══════════ PAGE CONTENT (max-width column with overflow) ═══════════ */
.page-content {
  max-width: 740px;
  width: 100%;
  max-height: 100vh;
  zoom: 0.8;
  overflow-y: auto;
  scrollbar-width: none;            /* Firefox */
  -ms-overflow-style: none;         /* IE/Edge */
}
.page-content::-webkit-scrollbar {
  display: none;                    /* Chrome/Safari */
}

/* ═══════════ SCROLL FADE HINT ═══════════ */
.page-inner {
  position: relative;
}
.page-inner::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: linear-gradient(to bottom, transparent, var(--bg));
  pointer-events: none;
  opacity: 0;
  transition: opacity 300ms ease;
  z-index: 2;
}
.page.has-scroll-below .page-inner::after {
  opacity: 1;
}

/* ═══════════ SCROLL HINT ARROW ═══════════ */
.scroll-hint {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) scale(0.92);
  z-index: 3;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 0.5px solid rgba(0,0,0,0.06);
  border-radius: 50%;
  box-shadow:
    0 0.5px 1px rgba(0,0,0,0.04),
    0 2px 8px rgba(0,0,0,0.06),
    0 0 0 0.5px rgba(0,0,0,0.03);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 350ms var(--apple-ease),
    transform 350ms var(--apple-ease),
    box-shadow 200ms var(--apple-ease);
  color: rgba(0,0,0,0.45);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  view-transition-name: none;
}
.scroll-hint.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) scale(1);
  will-change: transform;
}
.scroll-hint:hover {
  box-shadow:
    0 0.5px 1px rgba(0,0,0,0.04),
    0 4px 12px rgba(0,0,0,0.1),
    0 0 0 0.5px rgba(0,0,0,0.04);
}
.scroll-hint:active {
  transform: translateX(-50%) scale(0.95);
  transition-duration: 80ms;
}
.scroll-hint svg {
  display: block;
  width: 16px;
  height: 16px;
}
@media print {
  .scroll-hint { display: none !important; }
}

/* ═══════════ HERO PAGE ═══════════ */
.hero-inner {
  max-width: 740px;
  width: 100%;
}
#hero .page-inner {
  align-items: center;
  justify-content: center;
}
#hero h1 {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
  font-size: 2.75rem;
  font-weight: 700;
  letter-spacing: -.03em;
  line-height: 1.1;
  color: var(--t1);
  margin-bottom: 16px;
}
.hero-subtitle {
  font-size: 1.25rem;
  color: var(--t2);
  line-height: 1.5;
  max-width: 540px;
  margin-bottom: 48px;
}

/* ═══════════ PER-LEVEL ACCENT TINTS ═══════════ */
.level-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: -1;
  opacity: 0;
  transition: opacity 600ms var(--apple-ease);
}
.level-section.is-active::before { opacity: 1; }
[data-level="0"]::before { background: rgba(255,59,48,.015); }
[data-level="1"]::before { background: rgba(0,113,227,.015); }
[data-level="2"]::before { background: rgba(255,149,0,.015); }
[data-level="3"]::before { background: rgba(255,59,48,.015); }
[data-level="4"]::before { background: rgba(52,199,89,.015); }
[data-level="5"]::before { background: rgba(88,86,214,.015); }
[data-level="6"]::before { background: rgba(88,86,214,.015); }

/* summary pages get a subtle gradient background */
.summary-page::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, var(--bg) 0%, var(--surface) 100%);
  z-index: -1;
}

/* ═══════════ PAGE NAV (centered bottom, macOS native style) ═══════════ */
.page-nav {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  background: rgba(246,246,246,0.72);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 0.5px solid rgba(0,0,0,0.12);
  border-radius: 9px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 0.5px 1px rgba(0,0,0,0.04);
  cursor: pointer;
  transition: background-color 150ms ease, box-shadow 150ms ease;
}
.page-nav:hover {
  background: rgba(246,246,246,0.88);
  box-shadow: 0 2px 6px rgba(0,0,0,0.1), 0 0.5px 1px rgba(0,0,0,0.06);
}
.page-nav:active {
  background: rgba(232,232,232,0.82);
  box-shadow: 0 0.5px 1px rgba(0,0,0,0.06);
  transform: translateX(-50%) scale(0.98);
}
.page-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: rgba(0,0,0,0.5);
  cursor: pointer;
  transition: background-color 100ms ease, color 100ms ease;
  padding: 0;
  -webkit-appearance: none;
}
.page-nav-btn:hover:not(:disabled) {
  background: rgba(0,0,0,0.04);
  color: rgba(0,0,0,0.7);
}
.page-nav-btn:active:not(:disabled) {
  background: rgba(0,0,0,0.08);
  color: rgba(0,0,0,0.85);
}
.page-nav-btn:disabled {
  opacity: 0.2;
  cursor: default;
}
.page-nav-prev:disabled {
  visibility: hidden;
}
.page-nav-label {
  font-size: .8125rem;
  font-weight: 500;
  letter-spacing: -0.008em;
  color: rgba(0,0,0,0.55);
  min-width: 84px;
  text-align: center;
  padding: 0 8px;
  white-space: nowrap;
  transition: opacity 200ms ease;
  user-select: none;
  cursor: pointer;
}

.page-nav-menu[hidden] {
  visibility: hidden;
  pointer-events: none;
}

/* ═══════════ SECTION MENU TRIGGER ═══════════ */
.page-nav-menu {
  margin-left: 2px;
  border-left: 0.5px solid rgba(0,0,0,0.08);
  border-radius: 0 5px 5px 0;
  padding-left: 2px;
}
.page-nav-menu[aria-expanded="true"] {
  background: rgba(0,0,0,0.06);
  color: rgba(0,0,0,0.7);
}

/* ═══════════ SECTION MENU PANEL ═══════════ */
.section-menu {
  position: fixed;
  bottom: 68px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  background: rgba(246,246,246,0.88);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 0.5px solid rgba(0,0,0,0.12);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12), 0 1px 3px rgba(0,0,0,0.06);
  min-width: 240px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease, transform 150ms ease;
}
.section-menu.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.section-menu[hidden] {
  display: none;
}

/* Menu title */
.section-menu-title {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
  font-size: .6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: rgba(0,0,0,0.35);
  padding: 4px 12px 2px;
  user-select: none;
}

/* Menu items */
.section-menu-item {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 7px 12px;
  border: none;
  border-radius: 7px;
  background: transparent;
  font-family: inherit;
  font-size: .8125rem;
  font-weight: 500;
  color: rgba(0,0,0,0.65);
  text-align: left;
  cursor: pointer;
  transition:
    background-color 180ms var(--apple-ease),
    color 180ms var(--apple-ease),
    transform 120ms var(--apple-ease),
    box-shadow 180ms var(--apple-ease);
}
.section-menu-item:hover {
  background: rgba(0,0,0,0.04);
  color: rgba(0,0,0,0.85);
  transform: translateX(2px);
}
.section-menu-item:active {
  background: rgba(0,0,0,0.08);
  color: var(--t1);
  transform: translateX(2px) scale(0.98);
  transition-duration: 60ms;
}
.section-menu-item.is-current {
  color: var(--blue);
  font-weight: 600;
}
a.section-menu-home {
  text-decoration: none;
}
.section-menu-home {
  font-size: .6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: rgba(0,0,0,0.35);
  padding: 4px 12px 4px;
  margin-bottom: 2px;
}
.section-menu-home:hover {
  color: rgba(0,0,0,0.55);
}
.section-menu-home .smi-desc {
  text-transform: none;
  letter-spacing: 0;
}

/* Menu item hover description */
.smi-desc {
  display: block;
  font-size: .6875rem;
  font-weight: 400;
  color: rgba(0,0,0,0.35);
  line-height: 1.35;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transform: translateY(-2px);
  transition:
    max-height 250ms var(--apple-ease),
    opacity 200ms var(--apple-ease),
    transform 200ms var(--apple-ease),
    color 180ms var(--apple-ease);
  pointer-events: none;
}
.section-menu-item:hover .smi-desc {
  max-height: 3.5em;
  opacity: 1;
  transform: translateY(0);
  margin-top: 2px;
}
.section-menu-item:active .smi-desc {
  color: rgba(0,0,0,0.45);
}
.section-menu-item.is-current .smi-desc {
  color: rgba(0,113,227,0.5);
}
.section-menu-item.is-current:hover .smi-desc {
  color: rgba(0,113,227,0.65);
}

/* Level chip row */
.section-menu-levels {
  display: flex;
  gap: 4px;
  padding: 4px 8px;
  justify-content: center;
}
.section-menu-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 7px;
  background: transparent;
  font-family: inherit;
  font-size: .75rem;
  font-weight: 600;
  color: rgba(0,0,0,0.5);
  cursor: pointer;
  transition: background-color 100ms ease, color 100ms ease, border-color 100ms ease, transform 80ms ease;
}
.section-menu-chip:hover {
  border-color: var(--chip-accent, rgba(0,0,0,0.15));
  color: var(--chip-accent, rgba(0,0,0,0.8));
  background: color-mix(in srgb, var(--chip-accent, #000) 8%, transparent);
  transform: scale(1.05);
}
.section-menu-chip:active {
  background: color-mix(in srgb, var(--chip-accent, #000) 15%, transparent);
  transform: scale(0.95);
}
.section-menu-chip.is-current {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

/* Level chip hover description (matches smi-desc pattern) */
.sml-desc {
  font-size: .6875rem;
  font-weight: 400;
  color: rgba(0,0,0,0.35);
  line-height: 1.35;
  text-align: center;
  padding: 0 12px;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transform: translateY(-2px);
  transition:
    max-height 250ms var(--apple-ease),
    opacity 200ms var(--apple-ease),
    transform 200ms var(--apple-ease);
}
.sml-desc.is-visible {
  max-height: 2em;
  opacity: 1;
  transform: translateY(0);
  margin-top: 2px;
}

/* ═══════════ LEVEL SECTIONS (within pages) ═══════════ */
.level-section .page-content {
  padding-top: 0;
}

/* ═══════════ RESPONSIVE — TABLET ═══════════ */
@media (max-width: 1024px) {
  .page-inner {
    padding: 40px 24px 72px;
  }
}

/* ═══════════ RESPONSIVE — MOBILE ═══════════ */
@media (max-width: 768px) {
  html, body, .page-track, .page { width: 100%; height: 100vh; height: 100dvh; }
  html, body { overscroll-behavior: none; }
  .page { touch-action: manipulation; }
  .page-content { zoom: 1; max-height: calc(100vh - 128px); max-height: calc(100dvh - 128px); }

  .page-inner {
    padding: 32px 16px 56px;
    padding-top: 32px;
    padding-top: max(32px, env(safe-area-inset-top));
  }
  #hero h1 { font-size: 2rem; }
  .hero-subtitle { font-size: 1.0625rem; }

  .section-menu-levels {
    flex-wrap: wrap;
    max-width: calc(100vw - 48px);
  }
  .page-nav {
    bottom: 16px;
    bottom: max(16px, env(safe-area-inset-bottom));
    padding: 3px;
  }
  .page-nav-btn {
    width: 44px;
    height: 44px;
    border-radius: 8px;
  }
  .page-nav-btn svg { width: 24px; height: 24px; }
  .page-nav-label {
    font-size: .75rem;
    min-width: 72px;
    width: auto;
  }
  .section-menu {
    bottom: 72px;
    bottom: calc(max(16px, env(safe-area-inset-bottom)) + 56px);
    min-width: 260px;
  }
  .section-menu-chip {
    width: 44px;
    height: 44px;
    font-size: .75rem;
    border-radius: 10px;
  }
  .section-menu-item {
    font-size: .8125rem;
    padding: 12px 16px;
    min-height: 44px;
  }
  .smi-desc {
    max-height: 3.5em;
    opacity: 1;
    transform: none;
    margin-top: 2px;
  }

  .page-inner {
    padding-bottom: 88px;
    padding-bottom: calc(56px + max(16px, env(safe-area-inset-bottom)) + 16px);
  }
  .page-content { overscroll-behavior: none; }

  .page-nav-btn, .page-nav-label, .section-menu-chip, .section-menu-item { touch-action: manipulation; }

  .scroll-hint {
    bottom: calc(56px + max(16px, env(safe-area-inset-bottom)) + 24px);
  }
}

/* ═══════════ TOUCH DEVICE RESETS ═══════════ */
@media (hover: none) {
  .page-nav:hover {
    background: rgba(246,246,246,0.72);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 0.5px 1px rgba(0,0,0,0.04);
  }
  .page-nav-btn:hover:not(:disabled) {
    background: transparent;
    color: rgba(0,0,0,0.5);
  }
  .section-menu-item:hover {
    background: transparent;
    color: rgba(0,0,0,0.65);
    transform: none;
  }
  .section-menu-chip:hover {
    background: transparent;
    border-color: rgba(0,0,0,0.08);
    color: rgba(0,0,0,0.5);
    transform: none;
  }
  .section-menu-chip:active {
    border-color: var(--chip-accent, rgba(0,0,0,0.15));
    color: var(--chip-accent, rgba(0,0,0,0.8));
    background: color-mix(in srgb, var(--chip-accent, #000) 8%, transparent);
  }
}
