/*
 * AlopeciaCare | Small-screen polish
 * This stylesheet intentionally affects screens 480px wide and below only.
 * It is loaded after the component styles to keep the overrides predictable.
 */

@media (max-width: 480px) {
    :root {
        --mobile-gutter: 14px;
        --mobile-radius: 14px;
    }

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

    body {
        background: #eef2f5;
        line-height: 1.5;
        overflow-x: hidden;
    }

    .container {
        width: 100%;
        max-width: 600px;
        min-height: 100vh;
        min-height: 100svh;
        /* Do not create an overflow container: it prevents the navbar sticking to the viewport. */
        overflow: visible;
        background: #fff;
        box-shadow: 0 0 26px rgba(15, 23, 42, 0.06);
    }

    html {
        scroll-padding-top: 76px;
    }

    img {
        max-width: 100%;
    }

    /* Compact announcement strip */
    .top-announcement-bar {
        min-height: 34px;
        padding: 8px 10px;
        gap: 7px;
        font-size: 0.69rem;
        line-height: 1.3;
        letter-spacing: 0;
        box-shadow: none;
    }

    .pulse-dot {
        width: 7px;
        height: 7px;
        flex: 0 0 7px;
    }

    /* Cleaner, balanced mobile header */
    .main-header {
        position: -webkit-sticky;
        position: sticky;
        top: 0;
        z-index: 1100;
        isolation: isolate;
        min-height: 58px;
        padding: 9px 12px;
        gap: 8px;
        background: rgba(255, 255, 255, 0.97);
        border-bottom: 1px solid #e9eef0;
        box-shadow: 0 4px 15px rgba(15, 23, 42, 0.07);
    }

    .order-section {
        scroll-margin-top: 76px;
    }

    .brand-logo {
        gap: 7px;
        min-width: 0;
        flex: 1 1 auto;
    }

    .brand-icon {
        width: 31px;
        height: 31px;
        flex: 0 0 31px;
        font-size: 0.9rem;
        box-shadow: 0 3px 8px rgba(16, 185, 129, 0.2);
    }

    .brand-text {
        font-size: clamp(0.83rem, 3.8vw, 0.98rem);
        letter-spacing: -0.45px;
        white-space: nowrap;
    }

    .header-cta-btn {
        flex: 0 0 auto;
        padding: 8px 10px;
        gap: 4px;
        font-size: 0.64rem;
        letter-spacing: 0.1px;
        border-radius: 999px;
        white-space: nowrap;
        box-shadow: 0 3px 9px rgba(217, 119, 6, 0.22);
        animation: none;
    }

    .header-cta-btn:hover {
        transform: none;
    }

    /* Hero: stronger hierarchy with less wasted vertical space */
    .hero-heading-section {
        padding: 19px var(--mobile-gutter) 18px;
        background: linear-gradient(180deg, #ffffff 0%, #fbfefc 100%);
    }

    .rating-badge {
        display: inline-flex;
        max-width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 4px 6px;
        margin-bottom: 13px;
        padding: 6px 10px;
        border-color: #e4ebe7;
        border-radius: 999px;
        font-size: 0.69rem;
        line-height: 1.35;
        box-shadow: 0 3px 10px rgba(15, 23, 42, 0.035);
    }

    .rating-badge .stars {
        letter-spacing: 0.5px;
    }

    .hero-title {
        margin-bottom: 10px;
        font-size: clamp(1.43rem, 6.2vw, 1.72rem);
        line-height: 1.16;
        letter-spacing: -0.65px;
        text-wrap: balance;
    }

    .hero-subtitle {
        max-width: 34rem;
        margin: 0 auto 13px;
        color: #64748b;
        font-size: 0.88rem;
        line-height: 1.5;
    }

    .hero-benefits-pills {
        gap: 6px;
        margin-bottom: 13px;
    }

    .pill-tag {
        padding: 5px 8px;
        border-radius: 999px;
        font-size: 0.66rem;
        line-height: 1.25;
    }

    .hero-image-wrapper {
        margin: 14px auto 0;
        border: 1px solid #e5ece8;
        border-radius: var(--mobile-radius);
        box-shadow: 0 10px 24px rgba(15, 23, 42, 0.09);
        background: #f8faf9;
    }

    .hero-image-wrapper img {
        width: 100%;
        height: auto;
        object-fit: cover;
    }

    /* Consistent section rhythm and more refined cards */
    .problems,
    .benefits,
    .reviews,
    .faq {
        padding: 24px var(--mobile-gutter);
    }

    .section-title {
        margin-bottom: 16px;
        font-size: clamp(1.12rem, 4.8vw, 1.28rem);
        line-height: 1.25;
        letter-spacing: -0.35px;
        text-wrap: balance;
    }

    .problem-list {
        gap: 9px;
    }

    .problem-item {
        gap: 10px;
        padding: 11px 12px;
        border-left-width: 3px;
        border-radius: 11px;
        font-size: 0.88rem;
        line-height: 1.4;
        background: #f4fbf6;
    }

    .problem-num {
        width: 27px;
        height: 27px;
        flex: 0 0 27px;
        font-size: 0.78rem;
    }

    .problems > div[style*="margin-top"] {
        margin-top: 15px !important;
    }

    .problems > div[style*="margin-top"] img,
    .benefits .hero-image-wrapper,
    .reviews > div[style*="border-radius"] {
        overflow: hidden;
        border-radius: var(--mobile-radius) !important;
        box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08) !important;
    }

    .benefits {
        background: #f6f9f7;
    }

    .benefits h3 {
        font-size: 1rem;
        line-height: 1.35;
    }

    .ingredients-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 9px;
        margin-top: 13px;
    }

    .ingredient-card {
        min-height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 10px 8px;
        border: 1px solid #e8efeb;
        border-radius: 12px;
        font-size: 0.82rem;
        line-height: 1.3;
        box-shadow: 0 4px 12px rgba(15, 23, 42, 0.035);
    }

    .review-gallery {
        gap: 12px;
        margin-top: 12px;
    }

    .review-img {
        width: 100%;
        height: auto;
        border: 1px solid #edf0f2;
        border-radius: 13px;
        box-shadow: 0 6px 17px rgba(15, 23, 42, 0.07);
    }

    /* FAQ controls feel more like touch-friendly mobile accordions */
    .faq {
        background: #f5f8f6;
    }

    .faq-item {
        margin-bottom: 9px;
        border: 1px solid #e4ebe6;
        border-radius: 12px;
        box-shadow: 0 3px 10px rgba(15, 23, 42, 0.025);
    }

    .faq-question {
        min-height: 48px;
        gap: 10px;
        padding: 12px 13px;
        font-size: 0.86rem;
        line-height: 1.4;
    }

    .faq-question span {
        flex: 0 0 auto;
        color: #059669;
        font-size: 0.75rem;
    }

    .faq-answer {
        padding: 0 13px 13px;
        color: #52616b;
        font-size: 0.84rem;
        line-height: 1.55;
    }

    /* Checkout and bundle cards: protect the price from wrapping */
    .order-section {
        padding: 24px var(--mobile-gutter) 28px;
        border-top: 3px solid #10b981;
        border-radius: 18px 18px 0 0;
        background: linear-gradient(180deg, #f7fcf9 0%, #ffffff 210px);
        box-shadow: 0 -5px 24px rgba(15, 23, 42, 0.045);
    }

    .order-section .section-title {
        margin-bottom: 15px;
        font-size: clamp(1.1rem, 4.7vw, 1.24rem);
    }

    .phone-warning {
        display: block;
        margin-bottom: 17px;
        padding: 11px 12px;
        border: 1px solid #f2df9c;
        border-radius: 12px;
        background: linear-gradient(135deg, #fffbed, #fff8d9);
        color: #7c5b0b;
        font-size: 0.76rem;
        line-height: 1.45;
        box-shadow: 0 3px 10px rgba(234, 179, 8, 0.07);
    }

    .package-options {
        display: flex;
        flex-direction: column;
        gap: 10px;
        margin-bottom: 20px;
    }

    .package-card,
    .package-option {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        column-gap: 8px;
        min-height: 75px;
        width: 100%;
        margin: 0 !important;
        padding: 12px 10px !important;
        border: 1px solid #e0e9e4;
        border-radius: 14px;
        background: rgba(255, 255, 255, 0.96);
        box-shadow: 0 4px 13px rgba(15, 23, 42, 0.045);
        transition: border-color 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
    }

    .package-card > div:first-child,
    .package-option > div:first-child {
        display: flex;
        align-items: flex-start;
        gap: 7px;
        min-width: 0;
    }

    .package-card input[type="radio"],
    .package-option input[type="radio"] {
        width: 18px;
        height: 18px;
        flex: 0 0 18px;
        margin: 2px 0 0;
        accent-color: #059669;
    }

    .package-card label,
    .package-option label {
        display: block;
        min-width: 0;
        margin: 0 !important;
        color: #19252d;
        font-size: 0.83rem;
        font-weight: 750 !important;
        line-height: 1.35;
        overflow-wrap: normal;
    }

    .package-card .price-tag,
    .package-option .price-tag,
    .package-price-box,
    .package-right {
        min-width: 0;
        max-width: 112px;
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        justify-content: center;
        text-align: right;
    }

    .package-card .price-curr,
    .package-option .price-curr {
        color: #079455;
        font-size: clamp(0.88rem, 3.8vw, 1rem);
        font-weight: 900;
        line-height: 1.2;
        letter-spacing: -0.45px;
        white-space: nowrap;
        overflow-wrap: normal;
    }

    .package-card .price-save,
    .package-card .save-badge,
    .package-option .price-save,
    .package-option .save-badge,
    .discount-tag {
        max-width: 100%;
        margin-top: 5px;
        padding: 4px 6px;
        border: 1px solid #c5f0d7;
        border-radius: 999px;
        background: #e8fbef;
        color: #087443;
        font-size: 0.57rem;
        font-weight: 850;
        letter-spacing: 0;
        line-height: 1.2;
        white-space: nowrap;
        text-transform: uppercase;
    }

    .package-card.selected,
    .package-option.selected,
    .package-card:has(input:checked),
    .package-option:has(input:checked) {
        border-color: #10a765 !important;
        background: linear-gradient(135deg, #f0fcf5, #eafff1) !important;
        box-shadow: 0 7px 17px rgba(5, 150, 105, 0.1) !important;
    }

    .form-group {
        margin-bottom: 15px;
    }

    .form-group label {
        margin-bottom: 6px;
        color: #34434b;
        font-size: 0.82rem;
        font-weight: 750;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        width: 100%;
        min-height: 49px;
        padding: 13px 14px;
        border: 1px solid #dbe3e7;
        border-radius: 11px;
        background: #f9fbfa;
        color: #17212b;
        font-family: inherit;
        font-size: 16px;
        line-height: 1.35;
        box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.015);
        transition: border-color 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
    }

    .form-group input::placeholder {
        color: #8a979d;
        opacity: 1;
    }

    .form-group input:focus,
    .form-group select:focus,
    .form-group textarea:focus {
        outline: none;
        border-color: #10a765;
        background: #fff;
        box-shadow: 0 0 0 3px rgba(16, 167, 101, 0.12);
    }

    .order-section .btn-cta {
        min-height: 51px;
        margin-top: 16px !important;
        padding: 15px 12px;
        border-radius: 12px;
        background: linear-gradient(135deg, #0ca768, #087b47);
        box-shadow: 0 7px 16px rgba(5, 150, 105, 0.22);
        font-size: 0.88rem;
        line-height: 1.35;
        letter-spacing: 0.2px;
        overflow-wrap: anywhere;
    }

    .order-section .btn-cta:hover {
        transform: none;
        box-shadow: 0 7px 16px rgba(5, 150, 105, 0.22);
    }

    .site-footer {
        padding: 25px 14px 20px;
        font-size: 0.78rem;
        line-height: 1.6;
    }

    .site-footer .footer-brand {
        font-size: 1.08rem;
    }

    .site-footer .footer-tagline {
        margin-bottom: 15px;
        font-size: 0.73rem;
    }

    .site-footer .footer-contact a {
        display: inline-block;
        max-width: 100%;
    }

    .site-footer .footer-copyright {
        margin-top: 15px;
        font-size: 0.68rem;
    }
}

/* Extra-tight layout for older/smaller phones */
@media (max-width: 360px) {
    .main-header {
        padding-right: 9px;
        padding-left: 9px;
        gap: 6px;
    }

    .brand-logo {
        gap: 5px;
    }

    .brand-icon {
        width: 29px;
        height: 29px;
        flex-basis: 29px;
    }

    .brand-text {
        font-size: 0.82rem;
        letter-spacing: -0.55px;
    }

    .header-cta-btn {
        padding: 7px 8px;
        font-size: 0.6rem;
    }

    .hero-heading-section {
        padding-right: 12px;
        padding-left: 12px;
    }

    .rating-badge {
        font-size: 0.64rem;
    }

    .package-card,
    .package-option {
        column-gap: 6px;
        padding-right: 8px !important;
        padding-left: 8px !important;
    }

    .package-card label,
    .package-option label {
        font-size: 0.79rem;
    }

    .package-card .price-tag,
    .package-option .price-tag,
    .package-price-box,
    .package-right {
        max-width: 104px;
    }

    .package-card .price-curr,
    .package-option .price-curr {
        font-size: 0.86rem;
        letter-spacing: -0.5px;
    }

    .package-card .price-save,
    .package-card .save-badge,
    .package-option .price-save,
    .package-option .save-badge,
    .discount-tag {
        padding: 4px 5px;
        font-size: 0.53rem;
    }
}

@media (prefers-reduced-motion: reduce) and (max-width: 480px) {
    html {
        scroll-behavior: auto;
    }

    .top-announcement-bar::after,
    .pulse-dot,
    .header-cta-btn {
        animation: none !important;
    }

    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
    }
}
