/* === Components === */

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition), transform var(--transition);
    text-decoration: none;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
    background: var(--emerald);
    color: var(--pure-white);
}

.btn-primary:hover { background: var(--emerald-hover); color: var(--pure-white); }

/* Section Titles */
.section-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-sm);
    border-bottom: 3px solid var(--emerald);
    display: inline-block;
}

/* Card Grid */
.card-grid {
    display: grid;
    gap: var(--space-xl);
}

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

/* Card */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.card__link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.card__image {
    aspect-ratio: 3 / 2;
    overflow: hidden;
}

.card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

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

.card__body {
    padding: var(--space-lg);
}

.card__category {
    display: inline-block;
    font-family: var(--font-body);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--emerald);
    margin-bottom: var(--space-sm);
}

.card__title {
    font-family: var(--font-display);
    font-size: 1.125rem;
    line-height: 1.35;
    margin-bottom: var(--space-sm);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card__title a { color: var(--text-heading); text-decoration: none; }
.card__title a:hover { color: var(--emerald); }

.card__excerpt {
    font-size: 0.875rem;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: var(--space-md);
}

.card__meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    flex-wrap: wrap;
}

.card__sep { opacity: 0.5; }
.card__views { color: var(--text-secondary); font-weight: 400; }
.card__read { color: var(--emerald); font-weight: 500; }

/* Hero */
.hero__link {
    display: block;
    position: relative;
    color: var(--pure-white);
    text-decoration: none;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.hero__image {
    aspect-ratio: 21 / 9;
}

.hero__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.hero__body {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--space-3xl) var(--space-xl) var(--space-xl);
    background: linear-gradient(to top, rgba(15, 26, 46, 0.9) 0%, rgba(15, 26, 46, 0.4) 60%, transparent 100%);
}

.hero__title {
    font-size: 2rem;
    margin-bottom: var(--space-sm);
    line-height: 1.25;
    color: var(--pure-white);
}

.hero__excerpt {
    font-size: 0.9375rem;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: var(--space-md);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hero__link .card__meta {
    color: rgba(255, 255, 255, 0.7);
}

.hero__link .card__date,
.hero__link .card__views {
    color: rgba(255, 255, 255, 0.7);
}

.hero__link .card__read {
    color: var(--emerald);
}

.hero__link .card__sep {
    color: rgba(255, 255, 255, 0.4);
}

/* Home Sections */
.home-layout {
    max-width: var(--wide-width);
    margin: 0 auto;
    padding: var(--space-2xl) var(--space-lg);
}

.home-hero {
    margin-bottom: var(--space-3xl);
}

.home-section {
    margin-bottom: var(--space-3xl);
}

/* Article Single */
.article-single {
    max-width: var(--wide-width);
    margin: 0 auto;
    padding: var(--space-2xl) var(--space-lg);
}

.article-header__inner {
    max-width: var(--content-width);
    margin: 0 auto;
    text-align: center;
    padding: var(--space-xl) 0;
}

.article-header__title {
    font-size: 2.25rem;
    line-height: 1.2;
    margin-bottom: var(--space-md);
}

.article-header__meta {
    font-size: 0.875rem;
    color: var(--text-secondary);
    display: flex;
    justify-content: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.article-featured-image {
    max-width: 900px;
    margin: 0 auto var(--space-xl);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.article-featured-image img {
    width: 100%;
}

/* Article Body */
.article-body {
    max-width: var(--content-width);
    margin: 0 auto;
    font-size: 1.0625rem;
    line-height: 1.8;
    color: var(--text-body);
}

.article-body h2 {
    font-size: 1.625rem;
    margin: var(--space-2xl) 0 var(--space-md);
}

.article-body h3 {
    font-size: 1.25rem;
    margin: var(--space-xl) 0 var(--space-md);
}

.article-body p {
    margin-bottom: 1.35em;
}

.article-body ul,
.article-body ol {
    margin-bottom: 1.25em;
    padding-left: 1.5em;
}

.article-body ul { list-style: disc; }
.article-body ol { list-style: decimal; }

.article-body li {
    margin-bottom: 0.4em;
}

.article-body blockquote {
    border-left: 4px solid var(--emerald);
    padding: var(--space-md) var(--space-lg);
    margin: var(--space-xl) 0;
    background: var(--emerald-soft);
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.125rem;
    color: var(--text-heading);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.article-body blockquote p {
    margin-bottom: 0;
}

/* Data Highlight Box */
.article-body .wp-block-group.is-style-data-highlight,
.article-body .data-highlight {
    background: var(--emerald-soft);
    border-left: 3px solid var(--emerald);
    padding: var(--space-lg);
    margin: var(--space-xl) 0;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.article-body .data-highlight strong,
.article-body .data-highlight b {
    font-family: var(--font-mono);
    font-size: 1.25em;
    color: var(--navy);
}

/* Tables */
.article-body table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--space-xl) 0;
    font-size: 0.9375rem;
}

.article-body th {
    text-align: left;
    padding: var(--space-sm) var(--space-md);
    border-bottom: 2px solid var(--border);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-secondary);
}

.article-body td {
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--border-light);
}

.article-body tr:nth-child(even) {
    background: var(--bg-section);
}

/* Numbers right-aligned */
.article-body td[data-align="right"],
.article-body .align-numbers {
    text-align: right;
    font-family: var(--font-mono);
}

/* Article Footer */
.article-footer {
    max-width: var(--content-width);
    margin: var(--space-2xl) auto 0;
    padding-top: var(--space-xl);
    border-top: 1px solid var(--border);
}

.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-bottom: var(--space-xl);
}

.tag {
    display: inline-block;
    padding: var(--space-xs) var(--space-md);
    background: var(--bg-section);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 20px;
    text-decoration: none;
    transition: background var(--transition), color var(--transition);
}

.tag:hover {
    background: var(--emerald-soft);
    color: var(--emerald);
}

/* Related Posts */
.related-posts {
    margin-top: var(--space-2xl);
}

.related-posts__title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    margin-bottom: var(--space-lg);
}

/* Share Bar */
.share-bar {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin: var(--space-xl) 0;
    flex-wrap: wrap;
}

.share-bar__label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-right: var(--space-xs);
}

.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 50%;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--pure-white);
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
    font-family: var(--font-body);
    line-height: 1;
}

.share-btn:hover {
    border-color: var(--emerald);
    color: var(--emerald);
    background: var(--emerald-soft);
}

.share-btn svg {
    flex-shrink: 0;
    display: block;
    width: 18px;
    height: 18px;
}

.share-btn--copy {
    margin-left: auto;
    width: auto;
    height: 36px;
    padding: 0 14px;
    border-radius: var(--radius-md);
}

.share-btn--copy.copied {
    border-color: var(--emerald);
    color: var(--emerald);
    background: var(--emerald-soft);
}

/* Share style: icon+label — pill buttons */
.share-bar--both .share-btn {
    width: auto;
    padding: 0 14px;
    border-radius: var(--radius-md);
}

/* Share style: label only — pill buttons, hide SVGs */
.share-bar--label .share-btn {
    width: auto;
    padding: 0 14px;
    border-radius: var(--radius-md);
}

.share-bar--label .share-btn svg {
    display: none;
}

/* Comments */
.comment-list {
    list-style: none;
    padding: 0;
    margin: 0 0 var(--space-xl);
}

.comment-list .children {
    list-style: none;
    padding-left: var(--space-xl);
    margin: 0;
}

.comment-body {
    padding: var(--space-lg) 0;
    border-bottom: 1px solid var(--border-light);
}

.comment-body:first-child {
    padding-top: 0;
}

.comment-meta {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
    flex-wrap: wrap;
}

.comment-author img {
    border-radius: 50%;
    vertical-align: middle;
    margin-right: var(--space-xs);
}

.comment-author .fn {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text-heading);
}

.comment-author .says {
    display: none;
}

.comment-metadata {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.comment-metadata a {
    color: var(--text-secondary);
    text-decoration: none;
}

.comment-content {
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--text-body);
}

.comment-content p {
    margin-bottom: var(--space-sm);
}

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

.reply {
    margin-top: var(--space-sm);
}

.comment-reply-link {
    font-size: 0.8125rem;
    color: var(--emerald);
    font-weight: 500;
    text-decoration: none;
}

.comment-reply-link:hover {
    color: var(--emerald-hover);
}

/* Comment form */
.comment-respond {
    margin-top: var(--space-xl);
    padding-top: var(--space-xl);
    border-top: 1px solid var(--border-light);
}

.comment-form {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
}

.comment-form-comment,
.comment-form-author,
.comment-form-email {
    width: 100%;
}

.comment-form-author,
.comment-form-email {
    flex: 1 1 220px;
}

.comment-form label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    margin-bottom: var(--space-xs);
    color: var(--text-heading);
}

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form textarea {
    width: 100%;
    padding: 0.625rem var(--space-md);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.9375rem;
    background: var(--pure-white);
    color: var(--text-body);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.comment-form input:focus,
.comment-form textarea:focus {
    outline: none;
    border-color: var(--emerald);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

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

.comment-form .form-submit {
    width: 100%;
    margin-top: var(--space-xs);
}

.comment-form .submit {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    background: var(--emerald);
    color: var(--pure-white);
    transition: background var(--transition);
}

.comment-form .submit:hover {
    background: var(--emerald-hover);
}

.logged-in-as {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
}

.logged-in-as a {
    color: var(--emerald);
}

/* Newsletter */
.newsletter {
    background: var(--emerald);
    color: var(--pure-white);
    padding: var(--space-3xl) var(--space-lg);
    border-radius: var(--radius-lg);
    margin: var(--space-3xl) 0;
    text-align: center;
}

.newsletter__title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    margin-bottom: var(--space-sm);
    color: var(--pure-white);
}

.newsletter__desc {
    font-size: 0.9375rem;
    opacity: 0.9;
    margin-bottom: var(--space-lg);
}

.newsletter__form {
    display: flex;
    gap: var(--space-sm);
    max-width: 440px;
    margin: 0 auto;
}

.newsletter__form input[type="email"] {
    flex: 1;
    padding: 0.75rem var(--space-md);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.15);
    color: var(--pure-white);
    font-size: 0.9375rem;
    font-family: var(--font-body);
}

.newsletter__form input[type="email"]::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.newsletter__form input[type="email"]:focus {
    outline: none;
    border-color: var(--pure-white);
    background: rgba(255, 255, 255, 0.2);
}

.newsletter__form .btn {
    background: var(--pure-white);
    color: var(--emerald-hover);
    font-weight: 700;
    white-space: nowrap;
}

.newsletter__form .btn:hover {
    background: var(--white);
}

/* 404 */
.error-404 {
    max-width: 480px;
    margin: var(--space-4xl) auto;
    text-align: center;
}

.error-404 h1 {
    font-size: 6rem;
    color: var(--emerald);
    margin-bottom: var(--space-md);
}

.error-404 p {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-xl);
}

/* Pagination */
.pagination .nav-links {
    display: flex;
    gap: var(--space-sm);
    justify-content: center;
    margin-top: var(--space-2xl);
}

.pagination .page-numbers {
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    color: var(--text-body);
    text-decoration: none;
}

.pagination .page-numbers.current {
    background: var(--emerald);
    color: var(--pure-white);
    border-color: var(--emerald);
}

.pagination .page-numbers:hover:not(.current) {
    border-color: var(--emerald);
    color: var(--emerald);
}

/* Archive Header */
.archive-layout {
    max-width: var(--wide-width);
    margin: 0 auto;
    padding: var(--space-2xl) var(--space-lg);
}

.archive-header {
    margin-bottom: var(--space-2xl);
}

.archive-header__title {
    font-size: 2rem;
}

.archive-header__title span {
    color: var(--emerald);
}

.no-results {
    text-align: center;
    padding: var(--space-3xl);
    color: var(--text-secondary);
}

/* Widget */
.widget {
    margin-bottom: var(--space-xl);
}

.widget-title {
    font-family: var(--font-display);
    font-size: 1rem;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 2px solid var(--emerald);
}

/* === Responsive: Tablet (≤1024px) === */
@media (max-width: 1024px) {
    .card-grid--3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* === Responsive: Tablet portrait (≤768px) === */
@media (max-width: 768px) {
    .hero__title {
        font-size: 1.5rem;
    }

    .hero__body {
        padding: var(--space-2xl) var(--space-lg) var(--space-lg);
    }

    .home-layout {
        padding: var(--space-xl) var(--space-md);
    }

    .article-single {
        padding: var(--space-xl) var(--space-md);
    }

    .article-header__title {
        font-size: 1.75rem;
    }

    .article-body {
        font-size: 1rem;
    }

    .article-body h2 {
        font-size: 1.375rem;
    }

    .article-body h3 {
        font-size: 1.125rem;
    }

    .article-body blockquote {
        font-size: 1rem;
        padding: var(--space-md);
    }

    .article-body .data-highlight {
        padding: var(--space-md);
    }

    .archive-layout {
        padding: var(--space-xl) var(--space-md);
    }

    .archive-header__title {
        font-size: 1.5rem;
    }

    .section-title {
        font-size: 1.25rem;
    }

    .newsletter {
        padding: var(--space-2xl) var(--space-md);
    }

    .error-404 h1 {
        font-size: 4rem;
    }
}

/* === Responsive: Mobile (≤640px) === */
@media (max-width: 640px) {
    .card-grid--3 {
        grid-template-columns: 1fr;
    }

    .card__body {
        padding: var(--space-md);
    }

    .home-layout {
        padding: var(--space-lg) var(--space-md);
    }

    .home-hero {
        margin-bottom: var(--space-2xl);
    }

    .home-section {
        margin-bottom: var(--space-2xl);
    }

    .article-single {
        padding: var(--space-lg) var(--space-md);
    }

    .article-header__inner {
        padding: var(--space-md) 0;
    }

    .article-header__title {
        font-size: 1.5rem;
    }

    .article-body {
        font-size: 0.9375rem;
        line-height: 1.75;
    }

    .article-body h2 {
        font-size: 1.25rem;
    }

    .article-body h3 {
        font-size: 1.0625rem;
    }

    .article-body table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .newsletter__form {
        flex-direction: column;
    }

    .newsletter {
        padding: var(--space-xl) var(--space-md);
        border-radius: var(--radius-md);
    }

    .pagination .nav-links {
        flex-wrap: wrap;
    }

    .error-404 h1 {
        font-size: 3rem;
    }

    .section-title {
        font-size: 1.125rem;
    }

    .hero__image {
        aspect-ratio: 16 / 9;
    }

    .hero__title {
        font-size: 1.25rem;
    }

    .hero__body {
        padding: var(--space-xl) var(--space-md) var(--space-md);
    }

    .share-btn {
        padding: 5px 8px;
        font-size: 0.75rem;
    }

    .share-bar--both .share-btn span {
        display: none;
    }

    .comment-list .children {
        padding-left: var(--space-md);
    }

    .comment-form-author,
    .comment-form-email {
        flex: 1 1 100%;
    }
}
