/* Term Dates — hand-rolled CSS, mobile-first. Warm, light, friendly. */

:root {
  --bg: #faf8f5;
  --ink: #1a1a2e;
  --muted: #4a5361;
  --accent: #0d7377;
  --accent-dark: #0a5a5e;
  --accent-soft: #e6f2f2;
  --card: #ffffff;
  --line: #e8e2d8;
  --line-strong: #d8d2c8;
  --danger: #b3372e;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow-sm: 0 1px 2px rgb(26 26 46 / 0.06);
  --shadow-md: 0 2px 6px rgb(26 26 46 / 0.06), 0 12px 32px rgb(26 26 46 / 0.12);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background:
    radial-gradient(70rem 22rem at 50% -8rem, #f1ebe1 0%, rgb(241 235 225 / 0) 70%),
    var(--bg);
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
}

/* Header / main / footer frame; main takes the leftover viewport so the search
   hero can centre itself in that space on larger screens (see media query). */
main.container {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
}

[hidden] { display: none !important; }

::selection { background: rgb(13 115 119 / 0.2); }

.container { width: min(100% - 2.5rem, 640px); margin-inline: auto; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- header ---------- */

.site-header { padding: 1.1rem 0; text-align: center; }

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}

.logo-mark { display: block; width: 28px; height: 28px; border-radius: 8px; }

/* ---------- focus ring: teal, on every interactive element ---------- */

:where(.btn, .search-btn, .link-button, .phase-chip, .mode-card, .mode-seg-btn, .fb-btn, .fb-send, a):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-primary:focus-visible,
.search-btn:focus-visible,
.fb-send:focus-visible { outline-color: var(--accent-dark); }

/* ---------- cards & buttons ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.625rem 1.25rem;
  font: inherit;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.55; cursor: default; transform: none; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not([disabled]) { background: var(--accent-dark); }

.btn-secondary { background: var(--card); color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { border-color: #c4bcad; background: #fcfbf9; }

.btn-ghost { background: none; color: var(--accent); padding-inline: 0.5rem; }
.btn-ghost:hover { text-decoration: underline; }

.link-button {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: 0.95rem;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.link-button:hover { color: var(--accent-dark); }

.btn-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }

.another-row { margin: 1rem 0 0; }
.fineprint { color: var(--muted); font-size: 0.82rem; margin: 0.5rem 0 0; }

/* ---------- search view: a composed, centred hero ---------- */

/* Top-aligned below 640px so headline, sub copy and the search CTA all sit in
   the first viewport; the ≥640px media query re-centres via auto margins,
   which collapse to zero on overflow instead of clipping the top. */
#view-search {
  display: flex;
  flex-direction: column;
  padding-block: clamp(24px, 6vh, 56px) 3rem;
}

.hero { text-align: center; }

.hero h1 {
  margin: 0 auto;
  max-width: 22ch;
  font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.5rem);
  line-height: 1.12;
  letter-spacing: -0.022em;
  text-wrap: balance;
}

.hero .sub {
  margin: 1rem auto 0;
  max-width: 44ch;
  font-size: clamp(1rem, 0.95rem + 0.3vw, 1.125rem);
  line-height: 1.6;
  color: var(--muted);
}

.fee-accent {
  font-weight: 600;
  color: var(--accent-dark);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-decoration-color: rgb(13 115 119 / 0.4);
  text-underline-offset: 3px;
}

#search-form { position: relative; margin-top: 2.25rem; }

.search-bar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
}

#school-search {
  width: 100%;
  min-height: 54px;
  padding: 0.75rem 1rem;
  font: inherit;
  color: var(--ink);
  background: var(--card);
  border: 1.5px solid #cdc5b8;
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  appearance: none;
}
#school-search::placeholder { color: #7b8494; }
#school-search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(13 115 119 / 0.16), var(--shadow-sm);
}

.search-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 48px;
  padding: 0 1.25rem;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  box-shadow: 0 1px 2px rgb(26 26 46 / 0.1), 0 6px 16px rgb(13 115 119 / 0.2);
  transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}
.search-btn:hover { background: var(--accent-dark); }
.search-btn:active { transform: translateY(1px); }
.search-btn svg { width: 18px; height: 18px; flex: none; }

#school-listbox {
  position: absolute;
  z-index: 30;
  inset-inline: 0;
  top: calc(100% + 6px);
  margin: 0;
  padding: 0.375rem;
  list-style: none;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  max-height: 320px;
  overflow-y: auto;
}

.opt {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 0.75rem;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.opt:hover { background: #f4f0e9; }
.opt.is-active { background: var(--accent-soft); }
.opt-text { min-width: 0; }
.opt-logo { flex: none; width: 24px; height: 24px; border-radius: 6px; background: #f4f0e9; }
.opt-name { display: block; font-weight: 600; }
.opt-meta { display: block; font-size: 0.85rem; color: var(--muted); }

.no-results { padding: 0.625rem 0.75rem; font-size: 0.95rem; color: var(--muted); }

.web-status { padding: 0.5rem 0.75rem; font-size: 0.88rem; color: var(--muted); }

.web-section {
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem 0.125rem;
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

#add-school-teaser { margin-top: 1rem; text-align: center; }

/* ---------- how it works: quiet supporting strip under the search ---------- */

.how {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}
.how-heading {
  margin: 0 0 1.25rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  text-align: center;
}
.how-steps {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.how-step { display: flex; align-items: flex-start; gap: 0.625rem; }
.how-icon { flex: none; width: 20px; height: 20px; margin-top: 2px; color: var(--accent); }
.how-copy { min-width: 0; }
.how-title { margin: 0; font-size: 0.95rem; font-weight: 700; letter-spacing: -0.01em; }
.how-line { margin: 0.125rem 0 0; font-size: 0.88rem; line-height: 1.5; color: var(--muted); }

/* ---------- add-school form ---------- */

.add-card { margin-top: 1rem; }
.add-card h2 { margin: 0 0 0.25rem; font-size: 1.15rem; }
.add-hint { margin: 0 0 1rem; font-size: 0.92rem; color: var(--muted); }

.field { margin-bottom: 1rem; }
.field label { display: block; margin-bottom: 0.375rem; font-size: 0.85rem; font-weight: 600; }
.field input {
  width: 100%;
  min-height: 44px;
  padding: 0.625rem 0.875rem;
  font: inherit;
  color: var(--ink);
  background: #fcfbf9;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(13 115 119 / 0.16);
}

.error-text { margin: 0 0 0.75rem; font-size: 0.9rem; color: var(--danger); }

/* ---------- progress ---------- */

.progress-card { margin-top: 3rem; padding: 2.25rem 1.5rem; text-align: center; }

.spinner {
  width: 36px;
  height: 36px;
  margin: 0 auto 1rem;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(1turn); } }

.progress-card h2 { margin: 0; font-size: 1.25rem; letter-spacing: -0.01em; }
.progress-status { margin: 0.5rem 0 0; min-height: 1.5em; color: var(--muted); }

.progress-note {
  display: inline-block;
  margin: 1rem 0 0;
  padding: 0.375rem 0.75rem;
  font-size: 0.82rem;
  background: var(--accent-soft);
  color: var(--accent-dark);
  border-radius: 999px;
}

/* ---------- results ---------- */

.results-head { margin: 2.25rem 0 1.25rem; }
.results-head h2 { margin: 0; font-size: 1.45rem; letter-spacing: -0.015em; }

.badge {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.125rem 0.625rem;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
  background: var(--accent-soft);
  color: var(--accent-dark);
  border-radius: 999px;
}

.results-meta { margin: 0.25rem 0 0; font-size: 0.92rem; color: var(--muted); }

.results-title { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }

.results-logo {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #f4f0e9;
  box-shadow: var(--shadow-sm);
}

.head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.75rem;
  margin: 1rem 0 0;
}
.head-sep { color: #cfc7ba; }

.events-card { margin-top: 1rem; }

.group + .group { margin-top: 1.5rem; }

.group-label {
  margin: 0 0 0.25rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.event {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem;
  align-items: start;
  padding: 0.75rem 0;
}
.event + .event { border-top: 1px solid #f0ece4; }

.event-body p { margin: 0; }
.event-name { font-weight: 600; }
.event-body .event-dates { margin-top: 0.25rem; font-size: 0.95rem; }
.event-body .event-notes { margin-top: 0.25rem; font-size: 0.85rem; color: var(--muted); }

.chip {
  display: inline-block;
  margin-top: 0.25rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  border-radius: 999px;
}
.chip-term { background: #e2f2e5; color: #256e3c; }
.chip-holiday { background: #faf0da; color: #8a611c; }
.chip-inset { background: #eee8fa; color: #5f3fa8; }
.chip-other { background: #edebe6; color: #5b5e70; }

.source-row { margin: 1.25rem 0 0; font-size: 0.92rem; }
.source-link { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.source-link:hover { color: var(--accent-dark); }

/* ---------- phase filter ---------- */

.phase-filter { margin-top: 1rem; }
.phase-label { margin: 0 0 0.5rem; font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.phase-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.phase-chip {
  padding: 0.375rem 0.875rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.phase-chip:hover { border-color: #c4bcad; color: var(--ink); }
.phase-chip[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: #bcd9d9;
  color: var(--accent-dark);
}

/* ---------- paywall & unlocked ---------- */

.paywall-card {
  margin-top: 1.25rem;
  padding: 1.5rem;
  background: #eef6f5;
  border-color: #cfe3e2;
}
.paywall-card h3 { margin: 0; font-size: 1.15rem; letter-spacing: -0.01em; }
.paywall-card p { margin: 0.5rem 0 0; color: var(--muted); }
.paywall-card .btn { width: 100%; margin-top: 1rem; }

.mode-choice { margin-top: 1.25rem; }
.mode-choice .phase-label { margin: 0 0 0.5rem; color: var(--muted); }

.mode-cards { display: flex; flex-direction: column; gap: 0.5rem; }

.mode-card {
  width: 100%;
  padding: 0.75rem 0.875rem;
  font: inherit;
  text-align: left;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}
.mode-card:hover { border-color: #bcd9d9; }
.mode-card[aria-checked="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.mode-card-top { display: flex; align-items: center; gap: 0.5rem; }
.mode-title { font-weight: 700; font-size: 0.95rem; }
.mode-reco {
  padding: 0.125rem 0.5rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #fff;
  background: var(--accent);
  border-radius: 999px;
}
.mode-sub { display: block; margin-top: 0.25rem; font-size: 0.85rem; line-height: 1.45; color: var(--muted); }
.mode-count { display: block; margin-top: 0.5rem; font-size: 0.8rem; font-weight: 700; color: var(--accent-dark); }

.unlocked-card { margin-top: 1.25rem; }
.unlocked-card h3 { margin: 0 0 1rem; font-size: 1.15rem; }
.unlocked-card .btn-row { margin-top: 1rem; }

.mode-seg {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: #f1ede5;
  border: 1px solid var(--line);
  border-radius: 11px;
}
.mode-seg-btn {
  padding: 0.375rem 0.875rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.mode-seg-btn:hover { color: var(--ink); }
.mode-seg-btn[aria-pressed="true"] {
  background: var(--card);
  color: var(--accent-dark);
  box-shadow: var(--shadow-sm);
}
.mode-hint { margin: 0.5rem 0 0; font-size: 0.85rem; color: var(--muted); }
.mode-note { margin: 0.75rem 0 0; font-size: 0.88rem; color: var(--muted); }

.copy-row { display: flex; align-items: center; gap: 0.75rem; margin-top: 1rem; }
.copy-feedback { font-size: 0.88rem; font-weight: 600; color: var(--accent-dark); }

/* ---------- feedback ---------- */

.feedback-widget { margin-top: 1.25rem; font-size: 0.88rem; }
.feedback-row { display: flex; align-items: center; gap: 0.5rem; }
.fb-question { color: var(--muted); }
.fb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.fb-btn:hover { color: var(--accent); border-color: #bcd9d9; }
.feedback-box { display: flex; align-items: flex-start; gap: 0.5rem; margin-top: 0.5rem; }
.feedback-box textarea {
  flex: 1;
  min-width: 0;
  padding: 0.625rem 0.75rem;
  font: inherit;
  font-size: 0.88rem;
  color: var(--ink);
  background: #fcfbf9;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  resize: vertical;
}
.feedback-box textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(13 115 119 / 0.16);
}
.fb-send {
  min-height: 40px;
  padding: 0 1rem;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.fb-send:hover { background: var(--accent-dark); }
.fb-thanks { margin: 0; font-weight: 600; color: var(--accent-dark); }

/* ---------- errors ---------- */

.error-card { margin-top: 3rem; border-color: #ecd6d2; }
.error-card h2 { margin: 0 0 0.5rem; font-size: 1.2rem; }
.error-card .error-message { margin: 0 0 0.5rem; color: var(--muted); }
.error-card .fineprint { margin: 0 0 1.25rem; }

/* ---------- footer ---------- */

.site-footer {
  margin-top: 2.5rem;
  border-top: 1px solid var(--line);
  padding: 1.25rem 0 1.5rem;
}
.footer-row { display: flex; flex-direction: column; gap: 0.25rem; text-align: center; }
.site-footer p { margin: 0; font-size: 0.875rem; color: var(--muted); }
.site-footer a { color: var(--accent); text-decoration: none; border-bottom: 1px solid rgb(13 115 119 / 0.3); }
.site-footer a:hover { border-bottom-color: var(--accent); }

/* ---------- wider screens ---------- */

@media (min-width: 640px) {
  .progress-card, .error-card { margin-top: 4rem; }
  .results-head { margin-top: 3rem; }

  /* re-centre the search hero; auto margins collapse to zero on overflow, so
     short landscape viewports never clip the top of the content */
  #view-search { margin-block: auto; padding-block: 2.5rem 6vh; }

  /* search CTA docks inside the field */
  .search-bar { position: relative; display: block; }
  #school-search { min-height: 58px; padding-right: 9.5rem; }
  .search-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    bottom: 6px;
    min-height: 48px;
    padding: 0 1.1rem;
    border-radius: 9px;
  }

  /* how it works: three columns */
  .how-steps { flex-direction: row; gap: 1.5rem; }
  .how-step {
    flex: 1;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-align: center;
  }
  .how-icon { margin-top: 0; }

  .paywall-card { display: flex; align-items: center; gap: 1.5rem; }
  .paywall-text { flex: 1; }
  .paywall-actions { flex: none; width: 320px; }
  .paywall-card .btn { width: 100%; margin-top: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; }
  .spinner { animation-duration: 2.4s; }
  .btn:active, .search-btn:active { transform: none; }
}
