/* Merlo page CSS: the brand (white pages, near-black Nunito, one warm red, the clay renders) and the drawn
   product UI inside the visuals. Everything else comes from the kit (assets/system.css and friends). */

:root {
  /* the palette: calm white, near-black type, one red for the main action */
  --p-bg: #ffffff; --p-surface: #f5f4f2; --p-ink: #17161c; --p-muted: #625f69;
  --p-accent: #17161c; --p-accent-ink: #ffffff; --p-action: #E23A2E; --p-action-ink: #ffffff;
  --p-inv-bg: #17161c; --p-inv-surface: #24232a; --p-inv-ink: #ffffff; --p-inv-muted: #a8a5ae;
  --p-inv-accent: #ffffff; --p-inv-accent-ink: #17161c; --p-inv-action: #E23A2E; --p-inv-action-ink: #ffffff;
  /* the lit ground behind drawn UI and renders: a soft warm white, so the clay carries the colour */
  --ground-bg: #f3f1ed; --ground-surface: #faf9f6; --ground-ink: #17161c; --ground-muted: #5b5862; --ground-accent: #E23A2E;
  /* the brand's own face (Nunito, as in the app) */
  --font-display: "Nunito", system-ui, sans-serif;
  --font-text: "Nunito", system-ui, sans-serif;
  --display-weight: 800;
  --display-tracking: -0.025em;
  --display-tracking-xl: -0.035em;
  /* brand colours for the drawn UI */
  --km-red: #E23A2E;
  --km-green: #22B35E;
  /* the same colours as text and filled buttons, dark enough to read at 4.5:1 */
  --km-red-ink: #C0302A;
  --km-green-ink: #157A3C;
  /* soft layered shadows in place of outlines */
  --mo-shadow: 0 1px 2px rgb(23 22 28 / .06), 0 8px 24px -8px rgb(23 22 28 / .14), 0 24px 48px -24px rgb(23 22 28 / .18);
}

/* The evening grade follows the device setting, once, on load. */
@media (prefers-color-scheme: dark) {
  :root {
    --p-bg: #141318; --p-surface: #1f1e24; --p-ink: #f6f5f3; --p-muted: #aaa7b0;
    --p-accent: #f6f5f3; --p-accent-ink: #141318; --p-action: #E23A2E; --p-action-ink: #ffffff;
    --p-inv-bg: #0d0c10; --p-inv-surface: #1a191e; --p-inv-ink: #f6f5f3; --p-inv-muted: #aaa7b0;
    --p-inv-accent: #f6f5f3; --p-inv-accent-ink: #141318; --p-inv-action: #E23A2E; --p-inv-action-ink: #ffffff;
    --ground-bg: #24232a; --ground-surface: #2c2b32; --ground-ink: #f6f5f3; --ground-muted: #b4b1ba; --ground-accent: #ff8c84;
    --km-green: #2CC56B;
    --km-red-ink: #FF8C84;
    --km-green-ink: #5FD68F;
    color-scheme: dark;
  }
}

/* The Merlo mark in the nav and footer: the clay bird, front on, beside the lowercase name */
.km-mark { width: 34px; height: 34px; flex: none; object-fit: contain; }
.nav__logo { gap: var(--s-2); font-weight: 900; letter-spacing: -0.02em; }

/* ------------------------------------------------------------------ the renders
   The clay birds and objects carry the page's colour; they sit on white or the soft ground with no box. */
.mo-eyebrow { color: var(--km-red-ink); margin: 0 0 var(--s-3); }

/* the hero: Merlo waits in the middle, a new message beside him */
.mo-stage { position: relative; height: 100%; min-height: 420px; }
.mo-stage__bird { position: absolute; left: 50%; top: 50%; width: min(100%, 500px); aspect-ratio: 1; transform: translate(-50%, -46%); }
.mo-stage__bird img, .mo-hop img, .mo-call__bird img { width: 100%; height: 100%; object-fit: contain; display: block; }
.mo-chip { position: absolute; display: flex; align-items: center; gap: 12px; padding: 12px 16px 12px 12px; border-radius: 22px;
           background: var(--bg); box-shadow: var(--mo-shadow); max-width: 300px; }
.mo-chip--a { right: 2%; top: 16%; }
.mo-chip--b { left: 4%; bottom: 18%; }
@media (max-width: 1279px) and (min-width: 1024px) { .mo-chip--a { right: 2%; } .mo-chip--b { left: 2%; } }
@media (max-width: 639px) {
  .mo-stage { min-height: 360px; }
  .mo-stage__bird { width: 72%; transform: translate(-50%, -50%); }
  .mo-chip { padding: 10px 12px 10px 10px; gap: 10px; max-width: 250px; }
  .mo-chip--a { top: 0; }
  .mo-chip--b { bottom: 0; }
}

/* #messages: Merlo hops in the corner as a message lands */
.mo-hop { display: block; width: 100%; max-width: 120px; aspect-ratio: 1; justify-self: end; margin-top: -24px; }
@media (max-width: 1023px) { .mo-hop { display: none; } }

/* #call: Merlo tilts his head and listens beside the line */
main > #call > .wrap.mo-call { display: grid; grid-template-columns: 240px minmax(0, 1fr); column-gap: var(--s-7); align-items: center; align-content: center; }
#call .mo-call__bird { display: block; width: 240px; height: 240px; }
@media (max-width: 1023px) { main > #call > .wrap.mo-call { grid-template-columns: 160px minmax(0, 1fr); column-gap: var(--s-5); } #call .mo-call__bird { width: 160px; height: 160px; } }
@media (max-width: 639px) { main > #call > .wrap.mo-call { grid-template-columns: 1fr; row-gap: var(--s-3); } #call .mo-call__bird { width: 140px; height: 140px; } }

/* #family: the call page on Grandma's phone, the family's birds in front of it */
.mo-family { background: var(--ground-bg); }
.mo-family__flock { position: absolute; left: 50%; bottom: -2%; width: min(96%, 560px); transform: translateX(-50%); z-index: 2; pointer-events: none; }
@media (max-width: 639px) { .mo-family__flock { position: relative; left: auto; bottom: auto; transform: none; display: block; margin: -40px auto 8px; width: 92%; } }

/* #listen and #pricing: one render, whole, centred on its panel */
.panel.mo-render { display: grid; place-items: center; padding: var(--s-5); background: var(--bg); }
.panel.mo-render img { max-width: min(80%, 380px); max-height: 100%; width: auto; height: auto; object-fit: contain; }
#listen .panel.mo-render { --p-h: 280px; }
@media (max-width: 639px) { #listen .panel.mo-render { --p-h: 170px; } }
.mo-render--house { background: var(--surface) !important; }
.mo-soon { display: inline-block; vertical-align: middle; margin-left: 8px; padding: 3px 10px; border-radius: 999px; background: var(--surface);
           color: var(--muted); font: 800 12px/1.4 var(--font-text); letter-spacing: .02em; }
#listen .mo-soon { background: var(--bg); }

/* bird avatars: each person (and each kid) is a clay bird in their own colour, standing in the circle */
.km-avatar.km-bird { background: var(--surface); overflow: visible; }
.km-avatar.km-bird img { width: 86%; height: 86%; object-fit: contain; margin-top: 4%; }
.km-title--xl { font-size: 30px; }
.km-timer--red { color: var(--km-red-ink); }
.km-col { display: grid; gap: 10px; }
.km-meter { height: 10px; border-radius: 5px; background: var(--surface); overflow: hidden; }
.km-meter i { display: block; width: 50%; height: 100%; background: var(--ink); border-radius: 5px; }

/* ------------------------------------------------------------------ drawn product UI
   One look for every piece: the app's paper, ink and the red badge. */
.km { font-family: var(--font-text); color: var(--ink); }
.km-screen { background: var(--bg); color: var(--ink); height: 100%; display: flex; flex-direction: column; gap: 12px; padding: 18px 16px; text-align: left; }
.km-screen--center { align-items: center; text-align: center; }
.km-avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--ink); color: var(--bg); display: grid; place-items: center;
             font: 900 20px/1 var(--font-display); flex: none; position: relative; }
.km-avatar--lg { width: 88px; height: 88px; font-size: 40px; }
.km-avatar--sm { width: 32px; height: 32px; font-size: 14px; }
.km-avatar[data-count]::after { content: attr(data-count); position: absolute; top: -4px; right: -6px; min-width: 22px; height: 22px; padding: 0 5px;
             border-radius: 11px; background: var(--km-red); color: #fff; font: 900 12px/22px var(--font-text); text-align: center;
             box-shadow: 0 0 0 2.5px var(--bg); }
.km-avatar--live { box-shadow: 0 0 0 4px color-mix(in oklab, var(--km-red) 55%, transparent); }
.km-title { font: 900 22px/1.15 var(--font-display); letter-spacing: -0.02em; margin: 0; }
.km-sub { font-size: 13px; line-height: 1.35; color: var(--muted); margin: 0; }
.km-sub--red { color: var(--km-red-ink); font-weight: 700; }
.km-label { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 4px 0 0; }
.km-list { background: var(--surface); border-radius: 18px; padding: 2px 14px; }
.km-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.km-row + .km-row { border-top: 1px solid var(--line); }
.km-row__text { flex: 1; min-width: 0; display: grid; gap: 1px; }
.km-row__name { font-weight: 800; font-size: 15px; line-height: 1.25; }
.km-play { width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: var(--bg); display: grid; place-items: center; flex: none; position: relative; }
.km-play svg { width: 12px; height: 12px; }
.km-play[data-new]::after { content: ""; position: absolute; top: -2px; right: -2px; width: 11px; height: 11px; border-radius: 50%; background: var(--km-red);
             box-shadow: 0 0 0 2px var(--surface); }
.km-chip { font-size: 12px; font-weight: 800; color: var(--muted); }
.km-chip--green { color: var(--km-green-ink); }
.km-btn { display: grid; place-items: center; height: 40px; border-radius: 999px; background: var(--ink); color: var(--bg); font-weight: 800; font-size: 14px; }
.km-btn--ghost { background: none; color: var(--ink); box-shadow: inset 0 0 0 2px var(--line-strong); }
.km-field { height: 42px; border-radius: 12px; box-shadow: inset 0 0 0 2px var(--line-strong); display: flex; align-items: center; padding: 0 14px; font-weight: 700; font-size: 15px; }
.km-callbtn { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--km-green); box-shadow: 0 10px 24px -8px color-mix(in oklab, var(--km-green) 70%, transparent); }
.km-callbtn--hang { background: var(--km-red); box-shadow: 0 10px 24px -8px color-mix(in oklab, var(--km-red) 70%, transparent); }
.km-callbtn--hang svg { transform: rotate(135deg); }
.km-callbtn svg { width: 28px; height: 28px; }
.km-timer { font: 900 32px/1 var(--font-display); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.km-rec { color: var(--km-red-ink); font-weight: 800; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.km-rec::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.km-wave { display: flex; align-items: center; gap: 3px; height: 28px; }
.km-wave i { width: 4px; border-radius: 2px; background: var(--ink); }
.km-quote { background: var(--surface); border-radius: 16px; padding: 12px 14px; font-weight: 800; font-size: 15px; line-height: 1.35; }
.km-recbtn { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; box-shadow: inset 0 0 0 4px var(--line-strong); }
.km-recbtn::after { content: ""; width: 50px; height: 50px; border-radius: 50%; background: var(--km-red); }
.km-brand { display: flex; align-items: center; gap: 6px; font: 900 14px/1 var(--font-display); }
.km-brand img { width: 22px; height: 22px; object-fit: contain; }
.km-spacer { flex: 1; }

/* a phone held upright: the drawn screen inside a rounded device */
.km-phone { position: absolute; border-radius: 34px; padding: 8px; background: color-mix(in oklab, var(--ink) 92%, var(--bg));
            box-shadow: 0 24px 60px -24px rgb(0 0 0 / .45); }
.km-phone > .km-screen { border-radius: 27px; overflow: hidden; }

/* the Yoto card: a Make Your Own card with the kid's playlist on it */
.km-card { background: var(--bg); border-radius: 18px; padding: 16px; display: grid; gap: 10px; align-content: start; }
.km-card__art { aspect-ratio: 16 / 10; border-radius: 12px; background: var(--surface); display: grid; place-items: center; }
.km-card__art svg { width: 46%; height: auto; }

/* ------------------------------------------------------------------ collage pieces (hero) */
.ly-collage .ly-piece.km-piece { background: var(--bg); }
.ly-collage .ly-piece.km-piece--phone { background: color-mix(in oklab, var(--ink) 92%, var(--bg)); padding: 8px; border-radius: 30px; }
.ly-collage .ly-piece.km-piece--phone > .km-screen { border-radius: 23px; overflow: hidden; }
.ly-collage .ly-piece.km-piece > .km-screen, .ly-collage .ly-piece.km-piece > .km-card { height: 100%; }

/* ------------------------------------------------------------------ the app window (#messages) */
.app.ui { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); margin-top: var(--s-7); background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--r-lg); box-shadow: 0 30px 60px -40px rgb(0 0 0 / .35); }
.app > .app__pane { position: relative; min-width: 0; min-height: 0; overflow: hidden; }
.app > .app__pane + .app__pane { border-left: 1px solid var(--line); }
.app > .app__pane::after { content: ""; position: absolute; inset: auto 0 0 0; height: 64px; background: linear-gradient(transparent, var(--bg)); pointer-events: none; }
.app .km-screen { padding: 24px 28px; gap: 14px; }
.app .km-pane-head { display: flex; align-items: center; gap: 14px; }
.app .km-list { background: var(--surface); }
.app .km-tabs { display: flex; gap: 8px; }
.app .km-tab { font-size: 13px; font-weight: 800; padding: 6px 12px; border-radius: 999px; color: var(--muted); }
.app .km-tab.is-on { background: var(--ink); color: var(--bg); }
.app .km-mbox { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 16px; }
.app .km-mbox.is-on { background: var(--surface); }
.app .km-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (min-width: 1024px) and (max-width: 1279px) { .app.ui { grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); } }
@media (max-width: 1023px) {
  .app.ui { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .app > .app__pane--list { max-height: 252px; }
  .app > .app__pane--list::after { display: none; }
  .app > .app__pane + .app__pane { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 639px) {
  .app.ui { grid-template-rows: minmax(0, 1fr); }
  .app > .app__pane--list { display: none; }
  .app > .app__pane + .app__pane { border-top: 0; }
  .app .km-cols { grid-template-columns: 1fr; }
  .app .km-screen { padding: 18px 16px; }
}

/* ------------------------------------------------------------------ panels with drawn UI */
.km-stage-center { left: 50%; transform: translateX(-50%); }
.panel .km-panel-card > :is(.km-screen, .km-card) { border-radius: 22px; box-shadow: var(--mo-shadow); height: 100%; }

/* ------------------------------------------------------------------ install page steps */
.km-steps-phone { width: 220px; }

/* the family phone: the bezel drawn on the screen itself, so the frame holds one drawn window */
.km-device { border-radius: 30px; box-shadow: 0 0 0 8px color-mix(in oklab, var(--ink) 92%, var(--bg)), 0 30px 60px -24px rgb(0 0 0 / .45); }
.km-btn--danger { background: var(--km-red-ink); color: #fff; }

/* a drawn piece under a split's words (pricing, questions): it takes what the column leaves */
.km-fill-panel { --p-h: 240px; border-radius: var(--r-lg); margin-top: var(--s-5); }
@media (min-width: 1024px) { .split-col > .km-fill-panel { flex: 1 1 auto; } }

/* the name across the close, in the brand face: room for its round letters */
.close__word { line-height: 1.02; font-size: clamp(64px, 19vw, 280px); }

/* one button size for the main action everywhere (the triptych's large button would be a third look) */
.hero--triptych .hero__cta .btn { height: var(--btn-h, 44px); font-size: 16px; padding-inline: var(--s-5); }

/* body text inside a drawn screen, in the ink */
.km-body { margin: 0; font-size: 14px; line-height: 1.45; color: var(--ink); }

/* #how's boxed cards hold the drawn UI straight on their flush panel: no second box around it */
.panel--flush .km-screen.ui { background: none; box-shadow: none; }

/* on a phone the drawn pieces sit whole in their panels: the panel grows to hold them, nothing is cut */
@media (max-width: 639px) {
  .panel .stage > .km-panel-card.to-edge, .frame .stage > .fit.to-edge { position: relative; inset: auto; left: auto; right: auto; top: auto; bottom: auto;
    margin: 24px auto; width: calc(100% - 32px); max-width: 320px; }
  .panel .stage, .frame .stage { position: relative; -webkit-mask: none; mask: none; }
  .panel:has(.km-panel-card), .frame--split { min-height: 0; --p-h: 0px; }
  .frame--split::before { padding-top: 0; }
  .panel .km-panel-card > :is(.km-screen, .km-card), .frame .km-screen { height: auto !important; }
  .app .km-list .km-row:nth-child(n+5) { display: none; }
}

/* the drawn UI on the lit ground: its small lines in the ink, so they read on the ground's darker corner */
.panel--flush .km-sub { color: var(--ink); }
#pricing .km-fill-panel { --p-h: 440px; }
@media (max-width: 1023px) { #pricing .km-fill-panel { --p-h: 260px; } }
@media (max-width: 639px) {
  .app .km-cols > :nth-child(2) { display: none; }
  .frame.frame--split > .stage { position: relative; inset: auto; width: 100%; height: auto; }
}
@media (max-width: 639px) {
  /* the legal row: one item a line, each on the page margin */
  .km-legal { display: flex; flex-direction: column; gap: var(--s-3); }
  .km-legal .km-sep { display: none; }
  /* the app window grows to hold its rows on a phone */
  .app.ui { grid-template-rows: auto; }
  .app > .app__pane { overflow: visible; }
  .app > .app__pane::after { display: none; }
}

/* the app window keeps its rounded corners: the panes' white would otherwise paint over the border's arcs */
.app.ui { overflow: clip; }

@media (max-width: 639px) {
  /* #family on a phone: the call page, then the family's birds under it, both whole */
  .frame.mo-family { display: flex; flex-direction: column; align-items: center; }
  .frame.mo-family > .stage { width: 100%; }
  .grid.fill > .frame.mo-family { flex: 0 0 auto; height: auto; padding: 0; }
  .frame.mo-family::before { display: none; }
  /* the legal row: one line that wraps, every link a full tap target on the same baseline */
  .footer__legal .km-legal { flex-direction: row; flex-wrap: wrap; align-items: center; column-gap: var(--s-5); row-gap: 0; }
  .footer__legal .km-legal > a { display: inline-flex; align-items: center; min-height: 44px; margin: 0; padding: 0; }
}

/* Hero CTA sits under the lead, left-aligned with the copy */
.hero--triptych p.hero__cta { display: flex; justify-content: flex-start; margin: var(--s-6, 28px) 0 0; padding: 0; }
@media (max-width: 639px) { .hero--triptych p.hero__cta { margin-top: var(--s-5, 20px); } .hero--triptych p.hero__cta .btn { width: 100%; justify-content: center; } }
