/* ============================================================
   HARVEST · LAYOUT
   App shell, header, footer, stage, progress strip
   ============================================================ */

.skip-link {
  position: absolute;
  top: -100px;
  left: 8px;
  background: var(--green);
  color: var(--paper);
  padding: 12px 20px;
  z-index: 9999;
  border-radius: var(--r-sm);
  text-decoration: none;
  font-weight: 600;
  transition: top var(--t-fast) var(--ease);
}
.skip-link:focus { top: 8px; }

.app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: var(--sp-4) var(--gutter);
}

/* ─── Header ─────────────────────────────────────────────────── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-4);
  background: var(--paper);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  border-top: 3px solid var(--fs-primary);
  flex-wrap: wrap;
  gap: var(--sp-3);
}
.brand-block { display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap; }

/* ─── Co-branded lockup: Faith Schooling parent + HARVEST product ─── */
.cobrand-lockup {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.cobrand-parent {
  display: flex;
  align-items: center;
}
.cobrand-parent .fs-wordmark { display: block; }
.cobrand-parent img.fs-wordmark { object-fit: contain; }
.cobrand-divider {
  width: 1px;
  height: 44px;
  background: var(--fs-border-light);
  flex-shrink: 0;
}
.cobrand-product {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.cobrand-product-mark {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cobrand-product-mark svg { width: 100%; height: 100%; display: block; }
.cobrand-product-text { display: flex; flex-direction: column; line-height: 1; gap: 3px; }
.cobrand-product-eyebrow {
  font-family: var(--font-body);
  font-size: 10px;
  color: var(--fs-secondary);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-weight: 700;
}
.cobrand-product-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--fs-2xl);
  color: var(--green);
  letter-spacing: -0.005em;
}

.cobrand-lockup.is-compact .cobrand-product-mark { width: 44px; height: 44px; }
.cobrand-lockup.is-compact .cobrand-product-name { font-size: var(--fs-xl); }
.cobrand-lockup.is-compact .cobrand-divider { height: 36px; }

@media (max-width: 720px) {
  .cobrand-divider { display: none; }
  .cobrand-product-eyebrow { display: none; }
  .cobrand-lockup { gap: var(--sp-2); }
}

.header-controls { display: flex; align-items: center; gap: var(--sp-2); }
.btn-icon {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-md);
  color: var(--ink-soft);
  transition: all var(--t-fast) var(--ease);
}
.btn-icon svg { width: 20px; height: 20px; }
.btn-icon:hover { background: var(--green-glaze); color: var(--green); }
.btn-icon:active { transform: scale(0.96); }

/* ─── Progress Strip ─────────────────────────────────────────── */
.progress-strip {
  background: var(--paper);
  border-radius: var(--r-lg);
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-4);
  box-shadow: var(--shadow-sm);
}
.progress-list {
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0;
  margin: 0 0 var(--sp-3) 0;
  gap: var(--sp-2);
  flex-wrap: wrap;
}
.progress-step {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex: 1;
  min-width: 0;
  opacity: 0.42;
  transition: opacity var(--t-med) var(--ease);
}
.progress-step.active { opacity: 1; }
.progress-step.done { opacity: 0.85; }
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--green-glaze);
  color: var(--green);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-sm);
  flex-shrink: 0;
}
.progress-step.active .step-num {
  background: var(--green);
  color: var(--paper);
  box-shadow: var(--shadow-glow-green);
}
.progress-step.done .step-num {
  background: var(--gold);
  color: var(--paper);
}
.step-label {
  font-size: var(--fs-xs);
  color: var(--ink-soft);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.progress-bar {
  height: 6px;
  background: var(--green-glaze);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green-rich), var(--gold));
  border-radius: var(--r-pill);
  width: 0%;
  transition: width var(--t-med) var(--ease);
}

/* ─── Main Stage ─────────────────────────────────────────────── */
.app-main {
  flex: 1;
  display: flex;
  justify-content: center;
}
.stage {
  width: 100%;
  max-width: var(--max-w-stage);
  background: var(--paper);
  border-radius: var(--r-xl);
  padding: clamp(20px, 5vw, 56px);
  box-shadow: var(--shadow-paper);
  position: relative;
  min-height: 60vh;
  border-top: 4px solid var(--fs-accent);
}
.stage.wide { max-width: 100%; }

/* Paper texture overlay */
.stage::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--r-xl);
  pointer-events: none;
  background-image:
    radial-gradient(circle at 30% 20%, rgba(165, 124, 60, 0.025), transparent 50%),
    radial-gradient(circle at 70% 80%, rgba(165, 124, 60, 0.02), transparent 50%);
}

/* ─── Footer ─────────────────────────────────────────────────── */
.app-footer {
  margin-top: var(--sp-5);
  padding: var(--sp-3) var(--sp-4);
  background: var(--paper);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-3);
  font-size: var(--fs-sm);
}
.footer-brand {
  display: flex;
  align-items: center;
  padding-right: var(--sp-3);
  border-right: 1px solid var(--fs-border-light);
}
.footer-brand svg, .footer-brand img { display: block; }
.footer-meta { color: var(--ink-mute); font-size: var(--fs-xs); padding: 0 var(--sp-3); }
.version-tag { font-weight: 700; color: var(--green); }
.standards-tag { color: var(--ink-mute); }
.copyright { color: var(--ink-mute); }
.sep { margin: 0 var(--sp-2); color: var(--ink-faint); }
.footer-actions { display: flex; gap: var(--sp-3); flex-wrap: wrap; justify-content: flex-end; }

@media (max-width: 720px) {
  .app-footer { grid-template-columns: 1fr; text-align: center; }
  .footer-brand { border-right: none; border-bottom: 1px solid var(--fs-border-light); padding: 0 0 var(--sp-3) 0; justify-content: center; }
  .footer-meta { padding: 0; }
  .footer-actions { justify-content: center; }
}
.link-btn {
  background: none;
  border: none;
  color: var(--green-rich);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: var(--fs-sm);
  font-weight: 500;
  padding: 4px 0;
  transition: color var(--t-fast) var(--ease);
}
.link-btn:hover { color: var(--gold-rich); }

/* ─── Proctor Banner ─────────────────────────────────────────── */
.proctor-banner[hidden],
.progress-strip[hidden],
.progress-step[hidden] { display: none !important; }   /* a step outside the chosen check */

/* When the proctor banner is showing, lift app content above it */
body:has(.proctor-banner:not([hidden])) .app { padding-bottom: 96px; }
@supports not selector(:has(*)) {
  .app.proctor-active { padding-bottom: 96px; }
}
.proctor-banner {
  position: fixed;
  bottom: var(--sp-3);
  left: 50%;
  transform: translateX(-50%);
  background: var(--green);
  color: var(--paper);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  z-index: 100;
  font-size: var(--fs-sm);
  max-width: 95vw;
  flex-wrap: wrap;
  justify-content: center;
}
.proctor-flag-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  background: var(--alert);
  color: var(--paper);
  padding: 6px 12px;
  border-radius: var(--r-pill);
  font-weight: 600;
  font-size: var(--fs-sm);
  transition: all var(--t-fast) var(--ease);
}
.proctor-flag-btn:hover { background: var(--alert-soft); }
.proctor-flag-btn.flagged { background: var(--gold); color: var(--green); }
.proctor-flag-btn svg { width: 16px; height: 16px; }
.proctor-status .proctor-label { color: var(--sage-light); font-weight: 500; margin-right: 6px; }
.proctor-status .dot { margin: 0 var(--sp-2); opacity: 0.5; }
.proctor-timer {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--gold-light);
}

/* ─── Modal / Toast Roots ────────────────────────────────────── */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
}
.modal-root[aria-hidden="false"] { pointer-events: auto; }
.toast-root {
  position: fixed;
  /* At the bottom, clear of the proctor pill. At the top they covered Menu, Pause and Help for as
     long as they showed (2026-10-19). */
  bottom: calc(var(--sp-4) + 72px);
  right: var(--sp-4);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  pointer-events: none;
}

/* ─── No-Script Warning ──────────────────────────────────────── */
.noscript-warning {
  position: fixed;
  inset: 0;
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-6);
  text-align: center;
  font-size: var(--fs-lg);
  color: var(--ink);
  z-index: 99999;
}

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 720px) {
  .app { padding: var(--sp-2); }
  .stage { padding: var(--sp-4); }
  .step-label { display: none; }
  .progress-list { gap: 4px; }
  .footer-actions { width: 100%; justify-content: center; }
  .footer-meta { width: 100%; text-align: center; }
  body:has(.proctor-banner:not([hidden])) .app,
  .app.proctor-active { padding-bottom: 120px; }
}

@media (max-width: 480px) {
  .brand-tagline { display: none; }
  .brand-name { font-size: var(--fs-xl); }
  .proctor-banner { font-size: var(--fs-xs); padding: 6px 12px; gap: var(--sp-2); }
  .proctor-status { display: none; }
}

/* ════════════════════════════════════════════════════════════
   Back-to-site button (2026-06-24) — always visible in the HARVEST
   header so the family can return to the main Faith Schooling site
   at any time. target="_top" breaks out of the /harvest-app/ iframe.
   ════════════════════════════════════════════════════════════ */
.harvest-exit-btn {
  order: -1;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.85rem;
  min-height: 40px;
  background: var(--paper-warm);
  color: var(--ink-soft);
  border: 1px solid var(--paper-deep);
  border-radius: var(--r-md);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .18s ease, color .18s ease, border-color .18s ease;
}
.harvest-exit-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.harvest-exit-btn:hover,
.harvest-exit-btn:focus-visible {
  background: var(--paper-cream);
  color: var(--green-rich);
  border-color: var(--green);
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}
@media (max-width: 560px) {
  .harvest-exit-btn span { display: none; }   /* icon-only on small screens */
  .harvest-exit-btn { padding: 0.45rem 0.55rem; }
}
