/* FUNetics website: the one stylesheet.

   The tokens are the app's own, from docs/DESIGN_SYSTEM.md in the app repository, under the same
   names. The app's first rule carries over: a section is either a WORLD (full-bleed art, with UI
   floating on it as a few rounded, shadowed panels) or a BOARD (a flat panel in a page's hue).
   Body text is never set on art.

   Every text colour pairing here clears WCAG 2.2 AA in both themes. The hue solids are NEVER
   text colours (1.8 to 3.3:1 on white); they are fills only. Re-check contrast if you change one. */

:root {
  color-scheme: light dark;

  /* App tokens */
  --ink: #1b3a63;
  --ink-soft: #3d5f86;
  --white: #ffffff;
  --cream: #fdfbf3;
  --star: #ffc93c;
  --star-deep: #f5a623;
  --sky-top: #2c9ce8;
  --sky-horizon: #bfe6f7;
  --sand-shade: #d0af7c;
  --scrim: 14 44 76; /* #0E2C4C, as channels, for shadows. Never black. */

  /* Roles (these change in dark mode) */
  --text: var(--ink);
  --text-soft: var(--ink-soft);
  --link: #0a5282; /* the app's seaDeep, deepened: seaDeep is 4.4:1 and fails; this is 5.4:1 or better on every tint */
  --page: var(--cream);
  --header: var(--white);
  --panel: var(--cream);
  --card: var(--white);
  --rim: var(--white);
  --nav-hover: #e6f4fb;
  --nav-current: var(--sky-horizon);
  --footer: var(--ink);
  --footer-text: var(--cream);
  --footer-link: var(--sky-horizon);
  --focus: var(--ink);

  /* The default hue; pages and sections set their own with a .hue-* class. */
  --hue: #3da5e8;
  --tint: #bcd8f2;

  /* App §4: three elevations, all in scrim navy */
  --shadow-rest: 0 2px 6px rgb(var(--scrim) / 0.1);
  --shadow-float: 0 6px 16px rgb(var(--scrim) / 0.14);
  --shadow-lift: 0 12px 24px rgb(var(--scrim) / 0.18);

  --radius-card: 28px;
  --radius-panel: 36px;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --gutter: 1.25rem;
  --measure: 70ch;
  --tap: 44px;
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1); /* overshoots, like the app's spring(0.35, 0.7) */
}

.hue-blue { --hue: #3da5e8; --tint: #bcd8f2; }
.hue-green { --hue: #6dbe45; --tint: #d3e8b0; }
.hue-amber { --hue: #f5b92e; --tint: #f8dfa0; }
.hue-pink { --hue: #ee6fa5; --tint: #f7cfe0; }
.hue-purple { --hue: #9b7fd4; --tint: #d6cbf0; }
.hue-teal { --hue: #35bfae; --tint: #bfe8e2; }
.hue-cream { --hue: #d0af7c; --tint: #f3ecdc; }

@media (prefers-color-scheme: dark) {
  /* The app has no dark theme. Surfaces become its scrim navy; the art stays as drawn. */
  :root {
    --text: #fdfbf3;
    --text-soft: #c3d4e6;
    --link: #7fd0f2;
    --page: #0b2238;
    --header: #15385f;
    --panel: #0e2c4c;
    --card: #15385f;
    --rim: #dde8f3;
    --nav-hover: #1d4a78;
    --nav-current: #285d92;
    --footer: #071a2c;
    --focus: var(--star);
  }

  /* Each hue mixed into the navy, so a page keeps its colour at night. */
  .hue-blue { --tint: #18476e; }
  .hue-green { --tint: #234c4a; }
  .hue-amber { --tint: #44472f; }
  .hue-pink { --tint: #3f3b60; }
  .hue-purple { --tint: #2d3e6a; }
  .hue-teal { --tint: #174c62; }
  .hue-cream { --tint: #10273f; }
}

/* ---------- Base ---------- */

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

html {
  /* 112.5% of the browser default is 18px, and still follows the reader's own text size. */
  font-size: 112.5%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 500; /* the app's body style is Medium */
  line-height: 1.6;
  overflow-wrap: break-word;
}

h1,
h2,
h3 {
  text-wrap: balance;
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 1.8em 0 0.5em;
  max-width: var(--measure);
}

h1 {
  font-size: clamp(2rem, 1.55rem + 2vw, 2.75rem);
  margin-top: 0;
}

h2 {
  font-size: clamp(1.4rem, 1.2rem + 0.9vw, 1.8rem);
}

h3 {
  font-size: 1.2rem;
}

p,
li,
dd {
  max-width: var(--measure);
}

p {
  margin: 0 0 1em;
}

ul,
ol {
  padding-left: 1.4em;
  margin: 0 0 1em;
}

li + li {
  margin-top: 0.4em;
}

strong {
  font-weight: 800;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--link);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 0.16em;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 8px;
}

.wrap {
  width: min(100% - 2 * var(--gutter), 66rem);
  margin-inline: auto;
}

main {
  display: block;
}

.lead {
  font-size: 1.15rem;
  color: var(--text-soft);
}

/* ---------- Skip link ---------- */

.skip-link {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 1.1rem;
  background: var(--star);
  color: var(--ink);
  font-weight: 800;
  border: 4px solid var(--white);
  border-radius: 999px;
  box-shadow: var(--shadow-float);
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

/* ---------- Header ---------- */

.site-header {
  position: relative;
  z-index: 10;
  background: var(--header);
  box-shadow: var(--shadow-float);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  padding-block: 0.6rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  border-radius: 12px;
}

.brand img {
  display: block;
  width: auto;
  height: 40px;
}

/* While the site is a draft: plain bold text beside the wordmark. The auto margin keeps it
   next to the wordmark and pushes the nav to the right. At launch, remove it from every page's
   header (see README) and delete this rule. */
.draft-tag {
  margin-right: auto;
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.08em;
}

.site-nav {
  /* On a phone the nav takes its own row under the wordmark. */
  flex-basis: 100%;
  margin-left: -0.7rem;
}

.site-nav ul,
.footer-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0.2rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav li,
.footer-nav li {
  margin: 0;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 0.7rem;
  border-radius: 999px;
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 700;
  text-decoration: none;
}

.site-nav a:hover {
  background: var(--nav-hover);
}

/* The current page, without changing the header markup: each page's <main> names itself.
   Underlined as well as filled: the fill is only 1.3:1 against the header, too faint to be the
   only cue. */
body:has(main[data-page="about"]) .site-nav a[href="/about/"],
body:has(main[data-page="why-phonics"]) .site-nav a[href="/why-phonics/"],
body:has(main[data-page="our-approach"]) .site-nav a[href="/our-approach/"],
body:has(main[data-page="guides"]) .site-nav a[href="/guides/"],
body:has(main[data-page="support"]) .site-nav a[href="/support/"] {
  background: var(--nav-current);
  text-decoration: underline;
  text-decoration-thickness: 3px;
  text-underline-offset: 0.3em;
}

@media (min-width: 60rem) {
  .header-inner {
    padding-block: 0.75rem;
  }

  .brand img {
    height: 48px;
  }

  .site-nav {
    flex-basis: auto;
    margin-left: 0;
  }

  .site-nav a {
    padding: 0 0.9rem;
  }
}

/* ---------- Footer ---------- */

.site-footer {
  background: var(--footer);
  color: var(--footer-text);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-block: 1.5rem 2rem;
}

.footer-nav {
  margin-left: -0.6rem;
}

.footer-nav a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 0.6rem;
  border-radius: 999px;
  color: var(--footer-link);
  text-decoration: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

.footer-nav a:hover {
  background: rgb(255 255 255 / 0.08);
}

.site-footer :focus-visible {
  outline-color: var(--star);
}

.site-footer p {
  margin: 0;
}

/* ---------- Buttons ---------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3.25rem;
  padding: 0.55rem 1.5rem;
  border: 4px solid var(--rim);
  border-radius: 999px;
  background: var(--star);
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05rem;
  text-decoration: none;
  box-shadow: var(--shadow-float);
}

.button:hover {
  background: var(--star-deep);
  color: var(--ink);
}

.button:active {
  transform: scale(0.94);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  margin: 1.5rem 0 0;
}

.button-note {
  margin: 0.9rem 0 0;
  color: var(--text-soft);
}

/* A link that stands on its own, not inside a sentence, gets a full-size tap target. */
.text-link {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  font-weight: 700;
}

.link-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.link-list li {
  margin: 0;
}

.link-list a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  font-weight: 700;
}

/* ---------- World: full-bleed art, UI floating on it ---------- */

.world {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: linear-gradient(180deg, var(--sky-top) 0%, #74c3f0 50%, var(--sky-horizon) 100%);
}

/* On a phone the scene is a band under the panel, which overlaps its top edge. */
.world-scene {
  position: relative;
  z-index: 0;
  display: block;
  order: 2;
}

.world-scene img {
  display: block;
  width: 100%;
  height: auto;
  margin-top: -1.25rem; /* less than the panel's bottom padding, so no text sits over art */
}

.world-inner {
  order: 1;
  padding-block: 1rem 0;
}

.float-panel {
  position: relative;
  z-index: 1;
  background: var(--card);
  color: var(--text);
  border: 4px solid var(--rim);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-float);
  padding: 1.5rem 1.25rem 1.6rem;
}

.float-panel h1,
.float-panel h2 {
  margin-top: 0;
}

.float-panel h1 {
  font-size: clamp(2.1rem, 1.5rem + 2.6vw, 3.1rem);
}

.float-panel > :last-child {
  margin-bottom: 0;
}

/* Small on a phone, so the headline is on the first screen. Wider screens move them aside. */
.hero-tiles {
  display: block;
  width: min(46vw, 11.5rem);
  margin: 0 0 0.6rem -0.35rem;
}

.hero-tiles img {
  display: block;
  filter: drop-shadow(0 6px 10px rgb(var(--scrim) / 0.18));
}

.world-bird {
  position: absolute;
  z-index: 2;
  right: 0.5rem;
  bottom: 0.5rem;
  display: block;
  width: min(42vw, 11rem);
  pointer-events: none;
}

.world-bird img {
  display: block;
  width: 100%;
  transform-origin: 50% 70%;
}

.world--mirror .world-bird {
  transform: scaleX(-1);
  right: auto;
  left: 0.5rem;
}

@media (min-width: 60rem) {
  .world {
    display: block;
    min-height: 34rem;
  }

  /* Wider screens: the art bleeds in from the right edge and fades into the sky. The scene
     stops being positioned so the image is placed against the whole band, not its wrapper. */
  .world-scene {
    position: static;
  }

  .world-scene img {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 56%;
    height: 100%;
    margin: 0;
    object-fit: cover;
    object-position: 50% 40%;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 32%);
    mask-image: linear-gradient(90deg, transparent 0, #000 32%);
  }

  .world-inner {
    display: grid;
    grid-template-columns: minmax(0, 33rem) 1fr;
    align-items: center;
    min-height: 34rem;
    padding-block: 3.5rem;
  }

  .float-panel {
    padding: 2.25rem 2.25rem 2.1rem;
  }

  .hero-tiles {
    position: absolute;
    top: 2.5rem;
    right: max(var(--gutter), (100% - 66rem) / 2);
    width: 15rem;
    margin: 0;
  }

  /* The lorikeet perches on the panel's lower edge, overlapping only its padding, never text. */
  .world-bird {
    position: relative;
    right: auto;
    bottom: auto;
    grid-column: 2;
    grid-row: 1;
    align-self: end;
    justify-self: start;
    width: 15rem;
    margin: 0 0 -1rem -1.5rem;
  }

  /* The closing band mirrors the opening one: art on the left, panel on the right. */
  .world--mirror .world-scene img {
    right: auto;
    left: 0;
    transform: scaleX(-1);
  }

  .world--mirror .world-inner {
    grid-template-columns: 1fr minmax(0, 33rem);
  }

  .world--mirror .float-panel {
    grid-column: 2;
    grid-row: 1;
  }

  .world--mirror .world-bird {
    left: auto;
    grid-column: 1;
    justify-self: end;
    margin: 0 -1.5rem -1rem 0;
  }
}

/* ---------- Bands (home) and boards (inner pages) ---------- */

.band {
  padding-block: 3rem;
  background: var(--tint);
}

.band-plain {
  background: var(--page);
}

.band h2 {
  margin-top: 0;
}

.band-lead {
  color: var(--text); /* soft navy fails on the blue and purple tints */
  font-size: 1.1rem;
}

/* Inside FUNetics: on a phone each screenshot sits beside its caption; wider, three across.
   No sideways scrolling: most people never discover it, and it hides captions off-screen. */
.shots {
  display: grid;
  gap: 1.5rem;
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
}

.shots li {
  margin: 0;
}

.phone {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  gap: 1.25rem;
  align-items: center;
  margin: 0;
}

.phone-frame {
  overflow: hidden;
  border: 6px solid var(--ink);
  border-radius: 26px;
  background: var(--ink);
  box-shadow: var(--shadow-float);
}

.phone-frame img {
  display: block;
  width: 100%;
  height: auto;
}

.phone figcaption {
  margin: 0;
}

.phone figcaption strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.15rem;
}

@media (min-width: 52rem) {
  .shots {
    grid-template-columns: repeat(3, minmax(0, 14rem));
    justify-content: space-between;
  }

  .phone {
    grid-template-columns: 1fr;
    gap: 1rem;
    align-items: start;
  }

  .phone-frame {
    border-width: 7px;
    border-radius: 34px;
  }
}

/* What to expect: cards on a flat board, each with a journey-node badge. */
.cards {
  display: grid;
  gap: 1.25rem;
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
}

.cards li {
  margin: 0;
  padding: 1.5rem 1.4rem 1.25rem;
  background: var(--card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-rest);
}

.cards h3 {
  margin: 1rem 0 0.4rem;
}

.cards p:last-child {
  margin-bottom: 0;
}

.node {
  display: inline-grid;
  place-items: center;
  width: 3.5rem;
  height: 3.5rem;
  border: 4px solid var(--rim);
  border-radius: 50%;
  background: var(--hue);
  box-shadow: var(--shadow-float);
}

.node svg {
  width: 1.6rem;
  height: 1.6rem;
}

@media (min-width: 40rem) {
  .cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 60rem) {
  .cards {
    grid-template-columns: repeat(4, 1fr);
  }
}

.audiences {
  display: grid;
  gap: 1.25rem;
}

.audience {
  padding: 1.75rem 1.5rem 1.25rem;
  background: var(--tint);
  border-radius: var(--radius-panel);
}

.audience h2 {
  margin-top: 0;
}

@media (min-width: 52rem) {
  .audiences {
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
  }

  .audience {
    padding: 2.25rem 2.25rem 1.5rem;
  }
}

/* An inner page is a board in its hue: a title row with the lorikeet, then a cream panel. */
.board {
  padding-block: 2rem 3.5rem;
  background: var(--tint);
}

.board-head,
.board-panel {
  width: min(100% - 2 * var(--gutter), calc(var(--measure) + 5rem));
  margin-inline: auto;
}

.board-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.board-head h1 {
  margin: 0;
}

.avatar {
  flex: none;
}

.avatar img {
  display: block;
  width: 3.5rem;
  height: 3.5rem;
  border: 4px solid var(--rim);
  border-radius: 50%;
  box-shadow: var(--shadow-float);
}

.board-panel {
  padding: 1.5rem 1.25rem 2rem;
  background: var(--panel);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-rest);
}

.board-panel > :first-child {
  margin-top: 0;
}

.board-panel > :last-child {
  margin-bottom: 0;
}

@media (min-width: 40rem) {
  .board-panel {
    padding: 2.25rem 2.5rem 2.5rem;
  }
}

/* ---------- Content inside boards ---------- */

/* Guide steps are journey nodes, joined by a dashed path. */
.steps {
  counter-reset: step;
  list-style: none;
  margin: 1.75rem 0;
  padding: 0;
}

.steps > li {
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr);
  column-gap: 1rem;
  margin: 0;
}

.steps > li > * {
  grid-column: 2;
}

/* Both pseudo-elements sit in grid cells, never absolutely positioned, so they can never
   overlap the text (and contrast checkers can see that they don't). */
.steps > li::before {
  counter-increment: step;
  content: counter(step);
  grid-column: 1;
  grid-row: 1;
  display: grid;
  place-items: center;
  width: 3.5rem;
  height: 3.5rem;
  border: 4px solid var(--rim);
  border-radius: 50%;
  background: var(--hue);
  color: var(--white); /* white on the purple solid is 3.3:1, AA for large bold text */
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  box-shadow: var(--shadow-float);
}

.steps > li::after {
  content: "";
  grid-column: 1;
  grid-row: 2 / span 20;
  justify-self: center;
  width: 0;
  margin-block: 0.4rem;
  border-left: 4px dashed var(--sand-shade);
}

.steps > li:last-child::after {
  display: none;
}

.steps h2 {
  margin: 0.7rem 0 0.4rem;
}

.steps > li > :last-child {
  margin-bottom: 1.75rem;
}

.guide-list {
  list-style: none;
  padding: 0;
}

.guide-list li {
  margin-top: 1rem;
  padding: 1.25rem 1.4rem;
  background: var(--card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-rest);
}

.guide-list h2 {
  margin: 0 0 0.25rem;
  font-size: 1.3rem;
}

.guide-list a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
}

.guide-list p {
  margin: 0;
}

.person {
  margin-top: 1.25rem;
  padding: 1.25rem 1.4rem;
  background: var(--card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-rest);
}

.person h3 {
  margin-top: 0;
}

.person p:last-child {
  margin-bottom: 0;
}

.role {
  color: var(--text-soft);
  font-weight: 700;
}

.faq h2 {
  font-size: 1.3rem;
  margin-top: 1.75em;
}

.cta {
  margin-top: 2.5rem;
  padding: 1.5rem 1.5rem 1.25rem;
  background: var(--tint);
  border-radius: var(--radius-card);
}

.cta h2 {
  margin-top: 0;
}

/* The end of a page: a dashed path, like the journey's. */
.next {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 3px dashed var(--sand-shade);
}

.next a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
}

.next p {
  margin: 0;
}

/* ---------- Draft banner (Privacy, Terms) ---------- */

.draft-banner {
  margin: 0 0 1.75rem;
  padding: 0.9rem 1.15rem;
  background: #f8dfa0;
  color: var(--ink);
  border: 3px dashed var(--star-deep);
  border-radius: 20px;
}

.draft-banner p {
  margin: 0;
}

.placeholder {
  color: var(--text-soft);
  font-style: italic;
}

/* ---------- Motion: CSS only, and none of it for anyone who asks for less ---------- */

@keyframes breathe {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }

  50% {
    transform: translateY(-6px) scale(1.02);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .button,
  .site-nav a,
  .footer-nav a {
    transition: background-color 0.15s ease, transform 0.35s var(--spring);
  }

  .skip-link {
    transition: transform 0.15s ease;
  }

  /* One breath, then still. Under five seconds, so it never needs a pause control
     (WCAG 2.2.2) and never competes with reading. */
  .world-bird img {
    animation: breathe 4s ease-in-out 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }

  .button:active {
    transform: none;
  }
}

/* ---------- Print ---------- */

@media print {
  .site-header,
  .site-footer,
  .skip-link,
  .world-scene,
  .world-bird,
  .hero-tiles,
  .avatar {
    display: none;
  }

  body,
  .board,
  .band,
  .world {
    background: #ffffff;
    color: #000000;
  }
}
