/* ==========================================================================
   ColorLab — Responsive CSS
   Breakpoint strategy:
     Desktop  : 1200px+   (base design)
     Laptop   : 992–1199px
     Tablet   : 768–991px
     Mobile-L : 576–767px
     Mobile-S : below 576px
   ========================================================================== */


/* --------------------------------------------------------------------------
   GLOBAL RESET & FLUID FOUNDATIONS
   -------------------------------------------------------------------------- */

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

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

body {
    overflow-x: hidden;
}

img, svg, video, iframe {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Fluid container padding */
.container {
    padding: 0 clamp(1rem, 4vw, 2rem);
}


/* --------------------------------------------------------------------------
   LAPTOP  ≤ 1199px
   -------------------------------------------------------------------------- */

@media (max-width: 1199px) {
    .container {
        max-width: 960px;
    }

    .hero-title {
        font-size: clamp(2.25rem, 4.5vw, 3.5rem);
    }

    .section-title {
        font-size: clamp(1.75rem, 3vw, 2.5rem);
    }

    /* Pricing 3-col stays but tighter */
    .pricing-grid {
        gap: 1.25rem;
    }

    .pricing-card.popular {
        transform: translateY(-2px);
    }
}


/* --------------------------------------------------------------------------
   TABLET  ≤ 991px
   -------------------------------------------------------------------------- */

@media (max-width: 991px) {

    /* Container */
    .container {
        max-width: 720px;
    }

    /* Section spacing */
    .section-spacing {
        padding: 5rem 0;
    }

    /* --- NAVIGATION --- */
    .navbar {
        height: 60px;
    }

    .nav-content {
        height: 60px;
    }

    /* Hide desktop links, show hamburger */
    .nav-links {
        display: none !important;
    }

    .nav-hamburger {
        display: flex !important;
        flex-direction: column;
        gap: 5px;
        padding: 8px;
        cursor: pointer;
        background: none;
        border: none;
        border-radius: var(--radius-sm);
    }

    /* Mobile nav drawer — hidden by default, becomes visible with .open */
    .mobile-nav {
        display: flex !important;
        flex-direction: column;
        position: fixed;
        top: 60px;
        inset-inline: 0;
        bottom: 0;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        padding: 1.5rem;
        border-top: 1px solid var(--border-main);
        z-index: 99;
        gap: 0;
        overflow-y: auto;
        pointer-events: none;
        opacity: 0;
        transform: translateY(-8px);
        transition: opacity 240ms ease, transform 240ms cubic-bezier(0.16, 1, 0.3, 1);
    }

    .mobile-nav.open {
        opacity: 1;
        transform: translateY(0);
        pointer-events: all;
    }

    .mobile-nav .nav-link {
        display: flex;
        align-items: center;
        padding: 1rem 0;
        font-size: 1.1rem;
        font-weight: 500;
        color: var(--text-main);
        border-bottom: 1px solid var(--border-main);
        text-decoration: none;
        opacity: 1;
        transform: none;
        transition: color 160ms ease;
    }

    .mobile-nav .nav-link:last-child {
        border-bottom: none;
    }

    .mobile-nav .nav-link:hover {
        color: var(--text-muted);
    }

    .mobile-nav .btn {
        margin-top: 1.25rem;
        display: inline-flex;
        justify-content: center;
    }

    /* --- HERO --- */
    .hero {
        padding: 5rem 0 4rem;
        text-align: inherit;
    }

    .split-layout {
        flex-direction: column !important;
        gap: 3rem !important;
    }

    .split-text {
        text-align: inherit;
    }

    .hero-subtitle {
        max-width: 560px;
        margin-left: auto;
        margin-right: auto;
    }

    .hero-actions {
        justify-content: center !important;
        flex-wrap: wrap;
    }

    .hero-interactive {
        text-align: center;
    }

    #hero-color-picker {
        justify-content: center;
    }

    .hero-visuals {
        width: 100%;
        max-width: 480px;
        margin: 0 auto;
        height: 380px !important;
    }

    .split-image {
        max-width: 100% !important;
    }

    /* --- GRIDS: 2 columns on tablet --- */
    .grid-3 {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* --- SECTION LABELS --- */
    .section-subtitle {
        font-size: 1rem;
    }

    /* --- PRICING: stack to 1 column --- */
    .pricing-grid {
        grid-template-columns: 1fr !important;
        max-width: 480px;
        margin-left: auto;
        margin-right: auto;
    }

    .pricing-card.popular {
        transform: none;
        animation: none;
    }

    /* --- TESTIMONIALS: 1 column --- */
    .testimonials-grid {
        grid-template-columns: 1fr !important;
        max-width: 560px;
        margin-left: auto;
        margin-right: auto;
    }

    /* --- CONTACT wrapper --- */
    .contact-wrapper {
        flex-direction: column;
        gap: 2rem;
    }

    .contact-info,
    .contact-form {
        width: 100%;
    }

    /* --- FOOTER --- */
    .footer-top {
        grid-template-columns: 1fr 1fr !important;
        gap: 2.5rem;
        text-align: inherit;
        border-bottom: 1px solid var(--border-main);
    }

    .footer-col:first-child {
        grid-column: 1 / -1;
    }

    /* --- ABOUT split --- */
    .about .split-image {
        height: 280px !important;
    }

    /* --- OFFERS --- */
    .offers .card {
        padding: 3rem 2rem !important;
    }
}


/* --------------------------------------------------------------------------
   MOBILE  ≤ 767px
   -------------------------------------------------------------------------- */

@media (max-width: 767px) {

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

    /* Section spacing shrinks */
    .section-spacing {
        padding: 4rem 0;
    }

    /* --- HERO --- */
    .hero {
        padding: 4rem 0 3rem;
    }

    .hero-title {
        font-size: clamp(2rem, 8vw, 2.75rem);
        letter-spacing: -0.03em;
    }

    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 2rem;
    }

    .hero-actions {
        gap: 0.75rem;
        flex-direction: column;
        align-items: stretch !important;
    }

    .hero-actions .btn {
        width: 100%;
        justify-content: center;
        padding: 0.9rem 1.5rem;
    }

    .hero-visuals {
        height: 300px !important;
    }

    /* Hero floating cards — simplify on small screens */
    .hero-visuals > div:nth-child(3) { /* Primary palette card */
        width: 220px !important;
        right: 0 !important;
        top: 20px !important;
    }

    .hero-visuals > div:nth-child(4) { /* Secondary UI block */
        width: 180px !important;
        left: 0 !important;
        bottom: 30px !important;
    }

    /* --- NAVIGATION --- */
    .navbar {
        height: 56px;
    }
    .nav-content {
        height: 56px;
    }

    /* --- GRIDS: single column on mobile --- */
    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr !important;
    }

    /* --- SECTION TYPOGRAPHY --- */
    .section-title {
        font-size: clamp(1.6rem, 6vw, 2rem);
    }

    .section-subtitle {
        font-size: 0.95rem;
        margin-bottom: 2.5rem;
    }

    .section-label {
        font-size: 0.7rem;
    }

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

    .feature-card,
    .service-card {
        padding: 1.75rem;
    }

    .icon-box {
        width: 40px;
        height: 40px;
    }

    /* Disable tilt on touch */
    .feature-card,
    .service-card,
    .pricing-card {
        transform: none !important;
    }

    /* --- PRICING --- */
    .pricing-grid {
        grid-template-columns: 1fr !important;
        max-width: 100%;
    }

    .pricing-price {
        font-size: 2.25rem;
    }

    .pricing-card {
        padding: 2rem 1.5rem;
    }

    /* --- TESTIMONIALS --- */
    .testimonial-card {
        padding: 1.75rem;
    }

    .testimonial-card::before {
        font-size: 3.5rem;
    }

    /* --- FAQ --- */
    .faq-accordion {
        margin: 2rem auto 0;
    }

    .faq-header {
        padding: 1.1rem 1.25rem;
    }

    .faq-header h4 {
        font-size: 0.9rem;
    }

    .faq-content-inner {
        font-size: 0.875rem;
    }

    .faq-content-wrapper.open .faq-content-inner {
        padding: 0 1.25rem 1.25rem;
    }

    /* --- CONTACT --- */
    .contact-form.card {
        padding: 1.75rem;
    }

    .map-placeholder {
        height: 200px;
    }

    /* --- STEPS --- */
    .step-number {
        font-size: 3rem;
    }

    /* --- OFFERS --- */
    .offers .card {
        padding: 2.5rem 1.5rem !important;
    }

    .offers h2 {
        font-size: 1.6rem !important;
    }

    /* --- FOOTER --- */
    .footer-top {
        grid-template-columns: 1fr !important;
        gap: 2rem;
    }

    .footer-col:first-child {
        grid-column: auto;
    }

    .footer {
        padding-top: 3.5rem;
        padding-bottom: 3.5rem;
    }

    /* --- ABOUT --- */
    .about .split-image {
        height: 220px !important;
    }

    /* --- Scroll progress bar hides on tiny screens --- */
    .scroll-progress {
        display: none;
    }

    /* --- Back to top repositioned --- */
    .back-to-top {
        bottom: 1.25rem;
        inset-inline-end: 1.25rem;
        width: 40px;
        height: 40px;
    }
}


/* --------------------------------------------------------------------------
   SMALL MOBILE  ≤ 575px
   -------------------------------------------------------------------------- */

@media (max-width: 575px) {

    .container {
        padding: 0 1rem;
    }

    .section-spacing {
        padding: 3.5rem 0;
    }

    .hero-title {
        font-size: clamp(1.75rem, 8.5vw, 2.25rem);
    }

    /* Nav logo smaller */
    .logo img {
        height: 20px;
    }

    /* Feature/Service cards full-width */
    .feature-card h3,
    .service-card h3 {
        font-size: 1rem;
    }

    .feature-card p,
    .service-card p {
        font-size: 0.875rem;
    }

    /* Testimonial stars */
    .testimonial-stars {
        font-size: 0.8rem;
    }

    /* Pricing price big number */
    .pricing-price {
        font-size: 2rem;
    }

    /* FAQ narrower padding */
    .faq-header {
        padding: 1rem;
    }

    /* Contact form */
    .form-control {
        font-size: 0.95rem;
    }

    /* Footer links */
    .footer-links a {
        font-size: 0.85rem;
    }
}


/* --------------------------------------------------------------------------
   TOOL PAGE  —  Generator App  (all sizes)
   -------------------------------------------------------------------------- */

/* --- Tool app header --- */
.app-header {
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
}

.app-header h1 {
    font-size: clamp(1.1rem, 3vw, 1.5rem) !important;
}

/* --- Sidebar overlay backdrop --- */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 999;
    opacity: 0;
    transition: opacity 280ms ease;
}

.sidebar-backdrop.visible {
    display: block;
    opacity: 1;
}

/* --- Palette grid responsive --- */
.palette-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(450px, 100%), 1fr)) !important;
    gap: 1.5rem !important;
    margin-top: 2rem;
}

/* --- Swatch grid scales down --- */
.swatch-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 0.75rem !important;
}

.swatch-item {
    height: 64px !important;
    padding: 0.75rem !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: flex-start !important;
    border-radius: 8px !important;
    position: relative;
    overflow: hidden;
}

@media (max-width: 991px) {
    /* Sidebar always off-canvas on tablet */
    .sidebar {
        width: 300px;
        z-index: 1000;
    }

    /* Main content takes full width */
    .main-content {
        padding: 1.5rem;
        width: 100%;
    }

    .app-layout.sidebar-open {
        padding-inline-start: 0 !important; /* sidebar is overlay, not push */
    }

    /* Palette grid: 2 columns */
    .palette-grid {
        grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)) !important;
    }
}

@media (max-width: 767px) {
    .sidebar {
        width: 100%;
        max-width: 320px;
    }

    .main-content {
        padding: 1rem;
    }

    .app-header {
        margin: -1rem -1rem 1rem -1rem !important;
        padding: 0.75rem 1rem;
    }

    /* Palette grid: 1 column */
    .palette-grid {
        grid-template-columns: 1fr !important;
    }

    .swatch-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Preview container */
    .preview-container {
        font-size: 0.85rem;
    }

    .preview-content {
        height: auto !important;
        min-height: 300px;
        padding: 2rem 1rem;
    }

    /* Generate button */
    #generate-btn {
        font-size: 0.95rem;
        padding: 0.8rem 1.25rem;
    }
}

@media (max-width: 575px) {
    .swatch-item {
        height: 58px !important;
        font-size: 0.75rem !important;
    }

    .palette-header {
        font-size: 0.875rem;
    }

    .saved-item {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
}


/* --------------------------------------------------------------------------
   AUTH PAGES  (Login / Sign Up)
   -------------------------------------------------------------------------- */

@media (max-width: 767px) {
    .login-container {
        padding: 1rem !important;
    }

    .login-card {
        padding: 2rem 1.5rem !important;
    }

    .login-header h2 {
        font-size: 1.5rem !important;
    }
}

@media (max-width: 575px) {
    .login-card {
        padding: 1.5rem 1.25rem !important;
        border-radius: var(--r-md);
    }

    .login-header h2 {
        font-size: 1.35rem !important;
    }
}


/* --------------------------------------------------------------------------
   LEGAL PAGES  (Privacy / Terms)
   -------------------------------------------------------------------------- */

@media (max-width: 767px) {
    .legal-container,
    .privacy-content,
    .terms-content {
        padding: 2rem 1.25rem;
    }

    .legal-container h1 {
        font-size: 1.75rem;
    }

    .legal-container h2 {
        font-size: 1.25rem;
    }
}


/* --------------------------------------------------------------------------
   TOUCH DEVICE IMPROVEMENTS
   min-height on tap targets, remove hover-only states
   -------------------------------------------------------------------------- */

@media (hover: none) {
    /* Remove tilt / hover transforms on touch */
    .feature-card:hover,
    .service-card:hover,
    .pricing-card:hover,
    .testimonial-card:hover,
    .card:hover {
        transform: none;
        box-shadow: var(--shadow-soft);
    }

    /* Icon box stays static on touch */
    .service-card:hover .icon-box,
    .feature-card:hover .icon-box {
        transform: none;
    }

    /* Ensure buttons have large enough tap targets */
    .btn {
        min-height: 44px;
    }

    .nav-link {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

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

    .color-btn {
        width: 36px !important;
        height: 36px !important;
    }
}


/* --------------------------------------------------------------------------
   PRINT  —  remove motion/decorative
   -------------------------------------------------------------------------- */

@media print {
    .navbar,
    .back-to-top,
    .scroll-progress,
    .mobile-nav,
    .hero-interactive,
    .nav-hamburger {
        display: none !important;
    }

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

    .section-spacing {
        padding: 2rem 0;
    }

    .card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}


/* --------------------------------------------------------------------------
   UTILITY HELPERS (responsive)
   -------------------------------------------------------------------------- */

.hide-mobile {
    display: block;
}

.show-mobile {
    display: none;
}

@media (max-width: 767px) {
    .hide-mobile { display: none !important; }
    .show-mobile { display: block !important; }
    .text-center-mobile { text-align: center; }
}


/* --------------------------------------------------------------------------
   FOOTER — Grid layout (always defined here, overrides polish.css)
   -------------------------------------------------------------------------- */

.footer-top {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 3rem;
    padding-bottom: 3rem;
    border-bottom: 1px solid var(--border-main);
    margin-bottom: 2rem;
    text-align: start;
}

.footer-top h5 {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-main);
    margin-bottom: 1.25rem;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.footer-links a {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 180ms ease;
}

.footer-links a:hover {
    color: var(--text-main);
}

.footer-brand p {
    max-width: 260px;
    line-height: 1.75;
    margin-top: 10px;
}

.footer-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-bottom-links {
    display: flex;
    gap: 1.25rem;
}

.footer-bottom-links a {
    font-size: 0.8rem;
    color: var(--text-light);
    text-decoration: none;
    transition: color 180ms ease;
}

.footer-bottom-links a:hover {
    color: var(--text-muted);
}

/* Tablet footer: 2 columns */
@media (max-width: 991px) {
    .footer-top {
        grid-template-columns: 1fr 1fr;
        gap: 2.5rem;
    }
    .footer-brand {
        grid-column: 1 / -1;
    }
}

/* Mobile footer: 1 column */
@media (max-width: 575px) {
    .footer-top {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    .footer-brand {
        grid-column: auto;
    }
    .footer-bottom {
        flex-direction: column;
        text-align: center;
        align-items: center;
    }
}


/* --------------------------------------------------------------------------
   TOOL PAGE — Mobile FAB (Floating Action Button)
   -------------------------------------------------------------------------- */

.tool-fab {
    display: none; /* hidden on desktop */
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-main);
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 0.7rem 1.4rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    gap: 0.5rem;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    z-index: 998;
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.tool-fab:hover {
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.22);
}

@media (max-width: 991px) {
    .tool-fab {
        display: flex;
    }
}


/* --------------------------------------------------------------------------
   CONTACT — Wrapper responsive stacking
   -------------------------------------------------------------------------- */

.contact-wrapper {
    display: flex;
    gap: 3rem;
    align-items: flex-start;
}

.contact-info {
    flex: 0 0 320px;
    max-width: 320px;
}

.contact-form {
    flex: 1;
    min-width: 0;
}

@media (max-width: 991px) {
    .contact-wrapper {
        flex-direction: column;
    }
    .contact-info {
        flex: none;
        max-width: 100%;
        width: 100%;
    }
}


/* --------------------------------------------------------------------------
   SECTION LABEL — Responsive sizing
   -------------------------------------------------------------------------- */

.section-label {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--brand-accent);
    margin-bottom: 0.75rem;
}


/* --------------------------------------------------------------------------
   STEP NUMBER — class-based (replaces inline style)
   -------------------------------------------------------------------------- */

.step-number {
    display: block;
    font-size: clamp(3rem, 6vw, 4.5rem);
    font-weight: 900;
    color: var(--text-main);
    opacity: 0.05;
    line-height: 1;
    margin-bottom: 0.5rem; /* fixed: no negative margin */
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.04em;
}


/* --------------------------------------------------------------------------
   ABOUT SECTION — Palette swatch visual
   -------------------------------------------------------------------------- */

.about-visual {
    padding: 2rem;
    overflow: hidden;
    height: 360px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-muted);
}

.about-visual-inner {
    width: 100%;
}

.about-visual-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--text-light);
    margin-bottom: 1.25rem;
    text-align: center;
}

.about-palette-row {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
    border-radius: 12px;
    overflow: hidden;
}

.about-swatch {
    flex: 1;
    height: 44px;
    border-radius: 0;
    transition: transform 0.2s ease, filter 0.2s ease;
}

.about-swatch:hover {
    filter: brightness(1.1);
    transform: scaleY(1.08);
}

.about-palette-row:first-of-type .about-swatch:first-child { border-top-left-radius: 10px; }
.about-palette-row:first-of-type .about-swatch:last-child  { border-top-right-radius: 10px; }
.about-palette-row:last-of-type .about-swatch:first-child  { border-bottom-left-radius: 10px; }
.about-palette-row:last-of-type .about-swatch:last-child   { border-bottom-right-radius: 10px; }

@media (max-width: 991px) {
    .about-visual {
        height: 280px !important;
    }
    .about-swatch {
        height: 36px;
    }
}

@media (max-width: 767px) {
    .about-visual {
        height: auto !important;
        padding: 1.5rem;
    }
    .about-swatch {
        height: 30px;
    }
}


/* --------------------------------------------------------------------------
   MOBILE NAV BUTTON
   -------------------------------------------------------------------------- */

.mobile-nav-btn {
    margin-top: 1.5rem;
    display: inline-flex;
    justify-content: center;
    align-self: flex-start;
}


/* --------------------------------------------------------------------------
   HERO SPLIT LAYOUT — alignment helpers
   -------------------------------------------------------------------------- */

.hero-split {
    align-items: center;
    gap: 3rem;
}

.hero-text-col {
    z-index: 2;
}

@media (min-width: 992px) {
    .hero-split {
        gap: 4rem;
    }
}
