/* Mobile-first polish — animations, touch, layout */

@keyframes ats-m-fade-up {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes ats-m-scale-in {
    from { opacity: 0; transform: scale(0.94); }
    to { opacity: 1; transform: scale(1); }
}
@keyframes ats-m-slide-left {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes ats-m-pulse-soft {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}
@keyframes ats-m-scroll-line {
    0% { transform: scaleY(0); transform-origin: top; opacity: 1; }
    50% { transform: scaleY(1); transform-origin: top; opacity: 1; }
    51% { transform-origin: bottom; }
    100% { transform: scaleY(0); transform-origin: bottom; opacity: 0.3; }
}

/* Touch-friendly base */
/* Back to top float — desktop hidden */
.ats-back-to-top--float { display: none; }

@media (max-width: 767px) {
    html { -webkit-text-size-adjust: 100%; }
    body.ats-body { overflow-x: hidden; }
    .ats-container { padding: 0 1.15rem; }

    /* Buttons — 44px touch targets + tap feedback */
    .ats-btn {
        min-height: 44px;
        padding: 0.75rem 1.5rem;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
    .ats-btn--lg {
        min-height: 48px;
        padding: 0.85rem 1.75rem;
        width: 100%;
        max-width: 100%;
    }
    .ats-btn:active {
        transform: scale(0.97) !important;
        transition: transform 0.12s ease !important;
    }
    .ats-hero__actions {
        flex-direction: column;
        width: 100%;
    }
    .ats-hero__actions .ats-btn {
        width: 100%;
        justify-content: center;
    }

    /* Hero load sequence */
    .ats-hero__title,
    .ats-hero__lead,
    .ats-tag-ticket,
    .ats-hero__actions,
    .ats-hero__stats,
    .ats-hero__frame {
        opacity: 0;
    }
    .ats-ready .ats-tag-ticket {
        animation: ats-m-fade-up 0.6s ease 0.1s forwards;
    }
    .ats-ready .ats-hero__title {
        animation: ats-m-fade-up 0.7s ease 0.2s forwards;
    }
    .ats-ready .ats-hero__lead {
        animation: ats-m-fade-up 0.7s ease 0.35s forwards;
    }
    .ats-ready .ats-hero__actions {
        animation: ats-m-fade-up 0.7s ease 0.5s forwards;
    }
    .ats-ready .ats-hero__stats {
        animation: ats-m-fade-up 0.7s ease 0.65s forwards;
    }
    .ats-ready .ats-hero__frame {
        animation: ats-m-scale-in 0.85s ease 0.45s forwards;
    }

    /* Hero layout */
    .ats-hero {
        min-height: auto;
        margin-top: calc(-1 * var(--ats-header-h));
        padding: calc(var(--ats-header-h) + 1.25rem) 0 2.5rem;
        align-items: flex-start;
    }
    .ats-hero__visual,
    .ats-hero__visual img {
        max-height: none;
    }
    .ats-hero__content {
        grid-template-columns: 1fr;
        gap: 1.75rem;
    }
    .ats-hero__title {
        font-size: clamp(1.65rem, 7vw, 2.25rem);
        line-height: 1.4;
    }
    .ats-hero__lead {
        font-size: 0.92rem;
        margin-bottom: 1.25rem;
        max-width: none;
    }
    .ats-hero__stats {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
        width: 100%;
    }
    .ats-hero__stat {
        min-width: 0;
        padding: 0.55rem 0.45rem;
        text-align: center;
    }
    .ats-hero__stat strong { font-size: 1.05rem; }
    .ats-hero__stat span { font-size: 0.58rem; }
    .ats-hero__frame {
        max-width: 280px;
        margin: 0 auto;
    }
    .ats-hero__frame .ats-hero__visual {
        animation: ats-float 5s ease-in-out infinite;
    }
    .ats-hero__bg img {
        animation: ats-hero-ken 14s ease-out forwards;
    }
    .ats-hero__particles span:nth-child(n+4) { display: none; }

    /* Mobile scroll hint */
    .ats-hero__scroll {
        display: flex !important;
        bottom: 1rem;
        font-size: 0.6rem;
        opacity: 0.7;
    }
    .ats-hero__scroll span {
        height: 28px;
        animation: ats-m-scroll-line 2s ease infinite;
    }

    /* Page heroes */
    .ats-page-hero {
        min-height: 42vh;
        padding: calc(var(--ats-header-h) + 1.5rem) 0 2rem;
    }
    .ats-page-hero h1 { font-size: clamp(1.65rem, 6vw, 2.25rem); }
    .ats-page-hero p { font-size: 0.9rem; }

    /* Sections */
    .ats-section { padding: 3rem 0; }
    .ats-section--compact { padding: 2.75rem 0 !important; }
    .ats-section-header { margin-bottom: 2rem; }
    .ats-section-header h2 { font-size: clamp(1.45rem, 5vw, 1.85rem); }

    /* Scroll reveal — snappier on mobile */
    .ats-reveal {
        transform: translateY(18px);
        transition: opacity 0.55s ease, transform 0.55s ease;
    }
    .ats-stagger > * {
        transform: translateY(16px);
        transition: opacity 0.45s ease, transform 0.45s ease;
    }

    /* Vehicle lineup mobile — cinematic image + clean panel */
    .ats-section--aurora {
        min-height: auto;
        padding-bottom: 0;
    }
    .ats-aurora__split {
        display: flex;
        flex-direction: column;
    }
    .ats-aurora__visual-wrap {
        order: 1;
        min-height: 240px;
        height: 48vw;
        max-height: 360px;
        width: 100%;
        border-radius: 0 0 var(--ats-radius-lg) var(--ats-radius-lg);
    }
    .ats-aurora__visual-wrap::after {
        content: '← スワイプ →';
        position: absolute;
        bottom: 0.75rem;
        left: 50%;
        transform: translateX(-50%);
        z-index: 5;
        padding: 0.3rem 0.85rem;
        background: rgba(0, 0, 0, 0.45);
        backdrop-filter: blur(8px);
        border-radius: 999px;
        font-size: 0.62rem;
        font-weight: 600;
        letter-spacing: 0.1em;
        color: rgba(255, 255, 255, 0.85);
        pointer-events: none;
        animation: ats-m-pulse-soft 2.5s ease infinite;
    }
    .ats-aurora__panel {
        order: 2;
        padding: 1.15rem 1rem 1.5rem;
        gap: 1rem;
    }
    .ats-aurora__head {
        flex-direction: row;
        align-items: flex-start;
        justify-content: space-between;
        gap: 0.75rem;
    }
    .ats-aurora__head > div:first-child { flex: 1; min-width: 0; }
    .ats-aurora__head h2 { font-size: clamp(1.25rem, 5.5vw, 1.65rem); margin: 0.35rem 0; }
    .ats-aurora__head p { font-size: 0.82rem; line-height: 1.55; }
    .ats-aurora__ring { width: 52px; height: 52px; flex-shrink: 0; }
    .ats-aurora__ring-num { font-size: 1rem; }
    .ats-aurora__info { min-height: auto; }
    .ats-aurora__info-card {
        padding: 1rem 1.05rem;
        border-radius: var(--ats-radius-lg);
        overflow: visible;
    }
    .ats-aurora__info-card h3 { font-size: 1.05rem; }
    .ats-aurora__info-card p {
        font-size: 0.8rem;
        line-height: 1.6;
        margin-bottom: 0.85rem;
        word-break: break-word;
    }
    .ats-aurora__meta {
        flex-wrap: wrap;
        align-items: center;
        gap: 0.5rem 0.75rem;
        padding-top: 0.75rem;
    }
    .ats-aurora__price { font-size: 1rem; flex: 1 1 auto; }
    .ats-aurora__link {
        flex-shrink: 0;
        font-size: 0.78rem;
        white-space: nowrap;
    }
    .ats-aurora__dock {
        padding: 0.6rem;
        gap: 0.5rem;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x proximity;
    }
    .ats-aurora__chip {
        scroll-snap-align: center;
        min-width: 64px;
    }
    .ats-aurora__chip-img { width: 44px; height: 44px; }
    .ats-aurora__chip-label { font-size: 0.65rem; }
    .ats-aurora__chip:active { transform: scale(0.95); }
    .ats-aurora__slide.is-active .ats-aurora__visual img {
        animation: ats-aurora-kenburns 10s ease-out forwards;
    }
    .ats-aurora__shade {
        background: linear-gradient(to top, rgba(10, 48, 48, 0.7) 0%, transparent 50%) !important;
    }
    .ats-aurora__marquee { opacity: 0.06; }
    .ats-aurora__marquee-track { animation-duration: 30s; }
    .ats-aurora__footer { margin-top: 0.25rem; }
    .ats-aurora__footer .ats-btn { width: 100%; }

    /* Trust strip spacing — no overlap with float btn */
    .ats-trust-strip { margin-top: 0; }
    .ats-back-to-top--float { bottom: 1.5rem; }

    /* Trust strip */
    .ats-trust-strip { padding: 1rem 0; }
    .ats-trust-strip__track { animation-duration: 22s; }
    .ats-trust-strip__item { font-size: 0.75rem; padding: 0 1.25rem; }
    .ats-trust-strip__item strong { font-size: 1rem; }

    /* Editorial */
    .ats-editorial { gap: 2rem; }
    .ats-editorial__visual img {
        animation: ats-m-scale-in 0.8s ease both;
    }
    .ats-editorial__visual::after { inset: 0.75rem -0.75rem -0.75rem 0.75rem; }
    .ats-stamp { width: 70px; height: 70px; font-size: 0.48rem; }
    .ats-stamp strong { font-size: 0.9rem; }

    /* Filmstrip */
    .ats-filmstrip-wrap { margin: 0 -1.15rem; padding: 0 1.15rem; }
    .ats-filmstrip-wrap::before,
    .ats-filmstrip-wrap::after { width: 40px; }
    .ats-film-card {
        flex: 0 0 min(260px, 78vw);
        scroll-snap-align: center;
    }
    .ats-film-card.is-centered {
        transform: scale(1.02);
        box-shadow: var(--ats-shadow-lg), 0 0 0 1px rgba(135, 206, 235, 0.35);
    }
    .ats-film-card__img img {
        animation: ats-m-scale-in 0.6s ease both;
    }
    .ats-filmstrip-hint {
        animation: ats-m-pulse-soft 2.5s ease infinite;
    }

    /* CTA band */
    .ats-cta-band {
        padding: 3rem 0 !important;
    }
    .ats-cta__quote {
        padding: 1.25rem 1.25rem 1.25rem 1.75rem;
        font-size: 0.88rem;
        line-height: 1.75;
    }
    .ats-cta__quote::before { font-size: 2rem; }
    .ats-cta__perks {
        grid-template-columns: 1fr;
        margin-bottom: 1.35rem;
    }
    .ats-cta__actions {
        flex-direction: column;
    }
    .ats-cta__actions .ats-btn {
        width: 100%;
        max-width: 320px;
    }
    .ats-cta .ats-btn--lg { max-width: 320px; margin: 0 auto; }
    .ats-cta__stats {
        margin-top: 1.75rem;
        padding-top: 1.5rem;
        gap: 0.65rem;
    }
    .ats-cta__stat { padding: 0.7rem 0.35rem; }
    .ats-cta__stat strong { font-size: 1.2rem; }
    .ats-cta__stat span { font-size: 0.62rem; }

    /* Ticket cards — stack stub on top */
    .ats-ticket-card {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }
    .ats-ticket-card::before {
        left: 12px; right: 12px; top: auto;
        bottom: calc(100% - 1px);
        width: auto; height: 2px;
        background: repeating-linear-gradient(
            to right,
            var(--ats-border) 0, var(--ats-border) 4px,
            transparent 4px, transparent 8px
        );
    }
    .ats-ticket-card__stub {
        flex-direction: row;
        justify-content: space-between;
        padding: 0.85rem 1rem;
    }
    .ats-ticket-card__stub img {
        width: 64px; height: 48px;
        flex-shrink: 0;
    }
    .ats-ticket-card:active { transform: scale(0.98); }

    /* Cards & stats */
    .ats-card:active,
    .ats-pillar:active,
    .ats-plan-card:active { transform: scale(0.98); }
    .ats-stat { padding: 1.25rem 0.75rem; }
    .ats-stat strong { font-size: 1.75rem; }

    /* Blog featured */
    .ats-blog-featured__img img {
        animation: ats-m-scale-in 0.7s ease both;
    }

    /* Contact */
    .ats-glass-panel { padding: 1.35rem; }
    .ats-form input,
    .ats-form textarea {
        min-height: 44px;
        font-size: 16px; /* prevents iOS zoom */
    }
    .ats-form textarea { min-height: 120px; }
    .ats-map iframe { min-height: 220px; }

    /* FAQ */
    .ats-faq-item:active { transform: translateX(2px); }
    .ats-faq-section__title { font-size: 1.05rem; }

    /* Footer */
    .ats-footer__cta { padding: 2rem 0; }
    .ats-footer__cta .ats-btn {
        width: 100%;
        max-width: 300px;
    }
    .ats-footer__links a:active { transform: translateX(2px); }

    /* Mobile nav CTA */
    .ats-nav .ats-nav-cta {
        display: inline-flex !important;
        width: 100%;
        justify-content: center;
        margin-top: 0.75rem;
        padding: 0.85rem 1.25rem;
        min-height: 44px;
        font-size: 0.82rem;
    }
    .ats-nav .ats-nav-cta:active { transform: scale(0.97); }

    /* Back to top — floating on mobile */
    .ats-back-to-top--float {
        display: flex !important;
        position: fixed;
        bottom: 1.25rem;
        right: 1.15rem;
        z-index: 900;
        opacity: 0;
        visibility: hidden;
        transform: translateY(12px);
        box-shadow: var(--ats-shadow-lg);
        transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease, background var(--ats-transition);
    }
    .ats-back-to-top--float.is-visible {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
    .ats-back-to-top--float[hidden] { display: none !important; }
    .ats-back-to-top--float:not([hidden]) { display: flex !important; }

    /* Wave dividers */
    .ats-wave { height: 32px; }
}

@media (max-width: 380px) {
    .ats-hero__stats { grid-template-columns: 1fr 1fr; }
    .ats-hero__stats .ats-hero__stat:last-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 767px) and (prefers-reduced-motion: reduce) {
    .ats-hero__title,
    .ats-hero__lead,
    .ats-tag-ticket,
    .ats-hero__actions,
    .ats-hero__stats,
    .ats-hero__frame { opacity: 1; animation: none; }
    .ats-filmstrip-hint { animation: none; }
    .ats-hero__scroll span { animation: none; }
    .ats-aurora__visual-wrap::after { animation: none; }
}
