/* ============================================
   Structaly Blog — Premium Design System
   Matching Homepage Academic Warm Aesthetic
   ============================================ */

/* --- CSS Variables --- */
:root {
    --primary: #f2550d;
    --primary-light: #fff4ef;
    --primary-hover: #d94a0b;
    --bg: #fcfaf8;
    --bg-alt: #f4f2f0;
    --charcoal: #221610;
    --charcoal-70: rgba(34, 22, 16, 0.7);
    --charcoal-50: rgba(34, 22, 16, 0.5);
    --charcoal-30: rgba(34, 22, 16, 0.3);
    --border: #e8d7ce;
    --border-light: rgba(232, 215, 206, 0.4);
    --font-display: 'Newsreader', serif;
    --font-body: 'Noto Sans TC', 'Inter', sans-serif;
    --max-width: 780px;
    --max-width-wide: 1200px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 12px 40px rgba(34, 22, 16, 0.08);
    --shadow-primary: 0 4px 12px rgba(242, 85, 13, 0.25);
}

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

body {
    font-family: var(--font-body);
    background-color: var(--bg);
    color: var(--charcoal);
    line-height: 1.8;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Typography --- */
h1,
h2,
h3,
h4 {
    font-family: var(--font-display);
    line-height: 1.3;
    color: var(--charcoal);
    font-weight: 600;
    letter-spacing: -0.01em;
}

h1 {
    font-size: 2.75rem;
    margin-bottom: 1.25rem;
    letter-spacing: -0.02em;
}

h2 {
    font-size: 1.85rem;
    font-weight: 500;
    margin: 3rem 0 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-light);
}

h3 {
    font-size: 1.45rem;
    margin: 2.5rem 0 1rem;
}

h4 {
    font-size: 1.15rem;
    margin: 2rem 0 0.75rem;
}

p {
    margin-bottom: 1.5rem;
    color: var(--charcoal-70);
    line-height: 1.9;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: all 0.2s ease;
}

a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

strong {
    font-weight: 600;
    color: var(--charcoal);
}

/* --- Header / Navbar (Premium Glassmorphism) --- */
.blog-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(252, 250, 248, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-light);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.blog-header-inner {
    max-width: var(--max-width-wide);
    margin: 0 auto;
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.blog-logo {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--charcoal);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    transition: all 0.2s ease;
}

.blog-logo:hover {
    text-decoration: none;
    color: var(--primary);
    transform: translateY(-1px);
}

.blog-nav {
    display: flex;
    align-items: center;
    gap: 2.5rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.blog-nav a {
    color: var(--charcoal-70);
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
}

.blog-nav a:hover {
    color: var(--primary);
    text-decoration: none;
}

.blog-nav-cta {
    padding: 0.625rem 1.5rem;
    background: var(--primary);
    color: #fff !important;
    border-radius: 0.625rem;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.02em;
    transition: all 0.25s ease;
    text-decoration: none !important;
    box-shadow: var(--shadow-primary);
}

.blog-nav-cta:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(242, 85, 13, 0.3);
}

/* --- Article Layout --- */
.blog-article {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 4rem 1.5rem 6rem;
}

.blog-article-wide {
    max-width: 960px;
}

/* --- Article Meta --- */
.article-meta {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 2.5rem;
    font-size: 0.825rem;
    color: var(--charcoal-50);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
}

.article-meta .tag {
    background: linear-gradient(135deg, var(--primary-light) 0%, #fff9f5 100%);
    color: var(--primary);
    padding: 0.375rem 1rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    border: 1px solid rgba(242, 85, 13, 0.15);
    box-shadow: var(--shadow-sm);
}

/* --- Hero Image --- */
.article-hero {
    width: 100%;
    max-height: 460px;
    object-fit: cover;
    border-radius: 1.25rem;
    margin: 2.5rem 0;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
}

/* --- Lists --- */
.blog-article ul,
.blog-article ol {
    margin: 1.5rem 0 2rem 2rem;
    color: var(--charcoal-70);
}

.blog-article ul {
    list-style-type: disc;
}

.blog-article ol {
    list-style-type: decimal;
}

.blog-article li {
    margin-bottom: 0.75rem;
    line-height: 1.8;
    padding-left: 0.5rem;
}

.blog-article li strong {
    color: var(--charcoal);
}

/* --- Tables (Notion-inspired) --- */
.blog-table-wrapper {
    overflow-x: auto;
    margin: 2rem 0 2.5rem;
    border-radius: 1rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    background: #fff;
}

.blog-article table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: left;
}

.blog-article thead {
    background: linear-gradient(180deg, var(--bg-alt) 0%, #faf8f6 100%);
    border-bottom: 2px solid var(--border);
}

.blog-article th {
    padding: 1rem 1.25rem;
    font-weight: 600;
    color: var(--charcoal);
    white-space: nowrap;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.blog-article td {
    padding: 1rem 1.25rem;
    color: var(--charcoal-70);
    border-top: 1px solid var(--border-light);
}

.blog-article tbody tr {
    transition: all 0.2s ease;
}

.blog-article tbody tr:hover {
    background: var(--primary-light);
}

/* --- Blockquotes --- */
.blog-article blockquote {
    border-left: 4px solid var(--primary);
    padding: 1.5rem 2rem;
    margin: 2rem 0;
    background: linear-gradient(135deg, var(--primary-light) 0%, #fff9f5 100%);
    border-radius: 0 0.75rem 0.75rem 0;
    font-style: italic;
    color: var(--charcoal-70);
    box-shadow: var(--shadow-sm);
}

/* --- CTA Box (Premium Glassmorphism) --- */
.cta-box {
    background: linear-gradient(135deg, #fff4ef 0%, #fff9f5 100%);
    border: 1px solid var(--border);
    border-radius: 1.5rem;
    padding: 3rem;
    margin: 3.5rem 0;
    text-align: center;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.cta-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    opacity: 0.6;
}

.cta-box h3 {
    font-family: var(--font-display);
    font-size: 1.75rem;
    margin: 0 0 1rem;
    border: none;
}

.cta-box p {
    margin-bottom: 1.75rem;
    font-size: 1rem;
    color: var(--charcoal-70);
}

.cta-button {
    display: inline-block;
    padding: 1rem 2.5rem;
    background: var(--primary);
    color: #fff;
    border-radius: 0.75rem;
    font-weight: 700;
    font-size: 1rem;
    text-decoration: none;
    transition: all 0.25s ease;
    box-shadow: var(--shadow-primary);
}

.cta-button:hover {
    background: var(--primary-hover);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(242, 85, 13, 0.35);
    color: #fff;
    text-decoration: none;
}

/* --- FAQ Section (Enhanced) --- */
.faq-section {
    margin: 4rem 0 3rem;
}

.faq-item {
    border: 1px solid var(--border);
    border-radius: 1rem;
    margin-bottom: 1rem;
    overflow: hidden;
    background: #fff;
    box-shadow: var(--shadow-sm);
    transition: all 0.25s ease;
}

.faq-item:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.faq-item summary {
    padding: 1.5rem 2rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    list-style: none;
    transition: all 0.2s ease;
    font-size: 1.05rem;
}

.faq-item summary:hover {
    background: var(--primary-light);
}

.faq-item summary::after {
    content: '+';
    font-size: 1.5rem;
    color: var(--primary);
    transition: transform 0.3s ease;
    font-weight: 300;
}

.faq-item[open] summary::after {
    content: '−';
    transform: rotate(180deg);
}

.faq-item .faq-answer {
    padding: 0 2rem 1.5rem;
    color: var(--charcoal-70);
    font-size: 0.975rem;
    line-height: 1.9;
    border-top: 1px solid var(--border-light);
}

/* --- Table of Contents --- */
.blog-toc {
    background: linear-gradient(135deg, var(--bg-alt) 0%, #faf8f6 100%);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 2rem 2.5rem;
    margin: 2.5rem 0;
    box-shadow: var(--shadow-sm);
}

.blog-toc h4 {
    font-size: 0.825rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--charcoal-50);
    margin: 0 0 1.25rem;
    font-weight: 700;
}

.blog-toc ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.blog-toc li {
    margin-bottom: 0.625rem;
}

.blog-toc a {
    color: var(--charcoal-70);
    font-size: 0.95rem;
    text-decoration: none;
    transition: all 0.2s ease;
    display: block;
    padding: 0.25rem 0;
}

.blog-toc a:hover {
    color: var(--primary);
    transform: translateX(4px);
}

/* --- Footer --- */
.blog-footer {
    background: var(--charcoal);
    color: rgba(255, 255, 255, 0.6);
    padding: 4rem 1.5rem;
    text-align: center;
    font-size: 0.9rem;
    margin-top: 6rem;
}

.blog-footer a {
    color: rgba(255, 255, 255, 0.8);
    transition: all 0.2s ease;
}

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

/* --- Blog Listing Page --- */
.blog-listing-hero {
    text-align: center;
    padding: 5rem 1.5rem 3rem;
    max-width: var(--max-width-wide);
    margin: 0 auto;
}

.blog-listing-hero h1 {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.blog-listing-hero p {
    font-size: 1.2rem;
    color: var(--charcoal-50);
    max-width: 650px;
    margin: 0 auto;
    line-height: 1.7;
    font-style: italic;
}

.blog-section-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-weight: 700;
    color: var(--primary);
    margin: 4rem 0 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--primary);
    display: inline-block;
}

.blog-grid {
    max-width: var(--max-width-wide);
    margin: 0 auto;
    padding: 0 1.5rem 6rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 2.5rem;
}

.blog-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 1.25rem;
    overflow: hidden;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
}

.blog-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    text-decoration: none;
    border-color: var(--primary);
    color: inherit;
}

.blog-card-img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-bottom: 1px solid var(--border-light);
    transition: all 0.35s ease;
}

.blog-card:hover .blog-card-img {
    transform: scale(1.05);
}

.blog-card-body {
    padding: 2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.blog-card-tag {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--primary);
    margin-bottom: 0.75rem;
}

.blog-card-title {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    line-height: 1.4;
    color: var(--charcoal);
}

.blog-card-desc {
    font-size: 0.925rem;
    color: var(--charcoal-50);
    line-height: 1.7;
    margin-bottom: 1.5rem;
    flex: 1;
}

.blog-card-footer {
    font-size: 0.8rem;
    color: var(--charcoal-30);
    display: flex;
    align-items: center;
    gap: 1rem;
    font-weight: 500;
}

/* --- Related Articles --- */
.related-articles {
    margin: 4rem 0;
    padding-top: 3rem;
    border-top: 1px solid var(--border-light);
}

.related-articles h3 {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    border: none;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.related-card {
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 2rem;
    text-decoration: none;
    color: inherit;
    transition: all 0.25s ease;
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.related-card:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    text-decoration: none;
    color: inherit;
}

.related-card-title {
    font-family: var(--font-display);
    font-weight: 600;
    margin-bottom: 0.625rem;
    color: var(--charcoal);
    font-size: 1.1rem;
}

.related-card-desc {
    font-size: 0.9rem;
    color: var(--charcoal-50);
    line-height: 1.6;
}

/* --- Pros/Cons List --- */
.pros-cons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin: 2rem 0 2.5rem;
}

.pros-cons>div {
    padding: 1.5rem 2rem;
    border-radius: 1rem;
    font-size: 0.95rem;
    box-shadow: var(--shadow-sm);
}

.pros {
    background: linear-gradient(135deg, #f0fdf4 0%, #f7fef9 100%);
    border: 1px solid #bbf7d0;
}

.cons {
    background: linear-gradient(135deg, #fef2f2 0%, #fef9f9 100%);
    border: 1px solid #fecaca;
}

.pros-cons h4 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0 0 1rem;
    font-weight: 700;
}

.pros h4 {
    color: #16a34a;
}

.cons h4 {
    color: #dc2626;
}

.pros-cons ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.pros-cons li {
    margin-bottom: 0.5rem;
    padding-left: 1.75rem;
    position: relative;
    font-size: 0.9rem;
    line-height: 1.6;
}

.pros li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #16a34a;
    font-weight: bold;
    font-size: 1.1rem;
}

.cons li::before {
    content: '✗';
    position: absolute;
    left: 0;
    color: #dc2626;
    font-weight: bold;
    font-size: 1.1rem;
}

/* --- Highlight Box --- */
.highlight-box {
    background: linear-gradient(135deg, var(--primary-light) 0%, #fff9f5 100%);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    padding: 1.75rem 2rem;
    border-radius: 0 0.75rem 0.75rem 0;
    margin: 2rem 0;
    font-size: 1rem;
    color: var(--charcoal-70);
    box-shadow: var(--shadow-sm);
}

.highlight-box strong {
    color: var(--primary);
    font-weight: 600;
}

/* --- Responsive Design --- */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .blog-listing-hero h1 {
        font-size: 2.25rem;
    }

    .blog-listing-hero p {
        font-size: 1.05rem;
    }

    .blog-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .cta-box {
        padding: 2rem 1.5rem;
    }

    .cta-box h3 {
        font-size: 1.4rem;
    }

    .blog-nav {
        gap: 1.5rem;
    }

    .blog-nav a:not(.blog-nav-cta) {
        display: none;
    }

    .blog-article {
        padding: 2.5rem 1rem 4rem;
    }

    .blog-table-wrapper {
        font-size: 0.825rem;
    }

    .article-hero {
        border-radius: 1rem;
        max-height: 280px;
    }

    .pros-cons {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

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

    .blog-toc {
        padding: 1.5rem 1.75rem;
    }

    .faq-item summary {
        padding: 1.25rem 1.5rem;
        font-size: 0.975rem;
    }

    .faq-item .faq-answer {
        padding: 0 1.5rem 1.25rem;
    }
}

@media (max-width: 480px) {
    .blog-header-inner {
        padding: 1rem 1.25rem;
    }

    .blog-logo {
        font-size: 1.15rem;
    }

    .blog-listing-hero {
        padding: 3.5rem 1.25rem 2rem;
    }
}