/*
 * AutoYou — Responsive CSS
 *
 * Breakpoints
 *   1120px  tablet / collapsed nav
 *    860px  mid-tablet
 *    768px  landscape phones / small tablets
 *    640px  mobile
 *    480px  small phones (SE, etc.)
 */

/* ─── 1120px ─── Tablet / collapsed nav ────────────────────────────────── */
@media (max-width: 1120px) {
    .header-bar {
        grid-template-columns: auto auto;
        grid-template-areas:
            "brand toggle"
            "nav nav"
            "actions actions";
        align-items: start;
        border-radius: 2rem;
    }

    .brand { grid-area: brand; }

    .nav-toggle {
        display: inline-flex;
        grid-area: toggle;
        justify-self: end;
    }

    .site-nav,
    .header-actions {
        display: none;
    }

    .site-nav {
        grid-area: nav;
        flex-direction: column;
        align-items: stretch;
        gap: 0.35rem;
        padding: 1rem;
        border: 1px solid rgba(137, 173, 220, 0.16);
        border-radius: 1.4rem;
        background: rgba(8, 15, 29, 0.94);
    }

    .site-nav a {
        width: 100%;
        padding: 0.75rem 0.25rem;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .site-nav.is-open,
    .header-actions.is-open {
        display: flex;
    }

    .header-actions {
        grid-area: actions;
        flex-direction: column;
        align-items: stretch;
    }

    /* Single-column layouts */
    .hero-layout,
    .story-card,
    .support-grid,
    .article-layout,
    .surface-grid-three,
    .guide-grid,
    .form-grid {
        grid-template-columns: 1fr;
    }

    /* Steps: 2 columns on tablet */
    .steps-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    /* Hero device cluster: 2-phone layout */
    .hero-device-cluster {
        min-height: 0;
        position: relative;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1rem;
        align-items: start;
    }

    .phone-shot-main,
    .phone-shot-secondary {
        position: static;
        width: 100%;
        transform: none;
    }

    /* Show secondary browser phone, hide rotated chat phone */
    .phone-shot-browser {
        display: block;
    }

    .phone-shot-chat {
        display: none;
    }

    .toc-card {
        position: static;
    }

    .footer-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .cta-card {
        grid-template-columns: 1fr;
    }
}

/* ─── 860px ─── Mid-tablet ──────────────────────────────────────────────── */
@media (max-width: 860px) {
    .section {
        padding: 4.6rem 0;
    }

    .page-hero {
        padding-top: 3rem;
    }

    .hero-copy h1 {
        max-width: 15ch;
        font-size: clamp(2.9rem, 11vw, 4.6rem);
    }

    .section-heading h2,
    .surface-card h2 {
        font-size: clamp(2rem, 7vw, 3rem);
    }

    .dual-stack,
    .triple-stack {
        grid-template-columns: 1fr;
    }

    .footer-grid {
        grid-template-columns: 1fr;
    }

    .story-card {
        gap: 1.75rem;
    }

    /* Steps: single column */
    .steps-grid {
        grid-template-columns: 1fr;
    }

    /* Hero cluster: single centered phone */
    .hero-device-cluster {
        grid-template-columns: 1fr;
        max-width: 300px;
        margin: 0 auto;
    }

    .phone-shot-browser {
        display: none;
    }

    /* Security mode cards: 1 column */
    .security-grid {
        grid-template-columns: 1fr;
    }
}

/* ─── 768px ─── Landscape phones / small tablets ────────────────────────── */
@media (max-width: 768px) {
    .hero-copy h1 {
        font-size: clamp(2.6rem, 10vw, 3.8rem);
    }

    .page-hero {
        padding-top: 2.5rem;
    }

    .section {
        padding: 4rem 0;
    }

    /* Slightly reduce card padding */
    .surface-card {
        padding: 1.35rem;
    }

    /* Step cards: horizontal layout on landscape phones */
    .step-number {
        font-size: 1.8rem;
    }
}

/* ─── 640px ─── Mobile ───────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .container {
        width: min(calc(100% - 1.25rem), 1180px);
    }

    .site-header {
        padding-top: 0.72rem;
    }

    .header-bar {
        padding: 0.82rem;
    }

    .brand-copy span:last-child {
        display: none;
    }

    /* Full-width buttons on mobile */
    .button,
    .hero-actions .button,
    .header-actions .button,
    .action-row .button,
    .action-stack .button,
    .form-actions .button {
        width: 100%;
    }

    .hero-actions,
    .action-row,
    .form-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .hero-meta {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    /* Single phone on mobile */
    .hero-device-cluster {
        max-width: 260px;
    }

    .surface-card,
    .footer-grid {
        padding: 1.25rem;
        border-radius: 1.5rem;
    }

    .story-card {
        padding: 1.25rem;
        gap: 1.25rem;
    }

    .phone-shot {
        padding: 0.7rem;
        border-radius: 1.75rem;
    }

    .phone-shot img {
        border-radius: 1.15rem;
    }

    /* Step connector hidden on mobile */
    .step-connector {
        display: none;
    }

    /* Step card compact */
    .step-card {
        padding: 1.25rem;
        gap: 0.85rem;
    }

    .step-number {
        font-size: 1.5rem;
    }

    /* OpenClaw banner stack on mobile */
    .openclaw-banner {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 1.25rem;
    }

    .openclaw-logo-wrap {
        margin: 0 auto;
    }

    .openclaw-install pre code {
        font-size: 0.82rem;
    }
}

/* ─── 480px ─── Small phones (SE, etc.) ─────────────────────────────────── */
@media (max-width: 480px) {
    .hero-copy h1 {
        font-size: clamp(2.2rem, 13vw, 2.9rem);
        line-height: 1.0;
    }

    .section {
        padding: 3.25rem 0;
    }

    .page-hero {
        padding-top: 1.75rem;
    }

    /* Tighter phone frame */
    .hero-device-cluster {
        max-width: 220px;
    }

    /* Ensure touch targets */
    .button {
        min-height: 48px;
        padding: 0.88rem 1rem;
    }

    .site-nav a {
        min-height: 48px;
    }

    /* Smaller section headings */
    .section-heading h2,
    .surface-card h2 {
        font-size: clamp(1.7rem, 9vw, 2.4rem);
    }

    /* Hero meta pills smaller */
    .hero-meta span {
        font-size: 0.8rem;
        padding: 0.38rem 0.6rem;
    }

    /* Card reduced padding */
    .surface-card {
        padding: 1rem;
        border-radius: 1.25rem;
    }

    .footer-grid {
        padding: 1rem;
    }
}
