:root {
    /* The app's mono theme: a light gray viewfinder with a yellow accent. */
    --ground: #f2f2f2;
    --ground-low: #e6e6e6;
    --ink: #141414;
    --ink-soft: #4a4a4a;
    --ink-faint: #737373;
    --accent: #fac714; /* the record button */
    --accent-ink: #8a6a00; /* the accent, dark enough to read as text */
    --rule: rgba(0, 0, 0, 0.16);
    --card: rgba(255, 255, 255, 0.72);
    --contour: rgba(0, 0, 0, 0.07);
    --bracket: rgba(0, 0, 0, 0.28);
    --shade: 0, 0, 0;

    --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
    --font-body: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;

    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    :root {
        /* Night vision, like the app after dark. */
        --ground: #000;
        --ground-low: #000;
        --ink: #ffbdb3;
        --ink-soft: #d9877f;
        --ink-faint: #a0605a;
        --accent: #fa4d42;
        --accent-ink: #fa4d42;
        --rule: rgba(250, 77, 66, 0.32);
        --card: rgba(33, 33, 33, 0.72);
        --contour: rgba(250, 77, 66, 0.12);
        --bracket: rgba(250, 77, 66, 0.45);
        --shade: 0, 0, 0;
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    background: linear-gradient(var(--ground), var(--ground-low)) fixed;
    background-color: var(--ground);
    color: var(--ink);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
}

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

/* ---------- Single-screen home page ---------- */

.home {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    display: grid;
    grid-template-rows: 1fr auto;
}

.topo {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

/* Viewfinder corner brackets, framing the page like the app icon frames its pin. */
.frame {
    position: fixed;
    inset: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
    pointer-events: none;
    z-index: -1;
}

.frame i {
    position: absolute;
    width: 28px;
    height: 28px;
    border: 2px solid var(--bracket);
}

.frame i:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; border-top-left-radius: 6px; }
.frame i:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; border-top-right-radius: 6px; }
.frame i:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; border-bottom-left-radius: 6px; }
.frame i:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; border-bottom-right-radius: 6px; }

.stage {
    display: grid;
    grid-template-columns: minmax(300px, 0.9fr) 1.1fr;
    align-items: center;
    gap: 2rem;
    padding: 2rem clamp(1.5rem, 5vw, 5rem) 0;
    padding-left: max(clamp(1.5rem, 5vw, 5rem), env(safe-area-inset-left));
    padding-right: max(clamp(1.5rem, 5vw, 5rem), env(safe-area-inset-right));
    min-height: 0;
}

.intro {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    max-width: 32rem;
}

.app-icon {
    display: block;
    width: 72px;
    height: 72px;
    /* drop-shadow follows the icon's own pixels, so the shadow takes the exact squircle. */
    filter:
        drop-shadow(0 1px 1px rgba(var(--shade), 0.14))
        drop-shadow(0 3px 5px rgba(var(--shade), 0.14))
        drop-shadow(0 10px 16px rgba(var(--shade), 0.16));
    margin-bottom: 1.75rem;
}

/* ---------- Name and copy ---------- */

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.55em;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin-bottom: 0.7rem;
}

.rec-dot {
    width: 0.7em;
    height: 0.7em;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent), 0 0 10px var(--accent);
    animation: blink 2s steps(1, end) infinite;
}

@keyframes blink {
    50% { opacity: 0.25; }
}

.app-name {
    font-family: var(--font-mono);
    font-weight: 800;
    font-size: clamp(3rem, 6.2vw, 5.5rem);
    line-height: 1;
    letter-spacing: -0.045em;
    margin-bottom: 1.25rem;
}

.description {
    font-size: clamp(1.05rem, 1.35vw, 1.22rem);
    line-height: 1.55;
    color: var(--ink-soft);
    margin-bottom: 0.9rem;
    text-wrap: pretty;
}

.aside {
    color: var(--ink-faint);
    margin-bottom: 1.6rem;
}

/* A HUD card like the app's coordinate readout: labels left, values right. */
.readout {
    width: 100%;
    max-width: 24rem;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    background: var(--card);
    border: 1px solid var(--rule);
    border-radius: 12px;
    padding: 0.2rem 1rem;
    margin-bottom: 1.9rem;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.readout div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.55rem 0;
}

.readout div + div {
    border-top: 1px solid var(--rule);
}

.readout dt {
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-faint);
}

.readout dd {
    font-weight: 600;
    color: var(--ink);
    text-align: right;
}

.app-store-badge {
    display: inline-block;
    line-height: 0;
    transition: transform 0.2s ease;
}

.app-store-badge:hover {
    transform: translateY(-1px);
}

.app-store-badge img {
    height: 54px;
    width: auto;
}

.compat {
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--ink-faint);
}

/* ---------- The rendered iPhone ---------- */

.scene {
    /* --w is the phone's width; every other measurement derives from it. */
    --w: min(24vw, 35vh, 360px);
    --t: calc(var(--w) * 0.115); /* thickness */
    --b: calc(var(--w) * 0.034); /* bezel, glass edge to screen */
    --lip: calc(var(--w) * 0.006); /* metal showing around the glass */
    /* Height over width of the screenshot (1206 x 2622). The phone is sized so the screen,
       inside the bezel, has exactly this shape. */
    --media-aspect: 2.17413;
    --h: calc((var(--w) - var(--b) * 2) * var(--media-aspect) + var(--b) * 2);
    --sr: calc((var(--w) - var(--b) * 2) * 0.145); /* screen corner radius */
    --r: calc(var(--sr) + var(--b)); /* outer corner radius, concentric with the screen */

    position: relative;
    height: 100%;
    min-height: 0;
}

.view {
    position: relative;
    height: 100%;
    display: grid;
    place-items: center;
    perspective: calc(var(--w) * 6);
}

.stand,
.phone {
    position: relative;
    width: var(--w);
    height: var(--h);
    transform-style: preserve-3d;
}

/* Swings in from the side as the page opens. The phone itself is turned by the script,
   so the entrance lives on its own wrapper. */
.stand {
    animation: swing-in 1.5s cubic-bezier(0.25, 0.7, 0.2, 1) 0.15s both;
}

@keyframes swing-in {
    from { transform: translateY(5%) rotateY(55deg); }
}

.phone {
    /* The script turns this toward the pointer. */
    transform: rotateX(5deg) rotateY(-20deg);
}

.face {
    position: absolute;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.front {
    inset: var(--lip);
    border-radius: calc(var(--r) - var(--lip));
    background: #050506;
}

/* The frame: rounded slices stacked through the thickness, so the edge follows the corners.
   Silver aluminum, lit from the upper left. The deepest slice closes the back. */
.layer {
    inset: 0;
    border-radius: var(--r);
    backface-visibility: visible;
    -webkit-backface-visibility: visible;
    background: linear-gradient(170deg, #f1f1f0 0%, #c9c9c7 30%, #a3a3a1 70%, #727270 100%);
}

/* Side button and Camera Control on the right edge, the edge turned toward the viewer. */
.key {
    left: calc(100% + 0.5px);
    width: calc(var(--t) * 0.42);
    transform-origin: 0 50%;
    transform: translateZ(calc(var(--t) * -0.29)) rotateY(90deg);
    border-radius: 999px;
    background: linear-gradient(to bottom, #dcdcda, #9a9a98);
    box-shadow: inset 0 0 0 1px rgba(40, 40, 40, 0.3);
}

.side-button {
    top: 25%;
    height: 11%;
}

/* Camera Control, fittingly. */
.camera-control {
    top: 53%;
    height: 7%;
    background: linear-gradient(to bottom, #b8b8b6, #7d7d7b);
}

.screen-canvas {
    inset: var(--b);
    width: calc(100% - var(--b) * 2);
    height: calc(100% - var(--b) * 2);
    border-radius: var(--sr);
    transform: translateZ(0.5px);
    background: #000;
}

/* A soft reflection floating just above the glass. */
.glare {
    inset: var(--b);
    border-radius: var(--sr);
    transform: translateZ(1px);
    pointer-events: none;
    background: linear-gradient(118deg, rgba(255, 255, 255, 0.13) 0%, rgba(255, 255, 255, 0.03) 34%, transparent 34.2%);
}

/* The phone floats; its shadow pools on the page below it. */
.ground-shadow {
    position: absolute;
    left: 50%;
    top: calc(50% + var(--h) * 0.5 + var(--w) * 0.05);
    width: calc(var(--w) * 1.25);
    height: calc(var(--w) * 0.16);
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(closest-side, rgba(var(--shade), 0.3), rgba(var(--shade), 0.1) 60%, transparent);
    filter: blur(calc(var(--w) * 0.03));
    pointer-events: none;
}

/* ---------- Footer ---------- */

.site-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1.5rem;
    padding: 1rem clamp(1.5rem, 5vw, 5rem) 1.5rem;
    padding-left: max(clamp(1.5rem, 5vw, 5rem), env(safe-area-inset-left));
    padding-right: max(clamp(1.5rem, 5vw, 5rem), env(safe-area-inset-right));
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
    font-size: 0.8125rem;
    color: var(--ink-faint);
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.5rem;
}

.site-footer a {
    text-decoration: none;
    color: var(--ink-soft);
}

.site-footer a:hover {
    color: var(--ink);
}

.clock {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
}

/* ---------- Narrow and portrait screens ---------- */

@media (max-width: 820px), (max-aspect-ratio: 1/1) {
    /* The page is one screen tall, and only grows (and scrolls) when the copy leaves too
       little room under it for the phone. */
    .home {
        height: auto;
        min-height: 100vh;
        min-height: 100svh;
        overflow: visible;
    }

    .stage {
        grid-template-columns: 1fr;
        grid-template-rows: auto minmax(22rem, 1fr);
        align-items: start;
        gap: 0;
        padding-top: clamp(1.75rem, 5vh, 3rem);
        text-align: center;
    }

    .intro {
        align-items: center;
        margin: 0 auto;
    }

    .app-icon {
        width: 52px;
        height: 52px;
        margin-bottom: 0.9rem;
    }

    /* Small enough to stay on one line beside its dot. */
    .eyebrow {
        font-size: clamp(0.625rem, 2.9vw, 0.8125rem);
        letter-spacing: 0.02em;
        white-space: nowrap;
    }

    .app-name {
        font-size: clamp(2.5rem, 12vw, 4rem);
        margin-bottom: 0.9rem;
    }

    .description {
        font-size: 1.02rem;
        line-height: 1.5;
        margin-bottom: 0.75rem;
    }

    .aside {
        margin-bottom: 1.25rem;
    }

    .readout {
        text-align: left;
        margin-bottom: 1.25rem;
    }

    .app-store-badge img {
        height: 46px;
    }

    .compat {
        display: none;
    }

    /* The phone fills whatever room is left under the copy. */
    .scene {
        container-type: size;
        padding: 0.75rem 0 1.5rem;
        --w: min(46cqw, 41cqh, 300px);
    }

    .site-footer {
        flex-direction: column;
        justify-content: center;
        text-align: center;
    }
}

/* Small phones: the copy tightens to keep the phone in view. */
@media (max-width: 420px) {
    .description {
        font-size: 0.98rem;
        line-height: 1.45;
    }

    .aside,
    .readout {
        display: none;
    }
}

@media (max-height: 700px) and (min-width: 821px) {
    .app-icon { display: none; }
    .readout { display: none; }
}

@media (prefers-color-scheme: dark) {
    .ground-shadow {
        background: radial-gradient(closest-side, rgba(250, 77, 66, 0.16), rgba(250, 77, 66, 0.05) 60%, transparent);
    }

    .app-icon {
        filter:
            drop-shadow(0 3px 5px rgba(0, 0, 0, 0.4))
            drop-shadow(0 8px 20px rgba(250, 77, 66, 0.2));
    }

    .layer {
        background: linear-gradient(170deg, #5c5c5e 0%, #3a3a3c 30%, #262628 70%, #18181a 100%);
    }

    .key {
        background: linear-gradient(to bottom, #4a4a4c, #222224);
        box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.4);
    }

    .camera-control {
        background: linear-gradient(to bottom, #3c3c3e, #1c1c1e);
    }
}

@media (prefers-reduced-motion: reduce) {
    .stand { animation: none; }
    .rec-dot { animation: none; }
}

/* ---------- Text pages (privacy, support) ---------- */

.page-body {
    min-height: 100%;
}

.page {
    max-width: 40rem;
    margin: 0 auto;
    padding: 3rem 1.5rem 4rem;
    font-size: 1.0625rem;
    line-height: 1.65;
}

.page .back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: -0.02em;
    color: var(--ink-soft);
    text-decoration: none;
    margin-bottom: 2.5rem;
}

.page .back-link img {
    width: 30px;
    height: 30px;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.16)) drop-shadow(0 3px 5px rgba(0, 0, 0, 0.12));
}

.page h1 {
    font-family: var(--font-mono);
    font-weight: 800;
    font-size: 2.4rem;
    letter-spacing: -0.04em;
    line-height: 1.05;
    margin-bottom: 1.5rem;
}

.page h2 {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 2.25rem 0 0.4rem;
}

.page p,
.page li {
    color: var(--ink-soft);
    margin-bottom: 0.75rem;
}

.page ul {
    padding-left: 1.25rem;
}

.page a {
    color: var(--ink);
    text-decoration-color: var(--accent);
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

.page .updated {
    margin-top: 2.5rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--ink-faint);
}
