/*
Theme Name: Reader's Digest
Theme URI: https://example.com/readersdigest-starter
Author: Custom
Author URI: https://example.com
Description: Classic magazine theme inspired by Reader's Digest. Warm colors, traditional typography, family-friendly design.
Version: 1.0.2
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: readersdigest
Tags: blog, magazine, classic, warm, family
*/

/* === CSS Variables === */
:root {
    --rdg-primary: #c41e3a;
    --rdg-secondary: #1a3a5c;
    --rdg-accent: #f5a623;
    --rdg-bg: #ffffff;
    --rdg-bg-alt: #faf8f5;
    --rdg-bg-warm: #fcf9f4;
    --rdg-text: #333333;
    --rdg-text-light: #777777;
    --rdg-border: #e0dcd5;
    --rdg-font-heading: 'Playfair Display', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    --rdg-font-body: 'Source Serif Pro', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    --rdg-font-ui: 'Open Sans', -apple-system, sans-serif;
    --rdg-max-width: 1140px;
    --rdg-content-width: 700px;
    --rdg-transition: 0.2s ease;
}

/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; }

html {
    font-size: 17px;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--rdg-font-body);
    font-size: 1rem;
    line-height: 1.75;
    color: var(--rdg-text);
    background: var(--rdg-bg);
}

a {
    color: var(--rdg-primary);
    text-decoration: none;
    transition: color var(--rdg-transition);
}

a:hover { color: var(--rdg-secondary); }

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

/* === Typography === */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--rdg-font-heading);
    font-weight: 700;
    line-height: 1.25;
    margin: 0 0 0.75rem;
    color: var(--rdg-secondary);
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.375rem; }
h4 { font-size: 1.125rem; }

p { margin: 0 0 1.25rem; }

blockquote {
    margin: 2rem 0;
    padding: 1.5rem 2rem;
    background: var(--rdg-bg-warm);
    border-left: 4px solid var(--rdg-primary);
    font-style: italic;
    font-size: 1.1rem;
}

/* === Layout === */
.rdg-container {
    max-width: var(--rdg-max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* === Skip Link === */
.rdg-skip {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 9999;
    background: var(--rdg-primary);
    color: #fff;
    padding: 0.75rem 1.5rem;
}

.rdg-skip:focus { left: 0; }

/* === Header === */
.rdg-header {
    background: var(--rdg-bg);
    border-bottom: 3px solid var(--rdg-primary);
}

.rdg-header__top {
    background: var(--rdg-primary);
    padding: 0.5rem 0;
}

.rdg-header__top-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--rdg-font-ui);
    font-size: 0.75rem;
    color: #fff;
}

.rdg-header__date {
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.rdg-header__main {
    padding: 1.5rem 0;
    text-align: center;
}

.rdg-logo img,
.rdg-logo .custom-logo,
.custom-logo-link img {
    max-height: 60px;
    max-width: 200px;
    width: auto;
    height: auto;
    object-fit: contain;
    margin: 0 auto;
}

.rdg-site-name {
    font-family: var(--rdg-font-heading);
    font-size: 2.5rem;
    margin: 0;
    color: var(--rdg-primary);
}

.rdg-site-name a { color: inherit; }
.rdg-site-name a:hover { color: var(--rdg-secondary); }

.rdg-tagline {
    font-family: var(--rdg-font-ui);
    font-size: 0.85rem;
    color: var(--rdg-text-light);
    margin: 0.5rem 0 0;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* === Navigation === */
.rdg-nav {
    background: var(--rdg-secondary);
    padding: 0;
}

.rdg-nav__inner {
    display: flex;
    justify-content: center;
    align-items: center;
}

.rdg-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
}

.rdg-menu a {
    display: block;
    padding: 0.875rem 1.25rem;
    font-family: var(--rdg-font-ui);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #fff;
    letter-spacing: 0.03em;
}

.rdg-menu a:hover,
.rdg-menu .current-menu-item a {
    background: var(--rdg-primary);
}

.rdg-menu-btn {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-family: var(--rdg-font-ui);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    cursor: pointer;
    padding: 0.875rem 1.25rem;
}

/* === Main === */
.rdg-main {
    padding: 2.5rem 0;
    min-height: 60vh;
}

.rdg-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 3rem;
}

.rdg-layout--full {
    display: block;
}

/* === Article Card === */
.rdg-card {
    margin-bottom: 2.5rem;
    padding-bottom: 2.5rem;
    border-bottom: 1px solid var(--rdg-border);
}

.rdg-card:last-child { border-bottom: none; }

.rdg-card--sticky {
    background: var(--rdg-bg-warm);
    padding: 1.5rem;
    border: 1px solid var(--rdg-border);
    margin-bottom: 2rem;
}

.rdg-card__badge {
    display: inline-block;
    font-family: var(--rdg-font-ui);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #fff;
    background: var(--rdg-primary);
    letter-spacing: 0.1em;
    padding: 0.2rem 0.6rem;
    margin-bottom: 0.75rem;
    border-radius: 2px;
}

.rdg-card--featured {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: center;
}

.rdg-card__image {
    overflow: hidden;
    border-radius: 4px;
}

.rdg-card__image img {
    width: 100%;
    transition: transform var(--rdg-transition);
}

.rdg-card:hover .rdg-card__image img {
    transform: scale(1.03);
}

.rdg-card__cat {
    display: inline-block;
    font-family: var(--rdg-font-ui);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--rdg-primary);
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
}

.rdg-card__title {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

.rdg-card__title a { color: var(--rdg-secondary); }
.rdg-card__title a:hover { color: var(--rdg-primary); }

.rdg-card--featured .rdg-card__title {
    font-size: 1.75rem;
}

.rdg-card__meta {
    font-family: var(--rdg-font-ui);
    font-size: 0.75rem;
    color: var(--rdg-text-light);
    margin-bottom: 0.75rem;
}

.rdg-card__meta span { margin-right: 1rem; }

.rdg-card__excerpt {
    color: var(--rdg-text-light);
    font-size: 0.95rem;
    line-height: 1.65;
}

.rdg-card__more {
    margin-top: 1rem;
}

.rdg-card__more a {
    font-family: var(--rdg-font-ui);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--rdg-primary);
}

.rdg-card__more a:hover { color: var(--rdg-secondary); }

.rdg-sticky-badge {
    display: inline-block;
    background: var(--rdg-accent);
    color: #fff;
    font-family: var(--rdg-font-ui);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.2rem 0.6rem;
    margin-bottom: 0.5rem;
    letter-spacing: 0.05em;
}

/* === Single Post === */
.rdg-single {
    max-width: var(--rdg-content-width);
    margin: 0 auto;
}

.rdg-single__header {
    text-align: center;
    margin-bottom: 2rem;
}

.rdg-single__cat {
    display: inline-block;
    font-family: var(--rdg-font-ui);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--rdg-primary);
    letter-spacing: 0.1em;
    margin-bottom: 1rem;
}

.rdg-single__title {
    font-size: 2.25rem;
    margin-bottom: 1rem;
    color: var(--rdg-secondary);
}

.rdg-single__meta {
    font-family: var(--rdg-font-ui);
    font-size: 0.8rem;
    color: var(--rdg-text-light);
}

.rdg-single__meta span { margin: 0 0.75rem; }

.rdg-single__featured {
    margin: 2rem 0;
    border-radius: 4px;
    overflow: hidden;
}

.rdg-single__content {
    font-size: 1.05rem;
}

.rdg-single__content h2 { margin-top: 2.5rem; }
.rdg-single__content h3 { margin-top: 2rem; }

.rdg-single__content ul,
.rdg-single__content ol {
    margin: 1.25rem 0;
    padding-left: 1.5rem;
}

.rdg-single__content li { margin-bottom: 0.5rem; }

/* Tags */
.rdg-tags {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--rdg-border);
}

.rdg-tags__title {
    font-family: var(--rdg-font-ui);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--rdg-text-light);
    margin-bottom: 0.75rem;
}

.rdg-tags a {
    display: inline-block;
    background: var(--rdg-bg-alt);
    font-family: var(--rdg-font-ui);
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    margin: 0 0.25rem 0.5rem 0;
    color: var(--rdg-text);
    border-radius: 3px;
}

.rdg-tags a:hover {
    background: var(--rdg-primary);
    color: #fff;
}

/* Author Box */
.rdg-author-box {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--rdg-bg-warm);
    border-radius: 4px;
    display: flex;
    gap: 1.5rem;
}

.rdg-author-box__avatar img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
}

.rdg-author-box__name {
    font-family: var(--rdg-font-heading);
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
    color: var(--rdg-secondary);
}

.rdg-author-box__bio {
    font-size: 0.9rem;
    color: var(--rdg-text-light);
    margin: 0;
}

/* Post Navigation */
.rdg-post-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--rdg-border);
}

.rdg-post-nav__item { flex: 1; }
.rdg-post-nav__item--next { text-align: right; }

.rdg-post-nav__label {
    font-family: var(--rdg-font-ui);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--rdg-text-light);
    display: block;
    margin-bottom: 0.25rem;
}

.rdg-post-nav__title {
    font-family: var(--rdg-font-heading);
    font-size: 1rem;
    color: var(--rdg-secondary);
}

.rdg-post-nav__title:hover { color: var(--rdg-primary); }

/* Related Posts */
.rdg-related {
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--rdg-border);
}

.rdg-related__title {
    font-family: var(--rdg-font-ui);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--rdg-text-light);
    text-align: center;
    margin-bottom: 1.5rem;
}

.rdg-related__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.rdg-related__item-title {
    font-size: 0.95rem;
    text-align: center;
}

.rdg-related__item-title a { color: var(--rdg-secondary); }
.rdg-related__item-title a:hover { color: var(--rdg-primary); }

/* === Page === */
.rdg-page {
    max-width: var(--rdg-content-width);
    margin: 0 auto;
}

.rdg-page__title {
    text-align: center;
    font-size: 2.25rem;
    margin-bottom: 2rem;
}

/* === Archive === */
.rdg-archive__header {
    text-align: center;
    padding: 2rem 0;
    background: var(--rdg-bg-warm);
    margin-bottom: 2rem;
}

.rdg-archive__label {
    font-family: var(--rdg-font-ui);
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--rdg-text-light);
    letter-spacing: 0.1em;
}

.rdg-archive__title {
    font-size: 2rem;
    margin: 0.5rem 0 0;
    color: var(--rdg-secondary);
}

/* === Sidebar === */
.rdg-sidebar {}

.rdg-widget {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--rdg-border);
}

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

.rdg-widget__title {
    font-family: var(--rdg-font-heading);
    font-size: 1rem;
    color: var(--rdg-secondary);
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--rdg-primary);
    margin-bottom: 1rem;
}

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

.rdg-widget li {
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px dotted var(--rdg-border);
}

.rdg-widget a {
    color: var(--rdg-text);
    font-size: 0.9rem;
}

.rdg-widget a:hover { color: var(--rdg-primary); }

/* === Search Form === */
.rdg-search-form {
    display: flex;
}

.rdg-search-form input[type="search"] {
    flex: 1;
    padding: 0.65rem 1rem;
    border: 1px solid var(--rdg-border);
    border-right: none;
    font-family: var(--rdg-font-body);
    font-size: 0.95rem;
    border-radius: 3px 0 0 3px;
}

.rdg-search-form input:focus {
    outline: none;
    border-color: var(--rdg-primary);
}

.rdg-search-form button {
    padding: 0.65rem 1.25rem;
    background: var(--rdg-primary);
    color: #fff;
    border: none;
    font-family: var(--rdg-font-ui);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 0 3px 3px 0;
}

.rdg-search-form button:hover {
    background: var(--rdg-secondary);
}

/* === 404 === */
.rdg-404 {
    text-align: center;
    padding: 4rem 0;
}

.rdg-404__title {
    font-size: 5rem;
    color: var(--rdg-primary);
    margin-bottom: 1rem;
}

.rdg-404__text {
    font-size: 1.25rem;
    color: var(--rdg-text-light);
    margin-bottom: 2rem;
}

.rdg-404__home {
    display: inline-block;
    background: var(--rdg-primary);
    color: #fff;
    font-family: var(--rdg-font-ui);
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.75rem 2rem;
    border-radius: 3px;
}

.rdg-404__home:hover {
    background: var(--rdg-secondary);
    color: #fff;
}

/* === Comments === */
.rdg-comments {
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--rdg-border);
}

.rdg-comments__title {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
}

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

.rdg-comment {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--rdg-border);
}

.rdg-comment__header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.rdg-comment__avatar img {
    width: 45px;
    height: 45px;
    border-radius: 50%;
}

.rdg-comment__author {
    font-family: var(--rdg-font-heading);
    font-size: 1rem;
}

.rdg-comment__date {
    font-family: var(--rdg-font-ui);
    font-size: 0.75rem;
    color: var(--rdg-text-light);
}

.rdg-comment__body { font-size: 0.95rem; }

.rdg-comment__reply a {
    font-family: var(--rdg-font-ui);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--rdg-text-light);
}

.rdg-comment__reply a:hover { color: var(--rdg-primary); }

.rdg-comment-form input,
.rdg-comment-form textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--rdg-border);
    font-family: var(--rdg-font-body);
    font-size: 1rem;
    margin-bottom: 1rem;
    border-radius: 3px;
}

.rdg-comment-form input:focus,
.rdg-comment-form textarea:focus {
    outline: none;
    border-color: var(--rdg-primary);
}

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

.rdg-comment-form button {
    background: var(--rdg-primary);
    color: #fff;
    border: none;
    padding: 0.75rem 2rem;
    font-family: var(--rdg-font-ui);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 3px;
}

.rdg-comment-form button:hover {
    background: var(--rdg-secondary);
}

/* === Breadcrumbs === */
.rdg-breadcrumbs {
    padding: 0.75rem 0;
    background: var(--rdg-bg-alt);
    font-family: var(--rdg-font-ui);
    font-size: 0.75rem;
    color: var(--rdg-text-light);
}

.rdg-breadcrumbs a { color: var(--rdg-text-light); }
.rdg-breadcrumbs a:hover { color: var(--rdg-primary); }
.rdg-breadcrumbs__sep { margin: 0 0.5rem; }

/* === Pagination === */
.rdg-pagination {
    display: flex;
    justify-content: center;
    gap: 0.25rem;
    margin-top: 2rem;
}

.rdg-pagination a,
.rdg-pagination span {
    font-family: var(--rdg-font-ui);
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
    color: var(--rdg-secondary);
    border-radius: 3px;
}

.rdg-pagination a:hover {
    background: var(--rdg-bg-alt);
}

.rdg-pagination .current {
    background: var(--rdg-primary);
    color: #fff;
}

/* === Footer === */
.rdg-footer {
    background: var(--rdg-secondary);
    color: #fff;
    padding: 3rem 0 1.5rem;
    margin-top: 3rem;
}

.rdg-footer__widgets {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2.5rem;
    margin-bottom: 2rem;
}

.rdg-footer .rdg-widget__title {
    color: #fff;
    border-bottom-color: var(--rdg-primary);
}

.rdg-footer .rdg-widget li {
    border-bottom-color: rgba(255,255,255,0.1);
}

.rdg-footer .rdg-widget a { color: rgba(255,255,255,0.7); }
.rdg-footer .rdg-widget a:hover { color: var(--rdg-accent); }

.rdg-footer__bottom {
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rdg-footer__copy {
    font-family: var(--rdg-font-ui);
    font-size: 0.8rem;
    color: rgba(255,255,255,0.6);
}

.rdg-footer-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 1.5rem;
}

.rdg-footer-menu a {
    font-family: var(--rdg-font-ui);
    font-size: 0.8rem;
    color: rgba(255,255,255,0.6);
}

.rdg-footer-menu a:hover { color: var(--rdg-accent); }

/* === Scroll to Top === */
.rdg-scroll-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 44px;
    height: 44px;
    background: var(--rdg-primary);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all var(--rdg-transition);
    font-size: 1.25rem;
}

.rdg-scroll-top.visible {
    opacity: 1;
    visibility: visible;
}

.rdg-scroll-top:hover { background: var(--rdg-secondary); }

/* === Utility === */
.rdg-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* === Media Queries === */
@media (max-width: 992px) {
    .rdg-layout {
        grid-template-columns: 1fr;
    }

    .rdg-sidebar {
        border-top: 1px solid var(--rdg-border);
        padding-top: 2rem;
    }
}

@media (max-width: 768px) {
    html { font-size: 16px; }

    .rdg-header__main { padding: 1rem 0; }
    .rdg-site-name { font-size: 2rem; }

    .rdg-menu {
        display: none;
        width: 100%;
        flex-direction: column;
    }

    .rdg-menu.open { display: flex; }
    .rdg-menu-btn { display: block; width: 100%; }

    .rdg-card--featured {
        grid-template-columns: 1fr;
    }

    .rdg-single__title { font-size: 1.75rem; }

    .rdg-related__grid { grid-template-columns: 1fr; }

    .rdg-post-nav {
        flex-direction: column;
        gap: 1.5rem;
    }

    .rdg-post-nav__item--next { text-align: left; }

    .rdg-author-box {
        flex-direction: column;
        text-align: center;
    }

    .rdg-footer__widgets { grid-template-columns: 1fr; }

    .rdg-footer__bottom {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .rdg-footer-menu {
        flex-wrap: wrap;
        justify-content: center;
    }

    .rdg-sidebar {
        display: none !important;
    }
}

/* Interlinking Section */
.read-interlinking {
    margin: 2rem 0;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 8px;
}
.read-interlinking-title {
    margin: 0 0 1rem;
    font-size: 1.25rem;
    font-weight: 600;
}
.read-interlinking-list {
    margin: 0;
    padding: 0;
    list-style: none;
}
.read-interlinking-list li {
    margin-bottom: 0.5rem;
    padding-left: 1rem;
    position: relative;
}
.read-interlinking-list li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--read-color-primary, #333);
}
.read-interlinking-list a {
    color: var(--read-color-primary, #333);
    text-decoration: none;
}
.read-interlinking-list a:hover {
    text-decoration: underline;
}

/* === Grid Layouts === */
.rdg-content.grid-3col {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}
.rdg-content.grid-2col {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
}
.rdg-content.grid-list {
    display: block;
}
.rdg-content.grid-list .rdg-card {
    margin-bottom: 30px;
}
@media (max-width: 1024px) {
    .rdg-content.grid-3col {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 768px) {
    .rdg-content.grid-3col,
    .rdg-content.grid-2col {
        grid-template-columns: 1fr;
    }
}
