/* ====================================
   EDITORIAL EL SAUCE — Responsive Styles
   Mobile-first, full device coverage
   ====================================
   Breakpoints:
   - xs : < 480px  (small phones)
   - sm : < 768px  (phones)
   - md : < 1024px (tablets / small laptops)
   - lg : < 1280px (laptops)
   ==================================== */


/* ============ BASE — ALL DEVICES ============ */

/* Responsive images */
img {
    max-width: 100%;
    height: auto;
}

/* No horizontal scroll ever */
html,
body {
    overflow-x: hidden;
    width: 100%;
}

/* Minimum tap target: 44 × 44 px (WCAG 2.5.5) */
a,
button,
.btn,
.filter-btn,
.nav-links a,
.menu-toggle {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.faq-question {
    min-height: 52px;
}

/* Buttons: never wrap, never stretch by default */
.btn {
    white-space: nowrap;
}

/* Inline cards (Amazon KDP / Navarra section) — responsive base */
.index-inline-card {
    background: white;
    border-radius: 12px;
    padding: 1.8rem;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.07);
}


/* ============ LARGE LAPTOPS (max 1280px) ============ */
@media (max-width: 1280px) {
    .container {
        padding: 0 1.5rem;
    }

    .nav-links {
        gap: 0.5rem;
    }

    .nav-links a {
        font-size: 0.85rem;
        padding: 0.5rem 0.6rem;
    }
}


/* ============ TABLETS & SMALL LAPTOPS (max 1024px) ============ */
@media (max-width: 1024px) {

    /* --- Header --- */
    .header {
        position: sticky;
        top: 0;
        z-index: 1000;
    }

    .navbar {
        padding: 0.5rem 0;
        position: relative;
    }

    /* --- Hamburger menu drawer --- */
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: min(300px, 80vw);
        height: 100vh;
        background: var(--color-white);
        flex-direction: column;
        align-items: flex-start;
        padding: 5rem 2rem 2rem;
        box-shadow: -4px 0 30px rgba(27, 58, 13, 0.2);
        transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        gap: 0;
        overflow-y: auto;
        z-index: 999;
    }

    .nav-links.active {
        right: 0;
        display: flex;
    }

    .nav-links a {
        width: 100%;
        font-size: 1.05rem;
        padding: 0.9rem 0;
        border-bottom: 1px solid var(--color-border);
        border-radius: 0;
        justify-content: flex-start;
        min-height: 52px;
    }

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

    /* --- Hamburger button --- */
    .menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        font-size: 1.5rem;
        color: var(--color-primary);
        cursor: pointer;
        background: var(--color-secondary-light);
        border-radius: var(--radius-md);
        transition: var(--transition);
        z-index: 1001;
        position: relative;
    }

    .menu-toggle:hover,
    .menu-toggle:active {
        background: var(--color-primary);
        color: var(--color-white);
    }

    /* --- Overlay behind drawer --- */
    .nav-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 998;
        backdrop-filter: blur(2px);
    }

    .nav-overlay.active {
        display: block;
    }

    /* --- Grids --- */
    .grid-2 {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }

    /* --- Sections --- */
    .section {
        padding: 3rem 0;
    }

    /* --- Hero --- */
    .hero {
        height: 90vh;
        min-height: 640px;
    }

    /* --- Footer --- */
    .footer-content {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }

    /* --- Index inline cards (Amazon KDP / Navarra) --- */
    [style*="border-radius: 12px"][style*="box-shadow"] {
        padding: 1.5rem !important;
    }
}


/* ============ PHONES & SMALL TABLETS (max 768px) ============ */
@media (max-width: 768px) {

    /* --- Container --- */
    .container {
        padding: 0 1rem;
    }

    /* --- Typography --- */
    h1 {
        font-size: clamp(1.8rem, 7vw, 2.8rem);
    }

    h2 {
        font-size: clamp(1.5rem, 5.5vw, 2.2rem);
    }

    h3 {
        font-size: clamp(1.15rem, 4vw, 1.6rem);
    }

    h4 {
        font-size: 1.05rem;
    }

    p {
        font-size: 0.97rem;
    }

    /* --- Sections --- */
    .section {
        padding: 2.5rem 0;
    }

    .section-sm {
        padding: 1.75rem 0;
    }

    /* --- Hero --- */
    .hero,
    .about-hero {
        height: auto;
        min-height: 600px;
        padding: 7rem 0 5rem;
    }

    .hero-content {
        padding: 2rem 1.25rem;
    }

    .hero-content h1 {
        font-size: clamp(1.8rem, 7vw, 2.8rem);
        margin-bottom: 1rem;
    }

    .hero-content p {
        font-size: clamp(0.95rem, 3vw, 1.1rem);
        margin-bottom: 1.5rem;
    }

    /* Wrap hero buttons vertically */
    .hero-cta {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .hero-cta .btn {
        width: 100%;
        justify-content: center;
        white-space: normal;
    }

    /* --- Buttons (general) --- */
    .btn {
        padding: 0.85rem 1.5rem;
        font-size: 0.9rem;
    }

    /* Override: CTA sections with flex row buttons — keep inline */
    [style*="display: flex"][style*="gap: 1rem"] .btn {
        width: auto;
        flex: 0 1 auto;
    }

    /* --- Cards --- */
    .card-img {
        height: 220px;
    }

    .book-cover {
        height: 260px;
    }

    /* --- Grids: single column --- */
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }

    .grid-2[data-keep-md] {
        grid-template-columns: repeat(2, 1fr);
    }

    /* --- Index inline card grids (Amazon KDP, Navarra) --- */
    /* Targets the 3-column white-card grids created inline */
    [style*="grid-template-columns: repeat(3"] {
        grid-template-columns: 1fr !important;
    }

    [style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    /* Inline cards: full width, comfortable padding */
    [style*="border-radius: 12px"][style*="box-shadow"] {
        padding: 1.25rem !important;
    }

    /* --- Stats --- */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .stat-item::after {
        display: none;
    }

    /* --- Footer --- */
    .footer-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .footer {
        padding: 2rem 0 1.5rem;
    }

    /* --- Forms --- */
    .form-input,
    .form-textarea,
    .form-select {
        font-size: 16px;
        /* prevents iOS auto-zoom */
        padding: 0.75rem 0.875rem;
    }

    /* --- FAQ --- */
    .faq-question {
        font-size: 0.95rem;
        padding: 1rem;
    }

    /* --- Testimonials --- */
    .testimonial-card {
        padding: 1.5rem;
    }

    .testimonial-header {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    /* --- Team --- */
    .team-grid {
        grid-template-columns: 1fr;
    }

    /* --- Values --- */
    .values-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    /* --- Success stories --- */
    .success-story {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 1.25rem;
    }

    .success-story-image,
    .success-story-image-placeholder {
        width: 100%;
        height: 180px;
    }

    .success-metrics {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    /* --- Category cards --- */
    .category-showcase {
        grid-template-columns: 1fr;
    }

    .category-card {
        height: 220px;
    }

    /* --- Search bar --- */
    .search-bar {
        flex-direction: column;
    }

    .search-input {
        min-width: unset;
        width: 100%;
    }

    /* --- Timeline --- */
    .timeline::before {
        left: 22px;
    }

    .timeline-item,
    .timeline-item:nth-child(even) {
        flex-direction: row !important;
        padding-left: 56px;
    }

    .timeline-year {
        left: 22px;
        transform: none;
        width: 44px;
        height: 44px;
        font-size: 0.8rem;
    }

    .timeline-content {
        margin-left: 1rem;
        margin-right: 0;
    }

    /* --- Back to top --- */
    .back-to-top {
        bottom: 1.25rem;
        right: 1.25rem;
        width: 42px;
        height: 42px;
    }

    /* --- Step numbers --- */
    .step-number {
        width: 56px;
        height: 56px;
        font-size: 1.5rem;
    }
}


/* ============ SMALL PHONES (max 480px) ============ */
@media (max-width: 480px) {

    /* --- Container --- */
    .container {
        padding: 0 0.85rem;
    }

    /* --- Typography --- */
    h1 {
        font-size: clamp(1.55rem, 8vw, 2rem);
    }

    h2 {
        font-size: clamp(1.3rem, 6vw, 1.75rem);
    }

    /* --- Hero --- */
    .hero,
    .about-hero {
        min-height: 480px;
        padding: 5rem 0 3rem;
    }

    /* --- Logo: visible but compact --- */
    .logo-img {
        height: 60px !important;
    }

    /* --- Sections --- */
    .section {
        padding: 2rem 0;
    }

    /* --- Stats: single column on tiny screens --- */
    .stats-grid {
        grid-template-columns: 1fr;
    }

    /* --- Card images --- */
    .card-img {
        height: 190px;
    }

    .book-cover {
        height: 230px;
    }

    /* --- Spacing in cards --- */
    .card-body {
        padding: 1rem;
    }

    .book-info {
        padding: 1rem;
    }

    /* --- Filter buttons --- */
    .filter-group {
        gap: 0.5rem;
    }

    .filter-btn {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }

    /* --- Testimonials --- */
    .testimonial-image,
    .testimonial-image-placeholder {
        width: 64px;
        height: 64px;
    }

    /* --- Value icons --- */
    .value-icon-wrapper {
        width: 60px;
        height: 60px;
    }

    .value-icon-wrapper span {
        font-size: 1.8rem;
    }

    /* --- Inline cards extra compact --- */
    [style*="border-radius: 12px"][style*="box-shadow"] {
        padding: 1rem !important;
    }

    /* --- Footer bottom --- */
    .footer-bottom p {
        font-size: 0.78rem;
    }
}


/* ============ LANDSCAPE PHONES (height < 500px) ============ */
@media (max-height: 500px) and (orientation: landscape) {

    .hero,
    .about-hero {
        height: auto;
        min-height: 280px;
        padding: 4rem 0 3rem;
    }

    .nav-links {
        padding-top: 4rem;
    }
}


/* ============ PRINT ============ */
@media print {

    .header,
    .footer,
    .back-to-top,
    .nav-links,
    .menu-toggle,
    .hero-cta .btn:last-child {
        display: none !important;
    }

    body {
        font-size: 12pt;
        color: #000;
    }

    a {
        text-decoration: underline;
    }
}