/*!
 * Pratica Sbloccata - Main Stylesheet
 * Block theme FSE - vanilla CSS, no framework, no jQuery
 * Design tokens sincronizzati con theme.json
 *
 * @package PraticaSbloccata
 * @version 1.0.0
 */

/* ============================================================================
   1. RESET & BASE
   ============================================================================ */

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

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

body {
    font-family: var(--wp--preset--font-family--system);
    font-size: var(--wp--preset--font-size--medium);
    line-height: 1.6;
    color: var(--wp--preset--color--text);
    background-color: var(--wp--preset--color--background);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--wp--preset--color--primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--wp--preset--color--primary-dark);
}

a:focus-visible {
    outline: 3px solid var(--wp--preset--color--accent);
    outline-offset: 3px;
    border-radius: 4px;
}

/* Skip link accessibilità */
.skip-link {
    position: absolute;
    left: -10000px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.skip-link:focus {
    position: fixed;
    top: 1rem;
    left: 1rem;
    width: auto;
    height: auto;
    background: var(--wp--preset--color--primary);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    z-index: 99999;
}

/* ============================================================================
   2. HEADER
   ============================================================================ */

.ps-site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.wp-block-site-logo {
    max-width: 180px;
    height: auto;
}

.wp-block-site-logo img {
    max-height: 60px;
    width: auto;
}

.ps-main-nav {
    gap: 1.5rem;
}

.ps-main-nav a {
    color: var(--wp--preset--color--text);
    font-weight: 600;
    padding: 0.5rem 0;
    position: relative;
}

.ps-main-nav a:hover {
    color: var(--wp--preset--color--primary);
}

.ps-main-nav a::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--wp--preset--color--accent);
    transition: width 0.3s ease;
}

.ps-main-nav a:hover::after {
    width: 100%;
}

/* Mobile menu fallback (theme.json gestisce wp-navigation responsive) */
@media (max-width: 781px) {
    .ps-site-header .wp-block-buttons {
        display: none;
    }
}

/* ============================================================================
   3. HERO
   ============================================================================ */

.ps-hero {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #1a56db 100%);
    color: var(--wp--preset--color--background);
    position: relative;
    overflow: hidden;
    text-align: center;
}

.ps-hero::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 80% 20%, rgba(52, 211, 153, 0.15) 0%, transparent 50%);
    pointer-events: none;
}

.ps-hero > * {
    position: relative;
    z-index: 2;
}

.ps-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 10px 20px;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
}

.ps-badge-icon {
    background: var(--wp--preset--color--accent);
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

.ps-hero-highlight {
    color: #34d399;
    display: inline-block;
}

.ps-hero-trust {
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.ps-trust-item {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* ============================================================================
   4. SECTIONS / BADGES / TITLES
   ============================================================================ */

.ps-section {
    padding: var(--wp--preset--spacing--70) 0;
}

.ps-badge {
    display: inline-block;
    background: var(--wp--preset--color--accent-light);
    color: var(--wp--preset--color--accent);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wp-block-heading {
    letter-spacing: -0.02em;
    line-height: 1.2;
}

/* ============================================================================
   5. PROBLEM / SOLUTION / RESULT
   ============================================================================ */

.ps-problem-section {
    background: var(--wp--preset--color--background-alt);
}

.ps-problem-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.ps-problem-card {
    background: var(--wp--preset--color--background);
    border-radius: 12px;
    padding: 2rem 1.5rem;
    border-top: 4px solid var(--wp--preset--color--danger);
}

.ps-problem-card.solution {
    border-top-color: var(--wp--preset--color--accent);
}

.ps-problem-card.result {
    border-top-color: var(--wp--preset--color--primary);
}

.ps-problem-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.ps-problem-list,
.ps-problem-card ul {
    list-style: none;
}

.ps-problem-list li,
.ps-problem-card ul li {
    padding: 8px 0 8px 24px;
    position: relative;
    font-size: 0.95rem;
    color: var(--wp--preset--color--text-light);
    line-height: 1.5;
}

.ps-problem-card.problem ul li::before {
    content: "✗";
    position: absolute;
    left: 0;
    color: var(--wp--preset--color--danger);
    font-weight: 700;
}

.ps-problem-card.solution ul li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--wp--preset--color--accent);
    font-weight: 700;
}

.ps-problem-card.result ul li::before {
    content: "★";
    position: absolute;
    left: 0;
    color: var(--wp--preset--color--primary);
    font-weight: 700;
}

@media (max-width: 768px) {
    .ps-problem-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
}

/* ============================================================================
   6. SERVICES GRID
   ============================================================================ */

.ps-services-section {
    background: var(--wp--preset--color--background);
}

.ps-services-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.ps-service-card {
    background: var(--wp--preset--color--background-alt);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-left: 4px solid var(--wp--preset--color--primary);
}

.ps-service-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}

.ps-service-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.ps-service-price {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--wp--preset--color--accent);
    margin: 1rem 0;
}

.ps-service-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--wp--preset--color--primary);
    font-weight: 600;
    transition: gap 0.2s ease;
}

.ps-service-link:hover {
    gap: 10px;
}

@media (max-width: 768px) {
    .ps-services-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================================================
   7. HOW IT WORKS (4 STEP)
   ============================================================================ */

.ps-howto-section {
    background: var(--wp--preset--color--background-alt);
}

.ps-howto-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    position: relative;
}

.ps-howto-step {
    position: relative;
    text-align: center;
    padding: 1.5rem 1rem;
}

.ps-howto-num {
    width: 56px;
    height: 56px;
    background: var(--wp--preset--color--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0 auto 1rem;
    box-shadow: 0 4px 12px rgba(26, 86, 219, 0.3);
}

@media (max-width: 768px) {
    .ps-howto-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* ============================================================================
   8. WHY US
   ============================================================================ */

.ps-why-section {
    background: var(--wp--preset--color--background);
}

.ps-why-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
}

.ps-why-item {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
}

.ps-why-icon {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    background: var(--wp--preset--color--accent-light);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}

@media (max-width: 768px) {
    .ps-why-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

/* ============================================================================
   9. PRICING TABLE
   ============================================================================ */

.ps-pricing-section {
    background: var(--wp--preset--color--background-alt);
}

.ps-pricing-table {
    background: var(--wp--preset--color--background-alt);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

.ps-pricing-header {
    background: var(--wp--preset--color--primary);
    color: white;
    padding: 1rem 1.5rem;
    font-weight: 700;
    font-size: 0.9rem;
}

.ps-pricing-row {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--wp--preset--color--border);
    align-items: center;
    transition: background 0.2s ease;
}

.ps-pricing-row:hover {
    background: var(--wp--preset--color--background);
}

.ps-pricing-row:last-child {
    border-bottom: none;
}

.ps-pricing-service {
    font-weight: 600;
    font-size: 0.95rem;
}

.ps-pricing-price {
    font-weight: 800;
    color: var(--wp--preset--color--accent);
    font-size: 1.1rem;
}

.ps-pricing-includes {
    font-size: 0.85rem;
    color: var(--wp--preset--color--text-light);
    line-height: 1.5;
}

/* ============================================================================
   10. FAQ
   ============================================================================ */

.ps-faq-section {
    background: var(--wp--preset--color--background);
}

.ps-faq-list {
    max-width: 800px;
    margin: 0 auto;
}

.ps-faq-item {
    background: var(--wp--preset--color--background-alt);
    border-radius: 12px;
    margin-bottom: 0.75rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

.ps-faq-item summary {
    padding: 1.25rem 1.5rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 1rem;
    transition: background 0.2s ease;
    list-style: none;
}

.ps-faq-item summary::-webkit-details-marker {
    display: none;
}

.ps-faq-item summary:hover {
    background: var(--wp--preset--color--background);
}

.ps-faq-item summary::after {
    content: "▼";
    transition: transform 0.3s ease;
    font-size: 0.8rem;
    color: var(--wp--preset--color--text-light);
}

.ps-faq-item[open] summary::after {
    transform: rotate(180deg);
}

.ps-faq-item > * {
    padding: 0 1.5rem 1.25rem;
    font-size: 0.95rem;
    color: var(--wp--preset--color--text-light);
    line-height: 1.7;
}

/* ============================================================================
   11. CTA SECTION
   ============================================================================ */

.ps-cta-section {
    background: linear-gradient(135deg, #1e3a5f 0%, #1a56db 100%);
    color: white;
    text-align: center;
    border-radius: 0;
}

.ps-cta-section .wp-block-heading,
.ps-cta-section h2 {
    color: white;
}

.wp-block-button__link {
    transition: all 0.3s ease;
}

.ps-cta-section .wp-block-button__link {
    box-shadow: 0 8px 24px rgba(5, 150, 105, 0.4);
}

.ps-cta-section .wp-block-button__link:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(5, 150, 105, 0.5);
}

/* ============================================================================
   12. FOOTER
   ============================================================================ */

.ps-site-footer {
    background: var(--wp--preset--color--dark);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    line-height: 1.7;
}

.ps-site-footer a {
    color: rgba(255, 255, 255, 0.7);
    transition: color 0.2s ease;
}

.ps-site-footer a:hover {
    color: white;
}

.ps-footer-logo {
    margin-bottom: 1rem;
}

.ps-footer-list,
.ps-footer-list ul {
    list-style: none;
}

.ps-footer-list li {
    padding: 4px 0;
}

.ps-footer-disclaimer {
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.ps-footer-disclaimer strong {
    color: white;
}

.ps-footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* ============================================================================
   13. LANGUAGE SWITCHER (POLYLANG)
   ============================================================================ */

.ps-lang-switcher {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.ps-lang-switcher a {
    color: var(--wp--preset--color--text);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.2s ease;
}

.ps-lang-switcher a:hover {
    background: var(--wp--preset--color--accent-light);
    color: var(--wp--preset--color--accent);
}

.ps-lang-switcher .current-lang a {
    background: var(--wp--preset--color--primary);
    color: white;
}

/* ============================================================================
   14. RTL SUPPORT (Arabic)
   ============================================================================ */

[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] .ps-problem-card.problem ul li::before,
[dir="rtl"] .ps-problem-card.solution ul li::before,
[dir="rtl"] .ps-problem-card.result ul li::before {
    left: auto;
    right: 0;
}

[dir="rtl"] .ps-problem-list li,
[dir="rtl"] .ps-problem-card ul li {
    padding-left: 0;
    padding-right: 24px;
}

[dir="rtl"] .ps-howto-num,
[dir="rtl"] .ps-why-icon {
    margin-left: 0;
    margin-right: auto;
}

[dir="rtl"] .ps-service-card {
    border-left: 0;
    border-right: 4px solid var(--wp--preset--color--primary);
}

[dir="rtl"] body {
    font-family: 'Segoe UI', 'Tahoma', 'Cairo', 'Tajawal', 'Amiri', system-ui, sans-serif;
    font-size: 1.05rem;
    line-height: 1.8;
}

[dir="rtl"] .ps-hero-highlight::after {
    left: 0;
    right: 0;
}

[dir="rtl"] .wp-block-button__link,
[dir="rtl"] .ps-cta-btn,
[dir="rtl"] .ps-btn {
    letter-spacing: 0;
}

[dir="rtl"] .ps-hero-badge {
    font-family: 'Cairo', 'Tahoma', sans-serif;
}

[dir="rtl"] .ps-faq-item summary::after {
    content: "▼";
    transform: scaleX(-1);
}

[dir="rtl"] .ps-faq-item[open] summary::after {
    transform: rotate(180deg) scaleX(-1);
}

[dir="rtl"] .ps-trust-item,
[dir="rtl"] .ps-problem-icon,
[dir="rtl"] .ps-service-icon,
[dir="rtl"] .ps-why-icon {
    /* Keep icons in their natural visual order, not mirrored */
    transform: none;
}

/* Arabic font optimization - use system Arabic fonts via font-display swap */
@font-face {
    font-family: 'Cairo';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: local('Cairo'), local('Cairo-Regular'), local('Tahoma');
}

[lang="ar"] body,
[dir="rtl"] body {
    font-feature-settings: "kern" 1, "liga" 1;
    text-rendering: optimizeLegibility;
}

/* Arabic headings - slightly larger for readability */
[lang="ar"] h1, [lang="ar"] h2, [lang="ar"] h3 {
    letter-spacing: 0;
    font-weight: 800;
}

/* ============================================================================
   15. RESPONSIVE TWEAKS
   ============================================================================ */

@media (max-width: 1024px) {
    .ps-hero h1 {
        font-size: 2.2rem;
    }
}

@media (max-width: 768px) {
    body {
        font-size: 15px;
    }

    .ps-section {
        padding: 3rem 0;
    }

    .ps-hero {
        min-height: 480px;
    }

    .ps-hero h1 {
        font-size: 1.9rem;
    }

    .wp-block-buttons > .wp-block-button {
        width: 100%;
    }

    .wp-block-button__link {
        width: 100%;
        text-align: center;
    }
}

/* ============================================================================
   16. UTILITIES
   ============================================================================ */

.has-text-align-center {
    text-align: center;
}

.has-text-align-left {
    text-align: left;
}

.has-text-align-right {
    text-align: right;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============================================================================
   END OF STYLESHEET
   ============================================================================ */