/* Layout idea: a soft sticker sheet. Thick rounded outlines, flat offset shadows,
   a dotted pink ground, wavy section edges, and small round animals as the only decoration. */

@font-face {
  font-family: "Fredoka";
  src: url("fonts/fredoka-latin-wght.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: "Nunito";
  src: url("fonts/nunito-latin-wght.woff2") format("woff2");
  font-weight: 200 1000;
  font-display: swap;
}

:root {
  --font-display: "Fredoka", ui-rounded, "Hiragino Maru Gothic ProN", "Arial Rounded MT Bold", system-ui, sans-serif;
  --font-body: "Nunito", ui-rounded, system-ui, "Segoe UI", sans-serif;

  --bg: #fff3f7;
  --dots: #ffd9e6;
  --surface: #ffffff;
  --surface-soft: #ffe8f0;
  --ink: #4a2540;
  --muted: #724a5f;
  --outline: #6b3a5c;
  --line: #f3bfd2;

  --pink: #ff8db3;
  --pink-text: #c42d64;
  --mint: #b4efd9;
  --mint-text: #14694f;
  --butter: #ffe9a8;
  --butter-text: #7a5600;
  --peach: #ffcdb8;

  --btn-bg: #d1366c;
  --btn-ink: #ffffff;
  --btn-edge: #8f1f48;
  --btn-soft-bg: #ffffff;
  --btn-soft-ink: #4a2540;
  --btn-soft-edge: #f3bfd2;

  --band: #ffe9a8;
  --band-ink: #4a2540;
  --foot: #4a2540;
  --foot-ink: #ffe8f1;
  --foot-link: #ffb7d0;

  --shell: #ffd1e1;
  --shell-dark: #f59cbc;
  --screen: #fffaf0;
  --shadow: rgba(196, 45, 100, 0.2);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #2a1424;
    --dots: #3a1c30;
    --surface: #3b2033;
    --surface-soft: #4b2942;
    --ink: #ffe8f1;
    --muted: #dbb6c8;
    --outline: #ffc2d8;
    --line: #6a3c5e;

    --pink: #ff8db3;
    --pink-text: #ff9fc0;
    --mint: #3f9d80;
    --mint-text: #98ecce;
    --butter: #e8c765;
    --butter-text: #f5d98a;
    --peach: #d98e72;

    --btn-bg: #ff8db3;
    --btn-ink: #3a1428;
    --btn-edge: #b04a72;
    --btn-soft-bg: #3b2033;
    --btn-soft-ink: #ffe8f1;
    --btn-soft-edge: #6a3c5e;

    --band: #3f2a3a;
    --band-ink: #ffe8f1;
    --foot: #1d0e19;
    --foot-ink: #ffe8f1;
    --foot-link: #ffb7d0;

    --shell: #7a3f62;
    --shell-dark: #5a2c47;
    --screen: #2a1424;
    --shadow: rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #2a1424;
  --dots: #3a1c30;
  --surface: #3b2033;
  --surface-soft: #4b2942;
  --ink: #ffe8f1;
  --muted: #dbb6c8;
  --outline: #ffc2d8;
  --line: #6a3c5e;

  --pink: #ff8db3;
  --pink-text: #ff9fc0;
  --mint: #3f9d80;
  --mint-text: #98ecce;
  --butter: #e8c765;
  --butter-text: #f5d98a;
  --peach: #d98e72;

  --btn-bg: #ff8db3;
  --btn-ink: #3a1428;
  --btn-edge: #b04a72;
  --btn-soft-bg: #3b2033;
  --btn-soft-ink: #ffe8f1;
  --btn-soft-edge: #6a3c5e;

  --band: #3f2a3a;
  --band-ink: #ffe8f1;
  --foot: #1d0e19;
  --foot-ink: #ffe8f1;
  --foot-link: #ffb7d0;

  --shell: #7a3f62;
  --shell-dark: #5a2c47;
  --screen: #2a1424;
  --shadow: rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  background-color: var(--bg);
  background-image: radial-gradient(var(--dots) 2.2px, transparent 2.6px);
  background-size: 26px 26px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  overflow-x: hidden;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: 0.005em;
  text-wrap: balance;
  margin: 0;
}
h1 { font-size: clamp(2.4rem, 6.4vw, 4.1rem); }
h2 { font-size: clamp(1.7rem, 3.6vw, 2.4rem); }
h3 { font-size: 1.3rem; }
p { margin: 0; }
a { color: var(--pink-text); text-underline-offset: 0.18em; text-decoration-thickness: 0.09em; }
a:hover { text-decoration-thickness: 0.16em; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 0.5rem; }

.wrap { width: 100%; max-width: 70rem; margin-inline: auto; padding-inline: 1rem; }
.narrow { max-width: 38rem; }
.stack { display: grid; gap: 1.2rem; justify-items: start; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---------- header ---------- */
.top { padding-block: 1.1rem; }
.top .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1.5rem; }
.brand {
  display: inline-flex; align-items: center; gap: 0.6rem;
  font-family: var(--font-display); font-weight: 600; font-size: 1.3rem;
  color: var(--ink); text-decoration: none;
}
.brand svg { width: 2.6rem; height: 2.6rem; }
.nav { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.nav a {
  padding: 0.4rem 1rem; border-radius: 999px; color: var(--ink); text-decoration: none;
  font-family: var(--font-display); font-weight: 500;
  border: 3px solid transparent;
}
.nav a:hover { background: var(--surface); border-color: var(--line); }
.nav a[aria-current="page"] { background: var(--surface); border-color: var(--line); }

/* ---------- mascots ---------- */
.mascot { display: block; overflow: visible; }
/* These match the shapes inside the sprite's <symbol>s, so they must not depend on a .mascot ancestor:
   styles inside a <use> follow the original element's place in the document. The --b and --i colors
   are inherited from the <svg class="mascot m-..."> that references the symbol. */
.m-body { fill: var(--b); }
.m-in { fill: var(--i); }
.m-body, .m-in { stroke: var(--outline); stroke-width: 2.6; stroke-linejoin: round; }
.m-ink { fill: var(--outline); }
.m-blush { fill: var(--pink); opacity: 0.55; }
.m-line { fill: none; stroke: var(--outline); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.m-leaf { fill: var(--mint); stroke: var(--outline); stroke-width: 2.6; stroke-linejoin: round; }
.m-pink { --b: var(--pink); --i: #ffd0e0; }
.m-butter { --b: var(--butter); --i: #fff6d6; }
.m-mint { --b: var(--mint); --i: #e2fbf1; }
.m-peach { --b: var(--peach); --i: #ffe6da; }
.m-white { --b: #ffffff; --i: #ffe8f0; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .m-white { --b: #f6dbe7; --i: #ffc9dc; }
}
:root[data-theme="dark"] .m-white { --b: #f6dbe7; --i: #ffc9dc; }

.spark { fill: var(--butter); stroke: var(--outline); stroke-width: 2.4; stroke-linejoin: round; }
.heart { fill: var(--pink); stroke: var(--outline); stroke-width: 2.4; stroke-linejoin: round; }

@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes twinkle { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(0.8); opacity: 0.75; } }
.bob { animation: bob 4.2s ease-in-out infinite; }
.bob.late { animation-delay: -1.7s; }
.bob.later { animation-delay: -3s; }
.twinkle { animation: twinkle 3.2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.twinkle.late { animation-delay: -1.2s; }
@media (prefers-reduced-motion: reduce) {
  .bob, .twinkle { animation: none; }
}

/* ---------- buttons and forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 3rem; padding: 0.55rem 1.5rem; border-radius: 999px; border: 0; cursor: pointer;
  font-family: var(--font-display); font-weight: 600; font-size: 1.1rem; text-decoration: none;
  background: var(--btn-bg); color: var(--btn-ink);
  box-shadow: 0 5px 0 var(--btn-edge);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 7px 0 var(--btn-edge); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--btn-edge); }
.btn.soft { background: var(--btn-soft-bg); color: var(--btn-soft-ink); box-shadow: 0 5px 0 var(--btn-soft-edge); border: 3px solid var(--btn-soft-edge); padding-block: 0.4rem; }
.btn.soft:hover { box-shadow: 0 7px 0 var(--btn-soft-edge); }
.btn.soft:active { box-shadow: 0 1px 0 var(--btn-soft-edge); }
.btn.quiet { background: transparent; color: var(--ink); box-shadow: none; border: 3px solid var(--outline); }
.btn.quiet:hover { background: var(--surface-soft); transform: none; box-shadow: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.9rem 1rem; align-items: center; }
@media (prefers-reduced-motion: reduce) { .btn { transition: none; } }

label { display: block; font-family: var(--font-display); font-weight: 500; font-size: 1.05rem; margin-bottom: 0.3rem; }
.hint { color: var(--muted); font-size: 0.95rem; margin-top: 0.35rem; }
input[type="text"], input[type="email"] {
  width: 100%; min-height: 3.2rem; padding: 0.6rem 1rem; border-radius: 1.1rem;
  border: 3px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; font-size: 1.15rem;
}
input[type="text"]:focus, input[type="email"]:focus { outline: none; border-color: var(--pink-text); box-shadow: 0 0 0 4px var(--shadow); }
input.code { font-family: var(--font-display); font-size: 1.5rem; letter-spacing: 0.14em; text-transform: uppercase; text-align: center; }
::placeholder { color: var(--muted); opacity: 0.7; }

.note { padding: 0.8rem 1.1rem; border-radius: 1.2rem; border: 3px solid var(--line); background: var(--surface); }
.note.ok { background: var(--mint); color: #17342b; border-color: var(--mint-text); }
.note.error { background: var(--peach); color: #3b1a12; border-color: var(--outline); font-weight: 700; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .note.ok, :root:not([data-theme="light"]) .note.error { color: #1d0e19; }
}
:root[data-theme="dark"] .note.ok, :root[data-theme="dark"] .note.error { color: #1d0e19; }

/* ---------- home ---------- */
.hero { padding-block: 1.5rem 3.5rem; }
.hero .wrap { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: 2.5rem; align-items: center; }
.hero-copy { display: grid; gap: 1.4rem; justify-items: start; }
.hero-copy p { font-size: 1.2rem; max-width: 34rem; }
.sticker {
  display: inline-block; padding: 0 0.35em; border-radius: 0.5em; background: var(--butter); color: #4a2540;
  transform: rotate(-2.5deg); box-shadow: 0 4px 0 var(--shadow);
}
.hero-art { width: 100%; max-width: 30rem; justify-self: center; }
.hero-art > svg { width: 100%; height: auto; display: block; }
@media (max-width: 52rem) {
  .hero .wrap { grid-template-columns: minmax(0, 1fr); }
  .hero-art { max-width: 24rem; }
}

.wave-wrap { line-height: 0; margin-top: -1px; }
.wave-wrap.on-band { background: var(--band); }
.wave { display: block; width: 100%; height: 3.5rem; fill: var(--fill); }
.wave.to-band { --fill: var(--band); }
.wave.to-foot { --fill: var(--foot); }
.foot { margin-top: -1px; }

.section { padding-block: 3rem; }
.section-head { display: grid; gap: 0.75rem; max-width: 38rem; margin-bottom: 3.2rem; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem; }
.tile {
  position: relative; background: var(--surface); border: 3px solid var(--line); border-radius: 2rem 2rem 2.4rem 1.6rem;
  padding: 3.4rem 1.4rem 1.6rem; box-shadow: 0 7px 0 var(--shadow); display: grid; gap: 0.5rem; align-content: start;
}
.tile.r1 { transform: rotate(-1.2deg); }
.tile.r2 { transform: rotate(0.9deg) translateY(0.7rem); border-radius: 1.6rem 2.4rem 1.8rem 2.4rem; }
.tile.r3 { transform: rotate(-0.6deg); border-radius: 2.4rem 1.6rem 2rem 2rem; }
.tile .mascot { position: absolute; top: -2.1rem; left: 1.1rem; width: 4.6rem; height: 4.6rem; }
.tile p { color: var(--muted); }
@media (max-width: 52rem) {
  .tiles { grid-template-columns: minmax(0, 1fr); gap: 2.6rem; }
  .tile.r1, .tile.r2, .tile.r3 { transform: none; }
}

.band { background: var(--band); color: var(--band-ink); padding-block: 3rem 3.5rem; }
.band .wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2.5rem; align-items: center; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.steps li { display: grid; grid-template-columns: 2.6rem minmax(0, 1fr); gap: 0.9rem; align-items: start; }
.steps .n {
  display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 50%;
  background: var(--surface); color: var(--ink); border: 3px solid var(--outline);
  font-family: var(--font-display); font-weight: 600;
}
.code-card {
  justify-self: center; width: 100%; max-width: 24rem; background: var(--surface); color: var(--ink);
  border: 3px solid var(--outline); border-radius: 2rem; padding: 1.4rem; box-shadow: 0 7px 0 var(--shadow);
  display: grid; gap: 0.35rem; justify-items: center; text-align: center;
}
.code-card .label { color: var(--muted); font-size: 0.95rem; }
.code-card .sample { font-family: var(--font-display); font-weight: 600; font-size: clamp(1.7rem, 7vw, 2.4rem); letter-spacing: 0.12em; }
@media (max-width: 52rem) { .band .wrap { grid-template-columns: minmax(0, 1fr); } }

/* ---------- pages with a card ---------- */
.page { padding-block: 1.5rem 4rem; }
.page-head { display: grid; gap: 0.75rem; margin-bottom: 1.6rem; position: relative; padding-right: 6.5rem; }
.page-head .mascot { position: absolute; right: 0; top: -0.3rem; width: 5.4rem; height: 5.4rem; }
.panel {
  background: var(--surface); border: 3px solid var(--line); border-radius: 2rem; padding: 1.5rem;
  box-shadow: 0 7px 0 var(--shadow); display: grid; gap: 1.1rem;
}
.panel + .panel { margin-top: 1.6rem; }
.panel > * { min-width: 0; }
.divider { border: 0; border-top: 3px dashed var(--line); margin: 0.3rem 0; }
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.3rem 1.2rem; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.pill { display: inline-block; padding: 0.1rem 0.8rem; border-radius: 999px; background: var(--mint); color: #17342b; font-weight: 800; font-size: 0.95rem; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pill { color: #1d0e19; } }
:root[data-theme="dark"] .pill { color: #1d0e19; }
.inline-form { display: grid; gap: 0.8rem; }
.danger-note { color: var(--muted); }

/* ---------- reading pages ---------- */
.prose { display: grid; gap: 2rem; }
.prose section { display: grid; gap: 0.7rem; }
.prose h2 { font-size: 1.6rem; }
.prose ul { margin: 0; padding-left: 1.3rem; display: grid; gap: 0.45rem; }
.prose li::marker { color: var(--pink-text); }
.prose .summary { background: var(--surface); border: 3px solid var(--line); border-radius: 2rem; padding: 1.3rem 1.5rem; box-shadow: 0 7px 0 var(--shadow); }
.updated { color: var(--muted); font-size: 0.95rem; }

/* ---------- footer ---------- */
.foot { background: var(--foot); color: var(--foot-ink); padding-block: 2.2rem 2.6rem; }
.foot .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem 2rem; align-items: center; }
.foot a { color: var(--foot-link); }
.foot p { max-width: 36rem; }
.foot-links { display: flex; flex-wrap: wrap; gap: 0.4rem 1.4rem; }

/* ---------- small additions ---------- */
.page-head h1 { font-size: clamp(2rem, 5.4vw, 3rem); }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.leave { margin-top: 1.6rem; }
