/* AppMetrio developer page: direction D4 "Stages" (docs/studio-site-plan.md). No scripts: the
   CSP has no script-src, so all motion is CSS scroll-driven animation. The file name is its
   content hash (scripts/site-fingerprint.sh): Caddy caches /assets for a week. */

/* Rubik and Alegreya: Google Fonts subsets, SIL OFL 1.1 (fonts/OFL.txt). Upright only,
   nothing on the page is set in italic. */
@font-face {
  font-family: "Rubik";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/rubik-cyrillic-ext-normal-400-700.woff2") format("woff2");
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
@font-face {
  font-family: "Rubik";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/rubik-cyrillic-normal-400-700.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Rubik";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/rubik-latin-ext-normal-400-700.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Rubik";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/rubik-latin-normal-400-700.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Alegreya";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/alegreya-cyrillic-ext-normal-400-700.woff2") format("woff2");
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
@font-face {
  font-family: "Alegreya";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/alegreya-cyrillic-normal-400-700.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Alegreya";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/alegreya-latin-ext-normal-400-700.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Alegreya";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/alegreya-latin-normal-400-700.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Each app owns the whole ground while it is on stage: MyBaby's cream from its home screen,
   Bill Reminder's green from its icon. Radius character soft, 8px on surfaces and controls. */
:root {
  color-scheme: light;
  --stage-mybaby: #f9f0e8;  /* sampled from MyBaby's home screen */
  --stage-bills: #e6f5ea;   /* the icon's #30c35f at L 0.95 */
  --paper: #fcfaf7;         /* support and footer belong to neither app */
  --ink: #1d1a16;           /* 15.9:1 on cream, 15.9:1 on mint */
  --muted: #595249;         /* 6.8:1 on cream, 6.8:1 on mint, 7.4:1 on paper */
  --line: #d8cfc4;
  --chip: rgba(255, 255, 255, .72);
  --accent: #3b6fd6;        /* brand blue: 4.7:1 under white on the one filled control */
  --link: #2c5bb8;          /* 5.6:1 on cream and mint */
  --r: 8px;
  --display: "Rubik", "Segoe UI", system-ui, sans-serif;
  --text: "Alegreya", Georgia, serif;
  /* Alegreya has a small eye: body at 19px reads like 16px elsewhere. Scale 1.2 from there:
     19, 22.8, 27.4, 32.8, 39.4 */
  --s1: 1.1875rem; --s2: 1.425rem; --s3: 1.71rem; --s4: 2.052rem; --s5: 2.462rem;
  --gap: clamp(16px, 4vw, 56px);
  --wrap: 1280px;
  /* Side padding that also centres the content past --wrap on wide screens. */
  --pad: max(var(--gap), calc((100% - var(--wrap)) / 2));
  --head: 72px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body { margin: 0; min-height: 100svh; background: var(--stage-mybaby); color: var(--ink); font: 400 var(--s1)/1.55 var(--text); }
img, svg { display: block; max-width: 100%; }
h1, h2, p, ul, dl, dd, figure { margin: 0; padding: 0; }
ul { list-style: none; }
a { color: var(--link); text-underline-offset: .2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
::selection { background: #cddbf6; color: var(--ink); }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: var(--gap); top: -60px; z-index: 10; padding: 10px 16px; border-radius: var(--r); background: var(--ink); color: #fff; font: 500 1rem/1.4 var(--display); text-decoration: none; }
.skip:focus { top: 12px; }

/* The App Store badge keeps Apple's artwork untouched; only its height is ours, never under
   40px per Apple's marketing guidelines. */
.badge { display: inline-block; line-height: 0; }
.badge img { height: 44px; width: auto; }
/* A screenshot keeps the device's own corner radius: part of the image, not a design radius. */
.screen { aspect-ratio: 1242 / 2688; height: auto; border-radius: 13.7% / 6.35%; box-shadow: 0 40px 70px -40px rgba(29, 26, 22, .55); }
.icon { border-radius: 22.37%; }

.top { position: relative; z-index: 5; display: flex; align-items: center; gap: 24px; height: var(--head); padding: 0 var(--pad); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font: 500 1.25rem/1 var(--display); letter-spacing: -.01em; text-decoration: none; }
.mark { width: 28px; height: 28px; }
.mark-bg { fill: var(--accent); }
.mark-fg { fill: #fff; }
.top nav { margin-left: auto; display: flex; gap: 4px; }
.top nav a { padding: 10px 14px; border-radius: var(--r); color: var(--ink); font: 500 1rem/1.4 var(--display); text-decoration: none; }
.top nav a:hover { background: rgba(29, 26, 22, .07); }

/* The first screen. Below 1040px, or without scroll-driven animations, it is a plain column:
   the claim, then each app on its own ground. .pin-vp steps aside (display: contents) so the
   two jump targets can sit right before the stage they point at. */
.pin { display: flex; flex-direction: column; }
.pin-vp { display: contents; }
.claim { order: 1; padding: 24px var(--pad) 40px; }
.anchor-mybaby { order: 2; }
.stage-mybaby { order: 3; }
.anchor-bills { order: 4; }
.stage-bills { order: 5; }
.claim h1 { font: 500 clamp(2.125rem, 1.5rem + 2.4vw, var(--s5))/1.1 var(--display); letter-spacing: -.025em; max-width: 22ch; text-wrap: balance; }
.lead { margin-top: 20px; max-width: 34ch; color: var(--muted); font-size: var(--s2); line-height: 1.45; }

/* Both apps are named in the first screen even while one is on stage; the chips double as
   the way to jump between the two stages. */
.switch { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.switch a { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 16px 6px 6px; border-radius: var(--r); background: var(--chip); color: var(--ink); font: 500 1rem/1.3 var(--display); text-decoration: none; }
.switch img { width: 36px; height: 36px; }

.stage { display: grid; gap: 32px; padding: 48px var(--pad); align-items: center; }
.stage-mybaby { background: var(--stage-mybaby); }
.stage-bills { background: var(--stage-bills); }
.stage .screen { width: 240px; justify-self: center; }
.stage-text { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.stage-text .icon { width: 80px; height: 80px; box-shadow: 0 10px 22px -12px rgba(29, 26, 22, .5); }
.stage h2 { margin-top: 18px; font: 500 var(--s4)/1.1 var(--display); letter-spacing: -.02em; }
.sub { margin-top: 4px; font: 500 1rem/1.4 var(--display); }
.desc { margin-top: 12px; max-width: 34ch; color: var(--muted); }
.facts { display: grid; grid-template-columns: repeat(2, max-content); gap: 10px 32px; margin: 18px 0 22px; }
.facts div:first-child { grid-column: 1 / -1; }
.facts dt { font: 400 .875rem/1.3 var(--display); color: var(--muted); }
.facts dd { font: 500 1rem/1.4 var(--display); }
.links { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 16px; font-size: 1.0625rem; }

@media (min-width: 760px) {
  .stage { grid-template-columns: 240px minmax(0, 1fr); }
}

/* The stage: the viewport pins for 1.2 screens of scroll; the ground turns from MyBaby's
   cream to Bill Reminder's green while one app leaves and the other arrives. The two never
   share the frame, so a scroll that stops half way shows one app or none, not both. */
@media (min-width: 1040px) and (min-height: 700px) {
  @supports (animation-timeline: view()) {
    body:has(.pin) .top { position: absolute; inset: 0 0 auto; }
    .pin { display: block; position: relative; height: 220svh; view-timeline-name: --pin; }
    .pin-vp {
      position: sticky; top: 0; height: 100svh; overflow: clip;
      display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 6fr); align-items: center;
      padding: var(--head) var(--pad) 24px; column-gap: 48px;
      animation: ground linear both; animation-timeline: --pin; animation-range: contain 0% contain 100%;
    }
    .anchor { position: absolute; left: 0; }
    .anchor-mybaby { top: 0; }
    .anchor-bills { top: calc(100% - 100svh); }
    .claim { grid-area: 1 / 1; padding: 0; }
    .stage { grid-area: 1 / 2; padding: 0; background: none; grid-template-columns: 260px minmax(0, 1fr); }
    .stage .screen { width: 260px; }
    .stage-mybaby { animation: leave linear both; animation-timeline: --pin; animation-range: contain 0% contain 100%; }
    .stage-bills { animation: arrive linear both; animation-timeline: --pin; animation-range: contain 0% contain 100%; }
    .switch a { animation: chip-off linear both; animation-timeline: --pin; animation-range: contain 0% contain 100%; }
    .switch a + a { animation-name: chip-on; }
    /* The hidden stage stays in the accessibility tree and in the tab order; focusing into it
       brings it forward and sends the other one back. */
    .stage:focus-within { opacity: 1 !important; translate: none !important; pointer-events: auto !important; z-index: 2; }
    .pin-vp:has(.stage-bills:focus-within) .stage-mybaby,
    .pin-vp:has(.stage-mybaby:focus-within) .stage-bills { opacity: 0 !important; pointer-events: none !important; }
    .pin-vp:has(.stage-bills:focus-within) { background-color: var(--stage-bills) !important; }
    .pin-vp:has(.stage-mybaby:focus-within) { background-color: var(--stage-mybaby) !important; }
    .pin-vp:has(.stage-bills:focus-within) .switch a:first-child,
    .pin-vp:has(.stage-mybaby:focus-within) .switch a + a { background-color: transparent !important; color: var(--muted) !important; }
    .pin-vp:has(.stage-bills:focus-within) .switch a + a,
    .pin-vp:has(.stage-mybaby:focus-within) .switch a:first-child { background-color: var(--chip) !important; color: var(--ink) !important; }
  }
}
@keyframes ground { 0%, 44% { background-color: var(--stage-mybaby); } 56%, 100% { background-color: var(--stage-bills); } }
@keyframes leave { 0%, 36% { opacity: 1; translate: 0 0; } 49%, 100% { opacity: 0; translate: 0 -72px; pointer-events: none; } }
@keyframes arrive { 0%, 51% { opacity: 0; translate: 0 72px; pointer-events: none; } 64%, 100% { opacity: 1; translate: 0 0; pointer-events: auto; } }
@keyframes chip-off { 0%, 44% { background-color: var(--chip); color: var(--ink); } 56%, 100% { background-color: transparent; color: var(--muted); } }
@keyframes chip-on { 0%, 44% { background-color: transparent; color: var(--muted); } 56%, 100% { background-color: var(--chip); color: var(--ink); } }
@media (prefers-reduced-motion: reduce) {
  @keyframes leave { 0%, 36% { opacity: 1; } 49%, 100% { opacity: 0; pointer-events: none; } }
  @keyframes arrive { 0%, 51% { opacity: 0; pointer-events: none; } 64%, 100% { opacity: 1; pointer-events: auto; } }
}

/* Below the stage: more of each app, on its own ground. */
.more { padding: 112px var(--pad) 104px; }
.more-mybaby { background: var(--stage-mybaby); }
.more-bills { background: var(--stage-bills); }
.more h2 { font: 500 var(--s4)/1.1 var(--display); letter-spacing: -.02em; max-width: 20ch; text-wrap: balance; }
.more-head p { margin-top: 16px; max-width: 40ch; color: var(--muted); font-size: var(--s2); line-height: 1.45; }
.more figcaption { margin-top: 18px; max-width: 30ch; color: var(--muted); font-size: 1.0625rem; line-height: 1.45; }

/* MyBaby: feature. The growth screen leads, three smaller ones support it. */
.feature { display: grid; gap: 40px; }
.lead-shot .screen { width: min(320px, 78%); }
.shots, .trio { display: grid; gap: 24px; }

/* Bill Reminder: grid. Three equal screens, one line under each. */
.trio .screen, .shots .screen { width: 100%; max-width: 280px; }
.more-bills .more-head { margin-bottom: 48px; }

@media (max-width: 759px) {
  .more { padding-block: 72px 64px; }
  /* A row of screens scrolls sideways on a phone instead of stacking three tall images. */
  .shots, .trio {
    grid-auto-flow: column; grid-auto-columns: 62%; overflow-x: auto; overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory; scroll-padding-inline: var(--gap);
    margin-inline: calc(var(--gap) * -1); padding: 0 var(--gap) 8px;
  }
  .shots li, .trio li { scroll-snap-align: start; }
}
@media (min-width: 760px) {
  .shots, .trio { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1040px) {
  .feature {
    grid-template-columns: 340px minmax(0, 1fr); column-gap: 80px; row-gap: 56px;
    grid-template-areas: "lead head" "lead shots"; grid-template-rows: auto 1fr;
  }
  .feature .more-head { grid-area: head; }
  .lead-shot { grid-area: lead; }
  .lead-shot .screen { width: 340px; }
  /* The supporting screens stay clearly smaller than the lead one, or there is no lead. */
  .feature .shots { grid-area: shots; align-self: end; grid-template-columns: repeat(3, minmax(0, 224px)); justify-content: space-between; }
  .trio { grid-template-columns: repeat(3, minmax(0, 280px)); justify-content: space-between; }
}

/* Support: ledger. What to include, what Apple handles, what happens to your data. */
.support { padding: 112px var(--pad) 96px; background: var(--paper); display: grid; gap: 40px; }
.support h2 { font: 500 var(--s4)/1.1 var(--display); letter-spacing: -.02em; }
.support-head p { margin-top: 16px; max-width: 34ch; color: var(--muted); font-size: var(--s2); line-height: 1.45; }
.mail { display: inline-block; margin-top: 24px; padding: 12px 20px; border-radius: var(--r); background: var(--accent); color: #fff; font: 500 1rem/1.4 var(--display); text-decoration: none; }
.mail:hover { background: #2f5fc0; }
.ledger div { display: grid; gap: 4px 32px; padding: 20px 0; border-top: 1px solid var(--line); }
.ledger div:last-child { border-bottom: 1px solid var(--line); }
.ledger dt { font: 500 1.0625rem/1.5 var(--display); }
.ledger dd { max-width: 46ch; }
@media (min-width: 900px) {
  .support { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); column-gap: 80px; align-items: start; }
  .ledger div { grid-template-columns: 180px minmax(0, 1fr); }
}

.foot { padding: 28px var(--pad) 48px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; background: var(--paper); border-top: 1px solid var(--line); font: 400 .875rem/1.5 var(--display); color: var(--muted); }

/* 404: one screen on MyBaby's ground, in both languages. */
body:has(> .nf) { display: flex; flex-direction: column; }
.nf { flex: 1; padding: 64px var(--pad) 120px; }
.nf h1 { font: 500 var(--s5)/1.1 var(--display); letter-spacing: -.025em; }
.nf h2 { font: 500 var(--s4)/1.1 var(--display); letter-spacing: -.02em; }
.nf p { margin-top: 16px; max-width: 40ch; color: var(--muted); font-size: var(--s2); line-height: 1.45; }
.nf .links { margin-top: 24px; font: 500 1.0625rem/1.4 var(--display); }
.nf-ru { margin-top: 56px; padding-top: 32px; border-top: 1px solid var(--line); }

/* Reveal floor without a script (the site's CSP allows none). Visible at rest wherever
   scroll-driven animations are missing, so nothing ever waits on a handler. */
@keyframes reveal { from { opacity: 0; translate: 0 60px; } }
@keyframes reveal-calm { from { opacity: 0; } }
@supports (animation-timeline: view()) {
  .reveal {
    animation: reveal linear both;
    animation-timing-function: cubic-bezier(.16, 1, .3, 1);
    animation-timeline: view();
    animation-range: entry 0% entry 90%;
  }
  @media (prefers-reduced-motion: reduce) { .reveal { animation-name: reveal-calm; } }
}

/* Review hooks in place of ?static=1 and ?t= on a page with no script: set data-static, or
   data-t with --t, on <html> from devtools. */
html[data-static] .reveal { animation: none; }
html[data-t] .mech {
  animation-timeline: auto !important;
  animation-duration: 1s !important;
  animation-play-state: paused !important;
  animation-delay: calc(var(--t, 0) * -1s) !important;
  animation-range: normal !important;
}
