/* ==========================================================================
   Doodle Parade landing page
   Tokens follow the FiveFacet design kit (Doodle-Parade/Design-Tokens.json).
   Fonts: the kit specifies Bricolage Grotesque, DM Sans and Space Mono. They were not
   supplied as files, so each stack uses them when installed and falls back to strong
   system fonts. To self-host later, drop woff2 files in assets/fonts/ and add @font-face here.
   ========================================================================== */

:root {
  color-scheme: light;

  /* Pigments */
  --ink: #192343;
  --cobalt: #2945D5;
  --deep: #2034A0;
  --paper: #FFF9EA;
  --white: #FFFFFF;
  --coral: #F76A4B;
  --sun: #FFD263;
  --pool: #CEEBF0;
  --lilac: #E1DAFF;
  --sage: #D7E9C9;
  --mute: #535D70;
  --line: #C9C6BA;

  /* Roles */
  --canvas: var(--paper);
  --text: var(--ink);
  --text-quiet: var(--mute);
  --action: var(--cobalt);
  --action-pressed: var(--deep);
  --accent: var(--coral);
  --selected: var(--lilac);
  --border: var(--line);
  --shadow: 25 35 67; /* ink as an rgb triplet, for soft shadows */

  /* Space: 4 8 12 16 20 24 32 48 */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-7: 2rem;
  --space-8: 3rem;
  --space-section: clamp(3.5rem, 2rem + 5vw, 6.5rem);
  --gutter: clamp(1rem, 4vw, 2rem);
  --measure: 72rem;

  /* Radius: 8 16 24 pill */
  --radius-s: 0.5rem;
  --radius-m: 1rem;
  --radius-l: 1.5rem;
  --radius-pill: 100vmax;

  /* Type */
  --font-display: "Bricolage Grotesque", ui-rounded, "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --font-ui: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-spec: "Space Mono", ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --step-display: clamp(2.5rem, 0.9rem + 3.8vw, 4.5rem);
  --step-title: clamp(2rem, 1.3rem + 2.6vw, 3rem);
  --step-heading: clamp(1.375rem, 1.2rem + 0.8vw, 1.75rem);
  --step-lede: clamp(1.1875rem, 1.05rem + 0.6vw, 1.4rem);
  --step-body: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);

  /* Motion. The three --move-* values are read by script.js. */
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
  --dur-quick: 140ms;
  --move-march: 2200ms;
  --move-bounce: 2000ms;
  --move-fly: 2800ms;
}

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

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

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

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

body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: var(--step-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img { display: block; max-width: 100%; height: auto; }

a { color: var(--action); text-underline-offset: 0.18em; }

::selection { background: var(--lilac); }

:focus-visible {
  outline: 3px solid var(--cobalt);
  outline-offset: 3px;
}

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

.skip-link {
  position: absolute;
  top: -4rem;
  left: var(--space-4);
  z-index: 10;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-m);
  background: var(--ink);
  color: var(--paper);
  font-weight: 700;
}
.skip-link:focus { top: var(--space-3); }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
  width: 1.5rem;
  height: 1.5rem;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Headings share the display face. */
h1, h2, h3, .try__title {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
h2 { font-size: var(--step-title); line-height: 1.05; }
h3 { font-size: var(--step-heading); line-height: 1.12; letter-spacing: -0.01em; }

.eyebrow {
  font-family: var(--font-spec);
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-quiet);
}

.section-head { display: grid; gap: var(--space-3); max-width: 40rem; margin-bottom: var(--space-8); }
.section-lede { font-size: var(--step-lede); line-height: 1.4; text-wrap: balance; }

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

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3.5rem;
  padding: 0 var(--space-7);
  border-radius: var(--radius-m);
  background: var(--action);
  color: var(--white);
  font-size: 1.0625rem;
  font-weight: 700;
  text-decoration: none;
  transition: background-color var(--dur-quick) var(--ease-out);
}
.button:active { background: var(--action-pressed); }
@media (hover: hover) {
  .button:hover { background: var(--action-pressed); }
}

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

.site-header { padding-block: var(--space-3); }

.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
}

/* Phones: logo and both links stay on one compact row. */
.brand { display: block; padding-block: 0.25rem; border-radius: var(--radius-s); }
.brand img { height: 2.5rem; width: auto; }

.nav { display: flex; }
.nav a {
  display: inline-flex;
  align-items: center;
  min-height: 3rem;
  padding-inline: var(--space-2);
  border-radius: var(--radius-pill);
  color: var(--ink);
  font-size: 0.9375rem;
  font-weight: 700;
  text-decoration: none;
  transition: background-color var(--dur-quick) var(--ease-out);
}
@media (hover: hover) {
  .nav a:hover { background: var(--lilac); }
}

@media (min-width: 40rem) {
  .brand img { height: 3.5rem; }
  .nav a { padding-inline: var(--space-4); font-size: 1.0625rem; }
}

/* ---------- Hero ---------- */

.hero {
  padding-block: var(--space-2) calc(var(--space-section) * 0.6);
  overflow-x: clip;
}

.hero__grid { display: grid; gap: var(--space-5); }

.hero__intro { display: grid; gap: var(--space-3); align-content: center; justify-items: start; }

/* Extra room under the headline so the hand-drawn underline never touches the copy. */
.hero h1 { margin-bottom: var(--space-3); font-size: var(--step-display); line-height: 1.04; }

.first-step { position: relative; white-space: nowrap; }
.first-step::after {
  content: "";
  position: absolute;
  inset: auto -0.04em -0.17em;
  height: 0.22em;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 250 10' preserveAspectRatio='none'%3E%3Cpath d='M3 6C30 1 55 9 90 5S150 1 185 5 232 8 247 3' fill='none' stroke='%23F76A4B' stroke-width='4' stroke-linecap='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}

.lede { max-width: 32rem; font-size: var(--step-lede); line-height: 1.45; text-wrap: pretty; }

/* The official App Store badge. Apple asks for at least 40px of height and clear space around it. */
.get {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-5);
}
.get__badge {
  display: inline-block;
  padding-block: 2px;
  border-radius: var(--radius-s);
  line-height: 0;
}
.get__badge img { height: 2.75rem; width: auto; }
.get__note { font-weight: 700; }

@media (min-width: 40rem) {
  .get__badge img { height: 3.25rem; }
}

/* From iPad portrait up, headline and stage sit side by side. */
@media (min-width: 48rem) {
  .hero__grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 21rem);
    gap: var(--space-7);
    align-items: center;
  }
}

@media (min-width: 58rem) {
  .hero__grid {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: var(--space-8);
  }
}

/* ---------- Try Moss: stage ---------- */

/* Compact on phones so the move buttons sit close to the headline. From iPad portrait up the stage
   fills its column, flush with the page grid. (These overrides come after the base rule on purpose.) */
.try {
  display: grid;
  gap: var(--space-3);
  width: 100%;
  max-width: 28rem;
  justify-self: start;
}

@media (min-width: 48rem) {
  .try { max-width: none; justify-self: stretch; }
}

@media (min-width: 58rem) {
  .try { max-width: 34rem; }
}

.try__title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 1.5rem;
  line-height: 1;
}
.try__title .icon { color: var(--cobalt); }

.stage { display: grid; gap: var(--space-3); }

.stage__desk {
  padding: clamp(0.75rem, 4.5vw, 1.5rem);
  border-radius: var(--radius-l);
  background: var(--lilac);
}

/* The sheet of paper. Moss and his shadow share one box, so their percent transforms match. */
.sheet {
  position: relative;
  aspect-ratio: 5 / 4;
  border: 1px solid var(--line);
  border-radius: 0.25rem;
  background: var(--paper);
  box-shadow: 3px 4px 0 var(--line), 0 1.25rem 2rem -1rem rgb(var(--shadow) / 0.4);
  transform: rotate(-1.2deg);
}

.sheet__tape {
  position: absolute;
  top: -0.75rem;
  left: 50%;
  width: 5.5rem;
  height: 1.5rem;
  margin-left: -2.75rem;
  background: rgb(255 210 99 / 0.88);
  clip-path: polygon(0 0, 100% 0, 98% 25%, 100% 50%, 98% 75%, 100% 100%, 0 100%, 2% 75%, 0 50%, 2% 25%);
  transform: rotate(2.5deg);
}

.sheet__pencil {
  position: absolute;
  height: 2px;
  border-radius: 2px;
  background: var(--line);
}
.sheet__pencil--a { top: 13%; left: 8%; width: 8%; transform: rotate(-6deg); }
.sheet__pencil--b { right: 8%; bottom: 9%; width: 11%; transform: rotate(-4deg); }

/* will-change builds the two small layers at load, so the very first tap does not stall on creating them. */
.moss,
.moss-shadow {
  position: absolute;
  left: 13%;
  bottom: 11%;
  width: 60%;
  transform-origin: 0 0;
  will-change: transform;
}
.moss-shadow { will-change: transform, opacity; }
.moss img { width: 100%; }

/* A flat soft ellipse under the feet. script.js shrinks and fades it as Moss lifts off. */
.moss-shadow {
  aspect-ratio: 194 / 160;
  background: radial-gradient(closest-side, rgb(var(--shadow) / 0.3), rgb(var(--shadow) / 0)) 41.7% 96% / 52% 11% no-repeat;
}

.stage__caption {
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--text-quiet);
  text-wrap: pretty;
}

/* ---------- Try Moss: move tiles ---------- */

.moves {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
}

.move {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: var(--space-2);
  min-height: 4.75rem;
  padding: var(--space-3) var(--space-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--white);
  color: var(--ink);
  font: 700 1rem/1.2 var(--font-ui);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--dur-quick) var(--ease-out), box-shadow var(--dur-quick) var(--ease-out), border-color var(--dur-quick) var(--ease-out);
}
@media (hover: hover) {
  .move:hover { background: rgb(225 218 255 / 0.5); border-color: var(--cobalt); }
}
.move:active { background: var(--lilac); }

/* Selected: a check, a thicker outline, and a color change, so it never relies on color alone. */
.move.is-selected {
  border-color: var(--cobalt);
  background: var(--selected);
  box-shadow: 0 0 0 1px var(--cobalt);
}

.move__check {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 1.125rem;
  height: 1.125rem;
  color: var(--cobalt);
  opacity: 0;
}
.move.is-selected .move__check { opacity: 1; }

/* Always two short lines, so the layout never shifts as the message changes. */
.try__status { display: grid; gap: 0.125rem; }
.try__message { display: block; font-weight: 700; line-height: 1.35; }
.try__hint { display: block; font-size: 0.9375rem; line-height: 1.4; color: var(--text-quiet); }

/* ---------- How it works ---------- */

.story {
  padding-block: var(--space-section);
  overflow-x: clip;
}

.steps { display: grid; gap: calc(var(--space-8) + var(--space-4)); }

.step { display: grid; gap: var(--space-7); align-items: start; }

.step__text { display: grid; gap: var(--space-2); align-content: start; max-width: 28rem; }
.step__text p { text-wrap: pretty; }
.step__detail { color: var(--text-quiet); }

.step__num {
  position: relative;
  isolation: isolate;
  width: 3.25rem;
  margin-bottom: var(--space-2);
  font: 800 3.5rem/1 var(--font-display);
  color: var(--cobalt);
}
.step__num::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 0.12em;
  left: -0.12em;
  width: 0.92em;
  height: 0.92em;
  border-radius: 50%;
  background: var(--sun);
}

@media (min-width: 44rem) {
  .step { grid-template-columns: minmax(0, 1fr) minmax(0, 20rem); gap: var(--space-8); align-items: center; }
  .step:nth-child(even) { grid-template-columns: minmax(0, 20rem) minmax(0, 1fr); }
  .step:nth-child(even) .shot { order: -1; }
}

@media (min-width: 72rem) {
  .steps { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-8); align-items: start; }
  .step,
  .step:nth-child(even) { grid-template-columns: minmax(0, 1fr); align-items: start; }
  .step:nth-child(even) .shot { order: 0; }
  .step:nth-child(2) { margin-top: 4rem; }
  .step:nth-child(3) { margin-top: 8rem; }
}

/* ---------- Screen details (cropped from the real screens) ---------- */

/* Narrower than the column on phones so the tilted backing stays inside the page gutters. */
.shot {
  position: relative;
  isolation: isolate;
  width: min(100% - 1rem, 22rem);
  margin-inline: auto;
}
.shot::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -0.5rem;
  border-radius: var(--radius-l);
  background: var(--backing, var(--lilac));
  transform: rotate(var(--tilt, -1.5deg));
}

.shot__frame {
  overflow: hidden;
  aspect-ratio: 390 / var(--crop-h);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  background: var(--paper);
  box-shadow: 0 1rem 1.75rem -1rem rgb(var(--shadow) / 0.4);
}
/* Percent margins resolve against the frame's width, so the crop scales with it. */
.shot__frame img {
  width: 100%;
  max-width: none;
  margin-top: calc(var(--crop-top) / 390 * -100%);
}

.shot--cutout { --crop-top: 120; --crop-h: 570; --backing: var(--lilac); --tilt: -1.5deg; }
.shot--moves { --crop-top: 120; --crop-h: 544; --backing: var(--pool); --tilt: 1.5deg; }
.shot--movie { --crop-top: 120; --crop-h: 500; --backing: var(--sage); --tilt: -1deg; }
.shot--grownups { --crop-top: 120; --crop-h: 620; --backing: var(--sun); --tilt: 1.5deg; }

/* ---------- Parade in my room (iPad AR) ---------- */

.room {
  padding-block: var(--space-section);
  background: var(--pool);
  overflow-x: clip;
}

.room__grid { display: grid; gap: var(--space-8); align-items: center; }
.room__text { display: grid; gap: var(--space-4); align-content: start; }
.room__lede { font-size: var(--step-lede); line-height: 1.4; text-wrap: pretty; }

.compare { display: grid; gap: var(--space-4); margin-top: var(--space-4); }
.compare__row {
  display: grid;
  gap: var(--space-1);
  padding-top: var(--space-4);
  border-top: 1px solid rgb(var(--shadow) / 0.25);
}
.compare dt { font: 800 1.125rem/1.2 var(--font-display); letter-spacing: -0.01em; }

.ipad {
  padding: 0.5rem;
  border-radius: 1.5rem;
  background: var(--ink);
  box-shadow: 0 1.5rem 2.5rem -1.25rem rgb(var(--shadow) / 0.6);
}
.ipad__screen {
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border-radius: 1rem;
  background: var(--paper);
}
.ipad__screen img { width: 100%; max-width: none; }

/* On phones the whole iPad screen would be too small to read, so show the room itself. */
@media (max-width: 39.99rem) {
  .ipad__screen { aspect-ratio: 616 / 466; }
  .ipad__screen img { width: 166.23%; margin-left: -5.19%; margin-top: -39.77%; }
}
@media (min-width: 40rem) {
  .ipad { padding: 0.625rem; border-radius: 2rem; }
  .ipad__screen { border-radius: 1.5rem; }
}

.room__caption {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-5);
  font-family: var(--font-spec);
  font-size: 0.8125rem;
  line-height: 1.4;
  letter-spacing: 0.04em;
}

@media (min-width: 60rem) {
  .room__grid { grid-template-columns: minmax(0, 24rem) minmax(0, 1fr); gap: calc(var(--space-8) + var(--space-4)); }
}

/* ---------- For parents ---------- */

.parents {
  padding-block: var(--space-section);
  overflow-x: clip;
}

.parents__grid { display: grid; gap: calc(var(--space-8) + var(--space-4)); align-items: start; }
.parents__text { display: grid; gap: var(--space-4); align-content: start; }

.roles { display: grid; gap: var(--space-6); margin-top: var(--space-5); }
.role {
  display: grid;
  gap: var(--space-3);
  padding-top: var(--space-5);
  border-top: 1px solid var(--line);
}

.ticks { display: grid; gap: var(--space-3); }
.ticks li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--space-3); }
.ticks .icon { margin-top: 0.15em; color: var(--cobalt); }

@media (min-width: 56rem) {
  .parents__grid { grid-template-columns: minmax(0, 1fr) minmax(0, 20rem); }
}

/* ---------- Download ---------- */

.download { padding-block: 0 var(--space-section); }

/* One closing panel on the same grid as every other section. */
.download__inner {
  display: grid;
  justify-items: center;
  gap: var(--space-6);
  padding: clamp(1.75rem, 5vw, 3rem);
  border-radius: var(--radius-l);
  background: var(--lilac);
  text-align: center;
}
.download__text { display: grid; gap: var(--space-3); }
.download__text p { max-width: 34rem; font-size: var(--step-lede); line-height: 1.4; text-wrap: pretty; }
.download h2 { font-size: clamp(1.75rem, 1.2rem + 2vw, 2.5rem); }
.download .get__badge img { height: 3.5rem; }

.app-icon {
  width: 7rem;
  height: 7rem;
  border-radius: 22.37%;
  box-shadow: 0 0.75rem 1.5rem -0.75rem rgb(var(--shadow) / 0.55);
}

@media (min-width: 52rem) {
  .download__inner {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    justify-items: start;
    gap: var(--space-8);
    text-align: left;
  }
}

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

.site-footer {
  padding-block: var(--space-7);
  background: var(--cobalt);
  color: var(--paper);
}
.site-footer :focus-visible { outline-color: var(--paper); }

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-5);
}
.site-footer__pip { width: 4.5rem; }
/* Pip and the legal lines share a row on phones; the links drop below. */
.site-footer__legal { flex: 1 1 14rem; display: grid; gap: var(--space-2); }
.site-footer__copy { font-weight: 600; }

.site-footer__nav { display: flex; flex-wrap: wrap; gap: 0 var(--space-5); }
.site-footer__nav a {
  display: inline-flex;
  align-items: center;
  min-height: 3rem;
  color: var(--paper);
  font-weight: 700;
}

/* ---------- Document pages (privacy, support) and the 404 ---------- */

.doc { padding-block: var(--space-6) var(--space-section); }
.doc__inner { max-width: 46rem; }

.doc h1 { font-size: clamp(2.25rem, 1.4rem + 3vw, 3.5rem); line-height: 1.05; }
.doc__meta { margin-top: var(--space-3); font-family: var(--font-spec); font-size: 0.8125rem; letter-spacing: 0.04em; color: var(--text-quiet); }
.doc__lead { margin-top: var(--space-5); font-size: var(--step-lede); line-height: 1.45; text-wrap: pretty; }

.doc__body { display: grid; gap: var(--space-4); margin-top: var(--space-7); }
.doc__body h2 {
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid var(--line);
  font-size: var(--step-heading);
  line-height: 1.15;
}
.doc__body h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.doc__body h3 { margin-top: var(--space-3); }
.doc__body p,
.doc__body li { text-wrap: pretty; }
.doc__body ul { display: grid; gap: var(--space-2); padding-left: 1.25rem; list-style: disc; }
.doc__body li::marker { color: var(--cobalt); }

/* A contact panel on the same Lilac as the rest of the site's soft panels. */
.contact {
  display: grid;
  justify-items: start;
  gap: var(--space-3);
  padding: clamp(1.25rem, 4vw, 2rem);
  border-radius: var(--radius-l);
  background: var(--lilac);
}
.doc__body .contact h2 { margin: 0; padding: 0; border: 0; }
.contact .button { max-width: 100%; overflow-wrap: anywhere; text-align: center; }

.notfound { display: grid; justify-items: start; gap: var(--space-5); padding-block: var(--space-7) var(--space-section); }
.notfound img { width: min(100%, 15rem); }

/* ---------- Forced colors (Windows High Contrast): keep the selected move obvious ---------- */

@media (forced-colors: active) {
  .move { border-color: ButtonText; }
  .move.is-selected { outline: 3px solid Highlight; outline-offset: -2px; }
}

/* ---------- Reduced motion ---------- */

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