/* ========== DESIGN TOKENS ========== */
:root {
    --bg-primary: #FAFBFC;
    --bg-secondary: #FFFFFF;
    --bg-elevated: #FFFFFF;
    --bg-muted: #F4F6F8;
    --text-primary: #0A1628;
    --text-secondary: #57606A;
    --text-tertiary: #8B949E;
    --accent: #0052FF;
    --accent-bright: #0052FF;
    --accent-dim: rgba(0, 82, 255, 0.1);
    --accent-glow: rgba(0, 82, 255, 0.4);
    --positive: #10B981;
    --negative: #EF4444;
    --warning: #F59E0B;
    --border: rgba(0, 0, 0, 0.06);
    --border-strong: rgba(0, 0, 0, 0.1);
    --font-display: Georgia, 'Times New Roman', serif;
    --font-body: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 40px;
    --space-2xl: 64px;
    --space-3xl: 100px;
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 100px;
    --shadow-subtle: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-card: 0 4px 24px rgba(0,0,0,0.06);
    --shadow-elevated: 0 12px 48px rgba(0,0,0,0.08);
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* ========== RESET & BASE ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    min-width: 320px;
}
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { max-width: 100%; height: auto; }

/* ========== ANIMATIONS ========== */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
.animate-fade-up {
    animation: fadeUp 0.8s var(--transition-slow) forwards;
    opacity: 0;
}
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }

/* ========== LAYOUT ========== */
.container { max-width: 1240px; margin: 0 auto; padding: 0 var(--space-lg); }

/* ========== HEADER ========== */
.header {
    position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
    background: #FFFFFF;
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}
.header__inner {
    display: flex; align-items: center; justify-content: space-between; height: 72px;
}
.logo {
    display: flex; align-items: center; gap: 12px;
    font-family: var(--font-body); font-size: 18px; font-weight: 600; letter-spacing: -0.02em;
}
.logo__mark {
    width: 36px; height: 36px; background: var(--text-primary);
    border-radius: var(--radius-sm); display: flex; align-items: center;
    justify-content: center; position: relative; overflow: hidden;
}
.logo__mark::before {
    content: ''; position: absolute; width: 20px; height: 20px;
    background: var(--accent); border-radius: 50%; top: -6px; right: -6px;
}
.logo__mark::after {
    content: ''; position: absolute; width: 12px; height: 12px;
    background: var(--bg-primary); border-radius: 50%; bottom: 8px; left: 8px;
}
.nav { display: flex; align-items: center; gap: var(--space-xl); }
.nav__link {
    font-size: 14px; font-weight: 500; color: var(--text-secondary);
    transition: color var(--transition-fast);
}
.nav__link:hover { color: var(--text-primary); }
.nav__link.active,
.nav__link--active { color: var(--text-primary); }
.header__actions { display: flex; align-items: center; gap: var(--space-md); }

/* ========== BUTTONS ========== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 20px; font-family: var(--font-body); font-size: 14px; font-weight: 500;
    border-radius: var(--radius-md); border: none; cursor: pointer;
    transition: all var(--transition-base);
}
.btn--ghost { background: transparent; color: var(--text-secondary); }
.btn--ghost:hover { color: var(--text-primary); background: var(--bg-muted); }
.btn--primary { background: var(--text-primary); color: var(--bg-primary); }
.btn--primary:hover { background: #24292F; transform: translateY(-1px); box-shadow: var(--shadow-card); }
.btn--accent { background: var(--accent); color: #FFFFFF; font-weight: 600; }
.btn--accent:hover { box-shadow: 0 0 30px rgba(0, 82, 255, 0.4); transform: translateY(-1px); }
.btn--outline { background: transparent; border: 1px solid var(--border); color: var(--text-secondary); }
.btn--outline:hover { border-color: var(--accent); color: var(--text-primary); }
.btn--small { padding: 8px 16px; font-size: 13px; }
.btn--large { padding: 14px 28px; font-size: 15px; }
.btn--disabled,
.btn--disabled:hover {
    background: var(--bg-muted); color: var(--text-secondary);
    cursor: not-allowed; pointer-events: none; opacity: 0.65;
    transform: none; box-shadow: none;
}

/* ========== ARTICLE PROS/CONS + ALTERNATIVES ============================ */
.cr-proscons { margin: 24px 0; }
.cr-proscons__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .cr-proscons__grid { grid-template-columns: 1fr; } }
.cr-proscons__col {
    padding: 16px 18px; border-radius: var(--radius-md);
    border: 1px solid var(--border); background: var(--bg-muted);
}
.cr-proscons__col h4 { margin: 0 0 10px; font-size: 15px; }
.cr-proscons__col--pros h4 { color: var(--positive); }
.cr-proscons__col--cons h4 { color: var(--negative); }
.cr-proscons__col ul { margin: 0; padding-left: 18px; }
.cr-proscons__col li { margin-bottom: 6px; line-height: 1.5; }
/* The site renderer owns both comparison markup and presentation. */
.cr-alternatives-table-wrap { margin: 16px 0; overflow-x: auto; }
.cr-alternatives-table { width: 100%; min-width: 760px; border-collapse: collapse; font-size: 14px; }
.cr-alternatives-table th, .cr-alternatives-table td { padding: 10px 12px; border: 1px solid var(--border); text-align: left; }
.cr-alternatives-table thead th { background: var(--bg-muted); font-weight: 600; }
.cr-alternatives-table tbody tr:nth-child(even) { background: var(--bg-muted); }

.cr-key-takeaways {
    margin: 24px 0; padding: 18px 20px; border: 1px solid var(--border);
    border-radius: var(--radius-md); background: var(--bg-muted);
}
.cr-key-takeaways__title { margin: 0 0 12px; font-size: 20px; }
.cr-key-takeaways__list { margin: 0; padding-left: 20px; }
.cr-key-takeaways__list li { margin-bottom: 8px; line-height: 1.6; }
.cr-key-takeaways__list li:last-child { margin-bottom: 0; }

/* ========== EXCHANGE OPERATIONAL STATUS ========================== */
.cr-status-banner {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px;
    margin: 16px 0; padding: 14px 18px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(239, 68, 68, 0.35);
    background: rgba(239, 68, 68, 0.08);
    color: var(--text-primary); font-size: 14px; line-height: 1.5;
}
.cr-status-banner__title { color: var(--negative); font-weight: 700; }
.cr-status-chip {
    display: inline-block; margin-left: 6px; padding: 2px 8px;
    border-radius: 999px; font-size: 11px; font-weight: 600;
    background: rgba(239, 68, 68, 0.12); color: var(--negative);
    vertical-align: middle; white-space: nowrap;
}

/* ========== MOBILE TOGGLE ========== */
.mobile-toggle { display: none; background: none; border: none; cursor: pointer; padding: 8px; }
.mobile-toggle span { display: block; width: 20px; height: 1.5px; background: var(--text-primary); margin: 5px 0; transition: all var(--transition-fast); }

/* ========== DROPDOWN ========== */
.dropdown { position: relative; }
.dropdown__toggle {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 10px 20px; font-family: var(--font-body); font-size: 14px; font-weight: 500;
    background: transparent; color: var(--text-secondary); border: none; cursor: pointer;
    border-radius: var(--radius-md); transition: all var(--transition-fast);
}
.dropdown__toggle:hover { color: var(--text-primary); background: var(--bg-muted); }
.dropdown__toggle svg { width: 12px; height: 12px; transition: transform var(--transition-fast); }
.dropdown.active .dropdown__toggle svg { transform: rotate(180deg); }
.dropdown__menu {
    position: absolute; top: calc(100% + 8px); right: 0; min-width: 280px;
    max-width: calc(100vw - 48px);
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: var(--radius-md); box-shadow: var(--shadow-elevated);
    opacity: 0; visibility: hidden; transform: translateY(-10px);
    transition: all var(--transition-base); z-index: 100;
}
.dropdown.active .dropdown__menu { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown__menu__header { padding: var(--space-md); border-bottom: 1px solid var(--border); }
.dropdown__menu__header h4 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-tertiary); }
.dropdown__menu__item { display: flex; align-items: center; gap: var(--space-md); padding: var(--space-md); transition: background var(--transition-fast); }
.dropdown__menu__item:hover { background: var(--bg-muted); }
.dropdown__menu__item__icon { width: 40px; height: 40px; background: var(--accent-dim); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 18px; }
.dropdown__menu__item__content h5 { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.dropdown__menu__item__content p { font-size: 12px; color: var(--text-tertiary); }
.dropdown__menu__footer { padding: var(--space-md); border-top: 1px solid var(--border); background: var(--bg-muted); border-radius: 0 0 var(--radius-md) var(--radius-md); }
.dropdown__menu__footer a { font-size: 13px; color: var(--accent); font-weight: 500; }

/* ========== FOOTER ========== */
.footer {
    background: var(--bg-muted);
    padding: var(--space-2xl) 0;
    border-top: 1px solid var(--border);
}
.footer__inner {
    display: grid;
    grid-template-columns: 2fr repeat(3, 1fr);
    gap: var(--space-2xl);
}
.footer__brand { max-width: 260px; }
.footer__brand p {
    margin-top: var(--space-md);
    font-size: 14px;
    color: var(--text-tertiary);
    line-height: 1.7;
}
.footer__column h4 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-tertiary);
    margin-bottom: var(--space-md);
}
.footer__column ul li { margin-bottom: var(--space-sm); }
.footer__column ul a {
    font-size: 14px;
    color: var(--text-secondary);
    transition: color var(--transition-fast);
}
.footer__column ul a:hover { color: var(--text-primary); }
.footer__bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: var(--space-2xl);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border);
}
.footer__bottom p { font-size: 13px; color: var(--text-tertiary); }
.footer__socials { display: flex; gap: var(--space-sm); }
.footer__socials a {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: var(--bg-secondary);
    color: var(--text-tertiary);
    font-size: 14px;
    transition: all var(--transition-fast);
}
.footer__socials a:hover {
    background: var(--text-primary);
    color: var(--bg-primary);
}

/* ========== RESPONSIVE: SHARED ========== */
@media (max-width: 1024px) {
    .footer__inner { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .nav { display: none; }
    .header__actions { display: none; }
    .mobile-toggle { display: block; }

    /* Mobile Menu */
    .mobile-menu { display: none; position: fixed; top: 72px; left: 0; right: 0; bottom: 0; background: var(--bg-primary); z-index: 999; padding: var(--space-lg); overflow-y: auto; }
    .mobile-menu.active { display: block; }
    .mobile-menu__nav { display: flex; flex-direction: column; gap: var(--space-sm); }
    .mobile-menu__link { display: block; padding: var(--space-md) var(--space-lg); font-size: 17px; font-weight: 500; color: var(--text-secondary); border-radius: var(--radius-md); transition: all var(--transition-fast); }
    .mobile-menu__link:hover { color: var(--text-primary); background: var(--bg-muted); }
    .mobile-menu__actions { margin-top: var(--space-xl); padding-top: var(--space-lg); border-top: 1px solid var(--border); }
    .mobile-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
    .mobile-toggle.active span:nth-child(2) { opacity: 0; }
    .mobile-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

    /* Footer */
    .footer__inner { grid-template-columns: 1fr; gap: var(--space-xl); }
    .footer__bottom { flex-direction: column; gap: var(--space-md); text-align: center; }
}

@media (max-width: 480px) {
    .container { padding: 0 var(--space-md); }
    .dropdown__menu { max-width: calc(100vw - 32px); }
}

/* ========== SHARED ARTICLE SIDEBAR ========== */
/* Used by single.php (posts) and single-exchange_review.php (reviews). */
.article-sidebar {
    position: sticky;
    top: 96px;
    align-self: start;
    height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    z-index: 1;
}

/* The first card (TOC) takes available space and scrolls internally if the list is long. */
.article-sidebar > :first-child {
    flex: 0 1 auto;
    min-height: 0;
    overflow-y: auto;
}

.article-sidebar > :not(:first-child) {
    flex: 0 0 auto;
}

/* ========== CONTENT TABLES ========== */
/* Auto-style any table authored in posts/reviews/pages to match the comparison table look. */
.article-content table,
.article-content .wp-block-table table,
.content-body table,
.content-body .wp-block-table table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--space-xl) 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    font-size: 15px;
    color: var(--text-secondary);
    display: table;
}

.article-content .wp-block-table,
.content-body .wp-block-table {
    margin: var(--space-xl) 0;
    overflow-x: auto;
}

.article-content .wp-block-table table,
.content-body .wp-block-table table { margin: 0; }

.article-content table th,
.article-content table td,
.content-body table th,
.content-body table td {
    padding: var(--space-md) !important;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.article-content table thead th,
.article-content table th,
.content-body table thead th,
.content-body table th {
    background: var(--bg-muted) !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary) !important;
}

.article-content table tbody tr:last-child td,
.content-body table tbody tr:last-child td { border-bottom: none; }

.article-content table tbody tr:hover td,
.content-body table tbody tr:hover td { background: var(--bg-muted); }

.article-content table caption,
.content-body table caption {
    caption-side: bottom;
    padding-top: var(--space-sm);
    font-size: 13px;
    color: var(--text-tertiary);
    text-align: left;
}
