/* My Doodle World. Look: render A ("a colouring page waiting to be coloured").
   Warm paper everywhere, crayon swashes bleeding in from the edges, everything inside hand-drawn ink lines.
   One stroke weight (3px), one spacing scale, one type scale, one container. */

:root {
  /* Brand palette (signed off) */
  --paper: #f6f5f3;            /* low-chroma warm paper; the fibre texture carries the warmth */
  --sheet: #ffffff;            /* the white of a colouring page */
  --ink: #1a1a1a;
  --red: #e8452c;
  --yellow: #ffc531;
  --blue: #3a86ff;
  --green: #3bb273;
  --accent: var(--red);
  --stroke: 3px;

  --font-display: "Fredoka", "Baloo 2", "Arial Rounded MT Bold", system-ui, sans-serif;
  --font-text: "Nunito", "Segoe UI", system-ui, sans-serif;

  /* Type scale: five steps */
  --s-display: clamp(2.2rem, 4.8vw, 4.8rem);
  --s-head: clamp(2.1rem, 4.2vw, 4rem);
  --s-large: clamp(1.25rem, 1.7vw, 1.6rem);
  --s-body: 1.125rem;
  --s-small: 0.9375rem;

  /* Spacing scale */
  --sp-1: 0.5rem; --sp-2: 1rem; --sp-3: 1.5rem; --sp-4: 2rem; --sp-5: 3rem; --sp-6: 4rem; --sp-7: 6rem; --sp-8: 9rem;
  --section: clamp(var(--sp-6), 9vw, var(--sp-8));

  /* One container */
  --max: 1320px;
  --m: clamp(1rem, 3vw, 2.5rem);
  --gutter: clamp(0.75rem, 1.6vw, 1.5rem);
  --frame-gap: clamp(6px, 0.9vw, 14px);

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --t-press: 140ms; --t-hover: 180ms; --t-ui: 240ms;

  --paper-tex: url("../img/paper.png");
  --grain: url("../img/crayon-grain.png");
  --ink-frame: url("../img/frame.svg");
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; color: var(--ink);
  background: var(--paper) var(--paper-tex) repeat;
  font-family: var(--font-text); font-size: var(--s-body); line-height: 1.55;
  overflow-x: clip;
}
img, svg { display: block; max-width: 100%; }
img { height: auto; }
h1, h2, h3, p, ul, ol, figure, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
::selection { background: var(--yellow); color: var(--ink); }
/* Two-tone focus ring: ink line with a yellow halo, visible on paper, crayon fields and photos (3:1+ everywhere) */
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; box-shadow: 0 0 0 6px var(--yellow); border-radius: 6px; } /* taste-skill-ignore: focus ring, not a resting shadow */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: var(--m); top: -100px; z-index: 60; background: var(--yellow); padding: 10px 16px; font-weight: 800; border: var(--stroke) solid var(--ink); border-radius: 999px; }
.skip:focus { top: 16px; }

/* ---------- The drawn line: one hand-drawn ink outline for the page, cards and pictures ---------- */
.ink { border: var(--stroke) solid var(--ink); border-image: var(--ink-frame) 20 round; border-image-width: 20px; }
.page { margin: var(--frame-gap); border: var(--stroke) solid var(--ink); border-image: var(--ink-frame) 20 round; border-image-width: 20px; overflow: clip; position: relative; }

/* ---------- Containers ---------- */
.wrap { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--m); }
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); }

/* ---------- Type ---------- */
.display, .head, .btn, .tab, .logo, .go { font-family: var(--font-display); }
.display { font-size: var(--s-display); font-weight: 600; line-height: 1.02; letter-spacing: -0.012em; text-wrap: balance; }
.head { font-size: var(--s-head); font-weight: 600; line-height: 1.04; letter-spacing: -0.01em; text-wrap: balance; }
p { text-wrap: pretty; }

/* ---------- Colour fields (crayon-filled) and paper sections with swashes ---------- */
.field { background-color: var(--c, var(--blue)); background-image: var(--grain); background-size: 240px 240px; }
.paper-section { position: relative; isolation: isolate; }
.swash-left::before, .swash-right::before, .hero::before, .hero::after {
  content: ""; position: absolute; z-index: -1; pointer-events: none; background-repeat: no-repeat; background-size: contain;
}
.swash-left::before { left: calc(-1 * var(--sp-6)); top: calc(-1 * var(--sp-4)); width: min(46vw, 640px); aspect-ratio: 760 / 520; background-image: url("../img/swash-yellow.webp"); opacity: 0.75; }
.swash-right::before { right: calc(-1 * var(--sp-6)); top: calc(-1 * var(--sp-5)); width: min(44vw, 600px); aspect-ratio: 760 / 520; background-image: url("../img/swash-blue.webp"); opacity: 0.6; transform: scaleX(-1); }

/* ---------- Buttons and journey links ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0; white-space: nowrap;
  min-height: 56px; padding: 0.55em 1.5em; border-radius: 999px;
  font-size: 1.25rem; font-weight: 700; line-height: 1.1; text-decoration: none; color: var(--ink);
  background-color: var(--accent); border: var(--stroke) solid var(--ink); cursor: pointer;
  transition: transform var(--t-press) var(--ease-out), filter var(--t-hover) ease;
}
.btn:active { transform: scale(0.97); }
/* The render A button: a stripe of four crayon colours with an ink outline */
.btn--crayon { background-color: var(--yellow); background-image: url("../img/crayon-stripe.webp"); background-size: 200% 100%; background-position: 0% 0; padding-inline: 1.7em; transition: transform var(--t-press) var(--ease-out), background-position 700ms var(--ease-out); }
.btn--big { min-height: 64px; font-size: 1.4rem; }
.btn--quiet { background: var(--sheet); }
.has-arrow::after, .go::after { content: "\2192" / ""; display: inline-block; margin-left: 0.4em; transition: transform var(--t-ui) var(--ease-out); }
.go { display: inline; align-items: baseline; font-weight: 600; font-size: var(--s-large); text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 0.22em; text-decoration-color: var(--red); }
.go--on-colour { text-decoration-color: var(--ink); }
.go--on-dark { color: var(--sheet); text-decoration-color: var(--yellow); }
.section-cta { margin-top: var(--sp-4); }
@media (hover: hover) and (pointer: fine) {
  .btn--crayon:hover { background-position: 100% 0; }
  .btn:not(.btn--crayon):hover { filter: saturate(1.25) brightness(1.04); }
  .btn:hover.has-arrow::after, .go:hover::after { transform: translateX(4px); }
  .go:hover { text-decoration-color: currentColor; }
}
.textlink { font-weight: 700; text-decoration: underline; text-decoration-thickness: 0.12em; text-underline-offset: 0.2em; text-decoration-color: var(--blue); }

/* ---------- Logo ---------- */
.logo { display: inline-flex; align-items: center; gap: 0.4rem; text-decoration: none; font-weight: 700; font-size: 1.75rem; line-height: 1; white-space: nowrap; }
.logo svg { width: auto; height: 2.1em; margin-block: -0.35em -0.15em; }
.logo__word { -webkit-text-stroke: 0.12em var(--ink); paint-order: stroke fill; letter-spacing: 0.02em; }
.logo__word span:nth-child(1) { color: var(--red); }
.logo__word span:nth-child(2) { color: var(--green); }
.logo__word span:nth-child(3) { color: var(--blue); }

/* ---------- Navigation with the wobbly ink rule under it ---------- */
.nav { position: relative; z-index: 2; }
.nav__bar { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--sp-2) var(--sp-4); padding-top: var(--sp-3); padding-bottom: var(--sp-2); }
.nav__links { justify-self: end; }
.nav__links { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-4); font-weight: 800; font-size: var(--s-body); }
.nav__links a { display: inline-flex; align-items: center; min-height: 44px; }
.nav__links a { text-decoration: none; }
.nav__make { display: inline-flex; align-items: center; min-height: 44px; padding: 0.3em 1em; border: var(--stroke) solid var(--ink); border-radius: 999px; background: var(--yellow); font-weight: 800; text-decoration: none; white-space: nowrap; }
.nav__rule { height: 14px; width: 100%; max-width: var(--max); overflow: visible; }
.nav__rule path { fill: none; stroke: var(--ink); stroke-width: 3px; stroke-linecap: round; }
@media (hover: hover) and (pointer: fine) { .nav__links a:not(.nav__make):hover { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 0.3em; text-decoration-color: var(--red); } }


/* ---------- Form fields and chips (home page try-out and the order journey) ---------- */
.try { display: grid; gap: var(--sp-2); }
.try__row { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); align-items: end; }
.try label, .try legend { display: block; font-weight: 800; margin-bottom: var(--sp-1); padding: 0; }
.try fieldset { border: 0; padding: 0; margin: 0; }
.field-input {
  width: 100%; max-width: 22rem; min-height: 56px; padding: 0.4rem 1rem;
  font-family: var(--font-display); font-weight: 600; font-size: 1.5rem;
  background: var(--sheet); border: var(--stroke) solid var(--ink); border-radius: 10px;
}
.field-input:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; box-shadow: 0 0 0 6px var(--yellow); } /* taste-skill-ignore: focus ring */
.chips { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip span { display: inline-flex; align-items: center; min-height: 46px; padding: 0.35rem 1.05rem; border: var(--stroke) solid var(--ink); border-radius: 999px; background: var(--sheet); font-weight: 800; transition: background-color var(--t-hover) ease; }
.chip input:checked + span { background: var(--yellow); }
.chip input:focus-visible + span { outline: 3px solid var(--ink); outline-offset: 2px; box-shadow: 0 0 0 6px var(--yellow); } /* taste-skill-ignore: focus ring */
@media (hover: hover) and (pointer: fine) { .chip input:not(:checked):hover + span { background: #fff3cc; } }

/* Home page sections live in assets/css/home.css (index.html only). */

/* ---------- Simple pages (legal drafts, 404) ---------- */
.simple .page { min-height: calc(100svh - 2 * var(--frame-gap)); display: grid; grid-template-rows: auto 1fr auto; }
.simple main { padding-block: var(--sp-6); display: grid; align-content: start; } /* top-anchored: no jump when the display font swaps in */
.draft-banner { --c: var(--yellow); padding: var(--sp-3) var(--sp-4); font-weight: 800; max-width: 64ch; margin-block: var(--sp-3) var(--sp-5); }
.legal-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 0 var(--sp-4); }
.legal-top .head { font-size: var(--s-display); }
.legal-top svg { width: clamp(100px, 13vw, 190px); height: auto; }
.legal { display: grid; gap: var(--sp-4); }
.legal h2 { font-family: var(--font-display); font-size: var(--s-large); font-weight: 600; margin-bottom: var(--sp-1); }
.legal ul { list-style: disc; padding-left: 1.25rem; font-weight: 600; }
@media (min-width: 1100px) { .legal { grid-template-columns: 1fr 1fr; column-gap: var(--sp-6); } }
.lost { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); align-items: start; row-gap: var(--sp-4); }
.lost__text { grid-column: 1 / span 6; display: grid; gap: var(--sp-3); justify-items: start; }
.lost__text .large { font-size: var(--s-large); font-weight: 700; }
.lost__art { grid-column: 7 / -1; }
.lost__art svg { width: 100%; height: auto; }
.simple-foot { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); justify-content: space-between; padding-block: var(--sp-3) var(--sp-4); font-size: var(--s-small); font-weight: 700; }
.simple-foot nav { display: flex; gap: var(--sp-3); flex-wrap: wrap; }

/* ---------- Tablet ---------- */
@media (max-width: 1099px) {
  .nav__bar { grid-template-columns: 1fr auto; }
  .nav__links { grid-column: 1 / -1; grid-row: 2; justify-self: start; gap: 0 var(--sp-3); }
}

/* ---------- Phone ---------- */
@media (max-width: 699px) {
  :root { --s-body: 1.0625rem; --m: 1rem; }
  .logo { font-size: 1.2rem; gap: 0.2rem; }
  .logo svg { height: 1.9em; }
  .nav__bar { padding-top: var(--sp-2); }
  .nav__make { font-size: var(--s-small); padding: 0.3em 0.9em; }
  .nav__links { font-size: var(--s-small); gap: 0 var(--sp-2); }
  .legal-top { grid-template-columns: 1fr; } .legal-top svg { display: none; }
  .lost__text, .lost__art { grid-column: 1 / -1; }
}

/* ---------- Motion (every hidden state lives under no-preference) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .js [data-reveal] { opacity: 0; transform: translateY(24px); transition: opacity 700ms var(--ease-out), transform 900ms var(--ease-expo); transition-delay: var(--d, 0ms); }
  .js [data-reveal].is-in { opacity: 1; transform: none; }
  .dood-bob { animation: bob 2.6s ease-in-out infinite alternate; transform-origin: 50% 100%; }
  @keyframes bob { from { transform: rotate(-3deg); } to { transform: rotate(3deg); } }
  .lost__art svg { animation: snooze 3.2s ease-in-out infinite alternate; transform-origin: 30% 90%; }
  @keyframes snooze { from { transform: rotate(-1deg); } to { transform: rotate(1deg) translateY(-4px); } }
}
@keyframes rise-line { to { transform: none; } }
@keyframes rise { to { opacity: 1; transform: none; } }
@keyframes deal { from { opacity: 0; translate: 0 40px; } to { opacity: 1; translate: 0 0; } }
@media (prefers-reduced-motion: reduce) {
  .card__a, .levels__frame img, .level, .btn { transition: none !important; }
}

/* ---------- Very narrow screens and 400% zoom (WCAG reflow at 320px) ---------- */
@media (max-width: 420px) { .btn { white-space: normal; text-align: center; } }
@media (max-width: 360px) {
  .nav__bar { grid-template-columns: minmax(0, 1fr); }
  .nav__make { justify-self: start; }
  .logo { white-space: normal; }
}
.simple .page { grid-template-columns: minmax(0, 1fr); }
p, li, a { overflow-wrap: break-word; }
/* Tap targets: 44px for every stand-alone link */
.logo { min-height: 44px; }
.simple-foot nav a { display: inline-flex; align-items: center; min-height: 44px; }
.simple-foot nav { gap: 0 var(--sp-3); }
.simple-foot { font-size: var(--s-body); } .simple-foot > p { max-width: 62ch; }

/* ---------- Install the app (assets/js/pwa.js): a slim strip in the page flow under the navigation */
.installbar { display: flex; align-items: center; gap: var(--sp-2); width: calc(100% - 2 * var(--m)); max-width: calc(var(--max) - 2 * var(--m)); margin: var(--sp-1) auto 0; padding: 0.4rem 0.4rem 0.4rem var(--sp-3); background: var(--sheet); border: var(--stroke) solid var(--ink); border-radius: 18px; font-weight: 800; font-size: var(--s-small); }
.installbar p { flex: 1; }
.installbar__go { min-height: 44px; padding: 0 1em; border: var(--stroke) solid var(--ink); border-radius: 999px; background: var(--yellow); font-weight: 800; cursor: pointer; white-space: nowrap; }
.installbar__x { min-width: 44px; min-height: 44px; border: 0; background: none; font-size: 1.6rem; line-height: 1; cursor: pointer; }

