/* VERSUST — "The Duel". Two things, weighed against each other. Structural,
   not decorative: every color/motion choice below ties back to that. */

:root {
    --bg: #EDEFF0;
    --surface: #FFFFFF;
    --ink: #1A1D21;
    --muted: #6B7280;
    --border: rgba(26, 29, 33, 0.12);
    --side-a: #D98E2E;
    --side-a-tint: #FBF0DF;
    --side-b: #16847A;
    --side-b-tint: #DFF0EE;
    --radius: 6px;
    --font-display: "Fraunces", Georgia, serif;
    --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, monospace;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
}

h1, h2, h3, .display {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -0.01em;
    margin: 0 0 0.5em;
}

p {
    margin: 0 0 1em;
    color: var(--muted);
}

.mono {
    font-family: var(--font-mono);
}

.container {
    width: 100%;
    max-width: 1160px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 22px;
    border-radius: var(--radius);
    font-size: 14.5px;
    font-weight: 600;
    border: 1px solid var(--ink);
    cursor: pointer;
    background: var(--ink);
    color: var(--surface);
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.btn:hover {
    opacity: 0.85;
}

.btn-ghost {
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--border);
}

.btn-a {
    background: var(--side-a);
    border-color: var(--side-a);
    color: #fff;
}

.btn-b {
    background: var(--side-b);
    border-color: var(--side-b);
    color: #fff;
}

.btn-sm {
    padding: 7px 14px;
    font-size: 13px;
}

/* ---- Header ---- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(237, 239, 240, 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    gap: 24px;
}

.logo {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 20px;
    letter-spacing: -0.02em;
}

.logo .vs {
    color: var(--side-a);
}

.nav {
    display: flex;
    align-items: center;
    gap: 22px;
    font-size: 14.5px;
    color: var(--muted);
}

.nav a:hover {
    color: var(--ink);
}

.search-form {
    flex: 1;
    max-width: 300px;
}

.search-form input {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 9px 14px;
    font-family: var(--font-body);
    font-size: 14px;
}

.search-form input:focus {
    outline: none;
    border-color: var(--ink);
}

/* ---- The seam: the signature structural element ---- */
.duel {
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: stretch;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
}

.duel-side {
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.duel-side-a {
    border-right: 1px solid var(--border);
}

.duel-side-a .duel-eyebrow { color: var(--side-a); }
.duel-side-b .duel-eyebrow { color: var(--side-b); }

.duel-eyebrow {
    font-family: var(--font-mono);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

.duel-side img {
    border-radius: var(--radius);
    aspect-ratio: 1 / 1;
    object-fit: contain;
    background: var(--bg);
}

.duel-side h2, .duel-side h3 {
    font-size: 22px;
    margin: 0;
}

/* The seam itself — the vertical divider with the VS badge where the two halves meet. */
.duel-seam {
    position: relative;
    width: 1px;
    background: var(--border);
}

.duel-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--ink);
    color: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 15px;
    letter-spacing: 0.02em;
    z-index: 2;
}

/* Scroll-tied progress line — extends downward as the reader scrolls through
   a comparison page. Height is set by JS (scroll.js), not decorative CSS.
   It spans the full article behind the text (z-index:-1, needs the parent's
   isolation:isolate below to actually land behind static in-flow content —
   CSS otherwise always paints positioned elements above it) and never
   intercepts clicks (pointer-events:none) — it's a background guide line,
   not a hit target. */
.duel-progress-track {
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 100%;
    background: var(--border);
    transform: translateX(-50%);
    z-index: -1;
    pointer-events: none;
}

.duel-progress-fill {
    width: 100%;
    height: 0%;
    background: var(--ink);
    transition: height 0.1s linear;
}

/* ---- Lean meter: a live scoreboard reflecting narrative-section lean as the reader scrolls ---- */
.lean-meter {
    position: sticky;
    top: 65px;
    z-index: 40;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 10px 0;
}

.lean-meter-track {
    height: 6px;
    border-radius: 3px;
    background: var(--bg);
    overflow: hidden;
    display: flex;
}

.lean-meter-a {
    background: var(--side-a);
    transition: width 0.4s ease;
}

.lean-meter-b {
    background: var(--side-b);
    transition: width 0.4s ease;
}

.lean-meter-labels {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--muted);
    margin-top: 6px;
}

/* ---- Spec table ---- */
.spec-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14.5px;
}

.spec-table th, .spec-table td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.spec-table th {
    font-family: var(--font-mono);
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    font-weight: 600;
}

.spec-table td.value {
    font-family: var(--font-mono);
}

.spec-table tr:hover td.winner-a { background: var(--side-a-tint); }
.spec-table tr:hover td.winner-b { background: var(--side-b-tint); }

.spec-winner-marker {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
}

.spec-winner-marker.a { background: var(--side-a); }
.spec-winner-marker.b { background: var(--side-b); }

/* ---- Pros/cons ---- */
.pros-cons-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.pros-cons-col h4 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: var(--font-mono);
    margin-bottom: 10px;
}

.pros-cons-col.side-a h4 { color: var(--side-a); }
.pros-cons-col.side-b h4 { color: var(--side-b); }

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

.pros-cons-col li {
    padding: 6px 0 6px 20px;
    position: relative;
    font-size: 14.5px;
}

.pros-cons-col li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 14px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.pros-cons-col.side-a li { color: var(--side-a); }
.pros-cons-col.side-b li { color: var(--side-b); }
.pros-cons-col li span { color: var(--ink); }

/* ---- Narrative sections ---- */
.narrative-section {
    padding: 32px 0;
    border-top: 1px solid var(--border);
}

.narrative-section[data-lean="a"] { border-left: 3px solid var(--side-a); padding-left: 20px; }
.narrative-section[data-lean="b"] { border-left: 3px solid var(--side-b); padding-left: 20px; }

/* ---- Verdict reveal ---- */
.verdict {
    position: relative;
    padding: 40px;
    border-radius: var(--radius);
    background: var(--ink);
    color: var(--surface);
    overflow: hidden;
}

.verdict p {
    color: rgba(255, 255, 255, 0.82);
    font-size: 17px;
}

.verdict-winner-flag {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.verdict[data-winner="a"] .verdict-winner-flag { background: linear-gradient(120deg, var(--side-a) 0%, transparent 60%); }
.verdict[data-winner="b"] .verdict-winner-flag { background: linear-gradient(120deg, transparent 40%, var(--side-b) 100%); }
.verdict.revealed .verdict-winner-flag { opacity: 0.18; }

.verdict-content {
    position: relative;
    z-index: 1;
}

/* ---- FAQ accordion ---- */
.faq-item {
    border-bottom: 1px solid var(--border);
}

.faq-question {
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 18px 0;
    font-family: var(--font-body);
    font-size: 15.5px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--ink);
}

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

.faq-item.open .faq-answer {
    max-height: 400px;
}

.faq-answer p {
    padding-bottom: 18px;
}

/* ---- Cards ---- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
}

.duel-card {
    display: block;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.duel-card:hover {
    transform: translateY(-2px);
}

.duel-card-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.duel-card-half {
    padding: 16px;
    font-size: 13.5px;
}

.duel-card-half.a { background: var(--side-a-tint); }
.duel-card-half.b { background: var(--side-b-tint); }

.duel-card-half .name {
    font-weight: 600;
    font-size: 14.5px;
}

.duel-card-vs {
    text-align: center;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--muted);
    padding: 6px 0;
    border-top: 1px solid var(--border);
}

/* ---- Sections ---- */
.section {
    padding: 48px 0;
}

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 20px;
}

.section-head a {
    font-size: 14px;
    color: var(--muted);
}

.scroller {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 8px;
    scroll-snap-type: x proximity;
}

.scroller > * {
    flex: 0 0 300px;
    scroll-snap-align: start;
}

/* ---- Filter toggle (amber/teal duality for category sort) ---- */
.duel-toggle {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: 999px;
    overflow: hidden;
    font-size: 13.5px;
}

.duel-toggle a {
    padding: 8px 16px;
    color: var(--muted);
}

.duel-toggle a.active[data-mode="closest"] { background: var(--side-a); color: #fff; }
.duel-toggle a.active[data-mode="decisive"] { background: var(--side-b); color: #fff; }

/* ---- Breadcrumbs ---- */
.breadcrumbs {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 18px;
}

/* ---- Disclosure block ---- */
.disclosure {
    font-size: 13px;
    color: var(--muted);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin: 24px 0;
}

.disclosure a {
    text-decoration: underline;
}

/* ---- Footer ---- */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 40px 0;
    margin-top: 64px;
    color: var(--muted);
    font-size: 13.5px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 24px;
    margin-bottom: 28px;
}

.footer-grid h4 {
    color: var(--ink);
    font-size: 12.5px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 10px;
}

.footer-grid a {
    display: block;
    padding: 4px 0;
}

.footer-grid a:hover {
    color: var(--ink);
}

/* ---- Pagination ---- */
.pagination {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 32px;
}

.pagination a, .pagination span {
    padding: 8px 13px;
    border-radius: var(--radius);
    font-size: 14px;
    border: 1px solid var(--border);
    font-family: var(--font-mono);
}

.pagination .current {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--surface);
}

/* ---- Error/empty states ---- */
.empty-state, .error-page {
    text-align: center;
    padding: 80px 20px;
}

.error-page .code {
    font-family: var(--font-display);
    font-size: 64px;
    color: var(--muted);
}

/* ---- Forms ---- */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 13.5px;
    color: var(--muted);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    font-family: var(--font-body);
    font-size: 14.5px;
    color: var(--ink);
}

.form-control:focus {
    outline: none;
    border-color: var(--ink);
}

textarea.form-control {
    min-height: 140px;
    resize: vertical;
}

/* ---- Homepage hero ---- */
.hero {
    padding: 48px 0 20px;
    text-align: center;
}

.hero h1 {
    font-size: clamp(30px, 4.5vw, 46px);
    max-width: 700px;
    margin: 0 auto 12px;
}

.hero p {
    max-width: 520px;
    margin: 0 auto 4px;
    font-size: 16px;
}

/* ---- Animations ---- */
@keyframes slide-in-a {
    from { transform: translateX(-40px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slide-in-b {
    from { transform: translateX(40px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes badge-settle {
    from { transform: translate(-50%, -50%) scale(0.4); opacity: 0; }
    to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.duel-load .duel-side-a { animation: slide-in-a 0.6s cubic-bezier(0.22, 1, 0.36, 1) both; }
.duel-load .duel-side-b { animation: slide-in-b 0.6s cubic-bezier(0.22, 1, 0.36, 1) both; }
.duel-load .duel-badge { animation: badge-settle 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.45s both; }

.count-up {
    font-variant-numeric: tabular-nums;
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ---- Responsive ---- */
@media (max-width: 860px) {
    .nav { display: none; }
    /* Stack A on top, seam becomes a horizontal bar with the badge
       centered on it, B below — badge stays a child of .duel-seam so it
       can't be hidden separately from it. */
    .duel { grid-template-columns: 1fr; }
    .duel-side-a { border-right: none; border-bottom: 1px solid var(--border); }
    .duel-seam {
        width: 100%;
        height: 1px;
        position: relative;
    }
    .duel-badge {
        top: 0;
        left: 50%;
    }
    .pros-cons-grid { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .duel-progress-track { display: none; }
}
