/* ============================================================
   Base styles — Fancy Monkey Studios
   Loaded after tokens.css by all three PWAs.

   Deliberately small. No framework, no reset library. Modern
   CSS handles most of what a reset used to.
   ============================================================ */

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

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

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--fms-bg);
  color: var(--fms-fg);
  font-family: var(--fms-font-body);
  font-size: var(--fms-text-base);
  line-height: var(--fms-leading-normal);
  letter-spacing: var(--fms-tracking-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---- Headings ---------------------------------------------
   .TitleText in the legacy CSS was 275% with a hard 4px shadow
   and a rotate-in animation. Same character, less shouting. */
h1, h2, h3, h4 {
  margin: 0 0 var(--fms-space-4);
  color: var(--fms-heading);
  line-height: var(--fms-leading-tight);
  text-wrap: balance;
}

h1 {
  font-family: var(--fms-font-display);
  font-size: var(--fms-text-3xl);
  letter-spacing: var(--fms-tracking-display);
  word-spacing: var(--fms-word-spacing);
  text-shadow: var(--fms-shadow-title);
}

h2 { font-size: var(--fms-text-2xl); font-weight: var(--fms-weight-light); }
h3 { font-size: var(--fms-text-xl);  font-weight: var(--fms-weight-medium); }
h4 { font-size: var(--fms-text-lg);  font-weight: var(--fms-weight-medium); }

p { margin: 0 0 var(--fms-space-4); max-width: var(--fms-measure); }

/* ---- Links ------------------------------------------------- */
a {
  color: var(--fms-link);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color var(--fms-duration-fast) var(--fms-ease);
}
a:hover { color: var(--fms-link-hover); }

/* Visible focus everywhere. The legacy site suppressed outlines
   in places, which made it unusable by keyboard. */
:focus-visible {
  outline: 3px solid var(--fms-focus);
  outline-offset: 2px;
  border-radius: var(--fms-radius-sm);
}

/* ---- Media ------------------------------------------------- */
img, picture, video, canvas, svg, audio {
  display: block;
  max-width: 100%;
}
img, video { height: auto; }
audio { width: 100%; }

/* ---- Forms ------------------------------------------------- */
input, button, textarea, select {
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
}

button, [role="button"] {
  min-height: var(--fms-touch-target);
  cursor: pointer;
}

/* ---- Layout helpers ---------------------------------------- */
.fms-page   { width: var(--fms-width-page);   margin-inline: auto; }
.fms-narrow { width: var(--fms-width-narrow); margin-inline: auto; }

.fms-stack > * + * { margin-block-start: var(--fms-space-4); }

/* ---- Accessibility ----------------------------------------- */
.fms-visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.fms-skip-link {
  position: absolute;
  top: -100%;
  left: var(--fms-space-4);
  z-index: var(--fms-z-toast);
  padding: var(--fms-space-3) var(--fms-space-4);
  background: var(--fms-accent, var(--fms-jungle));
  color: var(--fms-on-accent);
  border-radius: 0 0 var(--fms-radius) var(--fms-radius);
  text-decoration: none;
}
.fms-skip-link:focus { top: 0; }


/* ---- Form rows -------------------------------------------------
   A labelled field: label above, control below, space beneath.

   Defined HERE rather than per app because all three use it and,
   until 27 Jul 2026, none of them defined it — the station portal
   styled it in radio.css, so Backstage's comp form and the order
   page both rendered as labels jammed against their inputs and a
   textarea sitting above its own label. Two apps were about to get
   two near-identical copies.
   ---------------------------------------------------------------- */

.FieldRow {
  display: grid;
  gap: var(--fms-space-1);
  margin-bottom: var(--fms-space-4);
  max-width: 34rem;
}

.FieldRow > label {
  font-size: var(--fms-text-sm);
  font-weight: var(--fms-weight-medium);
  color: var(--fms-heading);
}

.FieldRow input[type="text"],
.FieldRow input[type="email"],
.FieldRow input[type="password"],
.FieldRow input[type="number"],
.FieldRow input[type="time"],
.FieldRow select,
.FieldRow textarea {
  width: 100%;
  padding: var(--fms-space-2);
  border: 1px solid var(--fms-rule);
  border-radius: var(--fms-radius-sm);
  font: inherit;
  color: var(--fms-ink);
  background: var(--fms-white);
}

.FieldRow textarea { resize: vertical; }

/* Hints and errors under a field. */
.FieldNote, .FinePrint { font-size: var(--fms-text-sm); color: var(--fms-muted); }
.FieldError { font-size: var(--fms-text-sm); color: var(--fms-danger); }

/* ---- Motion -----------------------------------------------
   The legacy site animated headlines and characters in from
   offscreen with rotation and 3D scaling on every page view.
   Honour the OS preference and stop all of it. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---- Print ------------------------------------------------- */
@media print {
  body { background: #fff; color: #000; }
  nav, footer, .fms-no-print { display: none !important; }
  a::after { content: " (" attr(href) ")"; font-size: 0.85em; }
}
