/* Ara Registration — mobile-first, no framework, no web fonts.
   A parent opens this from a QR code on a paper flyer, on a phone, possibly on a
   slow network: everything here must render from this one file with no external
   request. (ara-connect learned this the hard way — a page that waits on a
   Google-hosted asset shows a blank screen on a filtered network.) */

:root {
  --ink: #16281f;
  --ink-soft: #4a5c53;
  --paper: #ffffff;
  --bg: #f4f6f4;
  --line: #d8e0da;
  --brand: #1f6b4a;
  --brand-dark: #16513a;
  --accent: #b8860b;
  --danger: #a32b2b;
  --ok: #1f6b4a;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(22, 40, 31, 0.1), 0 6px 18px rgba(22, 40, 31, 0.06);
  --header-bg: linear-gradient(165deg, #247853 0%, var(--brand) 45%, var(--brand-dark) 100%);
  /* Surfaces that were hardcoded white. A control that stays #fff while the page
     goes dark is a blinding white block a parent types their child's date of
     birth into — so every one of them resolves through a variable now. */
  --field-bg: #ffffff;
  --field-bg-soft: #fbfdfb;
  --tint-ok: #eef5f1;
  --tint-warn: #fdf6e3;
  --tint-error: #fdf1f1;
  --tint-warn-line: #e2cf9a;
  --tint-error-line: #e3b4b4;
  --tint-ok-line: #cfe3d8;
  --on-tint-error: #7a1f1f;
  --on-tint-warn: #6b4e07;
  --disabled-bg: #9db3a8;
}

/* A parent opens this from a QR code on a flyer, and most phones sit in dark
   mode by default. A page that is pure white at night is the one they squint
   at while typing a child's date of birth. The palette flips at the variables,
   so every rule below follows without being written twice. */
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e6efe9;
    --ink-soft: #a2b5aa;
    --paper: #12241c;
    --bg: #0c1710;
    --line: #243a2e;
    --brand: #2f9468;
    --brand-dark: #1d7350;
    --accent: #d9b661;
    --danger: #e98686;
    --ok: #4cbf8c;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 6px 20px rgba(0, 0, 0, 0.4);
    --header-bg: linear-gradient(165deg, #10362a 0%, #0e2b21 55%, #0a2019 100%);
    --field-bg: #172d23;
    --field-bg-soft: #14281f;
    --tint-ok: #14301f;
    --tint-warn: #2f2712;
    --tint-error: #331a1a;
    --tint-warn-line: #6b5a24;
    --tint-error-line: #7a3a3a;
    --tint-ok-line: #2b5741;
    --on-tint-error: #f0b4b4;
    --on-tint-warn: #e8d49a;
    --disabled-bg: #33473d;
  }
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.55;
}

.wrap {
  width: 100%;
  max-width: 44rem;
  margin: 0 auto;
  padding: 0 1.1rem;
}

.skip-link {
  position: absolute;
  left: -9999px;
}
.skip-link:focus {
  left: 1rem;
  top: 1rem;
  z-index: 10;
  background: var(--paper);
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
}

/* ── header / footer ─────────────────────────────────────────────────────── */

.site-header {
  background: var(--header-bg);
  color: #fff;
  padding: 1.5rem 0 1.8rem;
  position: relative;
}
/* A hairline of the school's gold along the bottom edge — the same accent the
   printed worksheets and the summer-school page use, so a parent who has seen
   one recognises the other. */
.site-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

/* The crest and the school name read as one mark, not two stacked things. */
.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0 0 0.7rem;
}
.crest {
  flex: 0 0 auto;
  width: 3.7rem;
  height: 3.7rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  /* ⛔ Stays white in dark mode, deliberately. The crest is dark-green artwork on
     a transparent background — on a dark disc it simply disappears. This is the
     one surface that must NOT follow the theme. */
  background: #ffffff;
  /* The disc and its shadow must end in the same place, or the shadow draws an
     arc past an edge that is no longer there and reads as a smudge. */
  box-shadow: 0 0 0 1px rgba(184, 134, 11, 0.45), 0 3px 10px rgba(0, 0, 0, 0.22);
}
.crest img {
  width: 2.9rem;
  height: auto;
  display: block;
}
/* Two deliberate lines rather than one that wraps wherever it lands — the full
   name is long enough that a phone strands "BOSTON" on its own. Same words. */
.site-header .eyebrow {
  margin: 0;
  min-width: 0;
}
.brand-name,
.brand-sub {
  display: block;
}
.brand-name {
  font-size: 0.92rem;
  line-height: 1.25;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  font-weight: 700;
}
.brand-sub {
  font-size: 0.8rem;
  line-height: 1.3;
  letter-spacing: 0.04em;
  opacity: 0.82;
}
.site-header h1 {
  margin: 0 0 0.45rem;
  font-size: 1.75rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.site-header .lede {
  margin: 0;
  opacity: 0.95;
}

/* The office line under the intro. White-on-green like everything else in the
   header, and the number is a real link — a parent filling this in on a phone
   taps once to call. Underlined so it reads as tappable against the green. */
.site-header .header-office {
  margin: 0.65rem 0 0;
  font-size: 0.95rem;
  opacity: 0.95;
}
.site-header .header-office a {
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.site-footer {
  margin: 2.5rem 0 0;
  padding: 1.5rem 0 2.5rem;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.92rem;
}
.site-footer p {
  margin: 0.35rem 0;
}
.site-footer a {
  color: var(--brand-dark);
}
.fine {
  font-size: 0.85rem;
  opacity: 0.85;
}

/* ── cards + sections ────────────────────────────────────────────────────── */

main {
  padding-top: 1.4rem;
}

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.1rem 1.25rem;
  margin: 0 0 1.1rem;
}
.card > h2 {
  margin: 0 0 0.2rem;
  font-size: 1.15rem;
}
.card > .hint {
  margin: 0 0 0.9rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.loading {
  color: var(--ink-soft);
}

/* ── form controls (large touch targets) ─────────────────────────────────── */

label {
  display: block;
  font-weight: 600;
  margin: 0.85rem 0 0.3rem;
  font-size: 0.97rem;
}
label .opt {
  font-weight: 400;
  color: var(--ink-soft);
}

/* Every text-like input, stated as an EXCLUSION rather than a list.
   This used to enumerate text/email/tel/date — so the password box on the staff
   sign-in and every number box in the catalog editor fell through to the
   browser default and rendered as a narrow, unstyled field. A list of types is
   a list that goes stale the first time someone adds an input; naming the few
   that must NOT be styled this way cannot. */
input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="file"]),
select,
textarea {
  width: 100%;
  padding: 0.7rem 0.75rem;
  font: inherit;
  color: inherit;
  background: var(--field-bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  min-height: 46px;
}
textarea {
  min-height: 88px;
  resize: vertical;
}
input:focus,
select:focus,
textarea:focus,
button:focus {
  outline: 3px solid rgba(31, 107, 74, 0.35);
  outline-offset: 1px;
}

.field-error {
  color: var(--danger);
  font-size: 0.9rem;
  margin: 0.3rem 0 0;
}
input[aria-invalid="true"],
select[aria-invalid="true"] {
  border-color: var(--danger);
}

/* honeypot — visually hidden but not display:none, so simple bots still fill it */
.hp-field {
  position: absolute !important;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ── program picker ──────────────────────────────────────────────────────── */

.program-option {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  margin: 0.5rem 0;
  cursor: pointer;
  background: var(--field-bg);
}
.program-option:hover {
  border-color: var(--brand);
}
.program-option input {
  margin-top: 0.25rem;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}
.program-option .p-title {
  font-weight: 600;
  display: block;
}
.program-option .p-meta {
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.child-block {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 0.9rem 1rem;
  margin: 0 0 0.9rem;
  background: var(--field-bg-soft);
}
.child-block header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}
.child-block h3 {
  margin: 0;
  font-size: 1.02rem;
}

/* ── buttons ─────────────────────────────────────────────────────────────── */

button {
  font: inherit;
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 0.75rem 1.1rem;
  min-height: 48px;
  cursor: pointer;
}
.btn-primary {
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  width: 100%;
}
.btn-primary:hover {
  background: var(--brand-dark);
}
.btn-primary[disabled] {
  background: var(--disabled-bg);
  cursor: not-allowed;
}
.btn-secondary {
  background: var(--field-bg);
  border-color: var(--line);
  color: var(--brand-dark);
  font-weight: 600;
}
/* The payment link is an <a>, and the box styling above lives on `button` — so
   "Go to the payment page" rendered as a plain underlined line of text. On the
   page a family reaches after registering, that link IS the checkout; it has to
   look like the thing you press. Written for any anchor wearing a button class
   so the next one does not have to rediscover this. */
a.btn-primary,
a.btn-secondary {
  display: inline-block;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.75rem 1.1rem;
  min-height: 48px;
  text-align: center;
  text-decoration: none;
}
a.btn-secondary {
  border-color: var(--line);
}
.btn-link {
  background: none;
  border: none;
  color: var(--brand-dark);
  text-decoration: underline;
  padding: 0.4rem 0;
  min-height: 0;
}
/* The programs section before the fees have arrived. Two grey bars, not a
   spinner: a spinner says "wait", a shape says "something is coming here" —
   and the rest of the form above it is already usable. */
.skeleton {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin: 0.6rem 0;
}
.skeleton-line {
  display: block;
  height: 1.1rem;
  border-radius: 6px;
  background: var(--line);
  opacity: 0.5;
  animation: skeleton-pulse 1.4s ease-in-out infinite;
}
.skeleton-line.short {
  width: 55%;
}
@keyframes skeleton-pulse {
  50% {
    opacity: 0.22;
  }
}
/* Someone who has asked for less movement gets a plain grey bar. */
@media (prefers-reduced-motion: reduce) {
  .skeleton-line {
    animation: none;
  }
}

/* The "taking you to the payment page" card. It sits directly under the green
   "Registration received" box, so it is deliberately NOT green as well: two
   identical panels read as one, and this one is the panel that is about to move
   the page. The brand edge marks it as the thing now happening. */
.redirect-card {
  border-color: var(--brand);
  border-left-width: 4px;
  background: var(--field-bg);
}

/* Stacked on a phone so the primary action is a full-width target and "stay" is
   unmistakably the quieter one — but never hidden, because it is the only way
   to keep the page a family has just been asked to screenshot. */
.redirect-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  margin: 0.6rem 0 0;
}
.redirect-actions .btn-primary {
  width: 100%;
}

.btn-remove {
  background: none;
  border: 1px solid var(--line);
  color: var(--danger);
  padding: 0.35rem 0.7rem;
  min-height: 0;
  font-size: 0.9rem;
}

/* ── totals + notices ────────────────────────────────────────────────────── */

.total-box {
  background: var(--tint-ok);
  border: 1px solid #cfe3d8;
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  margin: 0.9rem 0 0;
}
.total-box .amount {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--brand-dark);
}
.total-box ul {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
  color: var(--ink-soft);
  font-size: 0.93rem;
}

.notice {
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin: 0 0 1.1rem;
  border: 1px solid var(--line);
  background: var(--field-bg);
}
.notice-closed {
  border-color: var(--tint-warn-line);
  background: var(--tint-warn);
}
.notice-error {
  border-color: var(--tint-error-line);
  background: var(--tint-error);
  color: var(--on-tint-error);
}
.notice-ok {
  border-color: var(--tint-ok-line);
  background: var(--tint-ok);
}
/* The save WORKED, but something needs the owner's attention — a price with no
   payment link, say. Showing that as an error would be a lie; showing it as
   success would be silence. */
.notice-warn {
  border-color: var(--tint-warn-line);
  background: var(--tint-warn);
  color: var(--on-tint-warn);
}
.notice h2 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}
.notice p {
  margin: 0.35rem 0 0;
}

/* ── consent + legal viewer ──────────────────────────────────────────────── */

.consent-row {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  margin: 0.6rem 0;
}
.consent-row input {
  width: 22px;
  height: 22px;
  margin-top: 0.2rem;
  flex: 0 0 auto;
}
.legal-text {
  max-height: 15rem;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.8rem;
  background: var(--field-bg-soft);
  font-size: 0.92rem;
  white-space: pre-wrap;
  margin: 0.5rem 0;
}

dialog {
  border: none;
  border-radius: var(--radius);
  padding: 0;
  max-width: 40rem;
  width: calc(100% - 2rem);
}
dialog::backdrop {
  background: rgba(22, 40, 31, 0.5);
}
dialog .dlg-body {
  padding: 1.1rem;
}
dialog h2 {
  margin: 0 0 0.5rem;
}

/* ── payment choice ──────────────────────────────────────────────────────── */

.pay-choice {
  display: block;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.8rem 0.9rem;
  margin: 0.55rem 0;
  cursor: pointer;
  background: var(--field-bg);
}
.pay-choice input {
  width: 20px;
  height: 20px;
  margin-right: 0.5rem;
  vertical-align: -0.2rem;
}
.pay-choice .p-title {
  font-weight: 600;
}
.pay-choice .p-meta {
  display: block;
  color: var(--ink-soft);
  font-size: 0.92rem;
  margin-top: 0.15rem;
}

@media (min-width: 40rem) {
  body {
    font-size: 18px;
  }
  .site-header h1 {
    font-size: 2.1rem;
  }
  .btn-primary {
    width: auto;
    min-width: 16rem;
  }
}


/* ── branding tail ─────────────────────────────────────────────────────────
   Everything below is presentation only. No rule here changes what is
   collected, priced, validated or sent. */

@media (max-width: 24rem) {
  .crest {
    width: 3.1rem;
    height: 3.1rem;
  }
  .crest img {
    width: 2.4rem;
  }
  .brand-name {
    font-size: 0.85rem;
  }
  .brand-sub {
    font-size: 0.75rem;
  }
}

/* Honour the system setting rather than animating regardless. */
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

/* A parent who prints the page — or saves it as a PDF for their records —
   should get something legible, not a dark block with a white-on-white crest. */
@media print {
  body {
    background: #fff;
    color: #000;
    font-size: 12pt;
  }
  .site-header {
    background: none;
    color: #000;
    padding-bottom: 0.6rem;
  }
  .site-header::after {
    display: none;
  }
  .crest {
    box-shadow: none;
  }
  .card {
    box-shadow: none;
    border: 1px solid #999;
    break-inside: avoid;
  }
  .skip-link,
  .loading {
    display: none;
  }
}


/* ── the published legal pages ────────────────────────────────────────────
   The consent text a parent ticks promises "the policy the school publishes".
   These pages are what makes that true, so they have to be genuinely readable
   on a phone at night — not a wall of grey. */

.legal-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.1rem;
  margin: 0 0 1.2rem;
  font-size: 0.95rem;
}
.legal-nav a {
  color: var(--brand-dark);
}
.legal-nav-here {
  font-weight: 700;
  color: var(--ink);
  border-bottom: 2px solid var(--accent);
}

.legal-doc h2 {
  margin: 1.6rem 0 0.5rem;
  font-size: 1.18rem;
  line-height: 1.3;
  color: var(--ink);
}
.legal-doc h2:first-child {
  margin-top: 0;
}
.legal-doc h3 {
  margin: 1.2rem 0 0.4rem;
  font-size: 1.02rem;
}
.legal-doc p {
  margin: 0 0 0.8rem;
}
.legal-doc ul {
  margin: 0 0 0.9rem;
  padding-left: 1.2rem;
}
.legal-doc li {
  margin: 0 0 0.4rem;
}
.legal-doc hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 1.5rem 0;
}
.legal-doc .callout {
  border-left: 3px solid var(--accent);
  padding: 0.55rem 0 0.55rem 0.9rem;
  margin: 0 0 1rem;
  color: var(--ink-soft);
}
.legal-doc table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.legal-doc th,
.legal-doc td {
  text-align: left;
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

/* The consent wording, published byte-for-byte as the server fingerprints it.
   Wrapped rather than scrolled: a parent should never have to drag a box
   sideways to read what they agreed to. */
.legal-verbatim {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: inherit;
  font-size: 0.97rem;
  line-height: 1.6;
  margin: 0;
}

.legal-version {
  margin: 1.1rem 0 0;
}

@media print {
  .legal-nav,
  .skip-link {
    display: none;
  }
  .legal-doc {
    border: 0;
  }
}

.legal-links a {
  color: var(--brand-dark);
}
.legal-links {
  margin: 0.9rem 0 0.2rem;
}
