/* ── Reset ── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ── Variables ── */
:root {
    --text-primary: #111111;
    --text-secondary: #555555;
    --text-tertiary: #888888;
    --accent: #2e7d4f;
    --accent-line: #2e7d4f;
    --bg: #ffffff;
    --border: #e0e0e0;
    --rule: #d0d0d0;
}

/* ── Base ── */
html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg);
    color: var(--text-primary);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Layout ── */
.page {
    max-width: 960px;
    margin: 0 auto;
    padding: 60px 24px 80px;
    position: relative;
    z-index: 1;
}

/* ── Full-Page Animated Bubble Background ── */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}

.bg-animation span {
    position: absolute;
    display: block;
    background: rgba(0, 0, 0, 0.035);
    animation: float 25s linear infinite;
    bottom: -150px;
    border-radius: 50%;
}

.bg-animation span:nth-child(1)  { left: 25%; width: 80px;  height: 80px;  animation-delay: 0s; }
.bg-animation span:nth-child(2)  { left: 10%; width: 20px;  height: 20px;  animation-delay: 2s;  animation-duration: 12s; }
.bg-animation span:nth-child(3)  { left: 70%; width: 20px;  height: 20px;  animation-delay: 4s; }
.bg-animation span:nth-child(4)  { left: 40%; width: 60px;  height: 60px;  animation-delay: 0s;  animation-duration: 18s; }
.bg-animation span:nth-child(5)  { left: 65%; width: 20px;  height: 20px;  animation-delay: 0s; }
.bg-animation span:nth-child(6)  { left: 75%; width: 110px; height: 110px; animation-delay: 3s; }
.bg-animation span:nth-child(7)  { left: 35%; width: 150px; height: 150px; animation-delay: 7s; }
.bg-animation span:nth-child(8)  { left: 50%; width: 25px;  height: 25px;  animation-delay: 15s; animation-duration: 45s; }
.bg-animation span:nth-child(9)  { left: 20%; width: 15px;  height: 15px;  animation-delay: 2s;  animation-duration: 35s; }
.bg-animation span:nth-child(10) { left: 85%; width: 150px; height: 150px; animation-delay: 0s;  animation-duration: 11s; }

@keyframes float {
    0%   { transform: translateY(0) rotate(0deg);      opacity: 1; }
    100% { transform: translateY(-1000px) rotate(720deg); opacity: 0; }
}

/* ── Navigation ── */
.site-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 32px;
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    width: 100vw;
    margin-top: -60px;
    margin-bottom: 0;
    height: 56px;
}

.nav-header {
    display: flex;
    align-items: center;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0;
    height: 100%;
}

.nav-links a {
    display: flex;
    align-items: center;
    height: 56px;
    padding: 0 24px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    letter-spacing: 0.02em;
    border-bottom: 3px solid transparent;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.nav-links a:hover {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.02);
}

.nav-links a.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.site-nav .nav-logo {
    height: 28px;
    display: block;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--text-primary);
    cursor: pointer;
    padding: 4px;
}

/* ── Header Hero ── */
.site-header {
    text-align: center;
    padding: 80px 24px 60px;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    margin-top: -60px;
    margin-bottom: 48px;
    width: 100vw;
    background: linear-gradient(180deg, #ededed 0%, #f7f7f7 50%, #ffffff 100%);
    border-bottom: 1px solid var(--border);
}

.site-header img {
    height: 48px;
    display: inline-block;
    margin-bottom: 28px;
}

.hero-text {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: clamp(2.2rem, 5vw, 3.5rem);
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
    letter-spacing: -0.02em;
    max-width: 700px;
    margin: 0 auto;
}

.hero-text .accent {
    color: #4CAF50;
}

/* ── Sections ── */
.section {
    margin-bottom: 32px;
}

/* ── Content Card ── */
.content-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 36px 32px;
}

.content-card .card-label {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    text-transform: none;
    color: var(--text-primary);
    margin-bottom: 16px;
}

/* ── Typography ── */
h2 {
    font-family: 'Source Serif 4', 'Georgia', serif;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-primary);
    margin: 28px 0 12px;
    letter-spacing: -0.01em;
}

h2:first-of-type {
    margin-top: 0;
}

p {
    font-size: 0.975rem;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 12px;
}

p:last-child {
    margin-bottom: 0;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ── Lists (sub-pages) ── */
ul {
    list-style: none;
    padding: 0;
    margin: 0 0 16px;
}

ul li {
    position: relative;
    padding-left: 20px;
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 8px;
}

ul li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 10px;
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
}

ul li strong {
    color: var(--text-primary);
}

/* ── Last Updated (sub-pages) ── */
.last-updated {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    margin-bottom: 24px;
}

/* ── Positioning (homepage) ── */
.positioning p + p {
    margin-top: 1.2em;
}

.positioning p {
    font-size: 0.975rem;
    color: var(--text-secondary);
    line-height: 1.8;
}

/* ── Method List (homepage) ── */
.method-list {
    list-style: none;
    padding: 0;
}

.method-list li {
    position: relative;
    padding-left: 20px;
    font-size: 0.925rem;
    color: var(--text-secondary);
    line-height: 1.75;
    margin-bottom: 10px;
}

.method-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 11px;
    width: 6px;
    height: 6px;
    border: 1.5px solid var(--accent);
    border-radius: 50%;
}

/* ── Medium Articles (homepage) ── */
.medium-section h2 {
    font-size: 1.2rem;
    margin-bottom: 24px;
}

.articles-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.article-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
}

.article-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.article-card a {
    text-decoration: none;
    color: inherit;
}

.article-image {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
}

.article-image-placeholder {
    width: 100%;
    height: 140px;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    font-size: 2rem;
}

.article-thumb {
    flex: 0 0 160px;
    min-height: 140px;
    overflow: hidden;
}

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

.article-thumb .article-image-placeholder {
    width: 100%;
    height: 100%;
    min-height: 140px;
}

.article-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.article-card h3 {
    font-family: 'Source Serif 4', 'Georgia', serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-excerpt {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--accent);
    font-size: 0.825rem;
    font-weight: 500;
    text-decoration: none;
}

.article-link:hover {
    text-decoration: underline;
}

.article-link i {
    font-size: 0.7rem;
}

.article-loading {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-tertiary);
    font-size: 0.9rem;
}

.article-loading i {
    display: block;
    font-size: 1.5rem;
    margin-bottom: 12px;
    color: var(--text-tertiary);
}

.medium-link {
    display: inline-block;
    margin-top: 4px;
    font-size: 0.875rem;
    color: var(--accent);
    text-decoration: none;
    letter-spacing: 0.01em;
}

.medium-link:hover {
    text-decoration: underline;
}

/* ── Footer ── */
.site-footer {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
    text-align: center;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 20px;
    margin-bottom: 16px;
}

.footer-links a {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-decoration: none;
}

.footer-links a:hover {
    color: var(--text-primary);
}

.site-footer p {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    line-height: 1.6;
}

.site-footer a {
    color: var(--text-tertiary);
    text-decoration: none;
}

.site-footer a:hover {
    color: var(--text-primary);
}

/* ── Topic Filters ── */
.topic-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.topic-filters a {
    background: #f5f5f5;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 6px 16px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    text-decoration: none;
}

.topic-filters a:hover {
    background: #eaeaea;
    color: var(--text-primary);
}

.topic-filters a.active {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
}

/* ── Article Tag ── */
.article-tag {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--accent);
    background: rgba(46, 125, 79, 0.08);
    padding: 2px 8px;
    border-radius: 3px;
    margin-bottom: 8px;
}

/* ── View All Link ── */
.view-all-link {
    display: inline-block;
    margin-top: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
}

.view-all-link:hover {
    text-decoration: underline;
}

/* ── Article Date (homepage cards) ── */
.article-date-small {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    margin-bottom: 8px;
}

/* ── Article Pages ── */
.article-page .article-date {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    margin-bottom: 24px;
}

.article-page .article-subtitle {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    font-style: italic;
    margin-bottom: 24px;
    line-height: 1.6;
}

.article-page .content-card h2 {
    margin-top: 32px;
}

.article-page .content-card em {
    color: var(--text-primary);
}

.article-page .article-original {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* ── Article Tag Inline (article pages) ── */
.article-tag-inline {
    margin-bottom: 24px;
}

.article-tag-inline a {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--accent);
    background: rgba(46, 125, 79, 0.08);
    padding: 3px 10px;
    border-radius: 3px;
    text-decoration: none;
}

.article-tag-inline a:hover {
    background: rgba(46, 125, 79, 0.15);
}

/* ── Pagination ── */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.pagination-link {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    padding: 8px 16px;
    border: 1px solid var(--accent);
    border-radius: 6px;
    transition: all 0.2s;
}

.pagination-link:hover {
    background: var(--accent);
    color: #ffffff;
}

.pagination-link.disabled {
    color: var(--text-tertiary);
    border-color: var(--border);
    cursor: default;
    pointer-events: none;
}

.pagination-info {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
    .articles-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .articles-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .site-nav {
        flex-wrap: wrap;
        gap: 0;
        padding: 12px 20px;
        position: relative;
        height: auto;
        overflow: visible;
    }

    .site-nav .nav-links {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        width: 100%;
        background: #ffffff;
        border-bottom: 1px solid var(--border);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
        z-index: 200;
        gap: 0;
        text-align: center;
    }

    .site-nav .nav-links.open {
        display: flex;
    }

    .site-nav .nav-links a {
        height: 48px;
        border-bottom: none;
        border-left: 3px solid transparent;
    }

    .site-nav .nav-links a.active {
        border-bottom: none;
        border-left-color: var(--accent);
        background: rgba(0, 0, 0, 0.02);
    }

    .site-nav .nav-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }

    .nav-toggle {
        display: block;
    }
}

@media (max-width: 600px) {
    .page {
        padding: 40px 20px 60px;
    }

    .site-header {
        padding: 60px 20px 44px;
        margin-left: calc(-50vw + 50%);
        margin-right: calc(-50vw + 50%);
        margin-top: -40px;
        margin-bottom: 36px;
        width: 100vw;
    }

    .site-header img {
        height: 40px;
        margin-bottom: 22px;
    }

    .hero-text {
        font-size: 1.8rem;
    }

    .section {
        margin-bottom: 24px;
    }

    .content-card {
        padding: 28px 22px;
    }

    .footer-links {
        gap: 4px 16px;
    }

    .articles-grid {
        grid-template-columns: 1fr;
    }

    .article-thumb {
        flex: 0 0 auto;
        min-height: 0;
        height: 160px;
    }
}
