/* base-v8.css — design tokens (3 themes), layout, header, buttons, forms, article, lists.
   Themes: <html data-theme="light|dark|bloomberg"> set before first paint (base.html), toggled by theme-v1.js.
   To update: edit here, bump the filename version, update the <link> in base.html. */

/* ===== Tokens ===== */
:root,
:root[data-theme="light"] {
    color-scheme: light;
    --bg: #ffffff;
    --bg-2: #f6f7f9;
    --surface: #ffffff;
    --surface-2: #f2f4f7;
    --text: #0f1115;
    --heading: #0b0d11;
    --text-2: #3d4450;
    --muted: #6b7280;
    --border: #e7e9ee;
    --border-strong: #d3d8df;
    --primary: #0f1115;
    --primary-ink: #ffffff;
    --accent: #0a8f5a;
    --accent-2: #19b878;
    --accent-ink: #ffffff;
    --accent-soft: color-mix(in srgb, var(--accent) 11%, transparent);
    --pro-1: #0a8f5a;
    --pro-2: #3b5bfd;
    --link: #0b63ce;
    --danger: #d92d20;
    --header-bg: rgb(255 255 255 / 0.8);
    --backdrop: rgb(15 17 21 / 0.5);
    --shadow-sm: 0 1px 2px rgb(16 24 40 / 0.06), 0 1px 3px rgb(16 24 40 / 0.08);
    --shadow-md: 0 8px 24px -6px rgb(16 24 40 / 0.14);
    --shadow-lg: 0 24px 64px -12px rgb(16 24 40 / 0.28);
    --font-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --font-read: 'Source Serif 4', Georgia, 'Times New Roman', serif;
    --font-head: Merriweather, Georgia, 'Times New Roman', serif; /* h1-h3 */
    --font-article: 'Open Sans', Arial, 'Segoe UI', sans-serif; /* article title + text (as on the old site) */
    --text-article: #2f2f2f;
    --text-article-p: #000000; /* old site: paragraphs black, titles & headings #2f2f2f */
    --font-brand: 'Source Serif 4', Georgia, serif;
    --radius: 14px;
    --radius-lg: 22px;
    --radius-pill: 999px;
    --case: none;
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0b0d11;
    --bg-2: #101319;
    --surface: #14181f;
    --surface-2: #1b2029;
    --text: #e9edf3;
    --text-article: var(--text);
    --text-article-p: var(--text);
    --heading: #ffffff;
    --text-2: #c2c9d4;
    --muted: #8b94a3;
    --border: #232a35;
    --border-strong: #313a48;
    --primary: #f2f4f7;
    --primary-ink: #0b0d11;
    --accent: #2bd38a;
    --accent-2: #5ee6a8;
    --accent-ink: #04261a;
    --pro-1: #2bd38a;
    --pro-2: #7b8cff;
    --link: #7cb2ff;
    --danger: #ff6b5f;
    --header-bg: rgb(11 13 17 / 0.75);
    --backdrop: rgb(0 0 0 / 0.6);
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow-md: 0 8px 24px -6px rgb(0 0 0 / 0.55);
    --shadow-lg: 0 24px 64px -12px rgb(0 0 0 / 0.7);
}

/* Bloomberg terminal: black, amber type, monospace, square corners */
:root[data-theme="bloomberg"] {
    color-scheme: dark;
    --bg: #000000;
    --bg-2: #060504;
    --surface: #0a0806;
    --surface-2: #15100a;
    --text: #ff9f1c;
    --text-article: var(--text);
    --text-article-p: var(--text);
    --heading: #ffb84d;
    --text-2: #f0a033;
    --muted: #b5711a;
    --border: #2e2010;
    --border-strong: #4d3516;
    --primary: #ff9f1c;
    --primary-ink: #000000;
    --accent: #ff9f1c;
    --accent-2: #ffc061;
    --accent-ink: #000000;
    --accent-soft: rgb(255 159 28 / 0.12);
    --pro-1: #ff9f1c;
    --pro-2: #ffd166;
    --link: #4fc3f7;
    --danger: #ff4d4d;
    --header-bg: rgb(0 0 0 / 0.85);
    --backdrop: rgb(0 0 0 / 0.75);
    --shadow-sm: none;
    --shadow-md: 0 0 0 1px var(--border-strong);
    --shadow-lg: 0 0 0 1px var(--border-strong), 0 24px 64px -12px rgb(0 0 0 / 0.9);
    --font-ui: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
    --font-read: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
    --font-head: 'IBM Plex Mono', ui-monospace, monospace;
    --font-article: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
    --font-brand: 'IBM Plex Mono', ui-monospace, monospace;
    --radius: 3px;
    --radius-lg: 4px;
    --radius-pill: 3px;
    --case: uppercase;
}

/* Theme cross-fade (class set briefly by theme-v1.js) */
.theme-anim,
.theme-anim *,
.theme-anim *::before,
.theme-anim *::after {
    transition: background-color 0.4s ease, color 0.4s ease, border-color 0.4s ease !important;
}

/* ===== Base ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

* {
    -webkit-tap-highlight-color: transparent;
}

/* the hidden attribute always wins over component display rules */
[hidden] {
    display: none !important;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    overflow-x: clip;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
    color: var(--heading);
    font-family: var(--font-head);
    letter-spacing: -0.015em;
    line-height: 1.2;
    text-wrap: balance;
}

p {
    color: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

::selection {
    background: var(--accent);
    color: var(--accent-ink);
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

svg {
    flex-shrink: 0;
}

main {
    flex: 1;
    width: 100%;
}

#vars {
    display: none;
}

/* ===== Header ===== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--header-bg);
    backdrop-filter: saturate(1.6) blur(14px);
    -webkit-backdrop-filter: saturate(1.6) blur(14px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0.7rem 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--heading);
}

.brand-mark,
.auth-mark {
    display: inline-grid;
    place-items: center;
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 10px;
    background: var(--primary);
    color: var(--primary-ink);
    font-family: var(--font-brand);
    font-weight: 700;
    font-size: 1.35rem;
    line-height: 1;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.brand:hover .brand-mark {
    transform: rotate(-8deg) scale(1.06);
}

.brand-name {
    font-family: var(--font-brand);
    font-weight: 700;
    font-size: 1.4rem;
    letter-spacing: -0.01em;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.72rem 1.25rem;
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    font: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.2;
    text-transform: var(--case);
    cursor: pointer;
    white-space: nowrap;
    transition: transform 0.12s ease, background-color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.btn:active {
    transform: scale(0.97);
}

.btn:disabled,
.btn.is-loading {
    opacity: 0.6;
    cursor: progress;
}

.btn-primary {
    background: var(--primary);
    color: var(--primary-ink);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    box-shadow: var(--shadow-md);
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: var(--accent-ink);
    box-shadow: 0 6px 20px -6px color-mix(in srgb, var(--accent) 60%, transparent);
}

.btn-accent:hover {
    box-shadow: 0 10px 28px -6px color-mix(in srgb, var(--accent) 70%, transparent);
}

.btn-outline {
    background: transparent;
    border-color: var(--border-strong);
    color: var(--text);
}

.btn-outline:hover {
    background: var(--surface-2);
}

.btn-ghost {
    background: transparent;
    color: var(--text);
}

.btn-ghost:hover {
    background: var(--surface-2);
}

.btn-sm {
    padding: 0.5rem 0.95rem;
    font-size: 0.88rem;
}

.btn-lg {
    padding: 0.9rem 1.6rem;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
}

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--text);
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.12s ease;
}

.icon-btn:hover {
    background: var(--surface-2);
}

.icon-btn:active {
    transform: scale(0.94);
}

.icon-btn svg {
    width: 1.3rem;
    height: 1.3rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.link-btn {
    padding: 0;
    border: 0;
    background: none;
    color: var(--link);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.link-btn:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Theme toggle => shows the icon of the NEXT theme */
.theme-icon {
    display: none;
}

:root[data-theme="light"] .theme-icon-moon,
:root[data-theme="dark"] .theme-icon-terminal,
:root[data-theme="bloomberg"] .theme-icon-sun {
    display: block;
    animation: icon-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes icon-in {
    from { transform: rotate(-60deg) scale(0.6); opacity: 0; }
    to { transform: none; opacity: 1; }
}

/* ===== Menu (details/summary dropdown) ===== */
.menu {
    position: relative;
}

.menu summary {
    list-style: none;
}

.menu summary::-webkit-details-marker {
    display: none;
}

.menu[open] summary {
    background: var(--surface-2);
}

/* Hamburger => classic 3 full bars, staggered (full / short / medium, right-aligned) on hover and while open */
.burger {
    --bar: 2.5px;
    position: relative;
    display: block;
    width: 1.25rem;
    height: 0.95rem;
}

.burger span {
    position: absolute;
    right: 0;
    width: 100%;
    height: var(--bar);
    border-radius: var(--bar);
    background: currentColor;
    transition: top 0.25s ease, width 0.25s ease, opacity 0.2s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.burger span:nth-child(1) {
    top: 0;
}

.burger span:nth-child(2) {
    top: calc(50% - var(--bar) / 2);
}

.burger span:nth-child(3) {
    top: calc(100% - var(--bar));
}

.menu-btn:hover .burger span:nth-child(2),
.menu[open] .burger span:nth-child(2) {
    width: 55%;
}

.menu-btn:hover .burger span:nth-child(3),
.menu[open] .burger span:nth-child(3) {
    width: 78%;
}

:root[data-theme="bloomberg"] .burger span {
    border-radius: 0;
}

.menu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 0.5rem);
    min-width: 13rem;
    padding: 0.4rem;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    animation: pop-in 0.18s ease-out;
}

.menu-panel a,
.menu-panel button {
    display: block;
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 0;
    border-radius: calc(var(--radius) - 4px);
    background: none;
    color: var(--text);
    font: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    text-align: left;
    text-transform: var(--case);
    cursor: pointer;
}

.menu-panel a:hover,
.menu-panel button:hover {
    background: var(--surface-2);
}

.menu-signout {
    margin-top: 0.3rem;
    border-top: 1px solid var(--border) !important;
    border-radius: 0 0 calc(var(--radius) - 4px) calc(var(--radius) - 4px) !important;
    color: var(--muted) !important;
}

@keyframes pop-in {
    from { opacity: 0; transform: translateY(-6px) scale(0.98); }
    to { opacity: 1; transform: none; }
}

/* ===== Layout ===== */
.page {
    max-width: 820px;
    margin: 0 auto;
    padding: 1.5rem 20px 2rem;
}

.page-article {
    max-width: 740px;
}

.page-narrow {
    max-width: 620px;
    padding-top: 2.5rem;
}

.section-title {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 0.9rem;
}

/* ===== Article lists ===== */
.head-list {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.head-card {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 0.6rem 1.15rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.head-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-md);
}

.head-title {
    color: var(--heading);
    font-weight: 500;
    font-size: 1.06rem;
    line-height: 1.45;
}

.head-date {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* ===== Article ===== */
.article-header {
    margin: 0.5rem 0 0.5rem;
}

.article-meta {
    margin: 0 0 0.6rem;
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* Article typography => as on the old site (base-v7): Open Sans title & text, Merriweather section headings */
.article-title,
.article-body h2 {
    margin: 0;
    color: var(--text-article);
    font-family: var(--font-article);
    font-size: 2rem;
    font-weight: 700; /* old site: 600 rendered as 700 (only 400/700 loaded) */
    letter-spacing: 1px;
    line-height: 1.35;
    text-wrap: wrap;
}

.article-body {
    font-family: var(--font-article);
    font-size: 1.05rem;
    line-height: 1.65;
    color: var(--text-article);
}

.article-body p {
    margin: 1em 0;
    color: var(--text-article-p);
}

.article-body h2 {
    margin: 1.1rem 0 0.8rem;
}

.article-body h3,
.article-body h4 {
    margin: 1.3em 0 0.6em;
    color: var(--text-article);
    font-family: var(--font-head);
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 1px;
    line-height: 1.4;
    text-wrap: wrap; /* flow to the next line like the old site (the global h1-h4 rule balances lines) */
}

.article-body h4 { font-size: 1.1rem; }

@media (max-width: 768px) {
    .article-title,
    .article-body h2 {
        font-size: 1.6rem;
    }
    .article-body h3 {
        font-size: 1.2rem;
    }
    .article-body {
        font-size: 1.02rem;
        line-height: 1.55;
    }
}

.article-body a {
    color: var(--link);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.article-body ul,
.article-body ol {
    padding-left: 1.3rem;
    margin: 0 0 1.25rem;
}

.article-body li {
    margin-bottom: 0.4rem;
}

.article-body strong {
    color: var(--heading);
}

.article-body blockquote {
    margin: 1.5rem 0;
    padding: 0.2rem 0 0.2rem 1.1rem;
    border-left: 3px solid var(--accent);
    color: var(--text-2);
}

.article-body table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-ui);
    font-size: 0.92rem;
    margin: 0 0 1.5rem;
    display: block;
    overflow-x: auto;
}

.article-body th,
.article-body td {
    padding: 0.55rem 0.7rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.article-body img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
}

/* preview cut => fade the last lines into the paywall */
.article-body.is-faded {
    -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 200px), transparent);
    mask-image: linear-gradient(to bottom, #000 calc(100% - 200px), transparent);
    max-height: none;
}

.deep-dive {
    margin-top: 2.5rem;
    padding-top: 1.75rem;
    border-top: 1px solid var(--border);
}

.deep-dive-label {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin: 0 0 1rem;
    color: var(--heading);
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.read-next {
    margin: 3rem 0 1rem;
}

.disclaimer {
    margin-top: 2.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.6;
}

.disclaimer a {
    text-decoration: underline;
}

/* upvotes (currently hidden markup) */
.upvote {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 600;
}

/* ===== Badges ===== */
.pro-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.18rem 0.55rem;
    border-radius: var(--radius-pill);
    background: linear-gradient(135deg, var(--pro-1), var(--pro-2));
    color: #fff;
    font-family: var(--font-ui);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

:root[data-theme="bloomberg"] .pro-badge {
    color: #000;
}

/* ===== Panels (account, contact, subscribe, error) ===== */
.panel {
    padding: 2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.panel-hero {
    text-align: center;
}

.panel-title {
    margin: 0.4rem 0 0.4rem;
    font-size: 1.75rem;
    font-weight: 800;
}

.panel-sub {
    margin: 0 0 1.5rem;
    color: var(--text-2);
}

.panel-note {
    margin: 0 0 1.25rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    background: var(--accent-soft);
    color: var(--heading);
    font-weight: 500;
}

.panel-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 1.5rem;
}

.kv {
    margin: 1.25rem 0 0;
    display: grid;
    gap: 0;
}

.kv > div {
    display: grid;
    grid-template-columns: 9rem 1fr;
    gap: 1rem;
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--border);
}

.kv dt {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.kv dd {
    margin: 0;
    font-weight: 600;
    word-break: break-word;
}

.status {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: var(--radius-pill);
    background: var(--surface-2);
    font-size: 0.85rem;
}

.status-active,
.status-trialing {
    background: var(--accent-soft);
    color: var(--accent);
}

.status-past_due {
    background: color-mix(in srgb, var(--danger) 12%, transparent);
    color: var(--danger);
}

/* ===== Forms ===== */
.stack-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.field-label {
    color: var(--heading);
    font-size: 0.88rem;
    font-weight: 600;
    text-transform: var(--case);
}

.field-hint {
    color: var(--muted);
    font-weight: 400;
    margin-left: 0.3rem;
}

.field input,
.field textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 1rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

:root[data-theme="bloomberg"] .field input,
:root[data-theme="bloomberg"] .field textarea {
    border-radius: var(--radius);
}

.field textarea {
    resize: vertical;
    min-height: 9rem;
}

.field input::placeholder,
.field textarea::placeholder {
    color: var(--muted);
    opacity: 0.8;
}

.field input:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}

.field.has-error input {
    border-color: var(--danger);
}

.field-error,
.form-error {
    color: var(--danger);
    font-size: 0.85rem;
    font-weight: 500;
}

.field-error:empty,
.form-error:empty {
    display: none;
}

.form-error {
    margin: 0;
}

.fine-print {
    margin: 0.75rem 0 0;
    color: var(--muted);
    font-size: 0.8rem;
    text-align: center;
}

.fine-print a {
    text-decoration: underline;
}

/* ===== Newsletter widget (newsletter-v3.js) ===== */
.newsletter-signup {
    margin: 2rem 0;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    background: var(--bg-2);
    border: 1px solid var(--border);
    text-align: center;
    font-family: var(--font-ui);
}

.newsletter-signup .newsletter-title {
    margin: 0 0 1rem; /* beats .article-body h4 (the widget sits inside the article) => symmetric box padding */
    color: var(--heading);
    font-size: 1.02rem;
    font-weight: 700;
    line-height: 1.5;
}

.newsletter-form {
    display: flex;
    gap: 0.5rem;
}

.newsletter-input {
    flex: 1;
    min-width: 0;
    padding: 0.7rem 1.1rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-pill);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 1rem;
}

.newsletter-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}

.newsletter-btn {
    padding: 0.7rem 1.4rem;
    border: none;
    border-radius: var(--radius-pill);
    background: var(--primary);
    color: var(--primary-ink);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.newsletter-btn:disabled,
.newsletter-input:disabled {
    opacity: 0.6;
}

.newsletter-error {
    margin-top: 0.6rem;
    color: var(--danger);
    font-size: 0.9rem;
}

.newsletter-error:empty {
    display: none;
}

.newsletter-success {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--accent);
    font-weight: 700;
}

.newsletter-check {
    width: 24px;
    height: 24px;
}

/* ===== Terms page ===== */
.narrow-container {
    max-width: 740px;
    margin: 0 auto;
    padding: 2rem 20px;
}

.terms-text {
    color: var(--text-2);
    line-height: 1.7;
}

.terms-text .slogan {
    color: var(--text);
}

.terms-text .terms {
    margin: 2rem 0 0.5rem;
    color: var(--heading);
    font-weight: 700;
    font-size: 1.1rem;
}

/* ===== Footer ===== */
.site-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem 1.4rem;
    padding: 2rem 20px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.82rem;
}

.site-footer a:hover {
    color: var(--text);
}

/* ===== Toast ===== */
.toast {
    position: fixed;
    left: 50%;
    bottom: 1.5rem;
    z-index: 200;
    max-width: min(92vw, 30rem);
    padding: 0.85rem 1.3rem;
    border-radius: var(--radius-lg);
    background: var(--primary);
    color: var(--primary-ink);
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: var(--shadow-lg);
    transform: translateX(-50%);
    animation: toast-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toast.is-error {
    background: var(--danger);
    color: #fff;
}

@keyframes toast-in {
    from { opacity: 0; transform: translate(-50%, 20px) scale(0.96); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* ===== Bloomberg extras ===== */
:root[data-theme="bloomberg"] .site-header {
    border-bottom-color: var(--accent);
}

:root[data-theme="bloomberg"] .brand-name,
:root[data-theme="bloomberg"] .section-title,
:root[data-theme="bloomberg"] .deep-dive-label {
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

:root[data-theme="bloomberg"] .brand-name {
    font-size: 1.15rem;
}

:root[data-theme="bloomberg"] .brand-mark,
:root[data-theme="bloomberg"] .auth-mark {
    border-radius: var(--radius);
}

:root[data-theme="bloomberg"] .head-list {
    gap: 0;
}

:root[data-theme="bloomberg"] .head-card {
    border-width: 0 0 1px;
    border-style: dashed;
    border-radius: 0;
    background: transparent;
    padding: 0.85rem 0.25rem;
}

:root[data-theme="bloomberg"] .head-card:hover {
    transform: none;
    box-shadow: none;
    background: var(--surface-2);
}

:root[data-theme="bloomberg"] .head-date::before {
    content: "> ";
    color: var(--muted);
}

:root[data-theme="bloomberg"] .article-title {
    letter-spacing: -0.01em;
    font-weight: 600;
}

/* Dark & Bloomberg => larger article text (light keeps the old site's 1.05rem) */
:root[data-theme="dark"] .article-body {
    font-size: 1.14rem;
    line-height: 1.75;
}

:root[data-theme="bloomberg"] .article-body {
    font-size: 1.1rem;
    line-height: 1.75;
}

@media (max-width: 768px) {
    :root[data-theme="dark"] .article-body,
    :root[data-theme="bloomberg"] .article-body {
        font-size: 1.08rem;
        line-height: 1.65;
    }
}

/* ===== Responsive ===== */
@media (max-width: 560px) {
    .header-inner {
        padding: 0.55rem 16px;
    }
    .page {
        padding-inline: 16px;
    }
    .brand-name {
        font-size: 1.2rem;
    }
    .hide-xs {
        display: none !important;
    }
    .panel {
        padding: 1.4rem;
    }
    .kv > div {
        grid-template-columns: 1fr;
        gap: 0.15rem;
    }
    .newsletter-form {
        flex-direction: column;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
