/* =========================================
   R8Works Blog "Khāfan" Design V3.1
   Theme: Clean & Executive (Light Mode)
   ========================================= */

:root {
    /* --- Palette --- */
    --r8-navy: #072456;
    /* Primary Brand */
    --r8-ice: #f7f9fd;
    /* Background */
    --r8-white: #ffffff;
    /* Card Bg */
    --r8-gold: #ffc107;
    /* Accent/Action */
    --r8-text-main: rgba(15, 23, 39, 0.85);
    --r8-text-muted: rgba(15, 23, 39, 0.55);

    /* --- Shadows & Depth --- */
    --r8-shadow-soft: 0 10px 40px -10px rgba(7, 36, 86, 0.08);
    --r8-shadow-hover: 0 20px 50px -10px rgba(7, 36, 86, 0.15);
    --r8-radius: 16px;

    /* --- Typography --- */
    --r8-font-head: 'Plus Jakarta Sans', 'Inter', sans-serif;
    --r8-font-body: 'Inter', sans-serif;
}

/* --- Global Reset & Utils --- */
.r8-blog-wrapper {
    background-color: var(--r8-ice);
    font-family: var(--r8-font-body);
    color: var(--r8-text-main);
    padding-bottom: 80px;
}

.r8-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* =========================================
   1. Dynamic Hero Section (Home)
   ========================================= */
.r8-hero-v3 {
    position: relative;
    padding: 80px 0 100px;
    background: linear-gradient(135deg, var(--r8-navy) 0%, #0a357a 100%);
    color: white;
    border-radius: 0 0 40px 40px;
    margin-bottom: -60px;
    z-index: 1;
    overflow: hidden;
}

.r8-hero-v3::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(255, 193, 7, 0.15) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.r8-hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.r8-hero-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 6px 16px;
    border-radius: 50px;
    color: var(--r8-gold);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.r8-hero-title {
    font-family: var(--r8-font-head);
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 20px;
    color: white;
    letter-spacing: -1px;
}

.r8-hero-sub {
    font-size: 1.25rem;
    opacity: 0.85;
    font-weight: 300;
}

/* =========================================
   2. Bento Grid System (Home)
   ========================================= */
.r8-bento-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 24px;
    position: relative;
    z-index: 5;
}

/* --- Card Styles --- */
.r8-card-v3 {
    background: var(--r8-white);
    border-radius: var(--r8-radius);
    overflow: hidden;
    box-shadow: var(--r8-shadow-soft);
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.r8-card-v3:hover {
    transform: translateY(-8px) scale(1.01);
    box-shadow: var(--r8-shadow-hover);
}

.r8-card-figure {
    position: relative;
    overflow: hidden;
    width: 100%;
    aspect-ratio: 16/9;
}

.r8-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.r8-card-v3:hover .r8-card-img {
    transform: scale(1.08);
}

.r8-card-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.r8-card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--r8-text-muted);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.r8-pill {
    background: var(--r8-ice);
    color: var(--r8-navy);
    padding: 4px 10px;
    border-radius: 6px;
}

.r8-card-title {
    font-family: var(--r8-font-head);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--r8-navy);
    margin: 0 0 12px;
    line-height: 1.3;
}

.r8-card-excerpt {
    font-size: 0.95rem;
    color: var(--r8-text-muted);
    line-height: 1.6;
    margin-bottom: 20px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* --- Card Footer --- */
.r8-card-footer {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.r8-btn-read {
    background-color: var(--r8-navy);
    color: white;
    padding: 10px 24px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.2s ease;
    display: inline-block;
}

.r8-btn-read:hover {
    background-color: var(--r8-gold);
    color: var(--r8-navy);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.3);
}

.r8-read-time {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--r8-text-muted);
    opacity: 0.8;
}

.r8-read-time svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* --- Pagination --- */
.nav-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    font-family: var(--r8-font-head);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--r8-navy);
}

.nav-links .page-numbers {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    border-radius: 6px;
    background: white;
    color: var(--r8-navy);
    text-decoration: none;
    transition: all 0.2s;
    border: 1px solid rgba(7, 36, 86, 0.1);
}

.nav-links .page-numbers.current {
    background: var(--r8-navy);
    color: white;
    border-color: var(--r8-navy);
}

.nav-links .page-numbers:hover:not(.current) {
    background: var(--r8-ice);
    border-color: var(--r8-navy);
}

.nav-links .next,
.nav-links .prev {
    padding: 0 20px;
    width: auto;
    background: var(--r8-navy);
    color: white;
}

/* --- Layout Specifics (Bento) --- */
.r8-span-8 {
    grid-column: span 8;
    display: flex;
    flex-direction: row;
}

.r8-span-8 .r8-card-figure {
    width: 55%;
}

.r8-span-8 .r8-card-body {
    width: 45%;
    justify-content: center;
    padding: 40px;
}

.r8-span-8 .r8-card-title {
    font-size: 2.2rem;
}

.r8-span-4 {
    grid-column: span 4;
}

.r8-span-3 {
    grid-column: span 3;
}

.r8-col-4 {
    grid-column: span 4;
}

@media (max-width: 992px) {
    .r8-bento-grid {
        grid-template-columns: 1fr;
    }

    .r8-span-8 {
        grid-column: span 1;
        flex-direction: column;
    }

    .r8-span-8 .r8-card-figure,
    .r8-span-8 .r8-card-body {
        width: 100%;
    }

    .r8-span-4,
    .r8-span-3,
    .r8-col-4 {
        grid-column: span 1;
    }

    .r8-hero-title {
        font-size: 2.5rem;
    }
}

/* =========================================
   3. Single Post Design (The "California" Writer)
   ========================================= */

.r8-single-hero {
    background-size: cover;
    background-position: center;
    color: white;
    padding: 120px 0 160px;
    /* Extra bottom padding for overlap */
    margin-bottom: -100px;
    border-radius: 0 0 50px 50px;
    text-align: center;
    position: relative;
}

.r8-hero-inner {
    max-width: 800px;
    margin: 0 auto;
}

.r8-back-link {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-weight: 600;
    margin-bottom: 20px;
    display: inline-block;
    transition: color 0.2s;
}

.r8-back-link:hover {
    color: var(--r8-gold);
}

.r8-single-title {
    font-family: var(--r8-font-head);
    font-size: 3rem;
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 30px;
    letter-spacing: -1px;
}

.r8-single-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.r8-author-avatar img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.2);
}

.r8-meta-text {
    text-align: left;
    font-size: 0.9rem;
    line-height: 1.4;
}

.r8-meta-text strong {
    display: block;
    color: white;
}

.r8-meta-text span {
    color: rgba(255, 255, 255, 0.7);
}


/* Main Content Container */
.r8-single-content {
    max-width: 750px;
    /* Optimal Reading Width */
    margin: 0 auto;
    background: white;
    padding: 50px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.08);
    /* Lifted Paper Effect */
    position: relative;
    z-index: 10;
}

/* TL;DR Box */
.r8-tldr-wrapper {
    background: #fffbea;
    /* Very light gold */
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 40px;
    position: relative;
}

.r8-tldr-wrapper h3 {
    color: #926f00;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.r8-tldr-wrapper p {
    margin: 0;
    font-weight: 500;
    color: #555;
}


/* Typography (Prose) */
.r8-prose {
    font-family: var(--r8-font-body);
    font-size: 1.15rem;
    /* Larger text */
    line-height: 1.8;
    color: #334155;
    /* Slate 700 */
}

.r8-prose h2 {
    font-family: var(--r8-font-head);
    font-size: 1.8rem;
    color: var(--r8-navy);
    margin-top: 50px;
    margin-bottom: 20px;
    font-weight: 800;
}

.r8-prose h3 {
    font-size: 1.4rem;
    color: var(--r8-navy);
    margin-top: 30px;
    margin-bottom: 15px;
    font-weight: 700;
}

.r8-prose p {
    margin-bottom: 24px;
}

.r8-prose ul {
    margin-bottom: 24px;
    padding-left: 20px;
}

.r8-prose li {
    margin-bottom: 10px;
}

.r8-prose img {
    border-radius: 12px;
    max-width: 100%;
    height: auto;
}


/* In-Content CTA */
.r8-files-cta {
    background: linear-gradient(135deg, #0f172a 0%, var(--r8-navy) 100%);
    color: white;
    padding: 30px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 20px;
    margin: 40px 0;
    box-shadow: 0 10px 30px rgba(7, 36, 86, 0.2);
}

.r8-cta-icon {
    font-size: 3rem;
}

.r8-cta-text h4 {
    color: white;
    margin: 0 0 5px;
    font-size: 1.3rem;
}

.r8-cta-text p {
    margin: 0;
    opacity: 0.8;
    font-size: 0.95rem;
}

.r8-cta-button {
    margin-left: auto;
    background: var(--r8-gold);
    color: var(--r8-navy);
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    transition: transform 0.2s;
}

.r8-cta-button:hover {
    transform: scale(1.05);
}


/* Newsletter Banner */
.r8-newsletter-banner {
    max-width: 750px;
    margin: 60px auto 0;
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    border: 2px dashed rgba(7, 36, 86, 0.1);
}

.r8-newsletter-banner h3 {
    color: var(--r8-navy);
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.r8-newsletter-form {
    display: flex;
    gap: 10px;
    max-width: 400px;
    margin: 20px auto 0;
}

.r8-newsletter-form input {
    flex: 1;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.r8-newsletter-form button {
    background: var(--r8-navy);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
}


/* Sticky Actions (Mobile) */
.r8-sticky-actions {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: white;
    border-radius: 100px;
    padding: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    gap: 8px;
    z-index: 9999;
}

.r8-action-btn {
    flex: 1;
    text-align: center;
    padding: 12px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.r8-btn-phone {
    background: #f1f5f9;
    color: #334155;
}

.r8-btn-whatsapp {
    background: #DCFCE7;
    color: #166534;
}

.r8-btn-primary {
    background: var(--r8-navy);
    color: white;
    box-shadow: 0 4px 15px rgba(7, 36, 86, 0.3);
}

/* Responsive Adjustments */
@media (min-width: 900px) {
    .r8-sticky-actions {
        display: none;
    }

    /* Hide on desktop */
}

@media (max-width: 600px) {
    .r8-single-hero {
        padding: 80px 0 120px;
        border-radius: 0 0 30px 30px;
    }

    .r8-single-title {
        font-size: 2rem;
    }

    .r8-single-content {
        padding: 25px;
        margin-top: 0;
    }

    .r8-files-cta {
        flex-direction: column;
        text-align: center;
        padding: 20px;
    }

    .r8-cta-button {
        margin: 0;
        width: 100%;
        text-align: center;
    }

    .r8-newsletter-form {
        flex-direction: column;
    }
}