/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */

:root {
    color-scheme: light;

    /* Surfaces */
    --bg:            #ffffff;
    --bg-alt:        #f5f5f7;
    --bg-sunken:     #fafafc;

    /* Text */
    --text:          #1d1d1f;
    --text-2:        #6e6e73;

    --accent:        #0068d1;
    --accent-hover:  #0058ad;
    --accent-ring:   rgba(0, 104, 209, 0.5);

    /* Lines and shadows, tinted to the background hue, never pure black */
    --hairline:      rgba(29, 29, 31, 0.10);
    --hairline-soft: rgba(29, 29, 31, 0.06);
    --shadow-media:  0 22px 55px -24px rgba(29, 29, 31, 0.36);

    /* Glass */
    --glass-bg:      rgba(255, 255, 255, 0.72);
    --glass-solid:   #ffffff;

    /* Radii */
    --r-pill:        980px;
    --r-card:        22px;
    --r-small:       12px;

    /* Type */
    /* The visitor's own system UI font: SF Pro on Apple devices, Segoe UI on
       Windows, Roboto on Android. No font file is served or embedded, so
       there is nothing to license and no third-party request. */
    --font-sans: -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI",
                 Roboto, "Helvetica Neue", Arial, sans-serif;

    --fs-display: clamp(2.5rem, 6.2vw, 4.5rem);
    --fs-h2:      clamp(1.875rem, 4.2vw, 3rem);
    --fs-h3:      clamp(1.25rem, 2.2vw, 1.5rem);
    --fs-lead:    clamp(1.0625rem, 1.9vw, 1.3125rem);
    --fs-body:    1.0625rem;
    --fs-small:   0.9375rem;

    /* Rhythm (VISUAL_DENSITY 3: airy) */
    --nav-h:      48px;
    --gutter:     clamp(1.25rem, 5vw, 2.5rem);
    --section-y:  clamp(4.5rem, 11vh, 8rem);
    --measure:    44rem;

    /* Motion (MOTION_INTENSITY 5) */
    --ease-out:   cubic-bezier(0.16, 1, 0.3, 1);
    --dur:        0.65s;
}

/* --------------------------------------------------------------------------
   2. Base
   -------------------------------------------------------------------------- */

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

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

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}

body {
    margin: 0;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    font-family: var(--font-sans);
    font-size: var(--fs-body);
    line-height: 1.6;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

img,
svg { display: block; max-width: 100%; height: auto; }

h1, h2, h3 {
    font-weight: 600;
    letter-spacing: -0.022em;
    text-wrap: balance;
    margin: 0;
}

p { margin: 0 0 1.1em; }
p:last-child { margin-bottom: 0; }

a { color: var(--accent); }
a:hover { color: var(--accent-hover); }

:focus-visible {
    outline: 3px solid var(--accent-ring);
    outline-offset: 3px;
    border-radius: 6px;
}

.wrap {
    width: 100%;
    max-width: 1120px;
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.visually-hidden {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.skip-link {
    position: absolute;
    top: 0.5rem;
    left: 50%;
    translate: -50% -200%;
    z-index: 100;
    padding: 0.6rem 1.25rem;
    border-radius: var(--r-pill);
    background: var(--accent);
    color: #fff;
    font-size: var(--fs-small);
    font-weight: 500;
    text-decoration: none;
}

.skip-link:focus-visible {
    translate: -50% 0;
    color: #fff;
}

/* --------------------------------------------------------------------------
   3. Navigation - glass bar, single line, 48px tall
   -------------------------------------------------------------------------- */

.nav {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--nav-h);
    background: var(--glass-bg);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
}

/* The hairline lives in a pseudo-element rather than a border so the scroll
   animation below can drive opacity, which the compositor handles, instead of
   repainting a colour on every scroll frame. Visible by default, so browsers
   without scroll-driven animations simply get a permanent separator. */
.nav::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1px;
    background: var(--hairline);
    pointer-events: none;
}

/* Hairline fades in over the first 40px of scroll: a state cue, not decoration. */
@supports (animation-timeline: scroll()) {
    .nav::after {
        opacity: 0;
        animation: nav-hairline linear both;
        animation-timeline: scroll(root block);
        animation-range: 0 40px;
    }

    @keyframes nav-hairline {
        to { opacity: 1; }
    }

    /* A scroll timeline ignores animation-duration, so the global reduced-motion
       block further down cannot neutralise it. Pin it on instead. */
    @media (prefers-reduced-motion: reduce) {
        .nav::after {
            opacity: 1;
            animation: none;
        }
    }
}

/* Glass needs a real fallback on both counts. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .nav { background: var(--glass-solid); }
}

@media (prefers-reduced-transparency: reduce) {
    .nav {
        background: var(--glass-solid);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
}

.nav-inner {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.nav a {
    text-decoration: none;
    color: var(--text);
    font-size: var(--fs-small);
    white-space: nowrap;
    transition: opacity 0.25s ease;
}

.nav a:hover { opacity: 0.66; color: var(--text); }

.nav-brand { font-weight: 600; letter-spacing: -0.01em; }

/* --------------------------------------------------------------------------
   4. Hero
   -------------------------------------------------------------------------- */

.hero {
    padding-block: clamp(3.5rem, 11vh, 5.5rem) clamp(2.25rem, 6vh, 3.5rem);
    text-align: center;
}

.hero-title {
    font-size: var(--fs-display);
    line-height: 1.05;
    letter-spacing: -0.03em;
}

.hero-lead {
    margin: 1.1rem auto 0;
    max-width: 34rem;
    font-size: var(--fs-lead);
    line-height: 1.45;
    color: var(--text-2);
    letter-spacing: -0.01em;
}

/* --------------------------------------------------------------------------
   5. Product tiles
   -------------------------------------------------------------------------- */

.product {
    padding-block: var(--section-y);
}

/* The first product follows the hero directly, so its top padding is pulled
   in to keep that first download button above the fold. */
.hero + .product { padding-top: clamp(1.75rem, 5vh, 3rem); }

.product--alt { background: var(--bg-alt); }

.product-name {
    font-size: var(--fs-h2);
    line-height: 1.08;
    letter-spacing: -0.028em;
}

.product-lead {
    margin-top: 0.85rem;
    max-width: 32rem;
    font-size: var(--fs-lead);
    line-height: 1.5;
    color: var(--text-2);
    letter-spacing: -0.01em;
}

/* No hover state here on purpose: the icon is not a link, so it should not
   offer the affordance. The lift lives on the App Store badge instead. */
.product-icon {
    width: clamp(112px, 17vw, 152px);
    height: auto;
    border-radius: var(--r-card);
    box-shadow: var(--shadow-media);
}

.product-actions {
    margin-top: 1.75rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
}

/* Centered stack. Single column at every width, so there is no multi-column
   layout to collapse on mobile. */
.product--stacked .product-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.product--stacked .product-name { margin-top: 1.9rem; }
.product--stacked .product-lead { margin-inline: auto; }
.product--stacked .product-actions { align-items: center; }

/* --------------------------------------------------------------------------
   6. App Store badge + supporting links
   -------------------------------------------------------------------------- */

.badge-link {
    display: inline-block;
    border-radius: var(--r-small);
    /* drop-shadow rather than box-shadow: it follows the badge artwork's own
       silhouette, so the shadow matches Apple's corner radius exactly. */
    transition: transform 0.4s var(--ease-out), filter 0.4s var(--ease-out);
}

.badge-link:hover {
    transform: translateY(-3px) scale(1.02);
    filter: drop-shadow(0 12px 20px rgba(29, 29, 31, 0.38));
}

.badge-link:active {
    transform: translateY(-1px) scale(0.98);
    transition-duration: 0.1s;
}

.badge-link img {
    height: 48px;
    width: auto;
    margin: 0;
}

.quiet-link {
    font-size: var(--fs-small);
    color: var(--text-2);
    text-decoration: none;
    transition: color 0.25s ease;
}

.quiet-link:hover {
    color: var(--accent-hover);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* --------------------------------------------------------------------------
   7. Reading layout for the legal, imprint and support pages
   -------------------------------------------------------------------------- */

.page {
    flex: 1;
    padding-block: clamp(3rem, 8vh, 5rem) var(--section-y);
}

/* Body colour is set on the container so that loose text nodes between
   headings (present in some of the legal pages) match the paragraphs. */
.prose {
    max-width: var(--measure);
    margin-inline: auto;
    color: var(--text-2);
}

.prose h1 {
    font-size: clamp(2rem, 5vw, 3.25rem);
    line-height: 1.08;
    letter-spacing: -0.03em;
}

.prose h2 {
    font-size: var(--fs-h3);
    line-height: 1.25;
    margin-top: 2.75rem;
    margin-bottom: 0.75rem;
}

.prose h3 {
    font-size: 1.125rem;
    line-height: 1.3;
    margin-top: 1.9rem;
    margin-bottom: 0.5rem;
}

.prose h1 + p { margin-top: 1rem; }

.prose h1,
.prose h2,
.prose h3 { color: var(--text); }

.prose strong { color: var(--text); font-weight: 600; }

.prose a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}

.prose ul,
.prose ol {
    margin: 0 0 1.1em;
    padding-left: 1.3em;
}

.prose li { margin-bottom: 0.5em; }
.prose li::marker { color: var(--text-2); }

.page-lead {
    margin-top: 1.1rem;
    font-size: var(--fs-lead);
    line-height: 1.5;
    color: var(--text-2);
    letter-spacing: -0.01em;
}

.page-lead a { color: var(--accent); }

/* Tables carry real data, so they stay tables: a header rule plus light row
   separators, no full grid. */
.table-wrap {
    overflow-x: auto;
    margin: 1.5rem 0;
    border-radius: var(--r-small);
}

.prose table {
    border-collapse: collapse;
    width: 100%;
    min-width: 30rem;
    font-size: var(--fs-small);
}

.prose th,
.prose td {
    padding: 0.7rem 0.9rem;
    text-align: left;
    vertical-align: top;
    border: 0;
    border-bottom: 1px solid var(--hairline-soft);
}

.prose th {
    color: var(--text);
    font-weight: 600;
    border-bottom: 1px solid var(--hairline);
    white-space: nowrap;
}

.prose td { color: var(--text-2); }
.prose tr:last-child td { border-bottom: 0; }

/* --------------------------------------------------------------------------
   8. Footer
   -------------------------------------------------------------------------- */

.site-footer {
    margin-top: auto;
    background: var(--bg-sunken);
    border-top: 1px solid var(--hairline);
    padding-block: 2rem;
    font-size: var(--fs-small);
    color: var(--text-2);
    text-align: center;
}

.footer-inner {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.footer-link {
    color: var(--text-2);
    text-decoration: none;
    transition: color 0.25s ease;
}

.footer-link:hover {
    color: var(--accent-hover);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.footer-sep { color: var(--hairline); }

.copyright { margin-top: 0.6rem; }

/* --------------------------------------------------------------------------
   9. Motion

   Four motivated animations, nothing else:
     hero entry ....... establishes hierarchy on load
     tile reveal ...... sequences the two products as you scroll
     icon / badge ..... feedback on hover and press
     nav hairline ..... signals the scrolled state (see section 3)
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {
    .rise {
        opacity: 0;
        transform: translateY(18px);
        animation: rise var(--dur) var(--ease-out) forwards;
    }

    .rise-2 { animation-delay: 0.09s; }

    @keyframes rise {
        to { opacity: 1; transform: none; }
    }

    /* Tile reveal, driven by each tile's own position rather than a timer.
       A view timeline is progress-based, so a tile that is already on screen
       at load sits at the end of its range and renders fully visible with no
       scripting needed. Gated behind @supports, so browsers without
       scroll-driven animations just show the tiles outright. */
    @supports (animation-timeline: view()) {
        .product-body {
            animation: tile-reveal linear both;
            animation-timeline: view();
            animation-range: entry 0% entry 50%;
        }

        @keyframes tile-reveal {
            from { opacity: 0; transform: translateY(26px); }
            to   { opacity: 1; transform: none; }
        }
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
