/* Mafi Pal website. Colours and shapes follow the app: warm cream, forest
   green, rounded type for the interface and a soft serif for what Mafi says. */

@font-face {
  font-family: "Nunito";
  src: url("/assets/fonts/nunito-latin-wght-normal.woff2?76388dbf") format("woff2");
  font-weight: 200 1000;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Nunito";
  src: url("/assets/fonts/nunito-latin-ext-wght-normal.woff2?4fcdc09b") format("woff2");
  font-weight: 200 1000;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1EFF, U+201E;
}
@font-face {
  font-family: "Fraunces";
  src: url("/assets/fonts/fraunces-latin-opsz-normal.woff2?48642176") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --paper: #f8f5ee;
  --card: #ffffff;
  --ink: #22302a;
  --ink-soft: #616d66;
  --brand: #2f6b3e;
  --brand-deep: #245531;
  /* Green as text: on cream the forest green reads, on a dark page a lighter one does. */
  --brand-ink: #2f6b3e;
  --moss: #8fb86a;
  --sun: #e8930c;
  --sky: #2f8fd0;
  /* The green band and the foot of the page. */
  --forest: #234f30;
  --forest-card: #2d6340;
  --foot: #16261c;
  --line: #e6e1d4;
  /* Running text on the plain pages, a shade softer than headings. */
  --ink-body: #3f4c45;
  /* The case of a phone, a picture not yet loaded. */
  --frame: #22302a;
  --frame-ring: transparent;
  --blank: #efeadd;
  /* Shadows take the colour of the ink on cream and plain black at night. */
  --shadow: 34 48 42;
  --glow: radial-gradient(52rem 40rem at 104% -8rem, rgb(207 228 182 / 0.6), transparent 70%), radial-gradient(44rem 36rem at -6% 30rem, rgb(238 217 188 / 0.4), transparent 70%);
  --wide: 1180px;
  --ui: "Nunito", ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  --voice: "Fraunces", "New York", Georgia, serif;
  color-scheme: light;
}

/* A screen of the app comes in both looks; only the one that matches is shown and fetched. */
.only-dark { display: none; }

/* The dark page follows the app at night: a deep forest with a little light in it.
   The site is light for everyone, whatever the device is set to; the dark page
   is only for a visitor who chose it with the switch. */
:root[data-theme="dark"] {
  --paper: #0f1a14; --card: #1b2a21; --ink: #f2efe6; --ink-soft: #a7b3aa; --brand-ink: #9ad08a; --sun: #f7b544; --sky: #6cbdeb;
  --forest: #1b3a26; --forest-card: #254b32; --foot: #080e0b; --line: #2c3d32; --ink-body: #cfd8d1;
  --frame: #050806; --frame-ring: rgb(255 255 255 / 0.14); --blank: #24352b; --shadow: 0 0 0;
  --glow: radial-gradient(60rem 44rem at 8% -12rem, rgb(63 125 80 / 0.34), transparent 70%), radial-gradient(48rem 40rem at 104% 6rem, rgb(30 58 95 / 0.36), transparent 70%);
  color-scheme: dark;
}
:root[data-theme="dark"] .only-light { display: none; }
:root[data-theme="dark"] .only-dark { display: block; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--glow) no-repeat, var(--paper);
  color: var(--ink);
  font: 500 18px/1.55 var(--ui);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3, p { margin: 0; }
/* Short texts break into lines of even length; long ones only avoid a lone last word. */
h1, h2, h3, p, summary, figcaption { text-wrap: balance; }
h1, h2 { font-weight: 900; letter-spacing: -0.025em; line-height: 1.04; }
h1 { font-size: clamp(2.6rem, 5.4vw, 4.4rem); }
h2 { font-size: clamp(2.1rem, 4.4vw, 3.4rem); }
h3 { font-size: 1.3rem; font-weight: 800; letter-spacing: -0.01em; line-height: 1.2; }
.lede { font-size: clamp(1.15rem, 1.6vw, 1.35rem); color: var(--ink-soft); max-width: 34em; }
.wrap { width: min(var(--wide), 100% - 48px); margin-inline: auto; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 3px; border-radius: 8px; }

/* ── Top bar ─────────────────────────────────────────────── */
.top { display: flex; align-items: center; gap: 28px; padding-block: 22px; }
.brand { display: inline-flex; align-items: center; gap: 12px; font-weight: 900; font-size: 1.5rem; letter-spacing: -0.03em; text-decoration: none; }
.brand img { width: 42px; height: 42px; border-radius: 11px; }
.top nav { display: flex; gap: 26px; margin-left: auto; }
.top nav a, .lang { font-weight: 700; font-size: 1rem; text-decoration: none; color: var(--ink-soft); }
.top nav a:hover, .lang:hover { color: var(--ink); }
.lang { border: 2px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: 0.85rem; letter-spacing: 0.04em; }
/* The switch between the light and the dark page: it shows what a press brings. */
.theme { display: grid; place-items: center; width: 36px; height: 36px; margin-left: -14px; padding: 0; border: 2px solid var(--line); border-radius: 50%; background: none; color: var(--ink-soft); transition: color 0.15s, border-color 0.15s; }
.theme[hidden] { display: none; }
.theme:hover { color: var(--ink); border-color: var(--ink-soft); }
.theme svg { grid-area: 1 / 1; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 58px; padding: 0 30px; border: 0; border-radius: 999px;
  background: var(--brand); color: #fff; font-weight: 800; font-size: 1.08rem; text-decoration: none;
  box-shadow: 0 10px 24px -8px rgb(47 107 62 / 0.6);
  transition: transform 0.15s ease, background 0.15s ease;
}
.button:hover { background: var(--brand-deep); transform: translateY(-1px); }
.button.quiet { background: var(--ink); color: var(--paper); box-shadow: none; }
.button.small { min-height: 44px; padding: 0 20px; font-size: 0.95rem; box-shadow: none; }
.button[aria-disabled="true"] { cursor: default; }
.button[aria-disabled="true"]:hover { transform: none; background: var(--ink); }

/* ── Hero ────────────────────────────────────────────────── */
.hero { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: clamp(28px, 5vw, 72px); align-items: center; padding-block: clamp(24px, 4vw, 48px) clamp(56px, 8vw, 104px); }
.hero-copy { display: grid; gap: 24px; justify-items: start; }
.hero-note { font-size: 0.98rem; font-weight: 700; color: var(--ink-soft); }
/* The phone with Mafi waving from beside it. */
.hero-show { position: relative; display: grid; justify-items: center; }
.hero-show .phone { width: min(100%, 320px); }
.hero-mafi { position: absolute; left: max(-4%, calc(50% - 300px)); bottom: -3%; width: clamp(120px, 15vw, 190px); z-index: 1; filter: drop-shadow(0 18px 18px rgb(var(--shadow) / 0.25)); }

.phone { width: min(100%, 300px); border-radius: 42px; border: 9px solid var(--frame); background: var(--frame); overflow: hidden; box-shadow: 0 0 0 1px var(--frame-ring), 0 30px 50px -28px rgb(var(--shadow) / 0.55); }
.phone img { width: 100%; border-radius: 33px; }

/* ── Sections ────────────────────────────────────────────── */
section { padding-block: clamp(64px, 9vw, 120px); }
.section-head { display: grid; gap: 16px; margin-bottom: clamp(32px, 5vw, 56px); }
.section-head.center { justify-items: center; text-align: center; }

/* The plan that moves along: a row of things that can be different, and what Mafi makes of the day. */
.day { display: grid; gap: clamp(22px, 3vw, 36px); max-width: 880px; margin-inline: auto; }
.day-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.day-chips button { min-height: 46px; padding: 0 20px; border: 2px solid var(--line); border-radius: 999px; background: var(--card); font-weight: 800; font-size: 1rem; transition: background 0.15s, border-color 0.15s, color 0.15s; }
.day-chips button:hover { border-color: var(--brand-ink); }
.day-chips button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.day-answer { display: grid; grid-template-columns: clamp(110px, 18vw, 190px) minmax(0, 1fr); gap: clamp(16px, 3vw, 36px); align-items: end; padding: clamp(20px, 3vw, 36px); border-radius: 32px; background: var(--card); box-shadow: 0 30px 60px -36px rgb(var(--shadow) / 0.45); min-height: 300px; }
.day-answer img { align-self: end; width: 100%; max-height: 260px; object-fit: contain; object-position: bottom; }
.day-words { display: grid; gap: 18px; align-content: center; align-self: center; }
.says { font: 400 clamp(1.25rem, 2.2vw, 1.6rem)/1.35 var(--voice); font-variation-settings: "SOFT" 100, "WONK" 0; }
.day-step { display: grid; gap: 4px; padding: 16px 20px; border-radius: 20px; background: color-mix(in srgb, var(--brand-ink) 9%, transparent); }
.day-step span { font-size: 0.85rem; font-weight: 800; color: var(--ink-soft); }
.day-step strong { font-size: 1.2rem; font-weight: 900; letter-spacing: -0.01em; }
.day-step p { color: var(--ink-soft); font-size: 0.98rem; text-wrap: pretty; }
.day.changing .day-words, .day.changing .day-answer img { opacity: 0; }
.day-words, .day-answer img { transition: opacity 0.18s ease; }

/* Three screens of the app. */
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(20px, 3.5vw, 48px); }
.step { display: grid; gap: 22px; justify-items: center; align-content: start; text-align: center; }
.step p { color: var(--ink-soft); max-width: 22em; }

/* Training together: a green band, Mafi moving, the screen beside him. The
   colour stops 2px short of the band's own edges, so the waves overlap it. */
.forest { position: relative; background: linear-gradient(var(--forest), var(--forest)) center / 100% calc(100% - 4px) no-repeat; color: #f2efe6; padding-block: clamp(110px, 13vw, 180px); }
.forest .lede { color: #c9d8c9; }
.wave { position: absolute; left: 0; width: 100%; height: clamp(28px, 4.4vw, 60px); fill: var(--paper); }
/* Named upper and lower: `.top` is the page header. */
.wave.upper { top: -1px; }
.wave.lower { bottom: -1px; transform: scaleY(-1); }
.train { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.1fr) minmax(0, 260px); gap: clamp(24px, 4vw, 64px); align-items: center; }
.train .section-head { margin: 0; }
.train .phone { width: 100%; max-width: 260px; }
/* Two stances of one movement, shown in turn at the pace of a calm repetition. */
.train-figure { position: relative; aspect-ratio: 1; }
.train-figure::before { content: ""; position: absolute; inset: 6% 0 0; border-radius: 50%; background: radial-gradient(closest-side, rgb(255 255 255 / 0.16), rgb(255 255 255 / 0.05) 66%, transparent); }
.train-figure img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.train-stage { display: grid; gap: 14px; justify-items: center; min-width: 0; width: 100%; }
.train-stage .train-figure { width: 100%; }

/* Mafi in 3D (src/stage.js). The drawn picture is there first and stays if the model cannot be shown. */
.train-figure.stage { position: relative; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
/* Beside the phone he gets room around him, so a wave does not push him out of his frame. */
.hero-mafi { aspect-ratio: 490 / 720; }
.hero-mafi .stage-poster { width: 100%; height: 100%; object-fit: contain; }
.hero-mafi canvas { inset: -14% -40% -4%; width: 180%; height: 118%; }
.hero-mafi.is-live { filter: none; }
.stage .stage-poster { transition: opacity 0.4s ease; }
.stage.is-live { touch-action: pan-y; cursor: grab; user-select: none; -webkit-user-select: none; }
.stage.is-live:active { cursor: grabbing; }
.stage.is-live .stage-poster { opacity: 0; }
.stage-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.stage-chips[hidden], .stage-hint[hidden] { display: none; }
.stage-chips button { font: inherit; font-weight: 800; font-size: 0.92rem; min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1.5px solid rgb(255 255 255 / 0.28); background: rgb(255 255 255 / 0.06); color: #eef4ea; cursor: pointer; transition: background 0.15s ease, border-color 0.15s ease; }
.stage-chips button:hover { background: rgb(255 255 255 / 0.14); }
.stage-chips button[aria-pressed="true"] { background: #fff; border-color: #fff; color: var(--brand-deep); }
.stage-chips button:focus-visible { outline: 3px solid var(--moss); outline-offset: 2px; }
.stage-hint { font-size: 0.85rem; font-weight: 700; color: #b9cbb9; }

/* His world: one row to leaf through sideways, three places in view. */
.carousel { position: relative; }
.carousel-track { --gap: clamp(12px, 1.8vw, 24px); display: flex; gap: var(--gap); overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; padding: 6px 0 26px; }
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-track figure { flex: 0 0 calc((100% - 2 * var(--gap)) / 3); display: grid; gap: 12px; margin: 0; scroll-snap-align: start; }
.carousel-track img { width: 100%; border-radius: clamp(16px, 2vw, 26px); background: var(--blank); box-shadow: 0 24px 36px -24px rgb(var(--shadow) / 0.5); }
.carousel-track figcaption { font-weight: 800; font-size: 0.95rem; color: var(--brand-ink); text-align: center; }
.carousel .round { position: absolute; z-index: 1; top: calc(50% - 44px); background: var(--card); color: var(--ink); box-shadow: 0 8px 20px -8px rgb(var(--shadow) / 0.45); transition: opacity 0.2s; }
.carousel .round:hover { color: var(--brand-ink); }
.carousel .round:disabled { opacity: 0; pointer-events: none; }
.carousel [data-shelf-prev] { left: -22px; }
.carousel [data-shelf-next] { right: -22px; }
.round { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; }
.round svg { width: 22px; height: 22px; }

/* Plain promises. */
.promises { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(28px, 4vw, 56px); }
.promises div { display: grid; gap: 10px; align-content: start; padding-top: 22px; border-top: 4px solid var(--brand-ink); }
.promises p { color: var(--ink-soft); text-wrap: pretty; }

/* Questions and answers. */
.questions { max-width: 820px; margin-inline: auto; }
.questions details { border-top: 2px solid var(--line); }
.questions details:last-child { border-bottom: 2px solid var(--line); }
.questions summary { position: relative; padding: 20px 48px 20px 0; font-weight: 800; font-size: 1.15rem; line-height: 1.3; cursor: pointer; list-style: none; }
.questions summary::-webkit-details-marker { display: none; }
.questions summary::after { content: "+"; position: absolute; right: 6px; top: 50%; translate: 0 -50%; font-size: 1.7rem; font-weight: 700; color: var(--brand-ink); }
.questions details[open] summary::after { content: "\2013"; }
.questions p { padding: 0 48px 22px 0; color: var(--ink-soft); text-wrap: pretty; }

/* Closing band. Like the green band, its colour stops short of its edges so the
   wave overlaps it. Mafi and the words sit together in the middle. */
.cta { position: relative; background: linear-gradient(var(--brand), var(--brand)) center / 100% calc(100% - 4px) no-repeat; color: #fff; padding-block: 0; }
.cta-inner { display: grid; grid-template-columns: auto minmax(0, 33rem); justify-content: center; gap: clamp(28px, 5vw, 72px); align-items: center; padding-block: clamp(92px, 11vw, 148px) clamp(100px, 12vw, 164px); }
.cta-figure { position: relative; width: clamp(170px, 21vw, 270px); }
.cta-figure::before { content: ""; position: absolute; inset: 4% -14% 0; border-radius: 50%; background: radial-gradient(closest-side, rgb(255 255 255 / 0.26), rgb(255 255 255 / 0.1) 62%, transparent); }
.cta-figure img { position: relative; width: 100%; }
.cta-copy { display: grid; gap: 22px; justify-items: start; }
.cta .lede { color: rgb(255 255 255 / 0.86); }
.cta .button { background: #fff; color: var(--brand-deep); box-shadow: none; }
.cta .button:hover { background: #f3f8ee; }

/* The foot of every page: the darkest green, rising in a wave out of whatever comes before it. */
footer { position: relative; background: var(--foot); color: #a9b8ad; font-size: 0.98rem; font-weight: 600; }
footer .wave { top: auto; bottom: calc(100% - 2px); fill: var(--foot); transform: scaleY(-1); }
footer a { color: inherit; text-decoration: none; transition: color 0.15s; }
footer a:hover { color: #fff; }
.footer-main { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 40px 64px; padding-block: clamp(40px, 5vw, 60px) clamp(36px, 4.5vw, 52px); }
.footer-brand { display: grid; gap: 14px; align-content: start; max-width: 21em; }
.footer-brand .brand { color: #f2efe6; }
.footer-brand p { font-family: var(--voice); font-weight: 400; font-size: 1.1rem; font-variation-settings: "SOFT" 100, "WONK" 0; }
.footer-links { display: flex; gap: clamp(44px, 8vw, 104px); }
.footer-links ul { display: grid; gap: 12px; align-content: start; margin: 0; padding: 0; list-style: none; }
.footer-links a { color: #dfe8e0; }
.footer-base { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; padding-block: 22px 30px; border-top: 1px solid rgb(255 255 255 / 0.12); font-size: 0.9rem; }

/* Legal and plain text pages. */
.prose { max-width: 720px; padding-block: 24px 96px; }
.prose h1 { font-size: clamp(2.2rem, 5vw, 3.2rem); margin-bottom: 12px; }
.prose h2 { font-size: 1.45rem; letter-spacing: -0.01em; margin: 40px 0 10px; }
.prose p, .prose li { color: var(--ink-body); text-wrap: pretty; }
.prose p + p { margin-top: 14px; }
.prose ul { padding-left: 22px; margin: 10px 0; }
.prose li + li { margin-top: 8px; }
.prose a { color: var(--brand-ink); font-weight: 700; }
.prose .date { color: var(--ink-soft); font-weight: 700; margin-bottom: 28px; }

/* Contact form. */
.contact { display: grid; gap: 16px; margin-top: 28px; }
.contact[hidden] { display: none; }
.contact label { display: grid; gap: 6px; font-weight: 800; font-size: 0.95rem; color: var(--ink); }
.contact input, .contact textarea { font: inherit; font-weight: 500; padding: 14px 16px; border: 2px solid var(--line); border-radius: 16px; background: var(--card); color: var(--ink); resize: vertical; }
.contact input:focus, .contact textarea:focus { outline: none; border-color: var(--brand-ink); }
.contact .trap { position: absolute; left: -9999px; }
.contact .button { justify-self: start; border: 0; cursor: pointer; font-family: inherit; }
.contact .button:disabled { opacity: 0.6; cursor: default; }
.contact .status { font-weight: 700; min-height: 1.5em; color: var(--ink); }
.prose .mail { margin-top: 24px; }
.prose .care { margin-top: 14px; color: var(--ink-soft); font-size: 0.95rem; }
.lost { display: grid; justify-items: center; gap: 20px; text-align: center; padding-block: 48px 120px; }
.lost img { width: 180px; }

/* ── Narrower screens ────────────────────────────────────── */
@media (max-width: 900px) {
  .top nav { display: none; }
  .lang { margin-left: auto; }
  .hero, .cta-inner, .train { grid-template-columns: 1fr; }
  .hero { padding-top: 12px; }
  .steps { grid-template-columns: 1fr; gap: 56px; }
  .promises { grid-template-columns: 1fr 1fr; }
  .train { justify-items: center; text-align: center; }
  .train .section-head { justify-items: center; }
  .train-stage .train-figure { width: min(84%, 340px); }
  .carousel [data-shelf-prev] { left: 6px; }
  .carousel [data-shelf-next] { right: 6px; }
  .carousel-track figure { flex-basis: calc((100% - var(--gap)) / 2); }
  .cta-inner { justify-items: center; text-align: center; }
  .cta-copy { justify-items: center; }
}
@media (max-width: 620px) {
  body { font-size: 17px; }
  .wrap { width: min(var(--wide), 100% - 44px); }
  .top { gap: 16px; }
  .top .button { display: none; }
  .hero-mafi { left: -2%; width: 104px; }
  .promises { grid-template-columns: 1fr; }
  .day-chips { justify-content: flex-start; }
  .day-answer { grid-template-columns: 1fr; justify-items: center; min-height: 0; }
  .day-answer img { width: 130px; }
  /* On a phone the row is swiped; the next place peeks in from the edge. */
  .carousel-track { margin-inline: -22px; padding-inline: 22px; scroll-padding-inline: 22px; }
  .carousel-track figure { flex-basis: 78%; }
  .carousel .round { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
