/* The public site: home (/), students (/campus/) and businesses (/merchants/).
   Shared chrome and effects on top of mula.css + night.css: nav, sound toggle, custom cursor,
   spotlight, blur-in reveals, text scramble, marquee, page transitions, paper and halftone
   textures, pixel bands, dithered images and the footer with the fading wordmark.
   Every effect is decoration. The pages read and work without it, and motion stops under
   prefers-reduced-motion. */

body.night {
  --paper: #F3EFE6;
  --paper-ink: #0D2450;
  --paper-muted: #4A5670;
  --paper-line: rgba(13, 36, 80, 0.14);
  /* Paper: warm base with fine fibre noise. */
  --paper-texture: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.35 0 0 0 0 0.28 0 0 0 0 0.18 0 0 0 0.16 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23p)'/%3E%3C/svg%3E");
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* ------------------------------------------------------------------ */
/* Page transitions (same-origin navigation, where the browser has it)  */
/* ------------------------------------------------------------------ */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vt-out 200ms ease both; }
::view-transition-new(root) { animation: vt-in 340ms var(--ease-out) both; }
@keyframes vt-out { to { opacity: 0; filter: blur(6px); } }
@keyframes vt-in { from { opacity: 0; filter: blur(6px); transform: translateY(8px); } }

/* ------------------------------------------------------------------ */
/* Nav                                                                  */
/* ------------------------------------------------------------------ */
body.night > #site-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  border-bottom: 1px solid transparent;
  transition: background-color 240ms ease, border-color 240ms ease, backdrop-filter 240ms ease;
  view-transition-name: site-nav;
}
body.night > #site-nav.is-scrolled {
  background: rgba(13, 36, 80, 0.94);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  backdrop-filter: blur(14px) saturate(1.4);
  border-bottom-color: var(--night-line);
}
.nav-mark { display: block; padding: 8px 4px; margin-right: auto; border-radius: 0; }
.nav-mark .mark { width: 76px; }
.nav-links { display: none; list-style: none; margin: 0; padding: 0; gap: 4px; }
.nav-links a {
  display: block; padding: 10px 12px; font-size: 15px; font-weight: 500; text-decoration: none;
  color: var(--on-night-muted) !important; transition: color 140ms ease;
}
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--on-night) !important; }
.nav-links a[aria-current="page"] { text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 1px; }
.sound-toggle {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 11px;
  background: transparent; border: 1px solid rgba(255, 255, 255, 0.38); border-radius: 0;
  color: var(--on-night); font-size: 14px; font-weight: 500; cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease;
}
.sound-toggle:hover { background: rgba(255, 255, 255, 0.08); }
.sound-toggle svg { width: 18px; height: 18px; }
.sound-toggle .wave { opacity: 0.25; transition: opacity 160ms ease; }
.sound-toggle[data-on="true"] .wave { opacity: 1; }
.sound-toggle[data-on="true"] { border-color: var(--on-night); }
/* Icon only on phones; the label is still read out. */
.sound-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nav-cta {
  display: inline-flex; align-items: center; height: 40px; padding: 0 16px;
  background: var(--on-night); color: var(--night) !important;
  font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap;
  transition: background-color 140ms ease;
}
.nav-cta:hover { background: #E6ECFA; }
#site-nav :focus-visible { outline: 2px solid var(--on-night); outline-offset: 2px; border-radius: 0; }
@media (min-width: 900px) {
  body.night > #site-nav { padding-inline: 32px; gap: 16px; }
  .nav-links { display: flex; }
  .sound-label { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
}
/* The campus landing is the big wordmark: no second one in the nav until you scroll. */
body.campus #site-nav:not(.is-scrolled) .nav-mark { opacity: 0; pointer-events: none; }
.nav-mark { transition: opacity 200ms ease; }
.demo-badge-inline { top: calc(72px + env(safe-area-inset-top)) !important; }

/* Secondary landing button, outlined (home and businesses). */
.landing-cta.secondary {
  background: transparent; color: var(--on-night) !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55);
}
.landing-cta.secondary:hover { background: rgba(255, 255, 255, 0.08); }

/* ------------------------------------------------------------------ */
/* Custom cursor (mouse only) and spotlight                              */
/* ------------------------------------------------------------------ */
#fx-cursor-dot, #fx-cursor-ring {
  position: fixed; top: 0; left: 0; z-index: 100; pointer-events: none;
  opacity: 0; transition: opacity 200ms ease;
  mix-blend-mode: difference;
}
#fx-cursor-dot { width: 6px; height: 6px; margin: -3px 0 0 -3px; background: #fff; }
#fx-cursor-ring {
  width: 34px; height: 34px; margin: -17px 0 0 -17px; border: 1px solid #fff;
  transition: opacity 200ms ease, width 180ms var(--ease-out), height 180ms var(--ease-out), margin 180ms var(--ease-out), background-color 180ms ease;
}
#fx-cursor-ring.is-link { width: 54px; height: 54px; margin: -27px 0 0 -27px; background: rgba(255, 255, 255, 0.12); }
#fx-cursor-ring.is-down { width: 26px; height: 26px; margin: -13px 0 0 -13px; }
html.cursor-on #fx-cursor-dot, html.cursor-on #fx-cursor-ring { opacity: 1; }
html.cursor-on, html.cursor-on * { cursor: none !important; }
html.cursor-on input:not([type="checkbox"]):not([type="radio"]), html.cursor-on textarea { cursor: text !important; }
html.cursor-on select { cursor: default !important; }

[data-spotlight] { --mx: -9999px; --my: -9999px; }
[data-spotlight]::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background: radial-gradient(520px circle at var(--mx) var(--my), rgba(255, 255, 255, 0.09), transparent 60%);
}

/* ------------------------------------------------------------------ */
/* Reveals: blur in, word by word, scramble                             */
/* ------------------------------------------------------------------ */
.reveal { opacity: 0; filter: blur(12px); transform: translateY(18px); }
.reveal.is-in {
  opacity: 1; filter: none; transform: none;
  transition: opacity 800ms var(--ease-out), filter 800ms var(--ease-out), transform 800ms var(--ease-out);
}
.words > span { display: inline-block; animation: word-in 900ms var(--ease-out) both; }
.words > span:nth-of-type(2) { animation-delay: 70ms; }
.words > span:nth-of-type(3) { animation-delay: 140ms; }
.words > span:nth-of-type(4) { animation-delay: 210ms; }
.words > span:nth-of-type(5) { animation-delay: 380ms; }
.words > span:nth-of-type(6) { animation-delay: 450ms; }
.words > span:nth-of-type(7) { animation-delay: 520ms; }
.words > span:nth-of-type(8) { animation-delay: 590ms; }
.words > span:nth-of-type(n+9) { animation-delay: 660ms; }
@keyframes word-in { from { opacity: 0; transform: translateY(0.4em); filter: blur(10px); } }
.after-words { animation: fade-up 900ms var(--ease-out) 760ms both; }
@keyframes fade-up { from { opacity: 0; transform: translateY(12px); } }
.scramble-live { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ */
/* Shared section pieces                                                */
/* ------------------------------------------------------------------ */
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 24px; position: relative; z-index: 1; }
.eyebrow {
  font-size: 12px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--on-night-muted);
}
.section-title {
  font: 700 clamp(34px, 5.6vw, 64px)/1.03 var(--font-display); letter-spacing: -0.032em;
  text-wrap: balance; margin-top: 14px; max-width: 18ch;
}
.section-lead { margin-top: 18px; font-size: 19px; line-height: 1.5; max-width: 54ch; color: var(--on-night-muted); text-wrap: pretty; }

/* Paper sections: warm, textured, navy ink. */
.paper {
  position: relative; background: var(--paper) var(--paper-texture); color: var(--paper-ink);
}
body.night .paper .eyebrow { color: var(--brand); }
.paper .section-lead { color: var(--paper-muted); }
body.night .paper a { color: var(--paper-ink); }
.paper :focus-visible { outline-color: var(--paper-ink) !important; }

/* Pixel band: a dissolve from one section's color into the next (drawn by site.js). */
.pixels { display: block; width: 100%; height: auto; image-rendering: pixelated; image-rendering: crisp-edges; }

/* Halftone dots, fading out. */
.halftone {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle, var(--paper-ink) 1.1px, transparent 1.6px) 0 0 / 9px 9px;
  -webkit-mask-image: linear-gradient(135deg, #000 0%, transparent 55%);
  mask-image: linear-gradient(135deg, #000 0%, transparent 55%);
  opacity: 0.55;
}

/* Dithered image (canvas drawn by site.js). */
.dither { display: block; width: 100%; height: auto; image-rendering: pixelated; image-rendering: crisp-edges; }

/* ------------------------------------------------------------------ */
/* Footer with the fading wordmark                                      */
/* ------------------------------------------------------------------ */
.site-foot {
  position: relative; overflow: hidden; border-top: 1px solid var(--night-line);
  padding: 56px 0 0; background: var(--night);
}
.foot-grid { display: grid; gap: 28px; }
.foot-line { font: 600 22px/1.25 var(--font-display); letter-spacing: -0.015em; max-width: 22ch; }
.foot-links { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 24px; }
.foot-links a { display: inline-block; padding: 6px 0; color: var(--on-night-muted) !important; text-decoration: none; font-size: 15px; }
.foot-links a:hover { color: var(--on-night) !important; }
.foot-fine { margin-top: 32px; font-size: 13px; line-height: 1.6; color: var(--on-night-faint); max-width: 72ch; }
.foot-logo {
  width: 100%; aspect-ratio: 768 / 237; margin: 28px auto -9%;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0) 78%);
  -webkit-mask: url(/assets/mula-wordmark.png) center / contain no-repeat;
  mask: url(/assets/mula-wordmark.png) center / contain no-repeat;
}
@media (min-width: 800px) {
  .foot-grid { grid-template-columns: 1.3fr 1fr; align-items: start; }
}

/* ------------------------------------------------------------------ */
/* Reduced motion: everything still, everything visible                  */
/* ------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  .words > span, .after-words { animation: none; }
  .reveal { opacity: 1; filter: none; transform: none; }
}
@media print {
  .reveal { opacity: 1 !important; filter: none !important; transform: none !important; }
  #site-nav, #fx-cursor-dot, #fx-cursor-ring, .foot-logo { display: none !important; }
}
