/* Palette shared with the parent portal and the marketing site. The apply
   app shipped on a stock blue, which made the one page a parent reaches from
   an Akyeba advert look like a different company's product. */
:root {
  --bg: #FFFBF5;
  --surface: #FFFFFF;
  --surface-2: #FAF5EA;
  --surface-3: #F2EBDA;
  --text: #1A1F2C;
  --text-strong: #0E1320;
  --text-soft: #475569;
  --muted: #6B7280;
  --primary: #C68B5D;
  --primary-hover: #B0784D;
  --primary-bg: rgba(198, 139, 93, 0.10);
  --border: #E5E1D8;
  --border-strong: #D6D1C5;
  --ink: #161D2E;
  --radius: 8px;
  --radius-lg: 14px;
  --shadow: 0 1px 3px rgba(26, 31, 44, 0.07);
  --shadow-md: 0 4px 14px rgba(26, 31, 44, 0.09);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Fraunces', Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  line-height: 1.5;
}

section[data-screen] { display: none; }
body.screen-landing [data-screen="landing"],
body.screen-enter-email [data-screen="enter-email"],
body.screen-check-inbox [data-screen="check-inbox"],
body.screen-redeeming [data-screen="redeeming"],
body.screen-home [data-screen="home"],
body.screen-form [data-screen="form"] { display: block; }

/* ── Auth screens ─────────────────────────────────────────────── */
.auth-screen {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: 100dvh; padding: 2rem 1.5rem;
}
.brand-stack { text-align: center; margin-bottom: 2rem; }
.logo-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; border-radius: 12px;
  background: var(--primary); color: #fff; font-weight: 700; font-size: 1.25rem;
}
.logo-mark.small { width: 32px; height: 32px; font-size: 0.9rem; border-radius: 8px; }
.wordmark { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; margin-left: 0.5rem; }
.wordmark.small { font-size: 1.1rem; }
.dot { color: var(--primary); }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

.auth-form { width: 100%; max-width: 360px; }
.auth-form label { display: block; margin-bottom: 1rem; }
.auth-form label span { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.25rem; }
.auth-form input {
  width: 100%; padding: 0.75rem 1rem; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 1rem; background: var(--surface);
}
.auth-form input:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: var(--primary); }

.message-card {
  background: var(--surface); border-radius: var(--radius); padding: 2rem;
  box-shadow: var(--shadow); max-width: 400px; text-align: center;
}
.message-card h2 { font-family: var(--font-display); margin-bottom: 0.75rem; }

/* ── Buttons ──────────────────────────────────────────────────── */
.btn-primary {
  display: block; width: 100%; padding: 0.75rem 1.5rem; margin-top: 1rem;
  background: var(--primary); color: #fff; border: none; border-radius: var(--radius);
  font-family: inherit;
  font-size: 1rem; font-weight: 600; cursor: pointer; text-align: center;
  /* The hero CTA is an anchor, which arrives underlined by default. */
  text-decoration: none;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-secondary {
  display: inline-block; padding: 0.6rem 1.25rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 0.9rem; cursor: pointer;
}
.btn-text { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 0.85rem; }
.btn-icon { background: none; border: none; cursor: pointer; padding: 0.5rem; }

/* ── Top bar ──────────────────────────────────────────────────── */
.top-bar {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.75rem 1rem; border-bottom: 1px solid var(--border);
  background: var(--surface); position: sticky; top: 0; z-index: 10;
}
.top-bar .brand { display: flex; align-items: center; gap: 0.4rem; flex: 1; }

/* ── Home ─────────────────────────────────────────────────────── */
.home-screen { padding: 1.5rem 1rem; max-width: 560px; margin: 0 auto; }
.home-screen h1 { font-family: var(--font-display); margin-bottom: 1rem; font-size: 1.5rem; }
.apps-list { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1.5rem; }
.app-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem; background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); cursor: pointer;
}
.app-row:hover { box-shadow: 0 2px 6px rgba(0,0,0,0.12); }
.meta-title { font-weight: 600; }
.meta-sub { font-size: 0.8rem; color: var(--muted); }
.badge {
  font-size: 0.75rem; padding: 0.2rem 0.6rem; border-radius: 12px;
  font-weight: 600; text-transform: uppercase;
}
.badge-draft { background: #FEF3C7; color: #92400E; }
.badge-submitted { background: #DBEAFE; color: #1E40AF; }
.badge-pending-payment { background: #FEF3C7; color: #92400E; }
.badge-decided { background: #D1FAE5; color: #065F46; }
.empty-state { text-align: center; color: var(--muted); padding: 2rem 1rem; }

/* ── Form ─────────────────────────────────────────────────────── */
.form-screen { padding: 1.5rem 1rem; max-width: 560px; margin: 0 auto; }
.form-screen h2 { margin-bottom: 1rem; }
.form-screen fieldset {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem; margin-bottom: 1rem;
}
.form-screen legend { font-weight: 600; font-size: 0.9rem; padding: 0 0.5rem; }
.form-screen label { display: block; margin-bottom: 0.75rem; font-size: 0.85rem; color: var(--muted); }
.form-screen input, .form-screen select {
  display: block; width: 100%; padding: 0.6rem 0.75rem; margin-top: 0.25rem;
  border: 1px solid var(--border); border-radius: 6px; font-size: 0.95rem;
  background: var(--surface);
}
.form-actions { display: flex; gap: 0.75rem; margin-top: 1rem; }
.form-actions .btn-primary { width: auto; flex: 1; }
.status { padding: 0.75rem; border-radius: var(--radius); margin-top: 1rem; font-size: 0.85rem; text-align: center; }
.status.ok { background: #D1FAE5; color: #065F46; }
.status.error { background: #FEE2E2; color: #991B1B; }

/* ── Landing ──────────────────────────────────────────────────────────────
   What a parent sees arriving from the marketing site with no school in the
   URL. Its whole job is to answer "what is this and how do I reach my
   school", so the directory sits above the fold on a phone and the
   explanation comes after it, not before. */
.landing { min-height: 100dvh; display: flex; flex-direction: column; }

.landing-bar {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 1rem 1.25rem; max-width: 960px; margin: 0 auto; width: 100%;
}

.hero {
  padding: 1rem 1.25rem 2rem;
  max-width: 960px; margin: 0 auto; width: 100%;
}
.hero-inner { display: grid; gap: 1.75rem; align-items: center; }
@media (min-width: 820px) {
  .hero-inner { grid-template-columns: 1.1fr 0.9fr; gap: 3rem; }
  .hero { padding-block: 2.5rem 3.5rem; }
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 6vw, 3rem);
  line-height: 1.12;
  letter-spacing: -0.015em;
  color: var(--text-strong);
  margin-bottom: 0.75rem;
}
.hero h1 .accent { color: var(--primary); }
.hero-sub {
  font-size: 1.0625rem; color: var(--text-soft); max-width: 46ch;
  margin-bottom: 1.5rem;
}
.hero-cta { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.hero-cta .btn-primary { display: inline-block; width: auto; margin-top: 0; }
.hero-note { margin-top: 1rem; font-size: 0.85rem; color: var(--muted); }

/* Drawn rather than photographed: a stock image of a classroom would be a
   stock image of someone else's classroom, and it would cost a payload on
   connections this app is built for. */
.hero-art {
  background: linear-gradient(155deg, var(--surface-3), var(--surface-2) 60%, var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
}
.hero-art svg { display: block; width: 100%; height: auto; }

/* ── School directory ─────────────────────────────────────────────── */
.directory {
  padding: 0 1.25rem 3rem; max-width: 960px; margin: 0 auto; width: 100%;
}
.directory h2 {
  font-family: var(--font-display); font-size: 1.35rem;
  color: var(--text-strong); margin-bottom: 0.25rem;
}
.directory-sub { color: var(--text-soft); font-size: 0.9rem; margin-bottom: 1rem; }
.school-search {
  width: 100%; padding: 0.75rem 1rem; margin-bottom: 1rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 1rem; font-family: inherit; background: var(--surface);
}
.school-search:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-bg);
}
.school-grid { display: grid; gap: 0.75rem; }
@media (min-width: 640px) { .school-grid { grid-template-columns: 1fr 1fr; } }

.school-card {
  display: flex; align-items: center; gap: 0.875rem;
  padding: 1rem; text-decoration: none; color: inherit;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color 0.18s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
.school-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); }
.school-badge {
  flex-shrink: 0;
  width: 44px; height: 44px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-bg); color: var(--primary-hover);
  font-family: var(--font-display); font-weight: 700; font-size: 0.95rem;
}
.school-card-main { min-width: 0; flex: 1; }
.school-card-name {
  display: block;
  font-weight: 600; color: var(--text-strong);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.school-card-meta { display: block; font-size: 0.8rem; color: var(--muted); }
.school-card-go { display: inline-flex; flex-shrink: 0; color: var(--muted); }

.directory-empty {
  padding: 1.75rem 1.25rem; text-align: center;
  background: var(--surface-2); border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg); color: var(--text-soft); font-size: 0.9rem;
}

/* ── How it works ─────────────────────────────────────────────────── */
.how {
  background: var(--surface-2); border-top: 1px solid var(--border);
  padding: 2.5rem 1.25rem 3rem; margin-top: auto;
}
.how-inner { max-width: 960px; margin: 0 auto; }
.how h2 {
  font-family: var(--font-display); font-size: 1.35rem;
  color: var(--text-strong); margin-bottom: 1.25rem;
}
.how-steps { display: grid; gap: 1.25rem; list-style: none; }
@media (min-width: 720px) { .how-steps { grid-template-columns: repeat(3, 1fr); gap: 2rem; } }
.how-step-n {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--primary); color: #fff;
  font-size: 0.85rem; font-weight: 700; margin-bottom: 0.5rem;
}
.how-step h3 { font-size: 0.975rem; color: var(--text-strong); margin-bottom: 0.25rem; }
.how-step p { font-size: 0.875rem; color: var(--text-soft); }

.landing-foot {
  padding: 1.5rem 1.25rem 2rem; text-align: center;
  font-size: 0.85rem; color: var(--muted);
  background: var(--surface-2);
}
.landing-foot a { color: var(--primary-hover); }

/* Visible to screen readers only — the search field carries its own visible
   placeholder, but a placeholder is not a label. */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* Returning to the directory from a school's email screen. */
.back-link {
  display: inline-flex; align-items: center; gap: 0.35rem;
  background: none; border: none; padding: 0;
  color: var(--muted); font-family: inherit; font-size: 0.85rem;
  cursor: pointer; margin-bottom: 1.25rem;
}
.back-link:hover { color: var(--primary-hover); }
