/* Lemon Cart, lemoncart.app. Colours are the adult folio's own (ParentAndHelpPanel.swift)
   and the painted cart's (docs/style.md): folio paper, ink, honey wood, slate strap. */

:root {
  --paper: #faf5e0;          /* FolioPaper 0.98 0.96 0.88 */
  --paper-rule: rgb(120 80 40 / 0.045);
  --ink: #333a3d;            /* FolioMaterials.ink */
  --ink-soft: #4a5457;
  --slate: #4d6e7d;          /* FolioMaterials.slate, the single accent */
  --slate-deep: #3e5a67;
  --wood: #c28f52;           /* FolioMaterials.wood */
  --wood-ink: #2a2118;
  --lemon: #f4de64;
  --shadow: rgb(110 70 30 / 0.22);

  --font: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --gutter: clamp(1rem, 4vw, 3rem);
  --radius: 18px;
  --sheet: 86rem;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);

  color-scheme: light;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--wood);
}

body {
  margin: 0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--ink);
  /* The folio's faint ruled paper, one line every 13 points. */
  background-color: var(--paper);
  background-image: repeating-linear-gradient(to bottom, transparent 0 12px, var(--paper-rule) 12px 13px);
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--lemon); color: var(--ink); }

a { color: var(--slate-deep); text-underline-offset: 0.18em; text-decoration-thickness: 1.5px; }
a:hover { text-decoration-thickness: 3px; }
a:focus-visible {
  outline: 3px solid var(--slate);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  padding: 0.5rem 0.9rem;
  background: var(--ink);
  color: var(--paper);
  border-radius: 8px;
  z-index: 1;
}
.skip:focus { top: 1rem; }

main { flex: 1; }

/* ---------- Home ---------- */

.stage {
  width: min(100%, var(--sheet));
  margin-inline: auto;
  padding: clamp(1.25rem, 4vw, 3rem) var(--gutter) clamp(3rem, 6vw, 4.5rem);
}

.title {
  margin: 0 0 clamp(1rem, 2.5vw, 1.75rem);
  font-size: clamp(3rem, 10vw, 5.75rem);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.025em;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

/* The painting, 16:9 at every size. Phones get the 900 crop with the extra sky. */
.hero {
  position: relative;
  margin: 0 calc(var(--gutter) * -0.5);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius);
  background: #e9c9a7;
  box-shadow: 0 5px 16px var(--shadow);
}
.hero > picture > img,
.hero > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* The words sit under the painting, never over it. */
.words {
  margin-top: clamp(1.5rem, 3.5vw, 2.5rem);
  display: grid;
  gap: 1rem 4rem;
}
.words p {
  margin: 0 0 0.6em;
  text-wrap: pretty;
}
.words .lede {
  max-width: 24ch;
  font-size: clamp(1.4rem, 3vw, 2.1rem);
  line-height: 1.3;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.words .plain { font-size: 1.125rem; color: var(--ink-soft); }

.get {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.9rem;
  margin-top: 1.25rem;
}
/* The app's own icon, at the size it shows on the store listing, so a parent knows what to look for. */
.app-icon {
  flex: none;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 22.5%;
  box-shadow: 0 1px 0 rgb(110 70 30 / 0.12), 0 3px 10px var(--shadow);
}
/* Until launch: a plain line beside the app icon. Not badge-shaped, so nothing looks tappable that isn't. */
.soon {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 650;
  line-height: 1.3;
  color: var(--ink);
}

@media (min-width: 56rem) {
  .hero { margin: 0; }
  .words { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: start; }
  .words .aside { padding-top: 0.35rem; }
}

/* ---------- The butterfly: the game's two drawn wing states, carried across the sky by CSS ---------- */

.flight {
  position: absolute;
  inset: 4% 0 auto 0;          /* a lane across the sky; translate % is of the hero's width */
  pointer-events: none;
  transform: translateX(-6%);
}
.bob {
  display: block;
  width: 3.5%;                 /* 76 of the painting's 2200 source pixels: the game's own scale */
}
.butterfly {
  position: relative;
  display: block;
  aspect-ratio: 76 / 55;
}
/* Both states centred on the same body point: open 76x55 at (38, 27.5), closed 42x55 at (21, 27.5). */
.butterfly img { position: absolute; top: 0; height: 100%; object-fit: fill; }
.butterfly .wings-open { left: 0; width: 100%; }
.butterfly .wings-closed { left: 22.37%; width: 55.26%; opacity: 0; }

@media (max-width: 40rem) {
  .flight { inset-block-start: 2.5%; }
  .bob { width: 5%; }
}

@media (prefers-reduced-motion: no-preference) {
  .flight { animation: cross 28s linear 1.5s infinite both; }
  .bob { animation: bob 2.8s ease-in-out infinite alternate; }
  .wings-open { animation: wings-open 0.34s step-end infinite; }
  .wings-closed { animation: wings-closed 0.34s step-end infinite; }

  @keyframes cross {
    0%   { transform: translateX(-6%); }
    42%  { transform: translateX(104%); }
    100% { transform: translateX(104%); }
  }
  @keyframes bob {
    from { transform: translateY(-40%) rotate(-6deg); }
    to   { transform: translateY(110%) rotate(5deg); }
  }
  @keyframes wings-open   { 0% { opacity: 1; } 50% { opacity: 0; } }
  @keyframes wings-closed { 0% { opacity: 0; } 50% { opacity: 1; } }
}
@media (prefers-reduced-motion: reduce) {
  .flight { display: none; }
}

/* ---------- See it in play: the game itself ---------- */

.in-play {
  width: min(100%, var(--sheet));
  margin-inline: auto;
  padding: 0 var(--gutter) clamp(3.5rem, 7vw, 5.5rem);
}
.in-play h2 {
  margin: 0 0 1rem;
  font-size: clamp(1.5rem, 3vw, 1.9rem);
  font-weight: 800;
  letter-spacing: -0.015em;
}
.in-play figure { margin: 0 calc(var(--gutter) * -0.5); }
.in-play img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  background: #e9c9a7;
  box-shadow: 0 5px 16px var(--shadow);
}
@media (min-width: 56rem) {
  .in-play {
    display: grid;
    grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
    column-gap: clamp(2.5rem, 5vw, 4.5rem);
    align-items: start;
  }
  .in-play h2 { padding-top: 0.7rem; }
  .in-play figure { margin: 0; }
}

/* ---------- For grown-ups: plain facts, one per row, on the folio's ruled paper ---------- */

.facts {
  width: min(100%, var(--sheet));
  margin-inline: auto;
  padding: 0 var(--gutter) clamp(3.5rem, 7vw, 5.5rem);
}
.facts h2 {
  margin: 0 0 1rem;
  font-size: clamp(1.5rem, 3vw, 1.9rem);
  font-weight: 800;
  letter-spacing: -0.015em;
}
.facts dl {
  margin: 0;
  max-width: 52rem;
  border-top: 1.5px solid var(--ink);
}
.facts dl > div {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.2rem;
  padding: 0.8rem 0 0.85rem;
  border-bottom: 1px solid rgb(51 58 61 / 0.18);
}
.facts dt {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  color: var(--slate-deep);
}
/* Line icons drawn in the slate ink, the weight of a pen on the folio's paper. */
.fact-icon {
  flex: none;
  width: 1.375rem;
  height: 1.375rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.facts dd { margin: 0; text-wrap: pretty; }
@media (min-width: 40rem) {
  .facts dl > div { grid-template-columns: 10rem 1fr; gap: 1.25rem; align-items: start; }
}
/* On wide screens the facts take the hero's two columns: heading under the words, list under the painting. */
@media (min-width: 56rem) {
  .facts {
    display: grid;
    grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
    column-gap: clamp(2.5rem, 5vw, 4.5rem);
    align-items: start;
  }
  .facts h2 { padding-top: 0.7rem; position: sticky; top: 1.5rem; }
  .facts dl { max-width: none; }
}

/* ---------- Privacy and support ---------- */

.page {
  width: min(100%, 44rem);
  margin-inline: auto;
  padding: clamp(1.25rem, 4vw, 2.5rem) var(--gutter) clamp(3rem, 7vw, 5rem);
}
.home-link {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.015em;
  color: var(--ink);
  text-decoration: none;
  padding-block: 0.4rem;
}
.home-link img { border-radius: 22.5%; }
.home-link:hover { text-decoration: underline; text-decoration-thickness: 3px; }
.page h1 {
  margin: clamp(1.5rem, 5vw, 3rem) 0 1.25rem;
  font-size: clamp(2.1rem, 6vw, 3rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.page p { margin: 0 0 1.1em; max-width: 65ch; line-height: 1.65; text-wrap: pretty; }
.page .effective { margin-top: -0.4rem; color: var(--ink-soft); font-size: 0.95rem; }
.page .lede { font-size: 1.25rem; font-weight: 600; line-height: 1.4; }
.page .contact { list-style: none; padding: 0; margin: 1.5rem 0 0; }
.page .contact li { font-size: 1.2rem; font-weight: 600; }
.page .contact a { display: inline-block; padding-block: 0.45rem; overflow-wrap: anywhere; }

/* ---------- The cart body: cloth scallops over honey wood, a slate strap ---------- */

.cart {
  position: relative;
  background: var(--wood);
  color: var(--wood-ink);
  padding: 2.1rem var(--gutter) 0;
}
.cart::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -1px;
  height: 18px;
  background: radial-gradient(ellipse 50% 100% at 50% 0, var(--paper) 98%, transparent 100%) 50% 0 / 104px 18px repeat-x;
}
.cart-inner {
  width: min(100%, calc(var(--sheet) - 2 * var(--gutter)));
  margin-inline: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  align-items: center;
  padding-bottom: 1.1rem;
}
.cart a {
  color: var(--wood-ink);
  font-weight: 650;
  font-size: 1.0625rem;
  padding-block: 0.6rem;   /* 44pt touch height */
  overflow-wrap: anywhere;
}
.cart a:focus-visible { outline-color: var(--wood-ink); }
.strap {
  height: 12px;
  background: var(--slate);
  margin-inline: calc(var(--gutter) * -1);
}
.cart-foot {
  width: min(100%, calc(var(--sheet) - 2 * var(--gutter)));
  margin-inline: auto;
  padding: 0.9rem 0 max(1.1rem, env(safe-area-inset-bottom));
  margin-block: 0;
  font-size: 0.875rem;
  color: var(--wood-ink);
}

/* ---------- Arrival: the painting settles once, as the cart arrives in the game. ---------- */

@media (prefers-reduced-motion: no-preference) {
  .hero > picture img { animation: settle 800ms var(--ease-out) both; }
  @keyframes settle {
    from { opacity: 0.35; transform: translateY(8px); }
  }
}

.nowrap { white-space: nowrap; }

/* Policy pages: the footer shares the text column's left edge. */
.cart--page .cart-inner,
.cart--page .cart-foot { width: min(100%, calc(44rem - 2 * var(--gutter))); }
