/* Editor + Front shared styles (enhanced with responsive design and typography improvements) */

/* Typography utilities */
.page-header h1,
h1, h2, h3 {
    line-height: 1.2;
    margin: 0 0 10px;
}

.page-header {
    margin-bottom: 18px;
}

/* Enhanced typography hierarchy */
.lead {
    font-size: clamp(1.125rem, 2.5vw, 1.375rem);
    line-height: 1.6;
    color: var(--ink-2);
}

.section-title {
    font-size: clamp(1.5rem, 4vw, 2.25rem);
    margin-bottom: 2rem;
    background: linear-gradient(120deg, #e8f5f1, #9ee4cd);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* Entry content defaults */
.entry-content p,
.description,
.card p {
    color: var(--color-text-muted);
}

/* Lists in cards */
.card ul {
    margin: 0 0 10px 18px;
}

.card li {
    margin: 6px 0;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    border: 1px solid var(--color-border);
    padding: 8px 10px;
}

thead th {
    background: rgba(255,255,255,0.03);
}

/* Images */
.entry-thumb {
    margin: 10px 0 16px;
    border-radius: var(--radius);
    overflow: hidden;
}

.wp-block-image img {
    border-radius: var(--radius-sm);
}

/* Buttons in content */
.entry-content .wp-block-button__link {
    font-weight: 600;
}

/* Forms (enhance spacing) */
form label {
    font-weight: 600;
}

form .description {
    font-size: 13px;
    color: var(--color-text-muted);
}

/* Navigation current item */
.main-navigation .is-current > a {
    background: rgba(154,214,189,0.12);
}

/* Footer widgets */
.widget-title {
    margin: 0 0 8px;
}

/* Enhanced card hover states */
.card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(52, 203, 161, 0.15);
}

/* Mobile menu toggle button */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: background-color 0.2s ease;
}

.menu-toggle:hover {
    background: rgba(52, 203, 161, 0.1);
}

.hamburger {
    display: flex;
    flex-direction: column;
    width: 24px;
    height: 18px;
    justify-content: space-between;
}

.hamburger span {
    display: block;
    height: 2px;
    width: 100%;
    background: var(--ink);
    border-radius: 1px;
    transition: all 0.3s ease;
    transform-origin: center;
}

.menu-toggle[aria-expanded="true"] .hamburger span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.menu-toggle[aria-expanded="true"] .hamburger span:nth-child(2) {
    opacity: 0;
}

.menu-toggle[aria-expanded="true"] .hamburger span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Better mobile navigation */
@media (max-width: 760px) {
    .menu-toggle {
        display: block;
    }

    .main-navigation {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--surface);
        border: 1px solid var(--line);
        border-top: none;
        border-radius: 0 0 var(--radius-sm) var(--radius-sm);
        box-shadow: var(--shadow-md);
        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px);
        transition: all 0.3s ease;
        z-index: 1000;
    }

    .main-navigation.mobile-menu-open {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .main-navigation ul {
        flex-direction: column;
        gap: 0;
        padding: 1rem;
    }

    .main-navigation li {
        width: 100%;
    }

    .main-navigation a {
        display: block;
        padding: 12px 16px;
        border-radius: var(--radius-sm);
        margin: 2px 0;
    }

    /* Prevent body scroll when menu is open */
    .menu-open {
        overflow: hidden;
    }
}

/* Touch-friendly interactions */
@media (max-width: 760px) {
    .btn, .button {
        min-height: 44px; /* iOS touch target */
        padding: 12px 24px;
    }

    .card {
        padding: 1.5rem;
    }
}

/* Enhanced focus states */
.btn:focus,
.button:focus,
a:focus {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

/* Better contrast ratios */
@media (prefers-contrast: high) {
    .muted {
        color: var(--ink);
    }
}

/* Loading states */
.btn.loading {
    position: relative;
    pointer-events: none;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Editor adjustments */
.editor-styles-wrapper {
    color: var(--color-text);
}

.editor-styles-wrapper .wp-block {
    max-width: var(--container);
}

.editor-styles-wrapper .wp-block[data-align="wide"] {
    max-width: 1100px;
}

.editor-styles-wrapper .wp-block[data-align="full"] {
    max-width: none;
}

/* Enhanced accessibility helpers */
.skip-links {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 9999;
}

.skip-link {
    position: absolute;
    left: -10000px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
    background: var(--brand);
    color: #062621;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.skip-link:focus {
    position: static;
    width: auto;
    height: auto;
    left: 20px;
    top: 20px;
    transform: translateY(0);
}

/* Enhanced focus indicators */
*:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: var(--radius-xs);
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    .card,
    .btn,
    .menu-toggle,
    .hamburger span {
        transition: none;
    }

    .card:hover {
        transform: none;
    }
}

/* Enhanced touch interactions */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets on touch devices */
    .main-navigation a {
        padding: 14px 18px;
        min-height: 48px;
        display: flex;
        align-items: center;
    }

    .btn, .button {
        min-height: 48px;
        padding: 14px 28px;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    /* Remove hover effects on touch devices */
    .card:hover {
        transform: none;
        box-shadow: var(--shadow-sm);
    }

    .menu-toggle:hover {
        background: transparent;
    }
}

/* Enhanced button states */
.btn:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
}

/* Smooth transitions for better UX */
.btn,
.card,
.menu-toggle {
    transition: all 0.2s ease;
}

/* Focus management for better accessibility */
.user-is-tabbing *:focus {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

/* High contrast mode improvements */
@media (prefers-contrast: high) {
    .btn {
        border-width: 2px;
    }

    .card {
        border-width: 2px;
    }

    .muted {
        color: var(--ink);
        font-weight: 600;
    }
}
