/* ============================================================
   layout-app.css — App Shell Layout (Shared)
   ─────────────────────────────────────────
   PURPOSE : Global page structure shared between both simulators:
             body reset, .app wrapper, .brand header, .tab-bar.
   SCOPE   : Used by index.html AND visual_pathway.html.
   NOTE    : Do NOT add simulator-specific rules here.
   ============================================================ */

/* ── Reset & Box Model ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Matches body's --bg so the cross-document View Transition (see
     css/shared/animations.css) never crossfades over bare white canvas
     during the brief gap before the new document paints. */
  background: var(--bg);
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── App Wrapper ── */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

/* ── Site Header (Sticky Global Navigation Wrapper) ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  flex-shrink: 0;
  width: 100%;
  /* NOTE: deliberately no view-transition-name here. A shared name would
     make the cross-document View Transition (css/shared/animations.css)
     treat every page's header as "the same element" and morph one into the
     other — but the four pages' headers are not actually identical (
     different brand-mark SVG geometry, "Pupilla" vs "EyeExam Lab" wordmark,
     different extra controls in .brand), so the morph visibly warped/
     stretched the header between pages. Plain root crossfade only. */
}

/* ── Brand Header (Strict Pixel-Perfect Height Across All Pages) ── */
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 64px;
  min-height: 64px;
  max-height: 64px;
  box-sizing: border-box;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-soft);
  flex-shrink: 0;
  background: var(--surface);
  position: relative;
  z-index: 10;
  margin: 0;
}

.brand-mark {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.brand-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.brand-text h1 {
  font-family: 'Fraunces', Georgia, serif;
  font-optical-sizing: auto;
  font-size: clamp(1.05rem, 2vw, 1.2rem);
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0;
}

.brand-text p {
  font-size: 0.76rem;
  color: var(--text-soft);
  margin: 2px 0 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.brand-text .ret-disclaimer {
  display: none; /* Hide 3rd line disclaimer from header to preserve uniform 64px height */
}

@media (max-width: 640px) {
  .brand {
    height: auto;
    min-height: 56px;
    max-height: none;
    padding: 8px 14px;
    gap: 10px;
    flex-wrap: wrap;
  }
  .brand-mark {
    width: 30px;
    height: 30px;
  }
  .mode-toggle-wrap {
    width: 100%;
    margin-left: 0 !important;
    justify-content: flex-end;
    padding-top: 6px;
    border-top: 1px dashed var(--border-soft);
  }
}

/* ── Tab Bar (Responsive, Swipeable on Mobile, 46px Fixed Height) ── */
.tab-bar {
  display: flex;
  align-items: stretch;
  gap: 4px;
  height: 46px;
  min-height: 46px;
  max-height: 46px;
  box-sizing: border-box;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-soft);
  flex-shrink: 0;
  background: var(--surface);
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
  position: relative;
  z-index: 9;
  margin: 0;
}

.tab-bar::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Edge */
}

.tab-btn {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-soft);
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 0 16px;
  height: 100%;
  box-sizing: border-box;
  cursor: pointer;
  border-radius: 6px 6px 0 0;
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-shrink: 0;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  position: relative; /* Ensure ::before aligns correctly */
}

.tab-btn.badge-soon-link {
  padding-inline-end: 38px;
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

.tab-btn.badge-soon-link::before {
  content: attr(data-badge);
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  inset-inline-end: 8px;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1;
  padding: 3px 5px;
  border-radius: 4px;
  background: var(--mark-catch, #FEB536);
  color: var(--mark-disc, #043E3D);
  text-transform: uppercase;
  letter-spacing: 0.2px;
  box-shadow: 0 1px 3px rgba(254, 181, 54, 0.4), 0 1px 2px rgba(0,0,0,0.1);
  border: 1px solid rgba(254, 181, 54, 0.6);
  pointer-events: none;
  z-index: 1;
}

html[dir="rtl"] .tab-btn.badge-soon-link::before {
  letter-spacing: normal;
  font-family: 'IBM Plex Sans Arabic', 'Tajawal', 'Inter', system-ui, sans-serif;
}

.tab-btn:hover {
  color: var(--text);
  background: var(--surface-sunken);
}

.tab-btn:active {
  transform: scale(0.97);
}

.tab-btn.active {
  color: var(--accent-strong);
  border-bottom-color: var(--accent);
  background: var(--accent-tint);
  box-shadow: inset 0 -2px 0 var(--accent);
}

/* ── Persistent simulator stage ──────────────────────────────── */
.app-external-workspace {
  --app-workspace-height: max(480px, calc(100dvh - 110px));
  position: relative;
  width: 100%;
  height: var(--app-workspace-height);
  min-height: 480px;
  overflow: hidden;
  background: var(--bg);
  isolation: isolate;
}

.app-module-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--bg);
  opacity: 0;
  transition: opacity 160ms ease-out;
}

.app-module-frame.app-module-frame--active {
  opacity: 1;
}

.app-module-frame[hidden] {
  display: none;
}

/* The root shell owns the header; embedded modules render only their work. */
html.app-embedded .site-header {
  display: none;
}

.tab-btn.tab-btn-soon {
  color: var(--text-soft);
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.tab-btn.tab-btn-soon:hover {
  background: transparent;
  color: var(--text-soft);
}

.tab-btn-soon-badge {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--surface-sunken);
  color: var(--text-soft);
  border-radius: 999px;
  padding: 2px 7px;
  line-height: 1.4;
}

.page-soon-overlay {
  position: fixed;
  inset: 0;
  top: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg, #0b0e14);
  padding: 24px;
  text-align: center;
}

.page-soon-overlay__card {
  max-width: 420px;
}

.page-soon-overlay__badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--accent-tint);
  color: var(--accent-strong);
  border-radius: 999px;
  padding: 4px 12px;
  margin-bottom: 14px;
}

.page-soon-overlay__title {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 8px;
}

.page-soon-overlay__desc {
  font-size: 0.92rem;
  color: var(--text-soft);
  margin: 0 0 20px;
}

.page-soon-overlay__back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.86rem;
  color: var(--accent-strong);
  background: var(--accent-tint);
  border-radius: 8px;
  padding: 9px 18px;
}

@media (max-width: 640px) {
  .tab-bar {
    padding: 6px 12px 0;
    gap: 4px;
  }
  .tab-btn {
    font-size: 0.8rem;
    padding: 7px 12px 9px;
  }
}

