/* ============================================================
   Shared landing-page stylesheet for app subpages
   (Echoes, Block Blaster Puzzle, Color Number Match)
   Each page sets its own --accent-1, --accent-2, --accent-3 hue
   on the :root to customize the gradient + orb palette.
   ============================================================ */

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

:root {
    color-scheme: dark light;
    --bg-0: #05070f;
    --bg-1: #0a0f23;
    --text: #e8ecf4;
    --text-muted: rgba(255, 255, 255, 0.62);
    --text-dim: rgba(255, 255, 255, 0.38);
    --border: rgba(255, 255, 255, 0.1);
    --border-hi: rgba(255, 255, 255, 0.22);
    --card-bg: rgba(255, 255, 255, 0.04);
    --glass: rgba(12, 16, 38, 0.55);

    /* Default accent (overridden per page) */
    --accent-1: #4f80ff;
    --accent-2: #7b5cff;
    --accent-3: #50dcff;
}

@media (prefers-color-scheme: light) {
    :root {
        --bg-0: #f5f6ff;
        --bg-1: #e8ebff;
        --text: #0a0e22;
        --text-muted: rgba(10, 14, 34, 0.65);
        --text-dim: rgba(10, 14, 34, 0.4);
        --border: rgba(10, 14, 34, 0.1);
        --border-hi: rgba(10, 14, 34, 0.22);
        --card-bg: rgba(255, 255, 255, 0.72);
        --glass: rgba(255, 255, 255, 0.72);
    }
}

html { scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Inter', 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-0);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.65;
    overflow-x: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============ Animated orb background ============ */
.bg-stage {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
    background:
        radial-gradient(ellipse 80% 60% at 20% 0%, color-mix(in srgb, var(--accent-1) 25%, transparent), transparent 70%),
        radial-gradient(ellipse 60% 50% at 80% 100%, color-mix(in srgb, var(--accent-2) 22%, transparent), transparent 70%),
        linear-gradient(180deg, var(--bg-0) 0%, var(--bg-1) 100%);
}
.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.5;
    will-change: transform;
}
.orb-1 {
    top: -10%; left: -8%;
    width: 620px; height: 620px;
    background: radial-gradient(circle at 30% 30%, var(--accent-1), transparent 65%);
    animation: orbDrift1 24s ease-in-out infinite;
}
.orb-2 {
    bottom: -12%; right: -8%;
    width: 720px; height: 720px;
    background: radial-gradient(circle at 70% 40%, var(--accent-2), transparent 65%);
    animation: orbDrift2 30s ease-in-out infinite;
}
.orb-3 {
    top: 35%; left: 45%;
    width: 560px; height: 560px;
    background: radial-gradient(circle at 50% 50%, var(--accent-3), transparent 65%);
    animation: orbDrift3 36s ease-in-out infinite;
}
@keyframes orbDrift1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(140px, 120px) scale(1.15); }
}
@keyframes orbDrift2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-120px, -100px) scale(1.2); }
}
@keyframes orbDrift3 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(80px, -60px) scale(1.1); }
}
@media (prefers-reduced-motion: reduce) {
    .orb { animation: none !important; }
}

/* ============ Layout container ============ */
.container {
    max-width: 820px;
    margin: 0 auto;
    padding: 40px 24px 60px;
    position: relative;
    z-index: 1;
}

/* ============ Top nav / back link ============ */
.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    font-size: 0.9em;
}
.nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}
.nav a:hover { color: var(--text); }

/* ============ Global sticky topbar ============ */
.topbar {
    position: sticky;
    top: 0;
    z-index: 90;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 14px 28px;
    background: var(--glass, rgba(12, 16, 38, 0.6));
    backdrop-filter: blur(22px) saturate(150%);
    -webkit-backdrop-filter: blur(22px) saturate(150%);
    border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.08));
}
.topbar-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--text, #fff);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.96em;
    letter-spacing: -0.01em;
    white-space: nowrap;
}
.topbar-mark {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--accent-1, #4f80ff), var(--accent-2, #7b5cff));
    color: #fff;
    font-weight: 900;
    font-size: 0.9em;
    letter-spacing: 0;
    box-shadow: 0 6px 18px color-mix(in srgb, var(--accent-2, #7b5cff) 30%, transparent);
}
.topbar-links {
    display: flex;
    align-items: center;
    gap: 26px;
    font-size: 0.9em;
    font-weight: 500;
    margin-inline-start: auto;
}
.topbar-links a {
    color: var(--text-muted, rgba(255, 255, 255, 0.6));
    text-decoration: none;
    transition: color 0.2s ease;
    white-space: nowrap;
}
.topbar-links a:hover,
.topbar-links a[aria-current="page"] {
    color: var(--text, #fff);
}
.topbar-links a[aria-current="page"] {
    position: relative;
}
.topbar-links a[aria-current="page"]::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -6px;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--accent-1, #4f80ff), var(--accent-3, #50dcff));
}
@media (max-width: 720px) {
    .topbar { padding: 10px 16px; gap: 12px; }
    .topbar-name { display: none; }
    .topbar-links { gap: 16px; font-size: 0.86em; }
}
@media (max-width: 520px) {
    .topbar-links { gap: 12px; font-size: 0.82em; }
    .topbar-links a.topbar-changelog { display: none; }
}
/* Hide legacy back-link nav since topbar replaces it */
.container > nav.nav { display: none; }

/* ============ Hero ============ */
.hero {
    text-align: center;
    margin-bottom: 48px;
    padding: 48px 24px 24px;
    animation: fadeInUp 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.hero-badge {
    display: inline-block;
    padding: 6px 14px;
    margin-bottom: 20px;
    font-size: 0.72em;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.3px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    color: var(--text-muted);
    backdrop-filter: blur(10px);
}
.hero-badge.live {
    background: linear-gradient(135deg, var(--accent-3), var(--accent-1));
    color: #041a2a;
    border-color: transparent;
    box-shadow: 0 4px 16px color-mix(in srgb, var(--accent-1) 40%, transparent);
}
.hero h1 {
    font-size: clamp(2.4em, 6vw, 3.6em);
    font-weight: 900;
    letter-spacing: -0.03em;
    line-height: 1.05;
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2), var(--accent-3));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.hero p.tagline {
    font-size: clamp(1.05em, 1.5vw, 1.2em);
    color: var(--text-muted);
    max-width: 560px;
    margin: 0 auto 32px;
    line-height: 1.6;
}

/* ============ Hero image ============ */
.hero-image-wrap {
    position: relative;
    max-width: 720px;
    margin: 0 auto 40px;
    border-radius: 28px;
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
    aspect-ratio: 16 / 10;
    background: var(--card-bg);
}
.hero-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 1s cubic-bezier(0.22, 1, 0.36, 1);
}
.hero-image-wrap:hover img { transform: scale(1.04); }
.hero-image-wrap::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, 0.3) 100%);
    pointer-events: none;
}

/* ============ CTA buttons ============ */
.cta-row {
    display: flex;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 16px 32px;
    border-radius: 14px;
    font-weight: 700;
    font-size: 1em;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    border: none;
    cursor: pointer;
    white-space: nowrap;
}
.btn-primary {
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    color: #fff;
    box-shadow: 0 10px 30px color-mix(in srgb, var(--accent-1) 35%, transparent);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 40px color-mix(in srgb, var(--accent-1) 50%, transparent);
}
.btn-primary .apple {
    width: 18px;
    height: 18px;
    fill: currentColor;
}
.btn-ghost {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    border: 1px solid var(--border-hi);
    backdrop-filter: blur(10px);
}
.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
}
.btn-soon {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    border: 1px solid var(--border);
    backdrop-filter: blur(10px);
    cursor: default;
}
.btn-soon:hover { transform: none; }

/* ============ Features grid ============ */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin: 56px 0 40px;
}
.feature {
    padding: 24px 22px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    transition: transform 0.3s ease, border-color 0.3s ease;
}
.feature:hover {
    transform: translateY(-4px);
    border-color: var(--border-hi);
}
.feature-icon {
    font-size: 1.8em;
    margin-bottom: 10px;
    display: block;
}
.feature h3 {
    font-size: 1em;
    font-weight: 800;
    margin-bottom: 6px;
    color: var(--text);
}
.feature p {
    font-size: 0.88em;
    color: var(--text-muted);
    line-height: 1.55;
}

/* ============ Stats row ============ */
.stats {
    display: flex;
    justify-content: center;
    gap: 44px;
    margin: 40px 0;
    flex-wrap: wrap;
}
.stat-item { text-align: center; }
.stat-num {
    font-size: 2em;
    font-weight: 900;
    background: linear-gradient(135deg, var(--accent-1), var(--accent-3));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    margin-bottom: 4px;
}
.stat-label {
    font-size: 0.75em;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 600;
}

/* ============ Section blocks ============ */
.section {
    margin: 48px 0;
    padding: 32px 28px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 24px;
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
}
.section h2 {
    font-size: 1.35em;
    font-weight: 800;
    margin-bottom: 14px;
    letter-spacing: -0.01em;
}
.section p,
.section li {
    color: var(--text-muted);
    font-size: 0.96em;
    margin-bottom: 10px;
}
.section ul {
    list-style: none;
    padding-left: 0;
}
.section li {
    position: relative;
    padding-left: 22px;
}
.section li::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 10px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-1);
    opacity: 0.75;
}
.section strong { color: var(--text); }

/* ============ Footer links ============ */
.site-footer {
    margin-top: 56px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
    text-align: center;
}
.footer-links {
    display: flex;
    gap: 22px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.88em;
    font-weight: 500;
    transition: color 0.2s ease;
}
.footer-links a:hover { color: var(--text); }
.copyright {
    color: var(--text-dim);
    font-size: 0.8em;
}

/* ============ Other apps block ============ */
.other-apps {
    margin-top: 40px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
    text-align: center;
}
.other-apps .label {
    font-size: 0.75em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-dim);
    margin-bottom: 16px;
    display: block;
}
.other-apps-list {
    display: flex;
    gap: 22px;
    justify-content: center;
    flex-wrap: wrap;
}
.other-apps-list a {
    color: var(--accent-1);
    text-decoration: none;
    font-size: 0.95em;
    font-weight: 600;
    transition: color 0.2s ease, transform 0.2s ease;
    display: inline-flex;
    gap: 6px;
    align-items: center;
}
.other-apps-list a:hover {
    color: var(--text);
    transform: translateY(-1px);
}

/* ============ Animations ============ */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============ View Transitions ============ */
@view-transition { navigation: auto; }
::view-transition-old(root),
::view-transition-new(root) {
    animation-duration: 0.35s;
    animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}
@media (prefers-reduced-motion: reduce) {
    @view-transition { navigation: none; }
    * { animation-duration: 0s !important; transition-duration: 0s !important; }
}

/* ============ Responsive ============ */
@media (max-width: 600px) {
    .container { padding: 24px 16px 48px; }
    .hero { padding: 32px 12px 16px; }
    .features { grid-template-columns: 1fr 1fr; }
    .stats { gap: 28px; }
    .cta-row { flex-direction: column; }
    .btn { width: 100%; justify-content: center; }
}
@media (max-width: 400px) {
    .features { grid-template-columns: 1fr; }
}
