/* "Night" theme: the campus waitlist (web/campus/) and the merchant page (web/merchants/). Builds on mula.css.
   Landing: the grainy mountain photo (assets/mountains.jpg, from the brand banner) with the
   wordmark and one button. Sign-up below on the photo's night blue: flat, square fields,
   no cards, no shadows. */

[hidden] { display: none !important; }

body.night {
  --night: #0D2450;            /* the bottom of the mountain photo */
  --night-line: rgba(255, 255, 255, 0.16);
  --on-night: #FFFFFF;
  --on-night-muted: rgba(255, 255, 255, 0.72);
  --on-night-faint: rgba(255, 255, 255, 0.56);
  --error-on-night: #FCA5A5;
  --sharp: 0;                  /* square corners on every field, chip and button */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.6 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background: var(--night);
  color: var(--on-night);
}
/* Film grain over the plain blue, like the photo's. */
body.night::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.16;
  background-image: var(--grain);
}
body.night > :not(.skip) { position: relative; z-index: 1; }
body.night a { color: var(--on-night); }
body.night :focus-visible { outline-color: var(--on-night); }

/* ------------------------------------------------------------------ */
/* Landing                                                              */
/* ------------------------------------------------------------------ */

.landing {
  min-height: 100vh; min-height: 100svh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(24px + env(safe-area-inset-top)) 24px calc(28px + env(safe-area-inset-bottom));
  text-align: center;
  background:
    linear-gradient(to bottom, rgba(13, 36, 80, 0) 72%, var(--night) 100%),
    var(--night) url(/assets/mountains.jpg) 62% 100% / cover no-repeat;
}
/* Fade the page's grain into the bottom of the photo so there's no seam. */
.landing::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 40%; pointer-events: none;
  background-image: var(--grain); opacity: 0.16;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 75%);
  mask-image: linear-gradient(to bottom, transparent, #000 75%);
}
.landing-center {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px;
  /* Sit a little above center, in the sky, clear of the mountains. */
  padding-bottom: 16vh;
}
.landing h1 { margin: 0; line-height: 0; }
/* The wordmark artwork (assets/mula-wordmark.png, 768×237) as a white mask. */
.mark {
  display: block;
  width: min(68vw, 400px); aspect-ratio: 768 / 237;
  background-color: var(--on-night);
  -webkit-mask: url(/assets/mula-wordmark.png) center / contain no-repeat;
  mask: url(/assets/mula-wordmark.png) center / contain no-repeat;
}
.landing-cta {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 50px; padding: 0 28px;
  border-radius: var(--sharp);
  background: var(--on-night); color: var(--night) !important;
  font-size: 16px; font-weight: 600; letter-spacing: 0.01em; text-decoration: none;
  transition: background-color 140ms ease, transform 140ms ease;
}
.landing-cta:hover { background: #E6ECFA; }
.landing-cta:active { transform: scale(0.98); }
.landing-cta:focus-visible { outline: 2px solid var(--on-night); outline-offset: 3px; border-radius: var(--sharp); }
.count-line { font-size: 14px; color: var(--on-night-muted); font-variant-numeric: tabular-nums; }
.landing-foot {
  font-size: 12px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--on-night-muted);
}
.demo-badge-inline {
  position: absolute; top: calc(16px + env(safe-area-inset-top)); right: 16px;
  font-size: 12px; font-weight: 600; color: var(--amber-text); background: var(--amber-bg);
  border-radius: var(--sharp); padding: 4px 10px;
}

/* ------------------------------------------------------------------ */
/* Sign-up                                                              */
/* ------------------------------------------------------------------ */

body.night main { max-width: 440px; padding-top: 56px; padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
body.night main:focus { outline: none; }
body.night .step { gap: 40px; }

.panel { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.panel-title {
  font: 600 28px/1.15 var(--font-display); letter-spacing: -0.02em; color: var(--on-night);
}
.panel-title:focus { outline: none; }
body.night .sub { color: var(--on-night-muted); font-size: 15px; margin-top: 0; }
body.night .sub strong { color: var(--on-night); }
body.night .h3 { color: var(--on-night); }
body.night .eyebrow { color: var(--on-night-muted); font-size: 12px; letter-spacing: 0.14em; }
body.night .muted { color: var(--on-night-muted); }
body.night .strong { color: var(--on-night); }
.break { overflow-wrap: anywhere; }

.ref-note {
  font-size: 14px; color: var(--on-night-muted);
  border-left: 2px solid var(--on-night); padding: 2px 0 2px 12px;
}
.ref-note strong { color: var(--on-night); font-weight: 600; }

/* Fields: labels small and quiet, inputs flat white and square. */
body.night .form { gap: 18px; margin-top: 6px; }
body.night .field { gap: 8px; }
body.night .field label,
fieldset.pills legend {
  font-size: 12px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--on-night-muted);
}
.optional { font-weight: 500; letter-spacing: 0.02em; text-transform: none; color: var(--on-night-faint); }
body.night .field input,
body.night .field select {
  width: 100%; min-height: 52px; padding: 12px 14px;
  border: 1px solid transparent; border-radius: var(--sharp);
  background-color: var(--white); color: var(--navy);
  font: inherit; font-size: 17px;
  box-shadow: none;
  transition: box-shadow 120ms ease;
}
body.night .field input::placeholder { color: #8A94A6; }
body.night .field input:focus,
body.night .field select:focus { outline: none; box-shadow: 0 0 0 2px var(--night), 0 0 0 4px var(--on-night); }
body.night .field input[aria-invalid="true"] { box-shadow: 0 0 0 2px var(--night), 0 0 0 4px var(--error-on-night); }
.field select {
  padding-right: 40px !important;
  -webkit-appearance: none; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 23px, calc(100% - 14px) 23px;
  background-size: 6px 6px; background-repeat: no-repeat;
}
body.night .hint { color: var(--on-night-faint); font-size: 13px; }
body.night .field-error { color: var(--error-on-night); }
body.night .inline-error {
  background: rgba(252, 165, 165, 0.1); color: var(--error-on-night);
  border-radius: 0; border-left: 2px solid var(--error-on-night);
}

/* "What would you split first?": real radio buttons as flat chips. */
fieldset.pills { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.pills legend { padding: 0; margin-bottom: 10px; }
.pill-row { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { position: relative; }
/* The chips are <label>s inside a .field: undo the small-caps field-label style. */
body.night .field label.pill { font-size: 15px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--on-night); }
.pill input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pill span {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px;
  border-radius: var(--sharp); box-shadow: inset 0 0 0 1px var(--night-line);
  font-size: 15px; font-weight: 500; color: var(--on-night); cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease, box-shadow 120ms ease;
}
.pill span:hover { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4); }
.pill input:checked + span { background: var(--on-night); color: var(--night); box-shadow: none; font-weight: 600; }
.pill input:focus-visible + span { outline: 2px solid var(--on-night); outline-offset: 2px; }

/* Buttons: square and flat. White on night blue is the main action. */
body.night .btn { border-radius: var(--sharp); font-size: 16px; letter-spacing: 0.01em; }
body.night .btn-primary { background: var(--on-night); color: var(--night); min-height: 52px; }
body.night .btn-primary:hover { background: #E6ECFA; }
body.night .btn-primary:active { background: #DCE4F7; }
body.night .btn-primary:disabled { background: var(--on-night); }
body.night .btn-primary .spinner.on-dark { border-color: rgba(13, 36, 80, 0.25); border-top-color: var(--night); }
body.night .btn-secondary { background: transparent; color: var(--on-night); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4); }
body.night .btn-secondary:hover,
body.night .btn-secondary:active { background: rgba(255, 255, 255, 0.08); }
body.night .btn-ghost { color: var(--on-night-muted); }
body.night .btn-ghost:active { background: rgba(255, 255, 255, 0.08); }
body.night .btn:focus-visible { box-shadow: none; outline: 2px solid var(--on-night); outline-offset: 3px; }
body.night .btn-link,
body.night .link-inline { color: var(--on-night); }
body.night .btn-link:disabled { color: var(--on-night-faint); }
body.night .btn-secondary.danger { color: var(--error-on-night); box-shadow: inset 0 0 0 1px rgba(252, 165, 165, 0.5); }

.switch-line { font-size: 15px; color: var(--on-night-muted); }

body.night .loading-line { min-height: 160px; color: var(--on-night-muted); justify-content: flex-start; }

/* On the list */
.place { display: flex; flex-direction: column; gap: 2px; padding: 6px 0 4px; }
body.night .amount { color: var(--on-night); font-size: 64px; letter-spacing: -0.03em; }
body.night .info { border-top: 1px solid var(--night-line); padding-top: 20px; gap: 12px; }
.share-input {
  width: 100%; min-height: 48px; padding: 12px 14px;
  border: 1px solid var(--night-line); border-radius: var(--sharp);
  background: rgba(255, 255, 255, 0.06); color: var(--on-night);
  font: inherit; font-size: 15px; font-variant-numeric: tabular-nums; text-overflow: ellipsis;
}
.share-input:focus { outline: none; border-color: var(--on-night); }
.share-row { display: flex; flex-direction: column; gap: 8px; }
.copy-status:empty { display: none; }
.leave { border-top: 1px solid var(--night-line); padding-top: 4px; display: flex; flex-direction: column; gap: 8px; }
.leave .btn-link { align-self: flex-start; color: var(--on-night-faint); font-weight: 500; }
.leave-confirm { display: flex; flex-direction: column; gap: 10px; font-size: 15px; color: var(--on-night-muted); }

/* How it works and the fine print: quiet, below the form. */
.how { border-top: 1px solid var(--night-line); padding-top: 28px; display: flex; flex-direction: column; gap: 16px; }
body.night .steps li { color: var(--on-night-muted); }
body.night .steps li::before {
  background: none; box-shadow: inset 0 0 0 1px var(--night-line); border-radius: var(--sharp);
  color: var(--on-night); font-size: 13px;
}
.fine { display: flex; flex-direction: column; gap: 8px; font-size: 12px; line-height: 1.55; color: var(--on-night-faint); }
.fine strong { color: var(--on-night-muted); font-weight: 600; }

/* Demo state switcher, restyled for the dark page. */
body.night .demo-nav { border-color: var(--night-line); color: var(--on-night-faint); border-radius: var(--sharp); margin-top: 0; }
body.night .demo-nav a { background: transparent; color: var(--on-night); box-shadow: inset 0 0 0 1px var(--night-line); border-radius: var(--sharp); }
body.night .demo-nav a[aria-current="page"] { background: var(--on-night); color: var(--night); }

body.night .skip { background: var(--on-night); color: var(--night); border-radius: var(--sharp); z-index: 20; }

@media (min-width: 520px) {
  .share-row { flex-direction: row; }
  .share-row .btn { flex: 1; }
}

@media (prefers-reduced-motion: no-preference) {
  html:has(body.night) { scroll-behavior: smooth; }
}

@media (forced-colors: active) {
  .mark { forced-color-adjust: none; background-color: CanvasText; }
  .landing-cta, .pill span { border: 1px solid CanvasText; }
}
