/* ============================================
   HomeMapper — Marketing Site Styles
   ============================================ */

/* --- Font Faces --- */

@font-face {
    font-family: 'Inter';
    src: url('../fonts/inter-regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Inter';
    src: url('../fonts/inter-semibold.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

/* --- Custom Properties --- */

:root {
    /* Protocol colors (match AppStyles.swift exactly) */
    --color-homekit: #E5A500;
    --color-ip-network: #2AA5A1;
    --color-thread: #ED6032;
    --color-matter: #2158F3;
    --color-home-assistant: #03A9F4;

    /* Protocol text colors — darkened for WCAG AA large text (3:1) against white.
       Qualifies as large text: spans are font-weight 600 (bold) at ≥14px. */
    --color-homekit-text: #A67A00;
    --color-home-assistant-text: #0288D1;

    /* Brand */
    --brand-gradient-start: #4F46E5;
    --brand-gradient-end: #34D399;
    --brand-gradient: linear-gradient(135deg, var(--brand-gradient-start), var(--brand-gradient-end));

    /* Surfaces — light mode */
    --color-bg: #ffffff;
    --color-surface: #f5f5f7;
    --color-text-primary: #1d1d1f;
    --color-text-secondary: #6e6e73;
    --color-text-tertiary: #86868b;

    /* Typography */
    --font-family: -apple-system, BlinkMacSystemFont, 'Inter', system-ui, sans-serif;
    --font-size-hero: clamp(2.5rem, 5vw, 4rem);
    --font-size-h1: clamp(2rem, 4vw, 3rem);
    --font-size-h2: clamp(1.5rem, 3vw, 2.25rem);
    --font-size-h3: clamp(1.25rem, 2.5vw, 1.75rem);
    --font-size-subtitle: 1.125rem;
    --font-size-body: 1.0625rem;
    --font-size-body-lg: clamp(1.125rem, 2vw, 1.25rem);
    --font-size-small: 0.875rem;
    --font-size-caption: 0.8125rem;
    --font-size-xs: 0.75rem;

    /* Spacing / Layout */
    --max-width: 1200px;
    --section-padding: clamp(4rem, 10vw, 8rem) clamp(1.5rem, 5vw, 2rem);
    --section-gap: clamp(2rem, 6vw, 4rem);

    /* Footer (always dark, independent of theme) */
    --footer-bg: #1c1c1e;
    --footer-text: #86868b;
    --footer-link: #a1a1a6;
    --footer-link-hover: #f5f5f7;
    --footer-heading: #f5f5f7;
    --footer-sep: #48484a;

    /* Breakpoints (cannot be used in @media queries directly,
       but document the canonical values for JS and reference) */
    --bp-tablet: 768px;
    --bp-desktop: 1024px;
}

/* --- Dark Mode --- */

@media (prefers-color-scheme: dark) {
    :root {
        --color-bg: #0a0a0a;
        --color-surface: #1c1c1e;
        --color-text-primary: #f5f5f7;
        --color-text-secondary: #a1a1a6;
        --color-text-tertiary: #86868b;

        /* Dark mode: reset text colors to exact protocol values */
        --color-homekit-text: #E5A500;
        --color-home-assistant-text: #03A9F4;
    }
}

/* --- Site Nav --- */

#site-nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    background: color-mix(in srgb, var(--color-bg) 80%, transparent);
    backdrop-filter: saturate(180%) blur(8px);
    -webkit-backdrop-filter: saturate(180%) blur(8px);
    transition: background 0.2s ease;
}

#site-nav.is-scrolled {
    background: color-mix(in srgb, var(--color-bg) 92%, transparent);
}

.site-nav-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0.75rem clamp(1rem, 3vw, 2rem);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    min-height: 60px;
}

.site-nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: var(--font-size-body);
    color: var(--color-text-primary);
    text-decoration: none;
    flex-shrink: 0;
}

.site-nav-brand img {
    width: 28px;
    height: 28px;
}

.site-nav-links {
    display: none;
    list-style: none;
    align-items: center;
    gap: 1.75rem;
    margin: 0;
    padding: 0;
}

.site-nav-links a {
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: var(--font-size-small);
    font-weight: 500;
    transition: color 0.15s ease;
}

.site-nav-links a:hover,
.site-nav-links a:focus-visible {
    color: var(--color-text-primary);
}

.site-nav-cta {
    display: none;
    flex-shrink: 0;
    transition: opacity 0.15s ease;
}

.site-nav-cta img {
    width: 110px;
    height: auto;
    pointer-events: none;
}

.site-nav-cta:hover { opacity: 0.8; }

.site-nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 0;
    cursor: pointer;
    width: 44px;
    height: 44px;
    padding: 0;
    margin-left: auto;
    color: var(--color-text-primary);
}

.site-nav-toggle span {
    display: block;
    position: relative;
    width: 20px;
    height: 2px;
    background: currentColor;
    transition: background 0.2s ease;
}

.site-nav-toggle span::before,
.site-nav-toggle span::after {
    content: '';
    position: absolute;
    left: 0;
    width: 20px;
    height: 2px;
    background: currentColor;
    transition: transform 0.2s ease, top 0.2s ease;
}

.site-nav-toggle span::before { top: -6px; }
.site-nav-toggle span::after { top: 6px; }

.site-nav-toggle[aria-expanded="true"] span { background: transparent; }
.site-nav-toggle[aria-expanded="true"] span::before { top: 0; transform: rotate(45deg); }
.site-nav-toggle[aria-expanded="true"] span::after { top: 0; transform: rotate(-45deg); }

.site-nav-sheet {
    display: flex;
    flex-direction: column;
    background: var(--color-bg);
    border-bottom: 1px solid color-mix(in srgb, var(--color-text-tertiary) 18%, transparent);
    padding: 0.5rem clamp(1rem, 3vw, 2rem) 1.25rem;
}

.site-nav-sheet[hidden] {
    display: none;
}

.site-nav-sheet a {
    padding: 0.9rem 0;
    color: var(--color-text-primary);
    font-size: var(--font-size-body);
    font-weight: 500;
    text-decoration: none;
    border-bottom: 1px solid color-mix(in srgb, var(--color-text-tertiary) 12%, transparent);
}

.site-nav-sheet a:last-child { border-bottom: none; }

.site-nav-sheet-cta {
    padding-top: 1rem !important;
    align-self: flex-start;
}

.site-nav-sheet-cta img {
    width: 140px;
    height: auto;
    pointer-events: none;
}

@media (min-width: 768px) {
    .site-nav-links { display: flex; }
    .site-nav-cta { display: inline-block; }
    .site-nav-toggle { display: none; }
    .site-nav-sheet { display: none !important; }
}

/* Push content below fixed nav (landing page only — sub-pages have their own back-link chrome) */
body.has-site-nav { padding-top: 60px; }

/* Anchor-landing offset: account for fixed nav height so headings land below it */
:target,
.section-anchor {
    scroll-margin-top: 80px;
}

@media (prefers-reduced-motion: reduce) {
    #site-nav { transition: none; }
}

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

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

/* Screen-reader-only content — visible to AT, hidden from sighted users */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

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

body {
    font-family: var(--font-family);
    font-size: var(--font-size-body);
    line-height: 1.6;
    color: var(--color-text-primary);
    background-color: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

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

a {
    color: var(--brand-gradient-start);
    text-decoration: none;
}

@media (prefers-color-scheme: dark) {
    a {
        color: var(--brand-gradient-end);
    }
}

/* --- Focus Styles --- */

a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--brand-gradient-start);
    outline-offset: 2px;
    border-radius: 4px;
}

@media (prefers-color-scheme: dark) {
    a:focus-visible,
    button:focus-visible {
        outline-color: var(--brand-gradient-end);
    }
}

/* --- Skip Nav (first focusable element; hidden until focused) --- */

.skip-nav {
    position: absolute;
    top: 0;
    left: 0;
    padding: 0.75rem 1.25rem;
    background: var(--color-bg);
    color: var(--color-text-primary);
    text-decoration: none;
    font-weight: 600;
    border: 2px solid var(--brand-gradient-start);
    border-radius: 0 0 4px 0;
    transform: translateY(-110%);
    z-index: 200;
}

.skip-nav:focus {
    transform: translateY(0);
}

@media (prefers-color-scheme: dark) {
    .skip-nav {
        border-color: var(--brand-gradient-end);
    }
}

/* --- Layout --- */

section {
    padding: var(--section-padding);
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    width: 100%;
}

/* --- Footer (always dark, regardless of system theme) --- */

footer {
    background-color: var(--footer-bg);
    border-top: 2px solid transparent;
    border-image: var(--brand-gradient) 1;
    padding: clamp(2rem, 5vw, 3rem) clamp(1.5rem, 5vw, 2rem);
    text-align: center;
    font-size: var(--font-size-small);
    color: var(--footer-text);
}

footer a {
    color: var(--footer-link);
    text-decoration: none;
}

footer a:hover,
footer a:focus {
    color: var(--footer-link-hover);
}

.footer-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    color: var(--footer-heading);
    font-weight: 600;
    font-size: var(--font-size-h3);
}

.footer-brand img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
}

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

.footer-links a {
    padding: 0.625rem 0.5rem;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

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

.footer-legal {
    color: var(--footer-text);
    font-size: var(--font-size-small);
}

.app-store-badge {
    width: 160px;
    height: auto;
    pointer-events: none;
}

@media (min-width: 768px) {
    .footer-grid {
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .footer-brand {
        order: 1;
    }

    .footer-center {
        order: 2;
        flex: 1;
        text-align: center;
        align-self: center;
    }

    .footer-cta {
        order: 3;
    }

    .footer-links a {
        padding: 0.25rem 0.5rem;
        min-height: unset;
    }
}

/* ============================================
   Loading Animation
   ============================================ */

/* --- Content Hidden Until Loaded --- */

main,
footer {
    opacity: 0;
    transition: opacity 0.5s ease;
}

body.loaded main,
body.loaded footer {
    opacity: 1;
}

/* --- Overlay --- */

#loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg);
    transition: opacity 0.5s ease;
}

body.loaded #loading-overlay {
    opacity: 0;
    pointer-events: none;
}

/* --- Logo Animation SVG --- */

#logo-animation {
    width: min(280px, 70vw);
    height: auto;
}

/* Strokes: hidden initially, draw in */
.logo-stroke {
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
}

.logo-roof {
    animation: draw-stroke 1.6s cubic-bezier(0.4, 0, 0.2, 1) 0.6s forwards;
}

.logo-stroke.logo-line-left {
    stroke-dasharray: 86;
    stroke-dashoffset: 86;
    animation: draw-line 0.6s cubic-bezier(0.4, 0, 0.2, 1) 1.2s forwards;
}

.logo-stroke.logo-line-right {
    stroke-dasharray: 86;
    stroke-dashoffset: 86;
    animation: draw-line 0.6s cubic-bezier(0.4, 0, 0.2, 1) 1.4s forwards;
}

/* Nodes: scale in */
.logo-node {
    transform-origin: center;
    transform: scale(0);
    opacity: 0;
}

.node-left {
    animation: node-appear 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) 1.4s forwards;
}

.node-center {
    animation: node-appear 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) 1.5s forwards;
}

.node-right {
    animation: node-appear 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) 1.6s forwards;
}

@keyframes draw-stroke {
    to { stroke-dashoffset: 0; }
}

@keyframes draw-line {
    to { stroke-dashoffset: 0; }
}

@keyframes node-appear {
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* --- Protocol Dots --- */

.protocol-dot {
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    will-change: transform, opacity;
}

.dot-homekit {
    background: var(--color-homekit);
    top: calc(50% - 16px);
    left: calc(50% - 6px);
    animation: converge-homekit 1.8s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

.dot-home-assistant {
    background: var(--color-home-assistant);
    top: calc(50% - 16px);
    left: calc(50% - 6px);
    animation: converge-ha 1.8s cubic-bezier(0.23, 1, 0.32, 1) 0.1s forwards;
    opacity: 0;
}

.dot-matter {
    background: var(--color-matter);
    top: calc(50% - 16px);
    left: calc(50% - 6px);
    animation: converge-matter 1.8s cubic-bezier(0.23, 1, 0.32, 1) 0.15s forwards;
    opacity: 0;
}

.dot-thread {
    background: var(--color-thread);
    top: calc(50% + 24px);
    left: calc(50% - 56px);
    animation: converge-thread 1.8s cubic-bezier(0.23, 1, 0.32, 1) 0.2s forwards;
    opacity: 0;
}

.dot-ip-network {
    background: var(--color-ip-network);
    top: calc(50% + 24px);
    left: calc(50% + 44px);
    animation: converge-ip 1.8s cubic-bezier(0.23, 1, 0.32, 1) 0.25s forwards;
    opacity: 0;
}

/* Each dot starts at a unique viewport-edge position */
@keyframes converge-homekit {
    0% {
        transform: translate(-38vw, -32vh);
        opacity: 1;
    }
    75% { opacity: 1; }
    100% {
        transform: translate(0, 0);
        opacity: 0;
    }
}

@keyframes converge-ha {
    0% {
        transform: translate(35vw, -28vh);
        opacity: 1;
    }
    75% { opacity: 1; }
    100% {
        transform: translate(0, 0);
        opacity: 0;
    }
}

@keyframes converge-matter {
    0% {
        transform: translate(8vw, 40vh);
        opacity: 1;
    }
    75% { opacity: 1; }
    100% {
        transform: translate(0, 0);
        opacity: 0;
    }
}

@keyframes converge-thread {
    0% {
        transform: translate(-42vw, 20vh);
        opacity: 1;
    }
    75% { opacity: 1; }
    100% {
        transform: translate(0, 0);
        opacity: 0;
    }
}

@keyframes converge-ip {
    0% {
        transform: translate(40vw, 25vh);
        opacity: 1;
    }
    75% { opacity: 1; }
    100% {
        transform: translate(0, 0);
        opacity: 0;
    }
}

/* --- Reduced Motion --- */

@media (prefers-reduced-motion: reduce) {
    #loading-overlay {
        display: none;
    }

    main,
    footer {
        opacity: 1;
        transition: none;
    }

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

/* ============================================
   Section 1: Hero
   ============================================ */

#hero {
    position: relative;
    min-height: 80vh;
    display: flex;
    align-items: center;
}

#hero .container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3rem;
    align-items: center;
}

/* --- Hero Content (text side) --- */

.hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.25rem;
}

.hero-icon {
    width: 80px;
    height: 80px;
}

.hero-app-name {
    font-size: var(--font-size-h2);
    font-weight: 600;
    color: var(--color-text-secondary);
    letter-spacing: -0.01em;
}

.hero-tagline {
    font-size: var(--font-size-hero);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--color-text-primary);
}

.hero-subtitle {
    font-size: var(--font-size-subtitle);
    line-height: 1.5;
    color: var(--color-text-secondary);
    max-width: 520px;
}

.hero-cta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.hero-badge {
    display: inline-block;
    transition: opacity 0.2s ease;
}

.hero-badge img {
    width: 160px;
    height: auto;
}

.hero-badge:hover {
    opacity: 0.8;
}

.hero-platforms {
    font-size: var(--font-size-small);
    color: var(--color-text-secondary);
    letter-spacing: 0.08em;
}

/* --- Hero Devices (iPad + iPhone composite) --- */

.hero-devices {
    position: relative;
    width: 100%;
    aspect-ratio: 5 / 4;
    max-width: 560px;
    margin: 0 auto;
}

.hero-device {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--color-text-tertiary);
    background: linear-gradient(
        135deg,
        color-mix(in srgb, var(--brand-gradient-start) 8%, var(--color-bg)),
        color-mix(in srgb, var(--brand-gradient-end) 8%, var(--color-bg))
    );
}

@media (prefers-color-scheme: dark) {
    .hero-device {
        background: linear-gradient(
            135deg,
            color-mix(in srgb, var(--brand-gradient-start) 10%, var(--color-bg)),
            color-mix(in srgb, var(--brand-gradient-end) 10%, var(--color-bg))
        );
    }
}

.hero-ipad {
    top: 0;
    left: 0;
    width: 100%;
    aspect-ratio: 2800 / 2147;
    border-radius: 1.25rem;
}

.hero-iphone {
    top: 35%;
    left: 56%;
    width: 30%;
    aspect-ratio: 1200 / 2449;
    border-radius: 1.25rem;
    z-index: 1;
    border-width: 3px;
}

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

@media (min-width: 768px) {
    #hero .container {
        grid-template-columns: 1fr 1.4fr;
        gap: 4rem;
    }

    .hero-content {
        align-items: flex-start;
        text-align: left;
    }

    .hero-cta {
        align-items: flex-start;
    }

    .hero-icon {
        width: 96px;
        height: 96px;
    }

    .hero-devices {
        max-width: none;
    }
}

@media (min-width: 1024px) {
    #hero .container {
        gap: 6rem;
    }
}

/* ============================================
   Scroll Engine — Section Types & Reveal
   ============================================ */

/* --- Vertical Rhythm --- */

section + section {
    margin-top: var(--section-gap);
}

/* --- Section 8: Privacy — Brand Gradient Wash (muted) --- */

#privacy-section {
    background: linear-gradient(
        135deg,
        color-mix(in srgb, var(--brand-gradient-start) 8%, var(--color-bg)),
        color-mix(in srgb, var(--brand-gradient-end) 8%, var(--color-bg))
    );
}

@media (prefers-color-scheme: dark) {
    #privacy-section {
        background: linear-gradient(
            135deg,
            color-mix(in srgb, var(--brand-gradient-start) 10%, var(--color-bg)),
            color-mix(in srgb, var(--brand-gradient-end) 10%, var(--color-bg))
        );
    }
}

.privacy-bullets {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 640px;
    margin: 0 auto;
    text-align: left;
}

.privacy-bullets li {
    font-size: var(--font-size-body-lg);
    color: var(--color-text-secondary);
    line-height: 1.7;
    padding-left: 1.75rem;
    position: relative;
}

.discovery-sources {
    margin-top: 1.25rem;
}

.discovery-sources li strong {
    color: var(--color-text-primary);
    font-weight: 600;
}

.privacy-bullets li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.65em;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--brand-gradient);
}

.section-link {
    text-align: center;
    margin-top: 2rem;
    font-size: var(--font-size-small);
}

.section-link + .section-link {
    margin-top: 0.5rem;
}

.section-link a {
    color: var(--color-text-tertiary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0.5rem 0.75rem;
}

.section-link a:hover {
    text-decoration: underline;
}

/* --- Devices Composite (iPad + iPhone overlay) --- */

.devices-composite {
    position: relative;
    width: 100%;
    aspect-ratio: 5 / 4;
}

.devices-composite .placeholder-img--landscape {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    aspect-ratio: 2800 / 2147;
}

.devices-composite .placeholder-img--portrait {
    position: absolute;
    top: 35%;
    left: 56%;
    width: 30%;
    aspect-ratio: 1200 / 2449;
}

/* --- Export Composite (iPhone app + spreadsheet overlay) --- */

.export-composite {
    position: relative;
    width: 100%;
    aspect-ratio: 5 / 4;
}

.export-composite .placeholder-img--landscape {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    aspect-ratio: 2800 / 2147;
}

.export-composite .placeholder-img--portrait {
    position: absolute;
    top: 35%;
    left: 56%;
    width: 30%;
    aspect-ratio: 1200 / 2449;
}

/* --- Protocol Color Text --- */

.protocol-homekit,
.protocol-ha,
.protocol-matter,
.protocol-thread,
.protocol-ip {
    font-weight: 600;
}

.protocol-homekit { color: var(--color-homekit-text); }
.protocol-ha { color: var(--color-home-assistant-text); }
.protocol-matter { color: var(--color-matter); }
.protocol-thread { color: var(--color-thread); }
.protocol-ip { color: var(--color-ip-network); }

/* --- Section Type: Full-Width Visual --- */

.section-fullwidth {
    position: relative;
    min-height: 60vh;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.section-fullwidth .container {
    position: relative;
    z-index: 1;
}

/* --- Section 9: Pricing Layout --- */

.pricing-header {
    text-align: center;
    margin-bottom: clamp(2rem, 4vw, 3rem);
}

.pricing-header h2 {
    font-size: var(--font-size-h1);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.pricing-columns {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    max-width: 720px;
    margin: 0 auto;
}

.pricing-card {
    background: linear-gradient(
        135deg,
        color-mix(in srgb, var(--brand-gradient-start) 8%, var(--color-bg)),
        color-mix(in srgb, var(--brand-gradient-end) 8%, var(--color-bg))
    );
    border-radius: 0.5rem;
    padding: clamp(1.5rem, 3vw, 2rem);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

@media (prefers-color-scheme: dark) {
    .pricing-card {
        background: linear-gradient(
            135deg,
            color-mix(in srgb, var(--brand-gradient-start) 10%, var(--color-bg)),
            color-mix(in srgb, var(--brand-gradient-end) 10%, var(--color-bg))
        );
    }
}

.pricing-card-header {
    text-align: center;
}

.pricing-card-header h3 {
    font-size: var(--font-size-h3);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.pricing-card-price {
    font-size: var(--font-size-h2);
    font-weight: 700;
    color: var(--color-text-primary);
}

.pricing-per {
    font-size: var(--font-size-body);
    font-weight: 400;
    color: var(--color-text-secondary);
}

.price-strikethrough {
    font-size: var(--font-size-body-lg);
    font-weight: 500;
    color: var(--color-text-tertiary);
    text-decoration: line-through;
    text-decoration-thickness: 2px;
    margin-left: 0.5rem;
    letter-spacing: -0.01em;
}

.pricing-card-launch {
    font-size: var(--font-size-small);
    color: var(--brand-gradient-start);
    font-weight: 600;
    margin-top: 0.25rem;
}

@media (prefers-color-scheme: dark) {
    .pricing-card-launch {
        color: var(--brand-gradient-end);
    }
}

.pricing-card-term {
    font-size: var(--font-size-small);
    color: var(--color-text-tertiary);
    margin-top: 0.25rem;
}

.pricing-card-features {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.discovery-pricing-note {
    font-size: var(--font-size-small);
    color: var(--color-text-tertiary);
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid color-mix(in srgb, var(--color-text-tertiary) 15%, transparent);
    font-style: italic;
}

.pricing-card-footnote {
    font-size: var(--font-size-small);
    color: var(--color-text-tertiary);
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid color-mix(in srgb, var(--color-text-tertiary) 15%, transparent);
}

.pricing-card-features li {
    font-size: var(--font-size-body);
    color: var(--color-text-secondary);
    padding-left: 1.5rem;
    position: relative;
    line-height: 1.5;
}

.pricing-card-features li::before {
    content: '\2713';
    position: absolute;
    left: 0;
    color: var(--brand-gradient-end);
    font-weight: 600;
}

.pricing-cta {
    text-align: center;
    margin-top: clamp(2rem, 4vw, 3rem);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.pricing-badge {
    display: inline-block;
    transition: opacity 0.2s ease;
}

.pricing-badge:hover {
    opacity: 0.8;
}

.pricing-cta-text {
    font-size: var(--font-size-body-lg);
    color: var(--color-text-secondary);
    font-weight: 600;
}

@media (min-width: 768px) {
    .pricing-columns {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }
}

/* --- Section Type: Sticky Pinned Image + Scrolling Text --- */

.section-sticky-left,
.section-sticky-right {
    padding-top: 0;
    padding-bottom: 0;
}

.sticky-wrapper {
    display: flex;
    flex-direction: column;
    gap: clamp(2rem, 4vw, 4rem);
}

.sticky-media {
    flex: 0 0 auto;
    width: 100%;
    padding-top: var(--section-gap);
}

.sticky-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding-top: 1.5rem;
}

.sticky-text h2 {
    font-size: var(--font-size-h2);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.sticky-text p {
    font-size: var(--font-size-body);
    color: var(--color-text-secondary);
    line-height: 1.7;
}

/* --- Discovery section: three-beat structure --- */

.discovery-beat {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.25rem 0;
    border-top: 1px solid color-mix(in srgb, var(--color-text-tertiary) 15%, transparent);
}

.discovery-beat:first-of-type {
    border-top: none;
    padding-top: 0;
}

.beat-label {
    font-size: 0.9375rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--brand-gradient-start);
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}

.beat-label::before {
    content: '';
    width: 48px;
    height: 3px;
    background: var(--brand-gradient);
    display: inline-block;
}

@media (prefers-color-scheme: dark) {
    .beat-label { color: var(--brand-gradient-end); }
}

/* --- FAQ --- */

.faq-list {
    max-width: 720px;
    margin: 0 auto;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.faq-item {
    border-bottom: 1px solid color-mix(in srgb, var(--color-text-tertiary) 20%, transparent);
}

.faq-item:first-of-type {
    border-top: 1px solid color-mix(in srgb, var(--color-text-tertiary) 20%, transparent);
}

.faq-item summary {
    list-style: none;
    cursor: pointer;
    padding: 1.25rem 2rem 1.25rem 0;
    font-size: var(--font-size-body-lg);
    font-weight: 600;
    color: var(--color-text-primary);
    line-height: 1.4;
    position: relative;
    transition: color 0.2s ease;
    min-height: 44px;
    display: flex;
    align-items: center;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: '';
    position: absolute;
    right: 0.25rem;
    top: 50%;
    width: 12px;
    height: 12px;
    border-right: 2px solid var(--color-text-tertiary);
    border-bottom: 2px solid var(--color-text-tertiary);
    transform: translateY(-70%) rotate(45deg);
    transition: transform 0.25s ease, border-color 0.2s ease;
}

.faq-item[open] summary::after {
    transform: translateY(-30%) rotate(-135deg);
    border-color: var(--brand-gradient-start);
}

@media (prefers-color-scheme: dark) {
    .faq-item[open] summary::after {
        border-color: var(--brand-gradient-end);
    }
}

.faq-item summary:hover {
    color: var(--brand-gradient-start);
}

@media (prefers-color-scheme: dark) {
    .faq-item summary:hover {
        color: var(--brand-gradient-end);
    }
}

.faq-answer {
    padding: 0 0 1.25rem 0;
}

.faq-answer p {
    font-size: var(--font-size-body);
    color: var(--color-text-secondary);
    line-height: 1.7;
    margin: 0;
}

.faq-answer p + p {
    margin-top: 0.75rem;
}

.faq-answer-list {
    list-style: none;
    margin: 0.75rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.faq-answer-list li {
    font-size: var(--font-size-body);
    color: var(--color-text-secondary);
    line-height: 1.7;
    padding-left: 1.25rem;
    position: relative;
}

.faq-answer-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.7em;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--brand-gradient);
}

.faq-answer-list strong {
    color: var(--color-text-primary);
    font-weight: 600;
}

/* --- FAQ Page --- */

.faq-content {
    padding: clamp(2rem, 5vw, 4rem) clamp(1.5rem, 5vw, 2rem);
}

.faq-content .container {
    max-width: 760px;
}

.faq-content .back-link {
    display: inline-block;
    font-size: var(--font-size-small);
    color: var(--color-text-tertiary);
    text-decoration: none;
    margin-bottom: 2rem;
}

.faq-content .back-link:hover {
    text-decoration: underline;
}

.faq-content h1 {
    font-size: var(--font-size-h1);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.25rem;
}

.faq-content .effective-date {
    font-size: var(--font-size-small);
    color: var(--color-text-tertiary);
    margin-bottom: 2rem;
}

.faq-toc {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    padding: 1rem 1.25rem;
    margin-bottom: 2rem;
    border-radius: 0.5rem;
    background: linear-gradient(
        135deg,
        color-mix(in srgb, var(--brand-gradient-start) 8%, var(--color-bg)),
        color-mix(in srgb, var(--brand-gradient-end) 8%, var(--color-bg))
    );
}

.faq-toc a {
    font-size: var(--font-size-small);
    color: var(--brand-gradient-start);
    text-decoration: none;
    font-weight: 600;
    padding: 0.25rem 0;
}

@media (prefers-color-scheme: dark) {
    .faq-toc {
        background: linear-gradient(
            135deg,
            color-mix(in srgb, var(--brand-gradient-start) 10%, var(--color-bg)),
            color-mix(in srgb, var(--brand-gradient-end) 10%, var(--color-bg))
        );
    }
    .faq-toc a { color: var(--brand-gradient-end); }
}

.faq-toc a:hover { text-decoration: underline; }

.faq-content h2 {
    font-size: var(--font-size-h3);
    font-weight: 600;
    margin: 2.5rem 0 1rem;
    scroll-margin-top: 1rem;
}

.faq-content h2:first-of-type {
    margin-top: 0;
}

.faq-content .faq-item {
    border-bottom: 1px solid color-mix(in srgb, var(--color-text-tertiary) 20%, transparent);
}

.faq-content .faq-item:first-of-type {
    border-top: 1px solid color-mix(in srgb, var(--color-text-tertiary) 20%, transparent);
}

.faq-content h2 + .faq-item {
    border-top: 1px solid color-mix(in srgb, var(--color-text-tertiary) 20%, transparent);
}

.faq-footer-note {
    margin-top: 3rem;
    font-size: var(--font-size-body);
    color: var(--color-text-secondary);
    text-align: center;
}

/* --- Section Type: Text-Only --- */

.section-text-only .container {
    max-width: 800px;
    text-align: center;
}

.section-text-only h2 {
    font-size: var(--font-size-h1);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin-bottom: 1.5rem;
}

.section-text-only p {
    font-size: var(--font-size-body-lg);
    color: var(--color-text-secondary);
    line-height: 1.7;
    margin-bottom: 1rem;
}

.section-text-only p:last-child {
    margin-bottom: 0;
}

/* --- Social proof: promoted stat + testimonial --- */

.social-stat {
    text-align: center;
    margin: clamp(2rem, 5vw, 3rem) 0 clamp(2.5rem, 6vw, 3.5rem);
}

.social-stat-number {
    font-size: clamp(3.5rem, 9vw, 6rem);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.03em;
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    font-variant-numeric: tabular-nums;
}

.social-stat-label {
    font-size: var(--font-size-body-lg);
    color: var(--color-text-secondary);
    margin-top: 0.5rem;
    letter-spacing: 0.01em;
}

.social-testimonial {
    max-width: 640px;
    margin: 0 auto;
    padding: clamp(1.5rem, 3vw, 2rem);
    border-radius: 0.5rem;
    background: linear-gradient(
        135deg,
        color-mix(in srgb, var(--brand-gradient-start) 8%, var(--color-bg)),
        color-mix(in srgb, var(--brand-gradient-end) 8%, var(--color-bg))
    );
    text-align: left;
}

@media (prefers-color-scheme: dark) {
    .social-testimonial {
        background: linear-gradient(
            135deg,
            color-mix(in srgb, var(--brand-gradient-start) 10%, var(--color-bg)),
            color-mix(in srgb, var(--brand-gradient-end) 10%, var(--color-bg))
        );
    }
}

.social-testimonial blockquote p {
    font-size: var(--font-size-body-lg);
    color: var(--color-text-primary);
    line-height: 1.6;
    margin: 0 0 1rem;
    font-style: italic;
}

.social-testimonial blockquote p::before { content: '\201C'; }
.social-testimonial blockquote p::after  { content: '\201D'; }

.social-testimonial figcaption {
    font-size: var(--font-size-small);
    color: var(--color-text-tertiary);
    letter-spacing: 0.02em;
}

/* --- Placeholder Images --- */

.placeholder-img {
    background: linear-gradient(
        135deg,
        color-mix(in srgb, var(--brand-gradient-start) 8%, var(--color-bg)),
        color-mix(in srgb, var(--brand-gradient-end) 8%, var(--color-bg))
    );
    border: 1px solid color-mix(in srgb, var(--color-text-tertiary) 20%, transparent);
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.placeholder-img--portrait {
    aspect-ratio: 1200 / 2449;
}

.placeholder-img--landscape {
    aspect-ratio: 2800 / 2147;
}

@media (prefers-color-scheme: dark) {
    .placeholder-img {
        background: linear-gradient(
            135deg,
            color-mix(in srgb, var(--brand-gradient-start) 10%, var(--color-bg)),
            color-mix(in srgb, var(--brand-gradient-end) 10%, var(--color-bg))
        );
    }
}

.placeholder-img:has(> img),
.hero-device:has(> img) {
    background: none;
    border: 0;
}

.placeholder-img > img,
.hero-device > img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: inherit;
}

/* --- Scroll-Triggered Reveals --- */

.reveal {
    opacity: 0;
    transform: translateY(20px);
    transition:
        opacity 0.6s cubic-bezier(0.25, 0.1, 0.25, 1),
        transform 0.6s cubic-bezier(0.25, 0.1, 0.25, 1);
    will-change: opacity, transform;
}

.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }
.reveal-delay-5 { transition-delay: 0.5s; }

/* --- Scroll Engine Responsive --- */

@media (min-width: 768px) {
    .sticky-wrapper {
        flex-direction: row;
        align-items: flex-start;
    }

    .sticky-media {
        flex: 0 0 54%;
        position: sticky;
        /* Visual breathing room below viewport top when pinned */
        top: 4rem;
        width: auto;
        padding: var(--section-gap) 0;
    }

    /* Single iPhone sections (Discovery, Enrichment, Home Assistant): the
       portrait iPhone is too tall at the composite width, so narrow the
       image column and give the text column more room. */
    .sticky-media:has(> .placeholder-img--portrait) {
        flex: 0 0 30%;
    }

    .sticky-text {
        padding: var(--section-gap) 0;
        /* Ensures enough scroll distance for the sticky image to remain
           pinned while all text paragraphs scroll past */
        min-height: 120vh;
    }

    /* Right variant: image on right, text on left */
    .section-sticky-right .sticky-media {
        order: 2;
    }

    .section-sticky-right .sticky-text {
        order: 1;
    }
}

/* ============================================
   Privacy Policy Page
   ============================================ */

.privacy-content {
    padding: clamp(2rem, 5vw, 4rem) clamp(1.5rem, 5vw, 2rem);
}

.privacy-content .container {
    max-width: 680px;
}

.privacy-content .back-link {
    display: inline-block;
    font-size: var(--font-size-small);
    color: var(--color-text-tertiary);
    text-decoration: none;
    margin-bottom: 2rem;
}

.privacy-content .back-link:hover {
    text-decoration: underline;
}

.privacy-content h1 {
    font-size: var(--font-size-h1);
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.privacy-content .effective-date {
    font-size: var(--font-size-small);
    color: var(--color-text-tertiary);
    margin-bottom: 2rem;
}

.privacy-content .highlight-box {
    background: linear-gradient(
        135deg,
        color-mix(in srgb, var(--brand-gradient-start) 8%, var(--color-bg)),
        color-mix(in srgb, var(--brand-gradient-end) 8%, var(--color-bg))
    );
    border-radius: 0.5rem;
    padding: 1rem 1.25rem;
    margin-bottom: 2rem;
}

@media (prefers-color-scheme: dark) {
    .privacy-content .highlight-box {
        background: linear-gradient(
            135deg,
            color-mix(in srgb, var(--brand-gradient-start) 10%, var(--color-bg)),
            color-mix(in srgb, var(--brand-gradient-end) 10%, var(--color-bg))
        );
    }
}

.privacy-content h2 {
    font-size: var(--font-size-h3);
    font-weight: 600;
    margin: 2rem 0 0.75rem;
}

.privacy-content p {
    margin-bottom: 0.75rem;
    color: var(--color-text-secondary);
    line-height: 1.7;
}

.privacy-content ul {
    margin: 0 0 0.75rem 1.5rem;
    color: var(--color-text-secondary);
}

.privacy-content li {
    margin-bottom: 0.35rem;
    line-height: 1.6;
}

/* ============================================
   Lightbox (shared — used by home + media kit)
   ============================================ */

.zoomable {
    cursor: zoom-in;
}

/* Disable zoom on phone-sized viewports (iPad / desktop still zoom) */
@media (max-width: 768px) {
    .zoomable {
        cursor: default;
        pointer-events: none;
    }
}

#lightbox {
    border: 0;
    background: transparent;
    color: #fff;

    /* Padding reserves space for the close button beside the image */
    padding: 1.25rem;

    /* Shrink-wrap to image + padding */
    width: fit-content;
    height: fit-content;
    max-width: 95vw;
    max-height: 95vh;

    /* Center in viewport */
    inset: 0;
    margin: auto;
}

#lightbox::backdrop {
    background: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

#lightbox img {
    display: block;
    max-width: 90vw;
    max-height: 90vh;
    width: auto;
    height: auto;
    cursor: zoom-out;
}

.lightbox-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 0;
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.lightbox-close:hover,
.lightbox-close:focus-visible {
    background: rgba(0, 0, 0, 0.6);
}
