/* ──────────────────────────────────────────────────────────────
   AI Fees — editorial design system (Anthropic-inspired)
   Warm cream palette · serif headings · hairline borders · restrained motion.
   Shared across index.html, blog hub and posts.
   ────────────────────────────────────────────────────────────── */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}

/* ── Tokens — Light (default) ────────────────────────────────── */
:root,
:root[data-theme="light"] {
    /* Warm cream palette */
    --bg:            #faf9f5;
    --bg-elevated:   #ffffff;
    --bg-hover:      #f3f0e8;
    --bg-input:      #ffffff;
    --bg-subtle:     #f5f2eb;

    --text:          #2d2926;
    --text-muted:    #6b6660;
    --text-dim:      #9b9690;

    /* Anthropic-style coral */
    --primary:       #cc785c;
    --primary-hover: #b8654a;
    --primary-ink:   #ffffff;
    --primary-soft:  #f5e8e3;
    --primary-glow:  rgba(204, 120, 92, 0.18);

    --border:        #d8d3c8;
    --border-soft:   #e8e3d8;
    --border-strong: #c4bfb4;

    --warn:    #b8651a;
    --danger:  #a83232;
    --info:    #5b6b8e;
    --success: #5e7340;

    --shadow-sm: 0 1px 2px rgba(45, 41, 38, 0.04);
    --shadow-md: 0 4px 16px rgba(45, 41, 38, 0.06);
    --shadow-lg: 0 16px 48px rgba(45, 41, 38, 0.10);

    --radius-sm: 4px;
    --radius:    8px;
    --radius-lg: 12px;

    --font-serif: 'Iowan Old Style', 'Charter', 'Bitstream Charter', 'Sitka Text', Cambria, Georgia, serif;
    --font-sans:  -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
    --font-mono:  'SF Mono', ui-monospace, 'JetBrains Mono', 'Cascadia Mono', Consolas, 'Roboto Mono', monospace;
}

/* ── Tokens — Warm dark ──────────────────────────────────────── */
:root[data-theme="dark"] {
    --bg:            #1a1715;
    --bg-elevated:   #221f1c;
    --bg-hover:      #2a2623;
    --bg-input:      #1f1c19;
    --bg-subtle:     #1e1b18;

    --text:          #f5f4ef;
    --text-muted:    #b8b3aa;
    --text-dim:      #807a70;

    --primary:       #e8a085;
    --primary-hover: #f0b59c;
    --primary-ink:   #1a1715;
    --primary-soft:  #3a2d28;
    --primary-glow:  rgba(232, 160, 133, 0.18);

    --border:        #3a3530;
    --border-soft:   #2a2623;
    --border-strong: #4a443e;

    --warn:    #d99560;
    --danger:  #d97070;
    --info:    #8b97b8;
    --success: #95b075;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.20);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.30);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.45);
}

/* ── Animations (minimal) ────────────────────────────────────── */
@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.45; transform: scale(0.7); }
}
@keyframes fade-up {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes toast-in {
    from { opacity: 0; transform: translateY(14px) translateX(-50%); }
    to   { opacity: 1; transform: translateY(0)    translateX(-50%); }
}
@keyframes skeleton-pulse {
    0%, 100% { opacity: 0.5; }
    50%      { opacity: 0.85; }
}

/* ── Base ────────────────────────────────────────────────────── */
body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 16px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding: 20px;
    transition: background-color 0.25s ease, color 0.25s ease;
}

.skip-link {
    position: absolute;
    top: -40px; left: 20px;
    background: var(--primary);
    color: var(--primary-ink);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9em;
    text-decoration: none;
    z-index: 100;
    transition: top 0.2s;
}
.skip-link:focus { top: 20px; }

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.15s, opacity 0.15s;
}
a:hover { opacity: 0.78; }

.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.container {
    max-width: 1180px;
    margin: 0 auto;
    position: relative;
}
.container-narrow {
    max-width: 720px;
    margin: 0 auto;
    position: relative;
}

/* ── Topbar ──────────────────────────────────────────────────── */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 32px;
    padding: 14px 18px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
}
.topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-family: var(--font-serif);
    font-weight: 500;
    font-size: 1.15em;
    letter-spacing: -0.01em;
}
.topbar-brand:hover { opacity: 1; }
.topbar-brand-mark {
    width: 26px; height: 26px;
    background: var(--primary);
    color: var(--primary-ink);
    border-radius: var(--radius-sm);
    display: grid; place-items: center;
    font-family: var(--font-serif);
    font-weight: 500;
    font-size: 14px;
    line-height: 1;
}
.topbar-nav {
    display: none;
    gap: 2px;
    font-family: var(--font-sans);
}
.topbar-nav a {
    color: var(--text-muted);
    font-size: 0.92em;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: color 0.15s, background 0.15s;
}
.topbar-nav a:hover, .topbar-nav a.active {
    color: var(--text);
    background: var(--bg-hover);
    opacity: 1;
}
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.icon-btn {
    width: 34px; height: 34px;
    display: grid; place-items: center;
    background: transparent;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.icon-btn:hover {
    color: var(--text);
    border-color: var(--border);
    background: var(--bg-hover);
}
.icon-btn svg { width: 16px; height: 16px; display: block; }
:root[data-theme="dark"]  .theme-toggle .sun-icon  { display: block; }
:root[data-theme="dark"]  .theme-toggle .moon-icon { display: none; }
:root[data-theme="light"] .theme-toggle .sun-icon  { display: none; }
:root[data-theme="light"] .theme-toggle .moon-icon { display: block; }

/* ── Hero ────────────────────────────────────────────────────── */
.hero {
    text-align: center;
    padding: 72px 24px 56px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    margin-bottom: 32px;
    animation: fade-up 0.4s ease both;
}
.logo {
    font-family: var(--font-serif);
    font-size: clamp(3em, 7vw, 4.8em);
    font-weight: 400;
    color: var(--text);
    margin-bottom: 18px;
    letter-spacing: -0.02em;
    line-height: 1.02;
}
.tagline {
    color: var(--text-muted);
    font-size: clamp(1.02em, 2vw, 1.18em);
    max-width: 560px;
    margin: 0 auto 28px;
    line-height: 1.55;
}
.hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: center;
}
.update-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    font-size: 0.82em;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
.update-badge::before {
    content: '';
    width: 6px; height: 6px;
    background: var(--primary);
    border-radius: 50%;
    flex-shrink: 0;
    animation: pulse-dot 2.4s ease-in-out infinite;
}
.update-badge.stale {
    background: var(--bg-subtle);
    border-color: var(--warn);
    color: var(--warn);
}
.update-badge.stale::before { background: var(--warn); }
.news-flash {
    padding: 10px 14px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    background: var(--bg-subtle);
    color: var(--text-muted);
    font-size: 0.82em;
    line-height: 1.5;
    flex-basis: 100%;
    max-width: 680px;
}

/* ── Section primitives ──────────────────────────────────────── */
.section { margin-bottom: 40px; }
.section-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
    padding: 0 2px;
}
.section-heading h2 {
    font-family: var(--font-serif);
    font-size: clamp(1.5em, 2.8vw, 2em);
    font-weight: 500;
    letter-spacing: -0.015em;
    line-height: 1.15;
    color: var(--text);
}
.section-heading .accent { color: var(--primary); font-style: italic; }
.section-heading p {
    font-size: 0.92em;
    color: var(--text-muted);
    max-width: 380px;
    text-align: right;
}
.section-heading p a { font-weight: 500; }
.panel {
    background: var(--bg-elevated);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 28px;
    animation: fade-up 0.4s ease both;
}

/* ── Stats grid ──────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    animation: fade-up 0.4s 0.05s ease both;
}
.stat-card {
    background: var(--bg-elevated);
    padding: 24px 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border-soft);
    text-align: center;
    transition: border-color 0.2s;
}
.stat-card:hover { border-color: var(--border); }
.stat-value {
    font-family: var(--font-serif);
    font-size: clamp(2em, 4.2vw, 2.6em);
    font-weight: 500;
    color: var(--text);
    margin-bottom: 6px;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.015em;
    line-height: 1.1;
}
.stat-value.skeleton {
    background: var(--bg-hover);
    color: transparent;
    border-radius: var(--radius-sm);
    display: inline-block;
    min-width: 70px;
    animation: skeleton-pulse 1.6s ease-in-out infinite;
}
.stat-label {
    font-family: var(--font-sans);
    font-size: 0.78em;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 500;
}

/* ── Calculator ──────────────────────────────────────────────── */
.calculator h2 {
    font-family: var(--font-serif);
    color: var(--text);
    margin-bottom: 18px;
    font-size: 1.4em;
    font-weight: 500;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 10px;
}
.calculator h2 svg { color: var(--primary); }
.preset-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 18px;
}
.preset-chip {
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--border-soft);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.82em;
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font-sans);
}
.preset-chip:hover {
    border-color: var(--border);
    color: var(--text);
    background: var(--bg-hover);
}
.preset-chip.active {
    background: var(--primary);
    color: var(--primary-ink);
    border-color: var(--primary);
    font-weight: 600;
}
.calc-inputs {
    display: grid;
    gap: 14px;
    margin-bottom: 18px;
}
.calc-input-group label {
    display: block;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-size: 0.78em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.calc-input-group input,
.search-box input {
    width: 100%;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text);
    font-size: 1em;
    font-family: var(--font-mono);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.calc-input-group input:focus,
.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}
.calc-result {
    padding: 18px;
    background: var(--bg-subtle);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-soft);
}
.calc-result h3 {
    font-family: var(--font-serif);
    color: var(--text);
    margin-bottom: 12px;
    font-size: 1em;
    font-weight: 500;
}
.calc-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-soft);
    font-size: 0.93em;
}
.calc-row:last-child { border-bottom: none; }
.calc-row-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.calc-row-rank {
    font-family: var(--font-serif);
    font-weight: 500;
    color: var(--primary);
    width: 24px;
    flex-shrink: 0;
}
.calc-row-name {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.calc-row-provider {
    font-size: 0.86em;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* ── Controls (search, filters, view toggle) ─────────────────── */
.controls {
    background: var(--bg-elevated);
    padding: 18px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    border: 1px solid var(--border-soft);
}
.controls-row { display: flex; flex-direction: column; gap: 14px; }
.search-box { position: relative; }
.search-box input { padding-left: 42px; }
.search-icon {
    position: absolute;
    left: 14px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    pointer-events: none;
    width: 16px; height: 16px;
}
.filter-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.filter-chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
}
.filter-chip {
    padding: 6px 13px;
    border-radius: 999px;
    border: 1px solid var(--border-soft);
    background: var(--bg-elevated);
    color: var(--text-muted);
    font-size: 0.84em;
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font-sans);
}
.filter-chip:hover {
    border-color: var(--border);
    color: var(--text);
    background: var(--bg-hover);
}
.filter-chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--primary-ink);
    font-weight: 600;
}
.view-toggle {
    display: none;
    background: var(--bg-subtle);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    padding: 3px;
    gap: 2px;
}
.view-toggle button {
    padding: 5px 12px;
    border-radius: 4px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.82em;
    font-weight: 500;
    cursor: pointer;
    font-family: var(--font-sans);
    transition: background 0.15s, color 0.15s;
}
.view-toggle button.active {
    background: var(--bg-elevated);
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

/* ── Compare bar + modal ─────────────────────────────────────── */
.compare-bar {
    position: sticky;
    top: 12px;
    z-index: 50;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.compare-bar[hidden] { display: none !important; }
.compare-bar-label {
    font-size: 0.78em;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    flex-shrink: 0;
}
.compare-bar-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex: 1;
    min-width: 0;
}
.compare-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 6px 5px 12px;
    background: var(--primary-soft);
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    font-size: 0.82em;
    font-weight: 500;
    color: var(--text);
}
.compare-chip button {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.05em;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 999px;
    transition: background 0.15s, color 0.15s;
    font-family: var(--font-sans);
}
.compare-chip button:hover {
    color: var(--danger);
    background: rgba(168, 50, 50, 0.10);
}
.compare-bar-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}
.btn {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text);
    font-size: 0.86em;
    font-weight: 500;
    cursor: pointer;
    font-family: var(--font-sans);
    transition: all 0.15s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn:hover {
    border-color: var(--border-strong);
    background: var(--bg-hover);
    opacity: 1;
}
.btn-primary {
    background: var(--primary);
    color: var(--primary-ink);
    border-color: var(--primary);
}
.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: var(--primary-ink);
}

.compare-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(45, 41, 38, 0.55);
    display: grid;
    place-items: center;
    padding: 20px;
    animation: fade-up 0.15s ease both;
}
:root[data-theme="dark"] .compare-modal { background: rgba(0, 0, 0, 0.65); }
.compare-modal[hidden] { display: none !important; }
.compare-modal-card {
    width: 100%;
    max-width: 940px;
    max-height: 88vh;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}
.compare-modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-soft);
}
.compare-modal-head h3 {
    font-family: var(--font-serif);
    font-size: 1.2em;
    font-weight: 500;
    color: var(--text);
}
.compare-modal-body { overflow: auto; padding: 20px; }
.compare-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}
.compare-col {
    background: var(--bg-subtle);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    padding: 16px;
    display: flex;
    flex-direction: column;
}
.compare-col h4 {
    font-family: var(--font-serif);
    font-size: 1.05em;
    font-weight: 500;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text);
}
.compare-col .provider-name {
    font-size: 0.82em;
    color: var(--text-muted);
    margin-bottom: 12px;
}
.compare-stat {
    display: flex;
    justify-content: space-between;
    padding: 7px 0;
    font-size: 0.88em;
    border-bottom: 1px solid var(--border-soft);
}
.compare-stat:last-of-type { border-bottom: none; }
.compare-stat-label { color: var(--text-muted); }
.compare-stat-value {
    font-weight: 600;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    color: var(--text);
}
.compare-best {
    background: var(--primary-soft);
    border-color: var(--primary);
    position: relative;
}
.compare-best::after {
    content: 'Cheapest';
    position: absolute;
    top: -10px; right: 12px;
    padding: 2px 9px;
    background: var(--primary);
    color: var(--primary-ink);
    font-size: 0.7em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-radius: 999px;
}

/* ── Model cards (mobile) ────────────────────────────────────── */
.model-cards {
    display: grid;
    gap: 10px;
    margin-bottom: 20px;
    animation: fade-up 0.4s 0.1s ease both;
    content-visibility: auto;
    contain-intrinsic-size: 1px 6000px;
}
.model-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 18px;
    transition: border-color 0.15s, box-shadow 0.15s;
    position: relative;
}
.model-card:hover {
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
}
.model-card.pinned {
    border-color: var(--primary);
    background: var(--primary-soft);
}
:root[data-theme="dark"] .model-card.pinned { background: var(--bg-elevated); }
.model-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}
.provider-badge {
    width: 34px; height: 34px;
    border-radius: 50%;
    display: grid; place-items: center;
    font-weight: 600;
    font-size: 0.85em;
    flex-shrink: 0;
    color: #fff;
    font-family: var(--font-sans);
}
.provider-badge.openai     { background: #5aad92; }
.provider-badge.anthropic  { background: #cc785c; }
.provider-badge.google     { background: #4285f4; }
.provider-badge.meta       { background: #0066cc; }
.provider-badge.mistral    { background: #e55a2b; }
.provider-badge.cohere     { background: #39c2a5; }
.provider-badge.perplexity { background: #20808d; }
.provider-badge.groq       { background: #f26522; }
.provider-badge.xai        { background: #3a3530; }
.provider-badge.alibaba    { background: #f59e0b; }
.provider-badge.deepseek   { background: #0ea5e9; }
.provider-badge.zhipu      { background: #8b5cf6; }
.provider-badge.baidu      { background: #1d4ed8; }
.provider-badge.moonshot   { background: #a855f7; }
.provider-badge.minimax    { background: #ef4444; }
.provider-badge.unknown    { background: #6b6660; }

.model-info { flex: 1; min-width: 0; }
.model-name {
    font-weight: 500;
    font-size: 1.04em;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text);
    font-family: var(--font-sans);
}
.provider-name {
    font-size: 0.84em;
    color: var(--text-muted);
}
.pin-btn {
    background: transparent;
    border: 1px solid var(--border-soft);
    color: var(--text-dim);
    width: 32px; height: 32px;
    border-radius: var(--radius-sm);
    display: grid; place-items: center;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}
.pin-btn:hover {
    color: var(--primary);
    border-color: var(--border);
    background: var(--bg-hover);
}
.pin-btn.pinned {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--primary-soft);
}
.pin-btn svg { width: 13px; height: 13px; }

.model-pricing {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}
.price-item {
    text-align: center;
    padding: 12px 8px;
    background: var(--bg-subtle);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-soft);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.price-item:hover { border-color: var(--border); background: var(--bg-hover); }
.price-label {
    font-size: 0.72em;
    color: var(--text-muted);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}
.price-value {
    font-size: 1.1em;
    font-weight: 600;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}
.cheap     { color: var(--success); }
.medium    { color: var(--warn); }
.expensive { color: var(--danger); }

.model-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid var(--border-soft);
    font-size: 0.86em;
    gap: 8px;
}
.context-badge { color: var(--text-muted); }
.total-cost {
    font-family: var(--font-mono);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.table-view { display: none; }

/* ── Tips grid ──────────────────────────────────────────────── */
.tips-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: 1fr;
}
.tip-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 22px;
    display: flex;
    gap: 16px;
    align-items: flex-start;
    transition: border-color 0.15s;
}
.tip-card:hover { border-color: var(--border); }
.tip-number {
    flex-shrink: 0;
    width: 36px; height: 36px;
    display: grid; place-items: center;
    background: var(--primary-soft);
    color: var(--primary);
    font-family: var(--font-serif);
    font-weight: 500;
    border-radius: var(--radius-sm);
    font-size: 1.05em;
}
.tip-body { min-width: 0; }
.tip-body h3 {
    font-family: var(--font-serif);
    font-size: 1.12em;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text);
    letter-spacing: -0.005em;
}
.tip-body p {
    color: var(--text-muted);
    font-size: 0.93em;
    line-height: 1.6;
}
.tip-body .savings {
    display: inline-block;
    margin-top: 10px;
    padding: 3px 9px;
    background: var(--primary-soft);
    color: var(--primary);
    border-radius: 999px;
    font-size: 0.74em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ── Blog featured cards ────────────────────────────────────── */
.blog-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: 1fr;
}
.blog-card {
    display: block;
    background: var(--bg-elevated);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 24px;
    transition: border-color 0.15s, box-shadow 0.15s;
    color: var(--text);
}
.blog-card:hover {
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
    opacity: 1;
}
.blog-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78em;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 500;
    margin-bottom: 12px;
}
.blog-card-tag { color: var(--primary); }
.blog-card-title {
    font-family: var(--font-serif);
    font-size: 1.28em;
    font-weight: 500;
    letter-spacing: -0.01em;
    margin-bottom: 8px;
    line-height: 1.25;
    color: var(--text);
}
.blog-card-excerpt {
    color: var(--text-muted);
    font-size: 0.94em;
    line-height: 1.55;
}
.blog-card-cta {
    display: inline-block;
    margin-top: 12px;
    color: var(--primary);
    font-weight: 500;
    font-size: 0.9em;
}

/* ── How-to ─────────────────────────────────────────────────── */
.howto-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: 1fr;
}
.howto-card {
    padding: 22px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
}
.howto-card h3 {
    font-family: var(--font-serif);
    font-size: 1.15em;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 8px;
    letter-spacing: -0.005em;
}
.howto-card p {
    font-size: 0.93em;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 0;
}

/* ── Provider directory ─────────────────────────────────────── */
.provider-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}
.provider-tile {
    display: flex;
    align-items: stretch;
    background: var(--bg-elevated);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: border-color 0.15s;
    font-size: 0.92em;
}
.provider-tile:hover { border-color: var(--border); }
.provider-tile-filter {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-family: var(--font-sans);
    text-align: left;
    color: var(--text);
    min-width: 0;
    transition: background 0.15s;
}
.provider-tile-filter:hover { background: var(--bg-hover); }
.provider-tile-external {
    display: grid;
    place-items: center;
    padding: 0 12px;
    color: var(--text-dim);
    border-left: 1px solid var(--border-soft);
    transition: color 0.15s, background 0.15s;
}
.provider-tile-external:hover {
    color: var(--primary);
    background: var(--bg-hover);
    opacity: 1;
}
.provider-tile-external svg { width: 13px; height: 13px; display: block; }
.provider-tile-info { display: flex; flex-direction: column; min-width: 0; }
.provider-tile-name {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.provider-tile-count { font-size: 0.78em; color: var(--text-muted); }

/* ── External link icon next to model name ──────────────────── */
.model-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
    margin-left: 6px;
    vertical-align: -1px;
    transition: color 0.15s, opacity 0.15s;
    opacity: 0.65;
}
.model-link:hover { color: var(--primary); opacity: 1; }
.model-link svg { width: 11px; height: 11px; display: block; }

/* ── Visit provider link in compare modal ──────────────────── */
.compare-visit {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--border-soft);
    color: var(--primary);
    font-size: 0.85em;
    font-weight: 500;
    transition: opacity 0.15s;
    width: 100%;
}
.compare-visit:hover { opacity: 0.78; }
.compare-visit svg { width: 11px; height: 11px; display: block; flex-shrink: 0; }

/* ── FAQ accordion ──────────────────────────────────────────── */
.faq-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.faq-item {
    background: var(--bg-elevated);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: border-color 0.15s;
}
.faq-item[open] { border-color: var(--border); }
.faq-item summary {
    padding: 16px 20px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.98em;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    color: var(--text);
    font-family: var(--font-sans);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
    content: '+';
    font-size: 1.3em;
    color: var(--primary);
    font-weight: 400;
    line-height: 1;
    transition: transform 0.2s;
    flex-shrink: 0;
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item .faq-body {
    padding: 0 20px 18px;
    color: var(--text-muted);
    font-size: 0.93em;
    line-height: 1.65;
}
.faq-item .faq-body p { margin-bottom: 10px; }
.faq-item .faq-body p:last-child { margin-bottom: 0; }
.faq-item .faq-body strong { color: var(--text); font-weight: 600; }

/* ── Glossary ───────────────────────────────────────────────── */
.glossary-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.glossary-item {
    padding: 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
}
.glossary-term {
    font-family: var(--font-serif);
    font-weight: 500;
    color: var(--text);
    font-size: 1em;
    margin-bottom: 5px;
}
.glossary-def {
    font-size: 0.88em;
    color: var(--text-muted);
    line-height: 1.6;
}

/* ── Footer ─────────────────────────────────────────────────── */
footer {
    text-align: center;
    padding: 48px 20px 24px;
    margin-top: 48px;
    color: var(--text-dim);
    font-size: 0.86em;
    border-top: 1px solid var(--border-soft);
}
footer .footer-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin-bottom: 16px;
}
footer .footer-links a {
    color: var(--text-muted);
    transition: color 0.15s;
}
footer .footer-links a:hover { color: var(--primary); opacity: 1; }
footer p { line-height: 1.6; }
footer .footer-disclaimer {
    margin-top: 18px;
    font-size: 0.84em;
    color: var(--text-dim);
    max-width: 740px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.65;
}

/* ── Loading + toast ───────────────────────────────────────── */
.loading {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-style: italic;
}
.toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%);
    padding: 12px 20px;
    background: var(--text);
    border: 1px solid var(--text);
    border-radius: var(--radius-sm);
    color: var(--bg);
    font-size: 0.88em;
    font-weight: 500;
    box-shadow: var(--shadow-md);
    z-index: 250;
    animation: toast-in 0.18s ease both;
    pointer-events: none;
}
.toast[hidden] { display: none !important; }
.toast .toast-icon { color: var(--primary); margin-right: 6px; }

/* ── Editorial / prose (blog post body) ─────────────────────── */
.prose {
    color: var(--text);
    font-size: 1.05em;
    line-height: 1.75;
    font-family: var(--font-sans);
}
.prose > * + * { margin-top: 1.1em; }
.prose h2 {
    font-family: var(--font-serif);
    font-size: clamp(1.5em, 3vw, 1.95em);
    font-weight: 500;
    letter-spacing: -0.015em;
    margin-top: 2.5em;
    margin-bottom: 0.6em;
    line-height: 1.2;
    color: var(--text);
}
.prose h3 {
    font-family: var(--font-serif);
    font-size: 1.3em;
    font-weight: 500;
    color: var(--text);
    margin-top: 1.8em;
    margin-bottom: 0.4em;
    letter-spacing: -0.005em;
}
.prose p { color: var(--text); }
.prose strong { color: var(--text); font-weight: 600; }
.prose em { color: var(--text); font-style: italic; }
.prose ul, .prose ol {
    list-style: none;
    padding: 0;
    color: var(--text);
}
.prose ul li, .prose ol li {
    padding-left: 24px;
    position: relative;
    margin-bottom: 10px;
}
.prose ul li::before {
    content: '';
    position: absolute;
    left: 6px; top: 0.7em;
    width: 5px; height: 5px;
    background: var(--primary);
    border-radius: 50%;
}
.prose ol { counter-reset: pli; }
.prose ol li { counter-increment: pli; }
.prose ol li::before {
    content: counter(pli) '.';
    position: absolute;
    left: 0; top: 0;
    color: var(--primary);
    font-family: var(--font-serif);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}
.prose blockquote {
    border-left: 2px solid var(--primary);
    padding: 4px 0 4px 20px;
    color: var(--text-muted);
    font-style: italic;
    font-family: var(--font-serif);
    font-size: 1.1em;
    line-height: 1.6;
}
.prose code {
    font-family: var(--font-mono);
    background: var(--bg-subtle);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.88em;
    border: 1px solid var(--border-soft);
    color: var(--text);
}
.prose pre {
    background: var(--bg-subtle);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    padding: 16px 18px;
    overflow-x: auto;
    font-size: 0.86em;
    line-height: 1.6;
    margin-top: 1.2em;
}
.prose pre code { background: none; border: none; padding: 0; }
.prose hr {
    border: 0;
    border-top: 1px solid var(--border-soft);
    margin: 2.5em 0;
}
.prose table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92em;
    margin-top: 1.2em;
}
.prose table th, .prose table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-soft);
    text-align: left;
}
.prose table th {
    font-family: var(--font-sans);
    color: var(--text);
    font-weight: 600;
    font-size: 0.84em;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: var(--bg-subtle);
}
.prose table td { color: var(--text); }
.prose .callout {
    padding: 18px 20px;
    border-radius: var(--radius-sm);
    background: var(--primary-soft);
    border: 1px solid var(--border-soft);
    border-left: 3px solid var(--primary);
    color: var(--text);
    font-size: 0.96em;
}
:root[data-theme="dark"] .prose .callout { background: var(--bg-subtle); }
.prose .callout strong { color: var(--primary); }
.prose a {
    color: var(--primary);
    border-bottom: 1px solid var(--primary-soft);
    transition: border-color 0.15s, opacity 0.15s;
}
.prose a:hover { border-bottom-color: var(--primary); opacity: 1; }

/* ── Blog post header + back link + CTA ─────────────────────── */
.post-header {
    margin-bottom: 32px;
    padding: 32px 0 16px;
}
.post-eyebrow {
    display: inline-block;
    color: var(--primary);
    font-size: 0.8em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 14px;
    font-family: var(--font-sans);
}
.post-title {
    font-family: var(--font-serif);
    font-size: clamp(2em, 5.5vw, 3em);
    font-weight: 500;
    letter-spacing: -0.02em;
    line-height: 1.15;
    margin-bottom: 18px;
    color: var(--text);
}
.post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.92em;
}
.post-meta strong { color: var(--text); font-weight: 600; }
.post-meta time { font-variant-numeric: tabular-nums; }
.post-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 0.9em;
    margin-bottom: 20px;
    font-family: var(--font-sans);
}
.post-back:hover { color: var(--primary); opacity: 1; }
.post-cta {
    margin-top: 40px;
    padding: 24px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}
.post-cta-text { flex: 1; min-width: 220px; }
.post-cta-text h3 {
    font-family: var(--font-serif);
    font-size: 1.18em;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text);
    letter-spacing: -0.005em;
}
.post-cta-text p {
    color: var(--text-muted);
    font-size: 0.93em;
}

/* ── Desktop ────────────────────────────────────────────────── */
@media (min-width: 768px) {
    body { padding: 32px; }
    .topbar { padding: 14px 22px; }
    .topbar-nav { display: flex; }
    .hero { padding: 96px 40px 80px; }
    .stats-grid { grid-template-columns: repeat(4, 1fr); gap: 14px; }
    .calc-inputs { grid-template-columns: repeat(2, 1fr); gap: 20px; }
    .controls { padding: 20px; }
    .view-toggle { display: flex; }
    .howto-grid, .tips-grid { grid-template-columns: repeat(2, 1fr); }
    .blog-grid { grid-template-columns: repeat(2, 1fr); }
    .model-cards { display: none; }
    body[data-view="cards"] .model-cards { display: grid; }
    body[data-view="cards"] .table-view  { display: none; }
    .table-view {
        display: block;
        background: var(--bg-elevated);
        border-radius: var(--radius);
        overflow: hidden;
        border: 1px solid var(--border-soft);
        margin-bottom: 20px;
        animation: fade-up 0.4s 0.1s ease both;
        content-visibility: auto;
        contain-intrinsic-size: 1px 4500px;
    }
    table { width: 100%; border-collapse: collapse; font-size: 14px; }
    thead { background: var(--bg-subtle); position: sticky; top: 0; z-index: 2; }
    th {
        padding: 14px 16px;
        text-align: left;
        font-weight: 600;
        font-size: 11px;
        color: var(--text-muted);
        cursor: pointer;
        border-bottom: 1px solid var(--border);
        white-space: nowrap;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        user-select: none;
        transition: background 0.15s, color 0.15s;
        font-family: var(--font-sans);
    }
    th:hover { background: var(--bg-hover); color: var(--text); }
    th[data-sort] { padding-right: 28px; position: relative; }
    th.sorted { color: var(--primary); }
    th .sort-arrow {
        position: absolute;
        right: 12px;
        top: 50%;
        transform: translateY(-50%);
        opacity: 0.4;
        font-size: 0.9em;
    }
    th.sorted .sort-arrow { opacity: 1; }
    td {
        padding: 13px 16px;
        border-bottom: 1px solid var(--border-soft);
        vertical-align: middle;
    }
    tbody tr { transition: background 0.15s; }
    tbody tr:hover { background: var(--bg-hover); }
    tbody tr:last-child td { border-bottom: none; }
    tbody tr.pinned { background: var(--primary-soft); }
    :root[data-theme="dark"] tbody tr.pinned { background: var(--bg-subtle); }
    tbody tr.pinned td:first-child { border-left: 2px solid var(--primary); }
    td.model-name { font-weight: 500; font-size: 0.95em; color: var(--text); }
    .provider-cell { display: flex; align-items: center; gap: 10px; }
    .provider-cell .provider-badge { width: 26px; height: 26px; font-size: 0.78em; }
    td .price-value { font-size: 0.92em; cursor: pointer; }
    td .pin-cell-btn {
        background: transparent;
        border: none;
        color: var(--text-dim);
        cursor: pointer;
        padding: 4px 8px;
        border-radius: var(--radius-sm);
        transition: all 0.15s;
    }
    td .pin-cell-btn:hover { color: var(--primary); background: var(--bg-hover); }
    td .pin-cell-btn.pinned { color: var(--primary); }
    .compare-modal-body { padding: 28px; }
}

@media (min-width: 1024px) {
    .howto-grid { grid-template-columns: repeat(3, 1fr); }
    .tips-grid  { grid-template-columns: repeat(3, 1fr); }
    .blog-grid  { grid-template-columns: repeat(3, 1fr); }
}
