/*
Theme Name: Aperture Editorial
Description: Custom styles for FilmGearReview.com
Version: 1.1.0
*/

/* ===========================================
   1. GLOBAL TYPOGRAPHY
   =========================================== */

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 17px;
    line-height: 1.75;
    color: #1b1c1c;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Paragraphs */
.entry-content p,
.post-content p,
.wp-block-post-content p {
    margin-bottom: 1.5em;
    line-height: 1.8;
}

/* First paragraph - intro style */
.entry-content > p:first-of-type,
.post-content > p:first-of-type,
.entry-content p:first-child,
.post-content p:first-child {
    font-size: 1.125rem;
    line-height: 1.7;
    color: #2d2e2e;
}

/* Headings */
.entry-content h2,
.post-content h2,
.wp-block-heading h2 {
    font-size: 1.875rem;
    font-weight: 700;
    margin-top: 2.5em;
    margin-bottom: 0.75em;
    line-height: 1.3;
    color: #1b1c1c;
    letter-spacing: -0.02em;
}

.entry-content h3,
.post-content h3,
.wp-block-heading h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 2em;
    margin-bottom: 0.5em;
    line-height: 1.4;
    color: #1b1c1c;
}

.entry-content h4,
.post-content h4 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}

/* ===========================================
   2. LINKS
   =========================================== */

.entry-content a,
.post-content a,
.comment-content a {
    color: #930000;
    text-decoration: none;
    transition: color 0.2s ease;
}

.entry-content a:hover,
.post-content a:hover,
.comment-content a:hover {
    color: #c00000;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ===========================================
   3. BLOCKQUOTES & PULL QUOTES
   =========================================== */

.entry-content blockquote,
.post-content blockquote,
.wp-block-quote {
    margin: 2em 0;
    padding: 1.5em 2em;
    background: linear-gradient(135deg, #fafafa 0%, #f5f5f5 100%);
    border-left: 4px solid #930000;
    border-radius: 0 8px 8px 0;
    font-style: italic;
    font-size: 1.125rem;
    line-height: 1.7;
    color: #2d2e2e;
    position: relative;
}

.entry-content blockquote::before,
.wp-block-quote::before {
    content: '\201C';
    font-size: 4rem;
    color: #930000;
    opacity: 0.2;
    position: absolute;
    top: -10px;
    left: 10px;
    font-family: Georgia, serif;
    line-height: 1;
}

.entry-content blockquote p,
.wp-block-quote p {
    margin-bottom: 0;
}

.entry-content blockquote cite,
.wp-block-quote cite {
    display: block;
    margin-top: 1em;
    font-size: 0.875rem;
    font-style: normal;
    color: #666;
}

/* Pull quotes */
.wp-block-pullquote {
    margin: 2em 0;
    padding: 2em;
    border-top: 3px solid #930000;
    border-bottom: 3px solid #930000;
    background: transparent;
    font-size: 1.5rem;
    font-style: italic;
    text-align: center;
    color: #1b1c1c;
}

.wp-block-pullquote p {
    font-size: inherit;
    line-height: 1.5;
}

/* ===========================================
   4. LISTS
   =========================================== */

.entry-content ul,
.entry-content ol,
.post-content ul,
.post-content ol {
    margin: 1.5em 0;
    padding-left: 1.5em;
}

.entry-content li,
.post-content li {
    margin-bottom: 0.75em;
    line-height: 1.7;
}

.entry-content ul li,
.post-content ul li {
    list-style: none;
    position: relative;
}

.entry-content ul li::before,
.post-content ul li::before {
    content: '';
    position: absolute;
    left: -1.25em;
    top: 0.65em;
    width: 6px;
    height: 6px;
    background: #930000;
    border-radius: 50%;
}

.entry-content ol li,
.post-content ol li {
    list-style-type: decimal;
    color: #930000;
    font-weight: 500;
}

/* ===========================================
   5. IMAGES IN POSTS
   =========================================== */

.entry-content img,
.post-content img,
.wp-block-image img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1.5em 0;
}

.entry-content figure,
.wp-block-image {
    margin: 2em 0;
}

.entry-content figure img,
.wp-block-image img {
    margin: 0;
}

/* Image captions */
.entry-content figcaption,
.wp-block-image figcaption,
.wp-caption-text {
    font-size: 0.875rem;
    color: #666;
    text-align: center;
    margin-top: 0.75em;
    padding: 0.5em;
    background: rgba(0,0,0,0.02);
    border-radius: 4px;
}

/* Full-width images */
.entry-content .alignfull,
.wp-block-image.alignfull {
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    max-width: 100vw;
}

/* Wide images */
.entry-content .alignwide,
.wp-block-image.alignwide {
    margin-left: -5%;
    margin-right: -5%;
    max-width: 110%;
}

/* ===========================================
   6. CODE BLOCKS
   =========================================== */

.entry-content code,
.post-content code,
.wp-block-code code {
    font-family: 'SF Mono', 'Fira Code', 'Monaco', monospace;
    font-size: 0.9em;
    background: #f5f5f5;
    padding: 0.2em 0.4em;
    border-radius: 4px;
    color: #c00000;
}

.entry-content pre,
.post-content pre,
.wp-block-code {
    margin: 1.5em 0;
    padding: 1.5em;
    background: #1e1e1e;
    border-radius: 8px;
    overflow-x: auto;
}

.entry-content pre code,
.wp-block-code code {
    background: transparent;
    color: #d4d4d4;
    padding: 0;
    font-size: 0.875rem;
    line-height: 1.6;
}

/* ===========================================
   7. TABLES (Enhanced)
   =========================================== */

.wp-block-table {
    margin: 2rem 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.wp-block-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.04);
}

.wp-block-table thead {
    background: linear-gradient(135deg, #1b1c1c 0%, #2d2e2e 100%);
}

.wp-block-table thead th {
    color: #fff;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1rem 1.25rem;
    text-align: left;
}

.wp-block-table tbody tr {
    border-bottom: 1px solid #e8e8e8;
    transition: background 0.2s ease;
}

.wp-block-table tbody tr:hover {
    background: rgba(147, 0, 0, 0.03);
}

.wp-block-table tbody tr:last-child {
    border-bottom: none;
}

.wp-block-table tbody td {
    padding: 0.875rem 1.25rem;
    vertical-align: middle;
}

.wp-block-table tbody td:first-child {
    font-weight: 600;
    background: rgba(0,0,0,0.02);
}

/* Sticky first column on mobile */
@media (max-width: 768px) {
    .wp-block-table {
        font-size: 0.85rem;
        border: 1px solid #e0e0e0;
    }
    
    .wp-block-table thead th:first-child,
    .wp-block-table tbody td:first-child {
        position: sticky;
        left: 0;
        background: #fff;
        z-index: 1;
        box-shadow: 2px 0 4px rgba(0,0,0,0.1);
    }
    
    .wp-block-table thead th:first-child {
        background: #1e1e1e;
    }
}

/* ===========================================
   8. BUTTONS & CTAs
   =========================================== */

.entry-content .wp-block-button__link,
.post-content .wp-block-button__link,
.btn-amazon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5em;
    padding: 0.875em 1.5em;
    background: #FF9900 !important;
    color: #000 !important;
    font-weight: 700 !important;
    font-size: 0.875rem !important;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 6px !important;
    border: none !important;
    transition: all 0.2s ease !important;
    cursor: pointer;
}

.entry-content .wp-block-button__link:hover,
.btn-amazon:hover {
    background: #E68A00 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 153, 0, 0.4);
    color: #000 !important;
}

/* ===========================================
   9. NAVIGATION & HOVER STATES
   =========================================== */

/* Focus states for accessibility */
a:focus-visible,
button:focus-visible,
input:focus-visible {
    outline: 2px solid #930000;
    outline-offset: 2px;
}

/* Menu links hover */
header a:hover {
    color: #930000;
}

/* ===========================================
   10. AFFILIATE LINKS IN CONTENT
   =========================================== */

a[href*="/recommends/"] {
    color: #c45500;
    font-weight: 600;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

a[href*="/recommends/"]:hover {
    color: #930000;
    border-bottom-color: #930000;
    background: rgba(147, 0, 0, 0.05);
    padding: 2px 6px;
    margin: 0 -6px;
    border-radius: 4px;
}

/* ===========================================
   11. SIDEBAR STYLING
   =========================================== */

.widget-area .widget {
    margin-bottom: 2em;
}

.widget-area h3 {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #666;
    margin-bottom: 1em;
    padding-bottom: 0.5em;
    border-bottom: 2px solid #e0e0e0;
}

/* ===========================================
   12. AUTHOR BIO BOX
   =========================================== */

.wp-block-author-bio {
    background: #fafafa;
    padding: 1.5em;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

/* ===========================================
   13. MOBILE OPTIMIZATIONS
   =========================================== */

@media (max-width: 768px) {
    body {
        font-size: 16px;
    }
    
    .entry-content h2 {
        font-size: 1.5rem;
    }
    
    .entry-content h3 {
        font-size: 1.25rem;
    }
    
    .entry-content blockquote {
        padding: 1em 1.25em;
        font-size: 1rem;
    }
    
    /* Reduce spacing on mobile */
    .entry-content {
        margin-left: 1rem;
        margin-right: 1rem;
    }
    
    /* Full width on mobile */
    .entry-content .alignfull,
    .wp-block-image.alignfull {
        margin-left: -1rem;
        margin-right: -1rem;
    }
}

/* ===========================================
   14. PRINT STYLES
   =========================================== */

@media print {
    .sticky-sidebar,
    .widget-area,
    footer,
    nav {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.5;
    }
    
    a[href*="/recommends/"]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666;
    }
}

/* ===========================================
   15. SPEC OVERLAY LEGACY
   =========================================== */

.aperture-spec-overlay-container {
    position: relative;
    overflow: hidden;
}

.aperture-spec-overlay {
    position: absolute;
    bottom: -100%;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 1.5rem;
    transition: bottom 0.3s ease-in-out;
}

.aperture-spec-overlay-container:hover .aperture-spec-overlay {
    bottom: 0;
}

/* FORCE TABLE STYLES OVERRIDE - Higher specificity */
html body .wp-block-table {
    margin: 2rem 0 !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
}

html body .wp-block-table table {
    width: 100% !important;
    border-collapse: collapse !important;
    font-size: 0.9rem !important;
    line-height: 1.5 !important;
    background: #fff !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.04) !important;
    border: none !important;
}

html body .wp-block-table thead {
    background: linear-gradient(135deg, #1b1c1c 0%, #2d2e2e 100%) !important;
}

html body .wp-block-table thead th {
    color: #fff !important;
    font-weight: 700 !important;
    font-size: 0.75rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    padding: 1rem 1.25rem !important;
    text-align: left !important;
    border: none !important;
}

html body .wp-block-table tbody tr {
    border-bottom: 1px solid #e8e8e8 !important;
    transition: background 0.2s ease !important;
}

html body .wp-block-table tbody tr:hover {
    background: rgba(147, 0, 0, 0.03) !important;
}

html body .wp-block-table tbody td {
    padding: 0.875rem 1.25rem !important;
    color: #1b1c1c !important;
    vertical-align: middle !important;
    border: none !important;
}

html body .wp-block-table tbody tr:nth-child(even) {
    background: #fafafa !important;
}

/* ===========================================
   COMMENT SECTION STYLING
   =========================================== */

/* Comments Container */
.wp-block-post-comments {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid #e0e0e0;
}

.comments-title,
.comment-reply-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1b1c1c;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #930000;
    display: inline-block;
}

/* Comment List */
.commentlist {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Individual Comment */
.comment {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #f0f0f0;
}

.comment:last-child {
    border-bottom: none;
}

/* Comment Body */
.comment-body {
    display: flex;
    gap: 1rem;
}

/* Avatar */
.comment-author img.avatar,
.avatar {
    border-radius: 50% !important;
    object-fit: cover;
    border: 2px solid #e0e0e0;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.comment-author img.avatar:hover {
    transform: scale(1.05);
    border-color: #930000;
}

/* Author Name */
.comment-author .fn,
.comment-author .fn a {
    font-weight: 700;
    color: #1b1c1c;
    font-size: 0.95rem;
    text-decoration: none;
}

.comment-author .fn a:hover {
    color: #930000;
}

/* Author Badge - for contributors/admins */
.comment-author .fn .author-badge,
.bypostauthor .comment-author .fn::after {
    display: inline-block;
    background: #930000;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 6px;
    vertical-align: middle;
}

.bypostauthor > .comment-body > .comment-meta > .comment-author > .fn::after {
    content: 'Author';
    display: inline-block;
    background: #930000;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 8px;
}

/* Comment Meta */
.comment-metadata {
    font-size: 0.8rem;
    color: #888;
    margin-top: 0.25rem;
}

.comment-metadata a {
    color: #888;
    text-decoration: none;
}

.comment-metadata a:hover {
    color: #930000;
}

/* Comment Content */
.comment-content {
    margin-top: 1rem;
    padding-left: 3.5rem;
}

.comment-content p {
    margin-bottom: 1em;
    line-height: 1.7;
    color: #2d2e2e;
}

.comment-content p:last-child {
    margin-bottom: 0;
}

/* Reply Button */
.comment-reply-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 0.75rem;
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #930000 !important;
    background: rgba(147, 0, 0, 0.08);
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.comment-reply-link:hover {
    background: #930000;
    color: #fff !important;
}

/* Nested Replies */
.children {
    list-style: none;
    margin-left: 2rem;
    padding-left: 1.5rem;
    border-left: 2px solid #f0f0f0;
}

.children .comment {
    margin-top: 1.5rem;
}

.children .comment-body {
    flex-direction: column;
}

.children .comment-content {
    padding-left: 0;
}

/* Comment Form */
.comment-respond {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #e0e0e0;
}

.comment-reply-title {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
}

.comment-form label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #1b1c1c;
    margin-bottom: 0.5rem;
}

.comment-form input[type=text],
.comment-form input[type=email],
.comment-form input[type=url],
.comment-form textarea {
    width: 100%;
    padding: 12px 16px;
    font-size: 0.95rem;
    font-family: inherit;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

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

.comment-form textarea {
    min-height: 150px;
    resize: vertical;
}

.comment-form-comment,
.comment-form-author,
.comment-form-email,
.comment-form-url {
    margin-bottom: 1.25rem;
}

.form-submit {
    margin-top: 1.5rem;
}

.submit {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 0.9rem;
    font-weight: 700;
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #fff;
    background: #930000;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.submit:hover {
    background: #c00000;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(147, 0, 0, 0.3);
}

/* Comment Notes */
.comment-notes {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 1.5rem;
}

.comment-form-cookies-consent {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    color: #666;
}

.comment-form-cookies-consent input[type=checkbox] {
    width: 18px;
    height: 18px;
    accent-color: #930000;
}

/* Empty Comments State */
.comments-area:empty {
    display: none;
}

/* Loading State */
.comment-awaiting-moderation {
    font-style: italic;
    color: #888;
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
    background: #fafafa;
    border-radius: 4px;
    margin-top: 1rem;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .comment-body {
        flex-direction: column;
    }
    
    .comment-content {
        padding-left: 0;
        margin-top: 0.75rem;
    }
    
    .children {
        margin-left: 1rem;
        padding-left: 1rem;
    }
    
    .avatar {
        width: 40px !important;
        height: 40px !important;
    }
}
