/* ==========================================================================
   Mekatronyx — shared design system
   Tri-brand dark theme: Mekatronyx (indigo) · C43D (brass/gem) · Ketorra (green/violet)
   ========================================================================== */

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

:root {
    /* Surfaces */
    --bg:           #06070b;
    --bg-2:         #0a0c12;
    --surface:      #0f1219;
    --surface-2:    #161a23;
    --surface-3:    #1d222e;

    /* Text */
    --text:         #f4f6fb;
    --text-2:       #a6acbd;
    --text-3:       #6a7081;

    /* Lines */
    --border:       rgba(255,255,255,0.07);
    --border-2:     rgba(255,255,255,0.13);

    /* Brand — Mekatronyx (studio default) */
    --indigo:        #818cf8;
    --indigo-deep:   #6366f1;
    --indigo-rgb:    99,102,241;

    /* Brand — C43D (brass + gold) */
    --brass:         #ecca85;
    --brass-deep:    #c79a4e;
    --brass-rgb:     199,154,78;

    /* Brand — Ketorra */
    --green:         #4CAF50;
    --green-bright:  #66BB6A;
    --green-deep:    #388E3C;
    --green-rgb:     76,175,80;
    --violet:        #7C4DFF;
    --violet-rgb:    124,77,255;

    /* Gem accents (C43D balls) */
    --ruby:     #d82626;
    --amber:    #f2bf33;
    --emerald:  #33b259;
    --sapphire: #3366d8;
    --amethyst: #994cbf;
    --copper:   #d88c59;

    /* Active accent (overridden per page via [data-theme]) */
    --accent:        var(--indigo);
    --accent-bright: #a5adfb;
    --accent-deep:   var(--indigo-deep);
    --accent-rgb:    var(--indigo-rgb);

    /* Scale */
    --max:      1200px;
    --max-wide: 1340px;
    --xs: 0.5rem; --sm: 1rem; --md: 2rem; --lg: 4rem; --xl: 6rem; --xxl: 9rem;

    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="c43d"] {
    --accent: var(--brass);
    --accent-bright: #f4dca8;
    --accent-deep: var(--brass-deep);
    --accent-rgb: var(--brass-rgb);
}
[data-theme="ketorra"] {
    --accent: var(--green);
    --accent-bright: var(--green-bright);
    --accent-deep: var(--green-deep);
    --accent-rgb: var(--green-rgb);
}

/* ---- Base ---------------------------------------------------------------- */

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

h1, h2, h3, h4, .logo, .display {
    font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
    letter-spacing: -0.02em;
}

p { color: var(--text-2); }

a { color: var(--accent-bright); text-decoration: none; transition: color 0.25s var(--ease); }
a:hover { color: var(--accent); }

img { display: block; max-width: 100%; }

::selection { background: rgba(var(--accent-rgb), 0.3); color: #fff; }

/* Decorative fixed backdrop (skipped on the 3D home page) */
.fx-glow {
    content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none;
    background:
        radial-gradient(ellipse 70% 50% at 50% -15%, rgba(var(--accent-rgb), 0.16), transparent 70%),
        radial-gradient(circle at 85% 80%, rgba(var(--accent-rgb), 0.07), transparent 50%);
}
.fx-grid {
    position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.5;
    background-image:
        linear-gradient(rgba(255,255,255,0.018) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px);
    background-size: 54px 54px;
    -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 30%, #000 40%, transparent 100%);
            mask-image: radial-gradient(ellipse 90% 70% at 50% 30%, #000 40%, transparent 100%);
}

/* ---- Layout -------------------------------------------------------------- */

.container { max-width: var(--max); margin: 0 auto; padding: 0 var(--md); position: relative; z-index: 1; }
.container.wide { max-width: var(--max-wide); }

.eyebrow {
    display: inline-block;
    color: var(--accent-bright);
    font-size: 0.8rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.22em;
    margin-bottom: var(--sm);
}

.section-title {
    font-size: clamp(2rem, 5vw, 3.1rem);
    font-weight: 700; line-height: 1.05;
    background: linear-gradient(135deg, #ffffff 0%, #9aa0b2 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}

.gradient-accent {
    background: linear-gradient(135deg, var(--accent-bright) 0%, var(--accent-deep) 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}

/* ---- Header / nav -------------------------------------------------------- */

.site-header {
    position: sticky; top: 0; z-index: 200;
    padding: 1.1rem 0;
    background: rgba(6,7,11,0.6);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    border-bottom: 1px solid transparent;
    transition: background 0.3s var(--ease), border-color 0.3s var(--ease);
}
.site-header.scrolled {
    background: rgba(6,7,11,0.82);
    border-bottom-color: var(--border);
}
.site-nav { display: flex; justify-content: space-between; align-items: center; }

.logo {
    display: inline-flex; align-items: center; gap: 0.6rem;
    font-size: 1.2rem; font-weight: 500; color: var(--text);
    letter-spacing: 0.24em; text-transform: uppercase;
}
.logo:hover { color: var(--text); }
.logo-mark {
    width: 26px; height: 26px; flex-shrink: 0;
    filter: drop-shadow(0 0 8px rgba(var(--accent-rgb), 0.5));
}

.nav-links { display: flex; gap: 2.2rem; list-style: none; align-items: center; }
.nav-links a {
    color: var(--text-2); font-size: 0.92rem; font-weight: 500; position: relative;
    padding: 0.25rem 0;
}
.nav-links a::after {
    content: ''; position: absolute; left: 0; bottom: -2px; height: 2px; width: 0;
    background: var(--accent); transition: width 0.3s var(--ease);
}
.nav-links a:hover { color: var(--text); }
.nav-links a:hover::after,
.nav-links a[aria-current="page"]::after { width: 100%; }
.nav-links a[aria-current="page"] { color: var(--text); }

.menu-toggle {
    display: none; flex-direction: column; justify-content: center; gap: 5px;
    width: 38px; height: 38px; background: none; border: none; cursor: pointer; padding: 7px;
}
.menu-toggle span { display: block; width: 100%; height: 2px; background: var(--text); border-radius: 2px; transition: all 0.3s var(--ease); }
.menu-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.menu-toggle.active span:nth-child(2) { opacity: 0; }
.menu-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

@media (max-width: 720px) {
    .menu-toggle { display: flex; }
    .nav-links {
        position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; gap: 0;
        background: rgba(6,7,11,0.96); backdrop-filter: blur(20px);
        padding: 0; max-height: 0; overflow: hidden;
        transition: max-height 0.35s var(--ease), padding 0.35s var(--ease);
        border-bottom: 1px solid transparent;
    }
    .nav-links.open { max-height: 420px; padding: var(--sm) 0; border-bottom-color: var(--border); }
    .nav-links li { width: 100%; }
    .nav-links a { display: block; padding: 0.95rem var(--md); border-bottom: 1px solid var(--border); }
    .nav-links li:last-child a { border-bottom: none; }
    .nav-links a::after { display: none; }
}

/* ---- Buttons ------------------------------------------------------------- */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.6rem;
    padding: 0.9rem 1.5rem;
    font-family: 'Space Grotesk', sans-serif; font-size: 1rem; font-weight: 600;
    border-radius: 13px; border: 1px solid transparent; cursor: pointer;
    transition: transform 0.3s var(--ease), background 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.3s var(--ease), color 0.3s var(--ease);
    white-space: nowrap;
}
.btn--app {
    background: linear-gradient(135deg, #101218 0%, #1c2030 100%);
    border-color: var(--border-2); color: #fff;
    box-shadow: 0 10px 30px -12px rgba(0,0,0,0.7), inset 0 1px 0 rgba(255,255,255,0.06);
}
.btn--app:hover { transform: translateY(-2px); color: #fff; border-color: rgba(var(--accent-rgb),0.5); box-shadow: 0 16px 40px -14px rgba(var(--accent-rgb),0.45); }

.btn--accent {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
    color: #0a0a0a; font-weight: 700;
    box-shadow: 0 12px 34px -12px rgba(var(--accent-rgb), 0.7);
}
.btn--accent:hover { transform: translateY(-2px); color: #0a0a0a; box-shadow: 0 18px 46px -14px rgba(var(--accent-rgb), 0.85); }

.btn--ghost {
    background: rgba(255,255,255,0.02); border-color: var(--border-2); color: var(--text-2);
}
.btn--ghost:hover { transform: translateY(-2px); color: #fff; border-color: rgba(var(--accent-rgb),0.6); background: rgba(var(--accent-rgb),0.06); }

.apple-icon { flex-shrink: 0; }

/* ---- Product page shared components -------------------------------------- */

.page-hero { padding: clamp(3rem, 10vh, 6rem) 0 clamp(2rem, 6vh, 4rem); position: relative; }
.hero-grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: clamp(2rem, 6vw, 5rem); align-items: center; }
.hero-content h1 {
    font-size: clamp(3rem, 9vw, 6rem); font-weight: 700; line-height: 0.95;
    margin-bottom: var(--sm);
}
.hero-sub { font-size: clamp(1rem, 2vw, 1.25rem); color: var(--text-3); font-style: italic; margin-bottom: var(--sm); }
.hero-tagline { font-size: clamp(1.1rem, 2.4vw, 1.45rem); color: var(--text-2); margin-bottom: var(--md); max-width: 38ch; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 0.75rem; }

/* Phone frame for product screenshots */
.device {
    aspect-ratio: 1320 / 2868; max-width: 320px; width: 100%; justify-self: center;
    border-radius: 44px; position: relative; overflow: hidden;
    background:
        radial-gradient(circle at 30% 18%, rgba(var(--accent-rgb),0.45) 0%, transparent 60%),
        radial-gradient(circle at 72% 82%, rgba(var(--accent-rgb),0.2) 0%, transparent 55%),
        var(--surface);
    box-shadow: 0 40px 90px -24px rgba(var(--accent-rgb),0.45), 0 0 0 1px rgba(var(--accent-rgb),0.16), inset 0 1px 0 rgba(255,255,255,0.06);
}
.device img { width: 100%; height: 100%; object-fit: cover; object-position: top center; border-radius: inherit; }
.device--float { animation: float 6.5s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@media (prefers-reduced-motion: reduce) { .device--float { animation: none; } }

/* Trust strip */
.trust-strip { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: var(--md) 0; background: rgba(255,255,255,0.012); }
.trust-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: var(--md); text-align: center; }
.trust-item { display: flex; flex-direction: column; gap: 0.3rem; }
.trust-label { color: var(--accent-bright); font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.16em; }
.trust-value { color: var(--text); font-size: 1rem; font-weight: 500; }

/* Feature blocks */
.section { padding: var(--xl) 0; }
.section--bordered { border-top: 1px solid var(--border); }
.section-head { text-align: center; margin-bottom: var(--lg); }

.feature-stack { display: grid; gap: var(--md); max-width: 920px; margin: 0 auto; }
.feature-block {
    background: linear-gradient(180deg, var(--surface) 0%, var(--bg-2) 100%);
    border: 1px solid var(--border); border-radius: 22px;
    padding: clamp(1.5rem, 3vw, 2.4rem);
    display: grid; grid-template-columns: 64px 1fr; gap: var(--md); align-items: start;
    transition: transform 0.4s var(--ease), border-color 0.4s var(--ease), background 0.4s var(--ease);
}
.feature-block:hover {
    transform: translateY(-3px);
    border-color: rgba(var(--accent-rgb), 0.3);
    background: linear-gradient(135deg, rgba(var(--accent-rgb),0.05) 0%, var(--surface) 60%);
}
.feature-icon {
    width: 56px; height: 56px; border-radius: 16px; font-size: 1.6rem;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    background: linear-gradient(135deg, rgba(var(--accent-rgb),0.22) 0%, rgba(var(--accent-rgb),0.06) 100%);
    border: 1px solid rgba(var(--accent-rgb),0.22);
}
.feature-block h3 { font-size: clamp(1.2rem, 2.5vw, 1.5rem); margin-bottom: var(--xs); color: var(--text); }
.feature-block p { font-size: 0.95rem; line-height: 1.65; }

/* Detailed grid */
.detailed-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 270px), 1fr)); gap: var(--sm); }
.detailed-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 1.15rem 1.3rem; transition: transform 0.3s var(--ease), border-color 0.3s var(--ease), background 0.3s var(--ease); }
.detailed-card:hover { transform: translateY(-2px); border-color: var(--border-2); background: var(--surface-3); }
.detailed-card h4 { font-size: 1rem; font-weight: 600; color: var(--text); margin-bottom: 0.3rem; }
.detailed-card p { font-size: 0.875rem; line-height: 1.55; }

/* Final CTA */
.final-cta { padding: var(--xl) 0; text-align: center; border-top: 1px solid var(--border); background: radial-gradient(ellipse 60% 50% at 50% 50%, rgba(var(--accent-rgb),0.09), transparent 70%); }
.final-cta h2 { font-size: clamp(2rem, 5vw, 3rem); font-weight: 700; margin-bottom: var(--sm); }
.final-cta p { font-size: 1.05rem; max-width: 52ch; margin: 0 auto var(--md); }
.final-cta .hero-cta { justify-content: center; }

/* ---- Legal / prose ------------------------------------------------------- */

.prose { max-width: 760px; margin: 0 auto; padding: var(--lg) 0 var(--xl); }
.prose .eyebrow { display: block; text-align: left; }
.prose h1 { font-size: clamp(2.2rem, 6vw, 3.2rem); font-weight: 700; margin-bottom: 0.6rem; }
.prose .updated { color: var(--text-3); font-size: 0.9rem; margin-bottom: var(--lg); }
.prose h2 { font-size: 1.4rem; font-weight: 600; color: var(--text); margin: var(--lg) 0 var(--sm); padding-bottom: 0.5rem; border-bottom: 1px solid var(--border); }
.prose h3 { font-size: 1.1rem; font-weight: 600; color: var(--text); margin: var(--md) 0 var(--xs); }
.prose p, .prose li { color: var(--text-2); font-size: 1rem; line-height: 1.75; }
.prose p { margin-bottom: var(--sm); }
.prose ul, .prose ol { margin: 0 0 var(--sm) 1.3rem; }
.prose li { margin-bottom: 0.4rem; }
.prose strong { color: var(--text); font-weight: 600; }
.prose a { text-decoration: underline; text-underline-offset: 3px; }
.prose .card {
    background: var(--surface-2); border: 1px solid var(--border); border-radius: 16px;
    padding: var(--md); margin: var(--md) 0;
}

/* FAQ / details */
.faq { max-width: 820px; margin: 0 auto; display: grid; gap: 0.75rem; }
.faq details {
    background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px;
    padding: 0 1.3rem; overflow: hidden; transition: border-color 0.3s var(--ease);
}
.faq details[open] { border-color: rgba(var(--accent-rgb),0.3); }
.faq summary {
    list-style: none; cursor: pointer; padding: 1.15rem 0; font-weight: 600; color: var(--text);
    display: flex; justify-content: space-between; align-items: center; gap: 1rem;
    font-family: 'Space Grotesk', sans-serif;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; color: var(--accent-bright); font-size: 1.5rem; font-weight: 400; transition: transform 0.3s var(--ease); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { color: var(--text-2); padding-bottom: 1.15rem; line-height: 1.7; }
.faq details a { color: var(--accent-bright); }

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

.site-footer { border-top: 1px solid var(--border); padding: var(--lg) 0 var(--md); margin-top: var(--xl); position: relative; z-index: 1; background: var(--bg); }
.footer-content { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--md); }
.footer-links { display: flex; gap: 1.4rem; list-style: none; flex-wrap: wrap; }
.footer-links a { color: var(--text-3); font-size: 0.92rem; }
.footer-links a:hover { color: var(--text); }
.copyright { color: var(--text-3); font-size: 0.86rem; }

/* ---- Reveal-on-scroll (sub-pages, no GSAP) ------------------------------- */

.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out); }
.reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }

/* ---- Responsive ---------------------------------------------------------- */

@media (max-width: 768px) {
    :root { --lg: 3rem; --xl: 4rem; --xxl: 5.5rem; }
    .hero-grid { grid-template-columns: 1fr; gap: var(--lg); }
    .device { order: 1; max-width: 240px; }
    .hero-content { order: 2; text-align: center; }
    .hero-cta { justify-content: center; }
    .hero-tagline { margin-left: auto; margin-right: auto; }
    .feature-block { grid-template-columns: 1fr; text-align: center; }
    .feature-icon { margin: 0 auto; }
    .footer-content { flex-direction: column; text-align: center; }
}
