/*
 * Chrome shared by every page of the studio site: the palette, the fonts, the aurora
 * the page sits on, the header, the footer, and the handful of blocks that appear on
 * more than one page — product cards, feature cards, stats, prose. Anything a single
 * page alone needs stays inline in that page.
 */

/* The studio's display and UI faces, self-hosted so the site needs no third party. */
@font-face {
    font-family: 'Titan One';
    src: url('/fonts/TitanOne-Regular.ttf') format('truetype');
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: 'Fredoka';
    src: url('/fonts/Fredoka.ttf') format('truetype');
    font-weight: 300 700;
    font-display: swap;
}

/*
 * A studio sits behind six products with six different palettes, so the site takes
 * none of them: a deep night base with the studio's own violet-to-cyan aurora. Dark
 * chrome also lets each product's own icon art carry its own colour without clashing.
 */
:root {
    --ink: #070B1E;
    --ink-2: #0B1130;
    --ink-3: #121A3D;

    --violet: #8B4BFF;
    --indigo: #4A5BFF;
    --cyan: #22D3EE;
    --mint: #34D399;
    --amber: #FFB14E;

    --text: #EEF1FF;
    --muted: #A6B0D4;
    --faint: #7882A8;

    --surface: rgba(255, 255, 255, 0.045);
    --surface-hi: rgba(255, 255, 255, 0.075);
    --line: rgba(255, 255, 255, 0.10);
    --line-hi: rgba(255, 255, 255, 0.20);
    --shadow: 0 18px 44px rgba(3, 6, 22, 0.55);

    --display: 'Titan One', 'Fredoka', system-ui, sans-serif;
    --body: 'Fredoka', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

    --radius: 20px;
}

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

html {
    scroll-behavior: smooth;
    /* The header is sticky, so anchored sections must clear it rather than hide under it. */
    scroll-padding-top: 6rem;
}

body {
    font-family: var(--body);
    background: var(--ink);
    color: var(--text);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

/*
 * The aurora: two blooms in the studio's two hues over a deep vertical ramp. It is
 * fixed and behind everything, so scrolling moves the content across a steady light
 * rather than dragging a gradient along with it.
 */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -2;
    background:
            radial-gradient(58rem 40rem at 12% -6%, rgba(139, 75, 255, 0.42), transparent 62%),
            radial-gradient(52rem 38rem at 92% 8%, rgba(34, 211, 238, 0.22), transparent 60%),
            radial-gradient(60rem 44rem at 78% 96%, rgba(74, 91, 255, 0.24), transparent 62%),
            linear-gradient(180deg, var(--ink-3) 0%, var(--ink-2) 38%, var(--ink) 100%);
}

/* A faint grid gives the flat background a scale, the way a studio poster has one. */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: 0.5;
    background-image:
            linear-gradient(rgba(255, 255, 255, 0.028) 1px, transparent 1px),
            linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px);
    background-size: 64px 64px;
    mask-image: radial-gradient(80rem 60rem at 50% 0%, #000 20%, transparent 80%);
}

.wrap {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

h1, h2, h3 {
    font-family: var(--display);
    font-weight: 400;
    line-height: 1.18;
    letter-spacing: 0.2px;
}

a {
    color: var(--cyan);
}

section {
    padding: 4.5rem 0;
}

img {
    max-width: 100%;
}

/* Everything the keyboard can reach shows the same ring, on any surface. */
a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--cyan);
    outline-offset: 3px;
    border-radius: 6px;
}

/* ---------- shared blocks ---------- */

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.78rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text);
    background: var(--surface-hi);
    border: 1px solid var(--line-hi);
    border-radius: 999px;
    padding: 0.32rem 0.9rem;
}

.eyebrow i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--mint);
    box-shadow: 0 0 10px var(--mint);
}

/*
 * Small-caps labels are uppercased in CSS, which would print "iOS" as "IOS". Wrapping the
 * name in an <em> opts that one word out and keeps the platform spelled the way Apple
 * spells it.
 */
.eyebrow em,
.product-kind em {
    font-style: normal;
    text-transform: none;
}

.section-head {
    max-width: 46rem;
    margin-bottom: 2.8rem;
}

.section-head h2 {
    font-size: clamp(1.8rem, 3.6vw, 2.6rem);
    margin-bottom: 0.8rem;
}

.section-head p {
    color: var(--muted);
    font-size: 1.05rem;
}

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.6rem;
    box-shadow: var(--shadow);
    backdrop-filter: blur(8px);
}

.card h3 {
    font-size: 1.12rem;
    margin-bottom: 0.55rem;
}

.card p {
    color: var(--muted);
    font-size: 0.97rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    font-family: var(--display);
    font-size: 0.95rem;
    text-decoration: none;
    padding: 0.75rem 1.5rem;
    border-radius: 999px;
    border: 1px solid transparent;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn-primary {
    color: #FFFFFF;
    background: linear-gradient(135deg, var(--violet), var(--indigo) 55%, var(--cyan));
    box-shadow: 0 10px 26px rgba(74, 91, 255, 0.4);
}

.btn-primary:hover {
    box-shadow: 0 14px 32px rgba(74, 91, 255, 0.55);
}

.btn-ghost {
    color: var(--text);
    background: var(--surface-hi);
    border-color: var(--line-hi);
}

.btn-ghost:hover {
    border-color: var(--cyan);
    color: var(--cyan);
}

.btn .icon {
    width: 18px;
    height: 18px;
}

/* ---------- product cards ---------- */
/*
 * One card per product. The icon is the product's own store art, so the card is
 * recognisable before the name is read — which is the whole job of this grid.
 */
.products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr));
    gap: 1.2rem;
}

.product {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(8px);
    overflow: hidden;
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

/*
 * Each card carries its product's own accent as --accent, used only for a wash at the
 * top and the hover edge. It is a hint of the product's identity, not a repaint.
 */
.product::before {
    content: '';
    position: absolute;
    inset: -40% 40% 60% -20%;
    background: radial-gradient(closest-side, var(--accent, var(--indigo)), transparent);
    opacity: 0.28;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.product:hover {
    transform: translateY(-4px);
    border-color: var(--line-hi);
    box-shadow: 0 24px 54px rgba(3, 6, 22, 0.6);
}

.product:hover::before {
    opacity: 0.45;
}

.product-head {
    display: flex;
    align-items: center;
    gap: 0.95rem;
    position: relative;
}

.product-icon {
    flex: none;
    width: 62px;
    height: 62px;
    border-radius: 16px;
    border: 1px solid var(--line-hi);
    background: rgba(0, 0, 0, 0.25);
    object-fit: cover;
}

.product-name {
    font-family: var(--display);
    font-size: 1.2rem;
    line-height: 1.2;
    display: block;
}

.product-kind {
    font-size: 0.78rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--faint);
}

.product p {
    position: relative;
    color: var(--muted);
    font-size: 0.97rem;
    flex: 1;
}

.product-foot {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    flex-wrap: wrap;
    padding-top: 0.3rem;
}

.product-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.92rem;
    color: var(--text);
    text-decoration: none;
    background: var(--surface-hi);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.3rem 0.85rem;
    transition: border-color 0.2s, color 0.2s;
}

.product-link:hover {
    border-color: var(--cyan);
    color: var(--cyan);
}

.product-link .icon {
    width: 15px;
    height: 15px;
}

/* ---------- stats ---------- */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
    gap: 1rem;
}

.stat {
    text-align: center;
    padding: 1.5rem 1rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    backdrop-filter: blur(8px);
}

.stat b {
    display: block;
    font-family: var(--display);
    font-size: clamp(1.8rem, 4vw, 2.4rem);
    line-height: 1.1;
    background: linear-gradient(135deg, #FFFFFF, var(--cyan));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.stat span {
    display: block;
    font-size: 0.88rem;
    color: var(--muted);
    margin-top: 0.3rem;
}

/* ---------- store badges ---------- */
.badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
}

.badge {
    display: inline-block;
    line-height: 0;
    border-radius: 8px;
    transition: transform 0.2s ease;
}

.badge:hover {
    transform: translateY(-2px);
}

.badge img {
    display: block;
    height: 42px;
    width: auto;
}

/* ---------- header ---------- */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(7, 11, 30, 0.78);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--line);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.8rem 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    font-family: var(--display);
    font-size: 1.2rem;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
}

/*
 * The studio mark is transparent art cropped tight to its own edges, so its box is its
 * visible size. It carries no corner radius on purpose: a radius is for a square app tile,
 * and clipping a round mark with a glow around it only crops the glow.
 */
.logo img {
    width: 42px;
    height: 42px;
}

.logo span {
    background: linear-gradient(135deg, var(--violet), var(--cyan));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/*
 * Scoped to the header on purpose. These rules collapse the bar into a sheet on a phone,
 * and an unscoped `nav` would take any other navigation on the page down with it.
 */
header nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

header nav a {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.97rem;
    transition: color 0.2s;
}

header nav a:hover,
header nav a:focus-visible,
header nav a[aria-current="page"] {
    color: var(--text);
}

.nav-cta {
    font-family: var(--display);
    font-size: 0.88rem;
    color: #FFFFFF !important;
    background: linear-gradient(135deg, var(--violet), var(--indigo) 60%, var(--cyan));
    padding: 0.5rem 1.15rem;
    border-radius: 999px;
    white-space: nowrap;
    box-shadow: 0 6px 18px rgba(74, 91, 255, 0.38);
}

/* The toggle only exists on narrow screens; on desktop the links are always shown. */
.nav-toggle {
    display: none;
    width: 42px;
    height: 42px;
    align-items: center;
    justify-content: center;
    background: var(--surface-hi);
    border: 1px solid var(--line);
    border-radius: 12px;
    color: var(--text);
    cursor: pointer;
}

.nav-toggle svg {
    width: 20px;
    height: 20px;
}

.nav-toggle .close,
.nav-toggle[aria-expanded="true"] .open {
    display: none;
}

.nav-toggle[aria-expanded="true"] .close {
    display: block;
}

/* ---------- footer ---------- */
footer {
    margin-top: 2rem;
    background: rgba(5, 8, 24, 0.72);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
    padding: 3rem 0 2.4rem;
    color: var(--muted);
    font-size: 0.92rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr 1fr 1.2fr;
    gap: 2rem;
    padding-bottom: 2.2rem;
    border-bottom: 1px solid var(--line);
}

.footer-brand .logo {
    margin-bottom: 0.9rem;
}

.footer-brand p {
    max-width: 24rem;
    color: var(--muted);
}

.footer-col h3 {
    font-family: var(--body);
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--faint);
    margin-bottom: 0.9rem;
}

.footer-col ul {
    list-style: none;
    display: grid;
    gap: 0.5rem;
}

.footer-col a {
    color: var(--muted);
    text-decoration: none;
}

.footer-col a:hover {
    color: var(--cyan);
}

.footer-mail {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text);
    text-decoration: none;
    word-break: break-all;
}

.footer-mail:hover {
    color: var(--cyan);
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding-top: 1.6rem;
    color: var(--faint);
    font-size: 0.88rem;
}

/* ---------- sub-page chrome ---------- */
/*
 * Every page other than the landing page opens the same way: a title, a line under it,
 * and then either prose or blocks. Keeping that in one place is what makes About,
 * Contact, Privacy and Terms read as four pages of one site.
 */
.page-head {
    padding: 3.6rem 0 1rem;
    text-align: center;
}

.page-head h1 {
    font-size: clamp(2.2rem, 5.5vw, 3.2rem);
    margin: 0.9rem 0 0.7rem;
}

.page-head p {
    max-width: 40rem;
    margin: 0 auto;
    color: var(--muted);
    font-size: 1.08rem;
}

.prose {
    max-width: 48rem;
    margin: 0 auto 4rem;
    padding: clamp(1.5rem, 4vw, 2.8rem);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(8px);
}

.prose h2 {
    font-size: 1.4rem;
    margin: 2.4rem 0 0.8rem;
}

.prose h2:first-child {
    margin-top: 0;
}

.prose h3 {
    font-family: var(--body);
    font-weight: 600;
    font-size: 1.04rem;
    margin: 1.6rem 0 0.5rem;
}

.prose p {
    color: var(--muted);
    margin-bottom: 1rem;
}

.prose ul, .prose ol {
    color: var(--muted);
    margin: 0 0 1.2rem 0;
    padding-left: 1.3rem;
}

.prose li {
    margin-bottom: 0.45rem;
}

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

.prose a {
    color: var(--cyan);
}

.prose code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.88em;
    color: var(--cyan);
    background: rgba(34, 211, 238, 0.1);
    border: 1px solid rgba(34, 211, 238, 0.22);
    border-radius: 5px;
    padding: 0.05rem 0.35rem;
}

.updated {
    color: var(--faint);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.summary {
    background: rgba(52, 211, 153, 0.08);
    border: 1px solid rgba(52, 211, 153, 0.28);
    border-radius: 16px;
    padding: 1.4rem 1.6rem;
    margin-bottom: 2.4rem;
}

.summary h2 {
    font-size: 1.05rem;
    color: var(--mint);
    margin: 0 0 0.7rem;
}

.summary ul {
    margin: 0;
    padding-left: 1.1rem;
}

.notice {
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 3px solid var(--amber);
    border-radius: 10px;
    padding: 1.1rem 1.3rem;
    margin-bottom: 1.4rem;
}

.notice p:last-child {
    margin-bottom: 0;
}

.callout {
    background: rgba(74, 91, 255, 0.1);
    border: 1px solid rgba(74, 91, 255, 0.3);
    border-radius: 16px;
    padding: 1.4rem 1.6rem;
    margin-top: 2.4rem;
}

.callout h2 {
    margin-top: 0;
    font-size: 1.15rem;
}

.callout p:last-child {
    margin-bottom: 0;
}

.table-shell {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow-x: auto;
    margin-bottom: 1.6rem;
}

.key-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.93rem;
}

.key-table th, .key-table td {
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

.key-table th {
    font-family: var(--display);
    font-weight: 400;
    color: var(--faint);
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.key-table td:first-child {
    color: var(--text);
    white-space: nowrap;
}

.key-table td:last-child {
    color: var(--muted);
}

.key-table tr:last-child td {
    border-bottom: none;
}

/* ---------- error pages ---------- */
/*
 * Boot serves /static/error/<status>.html itself, so these are flat files like the rest of
 * the site rather than anything the app has to route. They share the chrome deliberately:
 * a visitor who hits a dead link should still be able to see it is the same studio, and
 * still be one click from the products and the support address.
 */
.errorpage {
    max-width: 44rem;
    margin: 0 auto;
    padding: 4.5rem 0 5rem;
    text-align: center;
}

.errorcode {
    font-family: var(--display);
    font-size: clamp(5rem, 18vw, 9rem);
    line-height: 1;
    letter-spacing: 0.02em;
    background: linear-gradient(130deg, var(--violet), var(--indigo) 45%, var(--cyan));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    /* The gradient is the whole mark here, so it gets a glow rather than a flat fill. */
    filter: drop-shadow(0 10px 30px rgba(74, 91, 255, 0.35));
}

.errorpage h1 {
    font-size: clamp(1.6rem, 4.5vw, 2.4rem);
    margin: 0.6rem 0 0.9rem;
}

.errorpage p {
    color: var(--muted);
    font-size: 1.05rem;
    max-width: 34rem;
    margin: 0 auto 1rem;
}

.errorpage .actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-top: 1.8rem;
}

.error-art {
    display: block;
    width: min(230px, 62vw);
    height: auto;
    margin: 0 auto 1.6rem;
}

/* The one tile that is missing, so the gap reads as deliberate rather than as a failure. */
.error-art .gap {
    fill: none;
    stroke: var(--line-hi);
    stroke-width: 2;
    stroke-dasharray: 7 6;
}

.errorpage .more {
    margin-top: 2.4rem;
    font-size: 0.92rem;
    color: var(--faint);
}

.errorpage .more a {
    color: var(--muted);
}

.errorpage .more a:hover {
    color: var(--cyan);
}

/* A one-line footer for the error pages: the legal links and the copyright, nothing else. */
.footer-compact {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.8rem 1.4rem;
    flex-wrap: wrap;
    color: var(--faint);
    font-size: 0.88rem;
}

.footer-compact nav {
    display: flex;
    gap: 1.1rem;
    flex-wrap: wrap;
}

.footer-compact a {
    color: var(--muted);
    text-decoration: none;
}

.footer-compact a:hover {
    color: var(--cyan);
}

/* ---------- closing call to action ---------- */
.cta {
    text-align: center;
    background: linear-gradient(150deg, rgba(139, 75, 255, 0.2), rgba(34, 211, 238, 0.12));
    border: 1px solid var(--line-hi);
    border-radius: 28px;
    padding: 3.4rem 1.5rem;
    margin-bottom: 4rem;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.cta h2 {
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    margin-bottom: 0.7rem;
}

.cta p {
    color: var(--muted);
    max-width: 36rem;
    margin: 0 auto 1.6rem;
}

.cta-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.8rem;
}

/* ---------- scroll reveal ---------- */
/*
 * Blocks fade up as they arrive. The class is only added by script, so with JavaScript
 * off — or with reduced motion asked for — everything is simply visible from the start.
 */
.reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.is-visible {
    opacity: 1;
    transform: none;
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 1.8rem;
    }

    .footer-brand {
        grid-column: 1 / -1;
    }

    .nav-toggle {
        display: inline-flex;
    }

    /*
     * The links leave the bar and become a sheet under it. The call to action stays in
     * the bar, because on a phone it is the one thing worth a permanent thumb target.
     */
    header nav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 0.5rem 1.5rem 1.2rem;
        background: rgba(7, 11, 30, 0.97);
        backdrop-filter: blur(16px);
        border-bottom: 1px solid var(--line);
        display: none;
    }

    header nav.is-open {
        display: flex;
    }

    header nav a {
        padding: 0.8rem 0;
        border-bottom: 1px solid var(--line);
        font-size: 1.02rem;
    }

    header nav a.nav-cta {
        margin-top: 1rem;
        text-align: center;
        border-bottom: none;
        padding: 0.75rem 1.15rem;
    }
}

@media (max-width: 560px) {
    section {
        padding: 3.2rem 0;
    }

    .products {
        grid-template-columns: 1fr;
    }

    .badge img {
        height: 38px;
    }
}

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

    .reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .btn:hover,
    .product:hover,
    .badge:hover {
        transform: none;
    }
}
