/**
 * Autohled Modern Theme - Custom CSS
 *
 * Additional styles beyond Tailwind CSS
 *
 * @package Autohled_Modern
 */

/* ==========================================================================
   Typography
   ========================================================================== */

/* Article content heading anchor links */
.article-content h2,
.article-content h3 {
    position: relative;
}

.article-content h2:target,
.article-content h3:target {
    scroll-margin-top: 5rem;
}

/* ==========================================================================
   Tables
   ========================================================================== */

/* Wrapper — horizontal scroll on mobile */
.article-content .wp-block-table {
    margin: 1.75rem 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
}

.article-content table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
    margin: 0;
}

.article-content th,
.article-content td {
    padding: 0.625rem 0.875rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}

/* First column (labels) can wrap */
.article-content td:first-child,
.article-content th:first-child {
    white-space: normal;
    font-weight: 500;
    color: #111827;
    min-width: 120px;
}

.article-content th {
    background-color: #f1f5f9;
    font-weight: 600;
    color: #374151;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 2px solid #dc2626;
}

/* Alternating row stripes */
.article-content tbody tr:nth-child(even) td {
    background-color: #fafafa;
}

.article-content tbody tr:hover td {
    background-color: #fef2f2;
}

/* Remove bottom border on last row */
.article-content tbody tr:last-child td {
    border-bottom: none;
}

/* Negative change values — auto red color */
.article-content td:last-child {
    font-variant-numeric: tabular-nums;
}

/* Caption styling */
.article-content .wp-block-table figcaption,
.article-content .wp-element-caption {
    font-size: 0.8125rem;
    color: #6b7280;
    padding: 0.5rem 0.875rem;
    border-top: 1px solid #e5e7eb;
    background-color: #f9fafb;
    margin: 0;
}

/* Mobile: card-style stacked layout for narrow screens */
@media only screen and (max-width: 540px) {
    .article-content .wp-block-table {
        border: none;
        border-radius: 0;
    }

    .article-content table,
    .article-content thead,
    .article-content tbody,
    .article-content th,
    .article-content td,
    .article-content tr {
        display: block;
    }

    .article-content thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
    }

    .article-content tbody tr {
        margin-bottom: 0.75rem;
        border: 1px solid #e5e7eb;
        border-radius: 0.5rem;
        overflow: hidden;
        background: #fff;
    }

    .article-content tbody tr:nth-child(even) td {
        background-color: transparent;
    }

    .article-content td {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        padding: 0.5rem 0.875rem;
        border-bottom: 1px solid #f3f4f6;
        white-space: normal;
        font-size: 0.875rem;
    }

    .article-content td:last-child {
        border-bottom: none;
    }

    /* Show header label via data-label attribute */
    .article-content td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #6b7280;
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        flex-shrink: 0;
        margin-right: 1rem;
    }

    .article-content td:first-child {
        background-color: #f1f5f9;
        font-weight: 600;
        color: #111827;
        font-size: 0.9375rem;
        border-bottom: 2px solid #dc2626;
        padding: 0.625rem 0.875rem;
    }

    .article-content td:first-child::before {
        display: none;
    }

    .article-content .wp-block-table figcaption,
    .article-content .wp-element-caption {
        border: 1px solid #e5e7eb;
        border-radius: 0.5rem;
        text-align: center;
    }
}

/* ==========================================================================
   Code blocks
   ========================================================================== */

.article-content pre {
    background-color: #1f2937;
    color: #e5e7eb;
    padding: 1.5rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin: 1.5rem 0;
    font-size: 0.875rem;
    line-height: 1.7;
}

.article-content code {
    background-color: #f3f4f6;
    color: #dc2626;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.875em;
}

.article-content pre code {
    background: transparent;
    color: inherit;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
}

/* ==========================================================================
   Responsive Video Embeds
   ========================================================================== */

.article-content iframe,
.article-content video {
    max-width: 100%;
    height: auto;
    margin: 1.5rem 0;
}

.wp-block-embed__wrapper {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    overflow: hidden;
}

.wp-block-embed__wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* ==========================================================================
   WordPress Core Blocks
   ========================================================================== */

/* Gallery */
.wp-block-gallery {
    display: grid;
    gap: 0.5rem;
    margin: 1.5rem 0;
}

.wp-block-gallery.columns-2 {
    grid-template-columns: repeat(2, 1fr);
}

.wp-block-gallery.columns-3 {
    grid-template-columns: repeat(3, 1fr);
}

.wp-block-gallery figure {
    margin: 0;
}

.wp-block-gallery img {
    width: 100%;
    height: auto;
    object-fit: cover;
}

/* Quote block */
.wp-block-quote {
    border-left: 4px solid #dc2626;
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    background-color: #f9fafb;
    font-style: italic;
}

.wp-block-quote cite {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #6b7280;
    font-style: normal;
}

/* Pullquote */
.wp-block-pullquote {
    border-top: 4px solid #dc2626;
    border-bottom: 4px solid #dc2626;
    padding: 2rem 0;
    margin: 2rem 0;
    text-align: center;
}

.wp-block-pullquote blockquote {
    border: none;
    padding: 0;
    margin: 0;
}

.wp-block-pullquote p {
    font-size: 1.5rem;
    font-weight: 500;
    color: #111827;
}

/* Cover block */
.wp-block-cover {
    position: relative;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 2rem 0;
    border-radius: 0.5rem;
    overflow: hidden;
}

.wp-block-cover__inner-container {
    position: relative;
    z-index: 1;
    padding: 2rem;
    text-align: center;
    color: white;
}

/* ==========================================================================
   Widgets
   ========================================================================== */

.widget ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.widget li {
    padding: 0.5rem 0;
    border-bottom: 1px solid #e5e7eb;
}

.widget li:last-child {
    border-bottom: none;
}

.widget a {
    color: #374151;
    text-decoration: none;
    transition: color 0.2s ease;
}

.widget a:hover {
    color: #dc2626;
}

/* ==========================================================================
   Comments
   ========================================================================== */

.comments-area {
    margin-top: 2rem;
}

.comment-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.comment {
    padding: 1.5rem 0;
    border-bottom: 1px solid #e5e7eb;
}

.comment-body {
    display: flex;
    gap: 1rem;
}

.comment-author .avatar {
    border-radius: 9999px;
}

.comment-content {
    flex: 1;
}

.comment-meta {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.comment-author .fn {
    font-weight: 600;
    color: #111827;
}

.comment-reply-link {
    font-size: 0.875rem;
    color: #dc2626;
}

.comment-respond {
    margin-top: 2rem;
}

.comment-form label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
    color: #374151;
}

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.comment-form input:focus,
.comment-form textarea:focus {
    outline: none;
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.comment-form .submit {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background-color: #dc2626;
    color: white;
    font-weight: 500;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.comment-form .submit:hover {
    background-color: #b91c1c;
}

/* ==========================================================================
   Dark Mode Support (optional - using prefers-color-scheme)
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    /* Uncomment to enable dark mode
    body {
        background-color: #111827;
        color: #e5e7eb;
    }

    .bg-white {
        background-color: #1f2937 !important;
    }

    .text-gray-900 {
        color: #f9fafb !important;
    }

    .text-gray-600,
    .text-gray-500 {
        color: #9ca3af !important;
    }

    .border-gray-200 {
        border-color: #374151 !important;
    }
    */
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

/* Skip to content link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #dc2626;
    color: white;
    padding: 8px 16px;
    z-index: 9999;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 0;
}

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

/* Focus visible improvements */
:focus-visible {
    outline: 2px solid #dc2626;
    outline-offset: 2px;
}

/* 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;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    * {
        background: white !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    a,
    a:visited {
        text-decoration: underline;
    }

    a[href]::after {
        content: " (" attr(href) ")";
    }

    pre,
    blockquote {
        page-break-inside: avoid;
    }

    thead {
        display: table-header-group;
    }

    tr,
    img {
        page-break-inside: avoid;
    }

    p,
    h2,
    h3 {
        orphans: 3;
        widows: 3;
    }

    h2,
    h3 {
        page-break-after: avoid;
    }
}

/* ==========================================================================
   Seznam SSP Ad Styles
   ========================================================================== */

/* Responsive ad visibility */
@media only screen and (max-width: 800px) {
    .banner-desktop {
        display: none !important;
    }
}

@media only screen and (min-width: 801px) {
    .banner-mobile {
        display: none !important;
    }
}

/* Ad container sizing */
.banner-desktop {
    width: 970px;
    max-width: 100%;
    margin: 0 auto;
    text-align: center;
}

.banner-mobile {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    text-align: center;
}

/* Minimum heights for ad slots to prevent layout shift */
[id^="ssp-zone-238441"] { min-height: 210px; }  /* Leaderboard */
[id^="ssp-zone-238456"] { min-height: 250px; }  /* Rectangle */
[id^="ssp-zone-238446"] { min-height: 250px; }  /* Wallpaper */
[id^="ssp-zone-238451"] { min-height: 250px; }  /* Text-only */
[id^="ssp-zone-238466"] { min-height: 300px; }  /* Mobile SMR */
[id^="ssp-zone-238471"] { min-height: 300px; }  /* Mobile SMR2 */
[id^="ssp-zone-238481"] { min-height: 300px; }  /* Mobile Text */
[id^="ssp-zone-238501"] { min-height: 300px; }  /* Mobile SMR3 */

/* ==========================================================================
   Mobile Typography Improvements
   ========================================================================== */

@media only screen and (max-width: 800px) {
    /* Improve body text readability on mobile */
    .article-content p,
    .article-content li,
    article p,
    article li {
        font-size: 1rem;      /* 16px base */
        line-height: 1.6;     /* Better readability */
    }

    /* Ensure proper heading scale on mobile */
    .article-content h2,
    article h2 {
        font-size: 1.375rem;  /* 22px */
        line-height: 1.3;
    }

    .article-content h3,
    article h3 {
        font-size: 1.125rem;  /* 18px */
        line-height: 1.4;
    }
}
