/* ── article.css ──
   Shared styles for all blog article pages.
   Chain: tax-pulse-tokens.css → layout.css → article.css
   Page-specific overrides stay inline (<30 lines). */

/* ── Layout ── */
.article-wrap {
    display: grid;
    grid-template-columns: 1fr 260px;
    gap: 2rem;
    align-items: start;
}

article {
    background: var(--bg-surface);
    border-radius: 18px;
    border: 1px solid color-mix(in srgb, var(--border-color) 88%, transparent);
    box-shadow: var(--surface-shadow);
    padding: 1.5rem 2rem;
}

article *, article *::before, article *::after {
    box-sizing: border-box;
}

/* ── Breadcrumb ── */
.breadcrumb-bar {
    background: color-mix(in srgb, var(--bg-subtle) 56%, transparent);
    border-radius: 12px;
    padding: 0.625rem 1.25rem;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    font-family: var(--pulse-font-body);
    color: var(--text-secondary);
}

.breadcrumb-bar a {
    color: var(--accent-blue);
    text-decoration: none;
}

.breadcrumb-bar a:hover {
    text-decoration: underline;
}

/* ── Typography ── */
article h1 {
    font-family: var(--pulse-font-display);
    font-size: clamp(1.65rem, 4vw, 2.1rem);
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

article h2 {
    font-family: var(--pulse-font-display);
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

article h3 {
    font-family: var(--pulse-font-display);
    font-size: 1.15rem;
    font-weight: 700;
    margin-top: 1.75rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

article p {
    font-family: var(--pulse-font-body);
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 1.5rem;
}

article ul, article ol {
    font-family: var(--pulse-font-body);
    margin-left: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
    line-height: 1.8;
}

article li {
    margin-bottom: 0.5rem;
}

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

article a:hover {
    text-decoration: underline;
}

article strong {
    color: var(--text-primary);
    font-weight: 700;
}

.subtitle {
    font-family: var(--pulse-font-body);
    font-size: 1.15rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.meta {
    display: flex;
    gap: 1rem;
    color: var(--text-muted);
    font-family: var(--pulse-font-body);
    font-size: 0.9rem;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    flex-wrap: wrap;
}

/* ── Article Tag ── */
.article-tag {
    display: inline-block;
    font-family: var(--pulse-font-body);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    margin-bottom: 0.75rem;
}

.article-tag.update { background: color-mix(in srgb, var(--accent-green) 15%, transparent); color: var(--accent-green); }
.article-tag.data { background: color-mix(in srgb, var(--accent-blue) 15%, transparent); color: var(--accent-blue); }
.article-tag.guide { background: color-mix(in srgb, var(--accent-amber, #c48a1a) 15%, transparent); color: var(--accent-amber, #c48a1a); }
.article-tag.comparison { background: color-mix(in srgb, var(--accent-teal, #14b8a6) 15%, transparent); color: var(--accent-teal, #14b8a6); }
.article-tag.reference { background: color-mix(in srgb, var(--accent-red) 15%, transparent); color: var(--accent-red); }

/* ── Note Box (replaces highlight-box with border-left) ── */
.note-box {
    background: color-mix(in srgb, var(--accent-blue) 8%, var(--bg-surface));
    border-radius: 12px;
    padding: 0.875rem 1.25rem;
    margin: 1.25rem 0;
    font-family: var(--pulse-font-body);
}

.note-box p { margin-bottom: 0; }
.note-box p + p { margin-top: 0.75rem; }
.note-box ul, .note-box ol { margin-bottom: 0; }
.note-box.red { background: color-mix(in srgb, var(--accent-red) 8%, var(--bg-surface)); }

/* ── TL;DR Box ── */
.tldr-box {
    background: color-mix(in srgb, var(--accent-amber, #c48a1a) 8%, var(--bg-surface));
    border-radius: 14px;
    padding: 1rem 1.25rem;
    margin: 1.25rem 0;
}

.tldr-box h3 {
    font-family: var(--pulse-font-display);
    margin-top: 0;
    font-size: 1rem;
    color: var(--accent-amber, #c48a1a);
    margin-bottom: 0.75rem;
}

.tldr-box ul { margin-bottom: 0; }

/* ── Tables ── */
.article-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.95rem;
    font-family: var(--pulse-font-body);
}

.article-table th, .article-table td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid color-mix(in srgb, var(--border-color) 88%, transparent);
}

.article-table th {
    background: color-mix(in srgb, var(--bg-subtle) 56%, transparent);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.article-table td {
    color: var(--text-secondary);
}

.article-table tr:hover td {
    background: color-mix(in srgb, var(--bg-subtle) 30%, transparent);
}

/* ── Stat Boxes ── */
.stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.stat-box {
    background: color-mix(in srgb, var(--bg-subtle) 56%, transparent);
    border-radius: 14px;
    padding: 1.25rem;
    text-align: center;
}

.stat-box .number {
    font-family: var(--pulse-font-display);
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-blue);
    line-height: 1.2;
}

.stat-box .number.green { color: var(--accent-green); }
.stat-box .number.amber { color: var(--accent-amber, #c48a1a); }
.stat-box .number.red { color: var(--accent-red); }

.stat-box .label {
    font-family: var(--pulse-font-body);
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* ── Persona / Scenario Cards ── */
.persona-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.persona-card {
    background: color-mix(in srgb, var(--bg-subtle) 56%, transparent);
    border-radius: 14px;
    padding: 1.25rem;
}

.persona-card .emoji {
    margin-bottom: 0.5rem;
    display: flex;
    color: var(--accent-blue);
}

.persona-card .who {
    font-family: var(--pulse-font-display);
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.persona-card .form {
    font-family: var(--pulse-font-body);
    font-size: 0.82rem;
    color: var(--accent-blue);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.persona-card .deadline {
    font-family: var(--pulse-font-display);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-green);
}

.persona-card .deadline.same {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
}

.persona-card p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    margin-bottom: 0;
    line-height: 1.5;
}

/* ── CTA Box ── */
.cta-box {
    background: var(--bg-surface);
    border: 1px solid color-mix(in srgb, var(--accent-blue) 20%, var(--border-color));
    border-radius: 18px;
    padding: 2rem;
    margin: 2rem 0;
    text-align: center;
}

.cta-box h3 {
    font-family: var(--pulse-font-display);
    margin-top: 0;
    color: var(--text-primary);
}

.cta-box p {
    margin-bottom: 1.5rem;
}

.cta-button {
    display: inline-block;
    background: var(--accent-blue);
    color: #ffffff;
    padding: 0.875rem 2rem;
    border-radius: 12px;
    font-family: var(--pulse-font-body);
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    transition: filter 0.2s ease;
    margin: 0.25rem;
}

.cta-button:hover {
    filter: brightness(1.1);
    text-decoration: none;
}

.cta-button.secondary {
    background: transparent;
    color: var(--accent-blue);
    border: 2px solid var(--accent-blue);
}

/* ── Fee / Data Box ── */
.fee-box {
    background: color-mix(in srgb, var(--bg-subtle) 56%, transparent);
    border-radius: 14px;
    padding: 1.25rem 1.5rem;
    margin: 1.5rem 0;
}

.fee-box .fee-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0;
    border-bottom: 1px solid color-mix(in srgb, var(--border-color) 88%, transparent);
    font-family: var(--pulse-font-body);
    font-size: 0.95rem;
}

.fee-box .fee-row:last-child { border-bottom: none; }
.fee-box .fee-row .condition { color: var(--text-secondary); }
.fee-box .fee-row .amount { font-weight: 700; color: var(--accent-amber, #c48a1a); }

/* ── Badges ── */
.badge-changed {
    display: inline-block;
    background: color-mix(in srgb, var(--accent-green) 15%, transparent);
    color: var(--accent-green);
    font-family: var(--pulse-font-body);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 20px;
    margin-left: 0.4rem;
}

.badge-same {
    display: inline-block;
    background: color-mix(in srgb, var(--bg-subtle) 56%, transparent);
    color: var(--text-muted);
    font-family: var(--pulse-font-body);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 20px;
    margin-left: 0.4rem;
}

/* ── Two-Column Comparison ── */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 1.5rem 0;
}

.col-box {
    background: color-mix(in srgb, var(--bg-subtle) 56%, transparent);
    border-radius: 14px;
    padding: 1.25rem;
}

.col-box.yes-col { border-top: 3px solid var(--accent-green); }
.col-box.no-col { border-top: 3px solid var(--accent-red); }

/* ── Calc Box (formula/calculation display) ── */
.calc-box {
    background: color-mix(in srgb, var(--bg-subtle) 56%, transparent);
    border-radius: 14px;
    padding: 1.25rem 1.5rem;
    margin: 1rem 0;
    font-family: var(--pulse-font-mono, 'IBM Plex Mono', monospace);
    font-size: 0.9rem;
    line-height: 1.7;
}

/* ── Series Navigation ── */
.series-nav {
    background: color-mix(in srgb, var(--accent-blue) 6%, var(--bg-surface));
    border-radius: 14px;
    padding: 1.25rem 1.5rem;
    margin: 1.5rem 0;
    font-family: var(--pulse-font-body);
}

.series-nav h4 {
    font-family: var(--pulse-font-display);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.series-nav ol, .series-nav ul {
    margin-bottom: 0;
    font-size: 0.9rem;
}

/* ── FAQ Section (Accordion) ── */
.article-faq {
    margin-top: 2rem;
}

.article-faq h2 {
    margin-bottom: 1rem;
}

.article-faq .faq-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.article-faq .faq-item {
    background: var(--bg-surface);
    border: 1px solid color-mix(in srgb, var(--border-color) 88%, transparent);
    border-radius: 14px;
    overflow: hidden;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.article-faq .faq-item:hover {
    border-color: color-mix(in srgb, var(--accent-blue) 25%, var(--border-color));
}

.article-faq .faq-item.open {
    border-color: color-mix(in srgb, var(--accent-blue) 35%, var(--border-color));
    box-shadow: 0 2px 8px color-mix(in srgb, var(--accent-blue) 8%, transparent);
}

.article-faq .faq-question {
    width: 100%;
    background: none;
    border: none;
    padding: 1.1rem 1.4rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-family: var(--pulse-font-body);
    font-size: 0.97rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: left;
    line-height: 1.5;
}

.article-faq .faq-question svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    transition: transform 0.3s ease;
    margin-left: 1rem;
}

.article-faq .faq-item.open .faq-question svg {
    transform: rotate(180deg);
}

.article-faq .faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
}

.article-faq .faq-answer-inner {
    padding: 0 1.4rem 1.2rem;
    font-family: var(--pulse-font-body);
    font-size: 0.93rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

.article-faq .faq-answer-inner p { margin-bottom: 0.5rem; }
.article-faq .faq-answer-inner p:last-child { margin-bottom: 0; }

/* ── Related Content ── */
.related-content {
    margin-top: 2.5rem;
}

.related-content h2 {
    font-family: var(--pulse-font-display);
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    margin-top: 0;
}

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

.related-card {
    background: var(--bg-surface);
    border: 1px solid color-mix(in srgb, var(--border-color) 88%, transparent);
    border-radius: 14px;
    padding: 1.25rem;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: transform 0.2s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.related-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--surface-shadow-strong);
    border-color: color-mix(in srgb, var(--accent-blue) 30%, var(--border-color));
    text-decoration: none;
}

.related-card .card-icon {
    display: flex;
    color: var(--accent-blue);
}

.related-card .card-title {
    font-family: var(--pulse-font-display);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.related-card .card-desc {
    font-family: var(--pulse-font-body);
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.related-card .card-tag {
    font-family: var(--pulse-font-body);
    font-size: 0.7rem;
    color: var(--accent-blue);
    font-weight: 600;
    text-transform: uppercase;
}

/* ── Sidebar ── */
.article-sidebar {
    position: sticky;
    top: 5.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sidebar-card {
    background: var(--bg-surface);
    border: 1px solid color-mix(in srgb, var(--border-color) 88%, transparent);
    border-radius: 14px;
    padding: 1.25rem;
    box-shadow: var(--surface-shadow);
}

.sidebar-card h4 {
    font-family: var(--pulse-font-body);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

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

.toc-links li {
    margin-bottom: 0.5rem;
}

.toc-links a {
    font-family: var(--pulse-font-body);
    font-size: 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
    line-height: 1.5;
}

.toc-links a:hover {
    color: var(--accent-blue);
}

.sidebar-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-links li {
    margin-bottom: 0.5rem;
}

.sidebar-links li:last-child {
    margin-bottom: 0;
}

.sidebar-links a {
    font-family: var(--pulse-font-body);
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-decoration: none;
    line-height: 1.4;
}

.sidebar-links a:hover {
    color: var(--accent-blue);
}

/* ── Source Note ── */
.source-note {
    font-family: var(--pulse-font-body);
    font-size: 0.85rem;
    font-style: italic;
    color: var(--text-muted);
    margin: 1rem 0;
}

/* ── Disclaimer ── */
.disclaimer {
    font-family: var(--pulse-font-body);
    font-size: 0.85rem;
    font-style: italic;
    color: var(--text-muted);
    border-top: 1px dashed color-mix(in srgb, var(--border-color) 88%, transparent);
    padding-top: 1rem;
    margin-top: 2rem;
}

/* ── Responsive ── */
@media (max-width: 900px) {
    .article-wrap {
        grid-template-columns: 1fr;
    }

    .article-sidebar {
        position: static;
    }
}

@media (max-width: 768px) {
    article {
        padding: 1.25rem;
        border-radius: 14px;
    }

    article h1 {
        font-size: 1.65rem;
    }

    .article-table {
        font-size: 0.82rem;
    }

    .article-table th, .article-table td {
        padding: 0.625rem 0.5rem;
    }

    .two-col {
        grid-template-columns: 1fr;
    }

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

    .stat-row {
        grid-template-columns: 1fr 1fr;
    }
}
