/* ============================================================
   APP-PAGE.CSS — the one frame every app page stands in
   (pages/17on, flip, keycaps, mememes, prorate, rexy).

   It is the home page's direction, carried to an app: the hero
   takes one of the four mattes by day and ink by night, with the
   site header on it and the app's own object drawn in particles;
   the page follows day and night (theme.css, theme.js); sections
   keep one rhythm, one type scale and one card.

   An app's own sheet (assets/css/<app>.css) sets its matte
   (--tone) and styles only what is the app's alone: its demo in
   the hero, its own widgets. The frame's pieces all carry the
   app- prefix. Stands on theme.css and chrome.css; base.css is
   not loaded on an app page.
   ============================================================ */

@import url('/assets/css/theme.css');
@import url('/assets/css/chrome.css');

html { scroll-behavior: smooth; }

/* The canvas: Safari paints its pull-to-refresh band, the space under the footer and the Duo's side rail from the
   body's background, so it takes the page's ground and follows day and night with it. */
body { margin: 0; background: var(--bg); }

.app-page {
    /* The app's matte. An app's sheet names one of the four; young leaf is the fallback. */
    --tone: #89FFCF;
    --pad: clamp(18px, 3.4vw, 48px);
    --gap: clamp(12px, 1.6vw, 20px);
    --radius: clamp(20px, 2.2vw, 28px);
    --section: clamp(64px, 8vw, 120px);
    color: var(--body);
    font-family: var(--font-text);
    font-size: 18px;
    line-height: 1.5;
    overflow-x: clip;
    transition: background-color 0.7s cubic-bezier(0.3, 0.7, 0.3, 1), color 0.7s cubic-bezier(0.3, 0.7, 0.3, 1);
}

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

.app-page main { display: block; }
.app-page img { max-width: 100%; }
:where(.app-page) a { color: inherit; }
:where(.app-page) :where(h1, h2, h3, p, ul) { margin: 0; }
.app-page ul { padding: 0; list-style: none; }

.app-page h1,
.app-page h2,
.app-page h3 {
    font-family: var(--font-display);
    color: var(--fg);
    text-wrap: balance;
}

.app-page :focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

.app-wrap {
    width: 100%;
    max-width: var(--chrome-max);
    margin: 0 auto;
    padding-left: var(--pad);
    padding-right: var(--pad);
}

/* --- Hero ---
   By day the ground takes the app's matte and the type and particles are ink; by night the ground is ink and the
   particles take the matte. The header reads --h-fg and --h-bg from here. */
.app-hero {
    --h-fg: #0C0C0C;
    --h-bg: var(--tone);
    --iro-fg: #0C0C0C;
    --iro-hi: #FFFFFF;
    background: var(--h-bg);
    color: var(--h-fg);
    transition: background-color 0.55s cubic-bezier(0.3, 0.7, 0.3, 1), color 0.55s;
}

[data-theme="night"] .app-hero {
    --h-fg: #F1F4F6;
    --h-bg: #0C0C0C;
    --iro-fg: var(--tone);
}

.app-hero-body {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 28px clamp(28px, 5vw, 72px);
    padding-top: clamp(28px, 5vw, 72px);
    padding-bottom: clamp(44px, 6vw, 88px);
}

/* The copy sizes its title from its own width, so the title fits whether the hero is one column or two. */
.app-hero-copy {
    flex: 3 1 460px;
    min-width: 0;
    container-type: inline-size;
}

.app-hero-copy > * + * { margin-top: clamp(16px, 4cqi, 26px); }

.app-id {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 16px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(20px, 5cqi, 28px);
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.app-icon {
    display: block;
    flex: none;
    width: clamp(60px, 15cqi, 84px);
    height: auto;
    aspect-ratio: 1;
    border-radius: 22.5%;
}

.app-eyebrow {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.app-page .app-title {
    color: inherit;
    font-weight: 800;
    font-size: clamp(38px, 11.5cqi, 96px);
    line-height: 0.9;
    letter-spacing: -0.035em;
}

.app-title em { font-style: normal; }

.app-lede {
    max-width: 46ch;
    font-size: clamp(18px, 3.4cqi, 21px);
    font-weight: 500;
    text-wrap: pretty;
}

.app-stores {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 16px;
}

.app-stores a { display: inline-flex; border-radius: 12px; transition: transform 0.45s cubic-bezier(0.3, 1.5, 0.5, 1); }
.app-stores a:hover { transform: translateY(-3px); }
/* The stores' own badges, unaltered. */
.app-badge { display: block; height: clamp(48px, 5vw, 58px); width: auto; }

.app-fineprint {
    max-width: 64ch;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.04em;
}

/* The app's object, in particles (iro.js). Decoration: it scatters from the pointer and never takes a click. */
.app-hero-art {
    flex: 2 1 320px;
    min-width: 0;
    height: clamp(240px, 38vw, 520px);
}

.app-hero-art canvas { display: block; width: 100%; height: 100%; }

/* --- Below the hero: a page of the same publication as the home page. Flat grounds, hairlines for boxes,
   display type set tight, mono for labels. --- */
.app-section {
    padding-top: var(--section);
}

main > .app-section:last-of-type { padding-bottom: var(--section); }

/* A section's head: the heading at the left, a sentence or a mono label at the right, on one baseline. */
.app-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px 40px;
    margin-bottom: clamp(28px, 4vw, 48px);
}

.app-page .app-h2 {
    max-width: 16ch;
    font-weight: 800;
    font-size: clamp(44px, 6vw, 92px);
    line-height: 0.9;
    letter-spacing: -0.035em;
}

.app-page .app-sub {
    max-width: 38ch;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--body);
    text-wrap: pretty;
}

.app-label,
.app-section .app-eyebrow,
.app-band .app-eyebrow {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--mut);
}

.app-head .app-label { margin-bottom: 10px; }

/* Figures: the screenshots in one row, centered on the page when they fit and edge to edge, scrolling sideways, when
   the row is wider than the page, each with its number under it. */
.app-figs { padding-top: clamp(40px, 5vw, 72px); }

.app-shots {
    display: flex;
    gap: var(--gap);
    padding: 0 var(--pad);
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scroll-padding: 0 var(--pad);
    scrollbar-width: none;
}

.app-shots::-webkit-scrollbar { display: none; }

/* While a row sits where it opened, centered by iro.js, it doesn't snap; snapping starts once the reader scrolls it. */
.app-shots[data-centered] { scroll-snap-type: none; }

.app-fig {
    flex: none;
    margin: 0;
    scroll-snap-align: center;
}

/* Auto margins at the two ends center a row that fits and fall to zero when it overflows, so a wide row still
   starts at its first screenshot (justify-content: center would cut off its start). */
.app-fig:first-child { margin-left: auto; }
.app-fig:last-child { margin-right: auto; }

.app-shot {
    display: block;
    height: clamp(340px, 44vw, 560px);
    width: auto;
    max-width: none;
}

.app-fig figcaption { padding-top: 12px; }

/* The list: what the app does, two columns of entries under hairlines, each numbered in small roman. */
.app-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr));
    gap: 0 clamp(40px, 6vw, 80px);
    counter-reset: app-item;
}

.app-item {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 4px 0;
    align-content: start;
    padding: 26px 0 30px;
    border-top: 1px solid var(--line);
    counter-increment: app-item;
}

.app-item::before {
    content: counter(app-item, lower-roman);
    grid-row: 1 / span 3;
    padding-top: 13px;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--mut);
}

.app-item > * { grid-column: 2; }

.app-page .app-item h3 {
    font-weight: 700;
    font-size: clamp(26px, 2.6vw, 34px);
    line-height: 1.1;
    letter-spacing: -0.03em;
}

.app-item p { color: var(--body); text-wrap: pretty; }

/* Rows: steps and questions, numbered 01, 02, … with the answer beside the line it answers. */
.app-rows {
    border-bottom: 1px solid var(--line);
    counter-reset: app-row;
}

.app-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px clamp(20px, 3vw, 48px);
    padding: 22px 0 24px;
    border-top: 1px solid var(--line);
    counter-increment: app-row;
}

.app-row::before {
    content: counter(app-row, decimal-leading-zero);
    flex: 0 0 34px;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.08em;
    color: var(--mut);
}

.app-page .app-row h3 {
    flex: 1 1 260px;
    min-width: 0;
    font-weight: 700;
    font-size: clamp(22px, 2vw, 27px);
    line-height: 1.15;
    letter-spacing: -0.025em;
}

.app-row p {
    flex: 2 1 380px;
    min-width: 0;
    color: var(--body);
    text-wrap: pretty;
}

/* A phrase the copy leans on. */
.app-mark {
    color: var(--fg);
    font-weight: 600;
}

a.app-mark { text-decoration: underline; text-underline-offset: 3px; }

/* The statement: one sentence, centered, in display type. */
.app-page .app-statement {
    max-width: 22ch;
    margin: clamp(48px, 7vw, 100px) auto 0;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(34px, 4.6vw, 68px);
    line-height: 0.98;
    letter-spacing: -0.035em;
    text-align: center;
    text-wrap: balance;
    color: var(--fg);
}

/* The band: full width in ink, a figure at the left and type at the right, the app's matte for emphasis. */
.app-band {
    margin-top: var(--section);
    background: var(--band);
    color: #F1F4F6;
    transition: background-color 0.7s;
}

.app-band-body {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 32px clamp(32px, 5vw, 72px);
    padding-top: var(--section);
    padding-bottom: var(--section);
}

.app-band-fig { flex: 1 1 280px; min-width: 0; }
.app-band-copy { flex: 2 1 520px; min-width: 0; }
.app-band-copy > * + * { margin-top: clamp(18px, 2.2vw, 28px); }
.app-band .app-label, .app-band .app-eyebrow { color: #C9D2D9; }
.app-band-fig .app-label { margin-top: 14px; }

.app-page .app-band .app-h2,
.app-page .app-band-title {
    max-width: 22ch;
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(28px, 3.4vw, 48px);
    line-height: 1.1;
    letter-spacing: -0.025em;
    color: inherit;
    text-wrap: balance;
}

.app-page .app-band h3 { color: inherit; }
.app-band p { color: #C9D2D9; text-wrap: pretty; }
.app-band strong { color: #F1F4F6; font-weight: 600; }
.app-band .app-mark { color: var(--tone); }
.app-band-copy > p { max-width: 52ch; font-size: clamp(18px, 1.6vw, 22px); }
.app-band .app-fineprint { color: #C9D2D9; font-size: 12px; }

/* A line of display type in the app's matte, as the home page colors its two lines. */
.app-page .app-band-line {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(26px, 3vw, 40px);
    line-height: 1.1;
    letter-spacing: -0.025em;
    color: var(--tone);
}

/* The closing band: the app's icon where the home page draws its name, and the last line beside it. */
.app-page .app-close .app-band-title {
    max-width: 16ch;
    font-weight: 700;
    font-size: clamp(34px, 4.6vw, 68px);
    line-height: 0.98;
    letter-spacing: -0.035em;
}

.app-close-icon {
    display: block;
    width: clamp(120px, 18vw, 240px);
    height: auto;
    aspect-ratio: 1;
    border-radius: 22.5%;
}

/* --- Pricing --- */
.app-plan,
.app-lifetime {
    min-width: 0;
    padding: clamp(22px, 2.6vw, 34px);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
    transition: background-color 0.7s cubic-bezier(0.3, 0.7, 0.3, 1), border-color 0.7s;
}

.app-page .app-lifetime h3 {
    font-weight: 700;
    font-size: clamp(21px, 1.8vw, 25px);
    line-height: 1.15;
    letter-spacing: -0.025em;
}

.app-lifetime p {
    margin-top: 10px;
    font-size: 17px;
    color: var(--body);
    text-wrap: pretty;
}

.app-pricing {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
    gap: var(--gap);
    align-items: stretch;
}

.app-page .app-plan h3 {
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--mut);
}

.app-plan-flag {
    display: inline-block;
    margin-bottom: 14px;
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--tone);
    color: #0C0C0C;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.app-price {
    margin-top: 12px;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(44px, 5vw, 64px);
    line-height: 1;
    letter-spacing: -0.035em;
    color: var(--fg);
}

.app-price span {
    font-family: var(--font-text);
    font-weight: 500;
    font-size: 17px;
    letter-spacing: 0;
    color: var(--mut);
}

.app-plan-list { margin-top: 22px; }

.app-plan-list li {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 11px 0;
    border-top: 1px solid var(--line);
    font-size: 17px;
}

/* In the plan: a dot. Not in the plan: a ring. */
.app-plan-list li::before {
    content: "";
    flex: none;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: currentColor;
    transform: translateY(-1px);
}

.app-plan-list li.disabled { color: var(--mut); }
.app-plan-list li.disabled::before { background: none; box-shadow: inset 0 0 0 1.5px currentColor; }

/* The plan the page leads with stands in ink by day and in paper by night. */
.app-plan.is-featured {
    --line: color-mix(in srgb, var(--bg) 24%, transparent);
    --mut: color-mix(in srgb, var(--bg) 72%, var(--fg));
    border-color: var(--fg);
    background: var(--fg);
    color: var(--bg);
}

.app-plan.is-featured .app-price { color: var(--bg); }

/* Monthly or annual. */
.billing-toggle {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin-top: 16px;
    font-size: 15px;
    font-weight: 500;
}

.billing-label { cursor: pointer; opacity: 0.6; transition: opacity 0.3s; }
.billing-label.active { opacity: 1; }

.toggle-track {
    position: relative;
    flex: none;
    width: 46px;
    height: 26px;
    border-radius: 999px;
    box-shadow: inset 0 0 0 1.5px currentColor;
    cursor: pointer;
}

.toggle-thumb {
    position: absolute;
    top: 5px;
    left: 5px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: currentColor;
    transition: transform 0.45s cubic-bezier(0.3, 1.5, 0.5, 1);
}

.toggle-track.annual .toggle-thumb { transform: translateX(20px); }

.savings-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 9px;
    border-radius: 999px;
    background: var(--tone);
    color: #0C0C0C;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.app-lifetime {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px 40px;
    margin-top: var(--gap);
}

.app-lifetime > :first-child { flex: 1 1 300px; min-width: 0; }
.app-lifetime .app-price { margin-top: 0; font-size: clamp(34px, 3.6vw, 48px); white-space: nowrap; }

.app-note {
    max-width: 64ch;
    margin-top: 22px;
    font-size: 16px;
    color: var(--mut);
}

/* --- Reveal: content rises into place once (iro.js adds is-in). Only hides when the script is running. --- */
html.iro-js [data-reveal] { opacity: 0; transform: translateY(22px); }
html.iro-js [data-reveal].is-in {
    opacity: 1;
    transform: none;
    transition: opacity 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) var(--d, 0s), transform 1.1s cubic-bezier(0.2, 0.9, 0.25, 1) var(--d, 0s);
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    html.iro-js [data-reveal], html.iro-js [data-reveal].is-in { opacity: 1; transform: none; transition: none; }
    .app-page, .app-page *, .app-page *::before, .app-page *::after { animation: none !important; transition: none !important; }
}
