/* ================================
   TruthBot - Editorial redesign
   ================================ */
:root {
    --paper: #f0efea;
    --paper-2: #e4e3dd;
    --card: #f9f8f4;
    --ink: #111110;
    --muted: #55534e;
    --line: #b9b7ae;
    --red: #dc3b46;
    --red-dark: #b82c36;
    --display: 'Archivo Black', 'Arial Black', Impact, sans-serif;
    --body: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--body);
    background: var(--paper);
    color: var(--ink);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }

.page {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 28px;
}

.red { color: var(--red); }

.arrow { display: inline-block; transition: transform .25s ease; }

/* ---------- Header ---------- */
.header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 18px 0;
    border-bottom: 1px solid var(--ink);
}

.logo { display: inline-flex; align-items: center; gap: 10px; justify-self: start; }

.logo-mark {
    width: 28px; height: 28px;
    background: var(--red);
    color: #fff;
    display: grid; place-items: center;
    font-family: var(--display);
    font-size: 16px;
}

.logo-text {
    font-family: var(--display);
    font-size: 15px;
    letter-spacing: .02em;
}

.nav { display: flex; gap: 40px; font-size: 12px; font-weight: 700; }
.nav a { position: relative; padding: 4px 0; }
.nav a::after {
    content: ''; position: absolute; left: 0; bottom: 0;
    width: 0; height: 2px; background: var(--red);
    transition: width .25s ease;
}
.nav a:hover::after { width: 100%; }

.upgrade-btn {
    justify-self: end;
    background: var(--ink);
    color: #fff;
    border: none;
    padding: 12px 22px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    display: inline-flex; align-items: center; gap: 22px;
    transition: background .25s ease;
}
.upgrade-btn:hover { background: var(--red); }
.upgrade-btn:hover .arrow,
.analyze-btn:hover .arrow,
.tool:hover .arrow,
.text-link:hover .arrow { transform: translateX(4px); }

/* ---------- Eyebrow ---------- */
.eyebrow {
    display: flex; align-items: center; gap: 10px;
    font-size: 10px; font-weight: 700;
    letter-spacing: .14em; text-transform: uppercase;
    color: var(--muted);
}
.eyebrow-line { width: 26px; height: 1px; background: var(--red); }
.eyebrow.light { color: rgba(255,255,255,.75); }

/* ---------- Hero ---------- */
.hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin-top: 24px;
    min-height: 520px;
    background: var(--paper-2);
}

.hero-left {
    padding: 56px 40px;
    display: flex; flex-direction: column; justify-content: center; gap: 28px;
}

.hero-title {
    font-family: var(--display);
    font-size: clamp(52px, 8vw, 100px);
    line-height: .9;
    letter-spacing: -0.035em;
    text-transform: uppercase;
}

.hero-copy { max-width: 360px; font-size: 15px; color: var(--ink); }

.text-link {
    align-self: flex-start;
    display: inline-flex; align-items: center; gap: 16px;
    font-size: 11px; font-weight: 700;
    letter-spacing: .1em; text-transform: uppercase;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--ink);
    background: none; border-top: none; border-left: none; border-right: none;
    color: var(--ink);
}
.text-link:hover { color: var(--red); border-color: var(--red); }

.hero-right { position: relative; overflow: hidden; background: #cfcdc6; }
.hero-right img { width: 100%; height: 100%; object-fit: cover; display: block; }

.stamp {
    position: absolute; top: 28px; right: -10px;
    transform: rotate(8deg);
    border: 2px solid var(--red);
    color: var(--red);
    padding: 6px 18px;
    font-size: 11px; font-weight: 700;
    letter-spacing: .12em; text-transform: uppercase;
    background: rgba(255,255,255,.55);
}

.issue-tag {
    position: absolute; right: 12px; bottom: 12px;
    background: var(--ink); color: #fff;
    font-size: 9px; font-weight: 700;
    letter-spacing: .12em; text-transform: uppercase;
    padding: 7px 12px;
}

/* ---------- Analyzer ---------- */
.analyzer {
    margin: 40px -28px 0;
    padding: 64px 28px;
    background: var(--ink);
    color: #fff;
    display: grid;
    grid-template-columns: 1fr 1.7fr;
    gap: 40px;
    align-items: start;
}
.analyzer > * { max-width: 1224px; }

.analyzer-intro { display: flex; flex-direction: column; gap: 22px; padding-left: calc((100vw - 1224px) / 2 > 0 ? 0px : 0px); }

.section-title-light {
    font-family: var(--display);
    font-size: clamp(36px, 4.5vw, 52px);
    line-height: .95;
    letter-spacing: -0.03em;
}

.analyzer-intro p { font-size: 13px; color: rgba(255,255,255,.7); max-width: 300px; }

.analyzer-card {
    background: var(--paper);
    color: var(--ink);
    padding: 32px;
}

.field-label {
    display: block;
    font-size: 9px; font-weight: 700;
    letter-spacing: .14em; text-transform: uppercase;
    margin-bottom: 8px;
}

.field {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--line);
    background: var(--card);
    font-family: var(--body);
    font-size: 14px;
    color: var(--ink);
    margin-bottom: 22px;
    border-radius: 0;
    transition: border-color .2s ease, box-shadow .2s ease;
}
.field::placeholder { color: #8c8a83; }
.field:focus { outline: none; border-color: var(--ink); box-shadow: 4px 4px 0 var(--red); }
textarea.field { resize: vertical; min-height: 150px; }

.card-actions {
    display: flex; justify-content: space-between; align-items: center;
    gap: 16px; flex-wrap: wrap;
}

.mini-links { display: flex; gap: 22px; }

.mini-link {
    background: none; border: none;
    font-size: 10px; font-weight: 700;
    letter-spacing: .08em; text-transform: uppercase;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--ink);
    color: var(--ink);
}
.mini-link:hover { color: var(--red); border-color: var(--red); }

.analyze-btn {
    background: var(--red); color: #fff; border: none;
    padding: 16px 28px;
    font-size: 11px; font-weight: 700;
    letter-spacing: .1em; text-transform: uppercase;
    display: inline-flex; align-items: center; gap: 28px;
    transition: background .25s ease;
}
.analyze-btn:hover { background: var(--red-dark); }
.analyze-btn:disabled { opacity: .6; cursor: not-allowed; }

/* Results */
.result-container {
    display: none;
    position: relative;
    margin-top: 28px;
    padding: 28px;
    color: #fff;
    animation: reveal .5s ease both;
}
.result-real { background: #0f6b4a; }
.result-fake { background: var(--red); }

@keyframes reveal {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-close {
    position: absolute; top: 10px; right: 14px;
    background: none; border: none; color: #fff;
    font-size: 26px; line-height: 1;
}
.result-close:hover { opacity: .7; }

.result-header { display: flex; align-items: center; gap: 18px; margin-bottom: 22px; }
.result-icon {
    width: 56px; height: 56px;
    display: grid; place-items: center;
    background: rgba(255,255,255,.18);
    font-size: 26px;
}
.result-title { font-family: var(--display); font-size: 24px; line-height: 1.1; letter-spacing: -0.02em; }
.result-subtitle { font-size: 14px; opacity: .9; margin-top: 4px; }

.confidence-top { display: flex; justify-content: space-between; margin-bottom: 8px; }
.confidence-label { font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.confidence-text { font-family: var(--display); font-size: 18px; }
.confidence-bar { height: 8px; background: rgba(255,255,255,.28); }
.confidence-fill { height: 100%; width: 0; background: #fff; transition: width 1.2s cubic-bezier(.16,1,.3,1); }

.result-details {
    margin-top: 22px; padding-top: 18px;
    border-top: 1px solid rgba(255,255,255,.35);
    font-size: 14px; line-height: 1.8;
}

/* ---------- Why ---------- */
.why {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 40px;
    padding: 90px 0 60px;
}

.why-side {
    align-self: start;
    border-top: 1px solid var(--ink);
    padding-top: 10px;
    display: flex; gap: 18px;
    font-size: 9px; font-weight: 700;
    letter-spacing: .14em; text-transform: uppercase;
}
.why-num { color: var(--red); }

.why-main { display: flex; flex-direction: column; gap: 26px; }

.why-title {
    font-family: var(--display);
    font-size: clamp(44px, 6.5vw, 82px);
    line-height: .92;
    letter-spacing: -0.035em;
    text-transform: uppercase;
}

.why-copy { max-width: 600px; font-size: 14px; color: var(--muted); }
.as-button { font-family: var(--body); }

.features {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border-top: 1px solid var(--ink);
    border-bottom: 1px solid var(--ink);
}

.feature-cell {
    padding: 22px 20px 28px;
    border-right: 1px solid var(--line);
    transition: background .25s ease;
}
.feature-cell:last-child { border-right: none; }
.feature-cell:hover { background: var(--paper-2); }
.feature-num { display: block; font-size: 10px; font-weight: 700; color: var(--red); margin-bottom: 28px; }
.feature-cell h3 { font-size: 15px; font-weight: 500; margin-bottom: 6px; }
.feature-cell p { font-size: 12px; color: var(--muted); }

/* ---------- Toolkit ---------- */
.toolkit {
    margin: 64px -28px 0;
    padding: 60px 28px;
    background: var(--red);
    color: #fff;
    display: grid;
    grid-template-columns: 1fr 1.7fr;
    gap: 40px;
    align-items: start;
}

.toolkit-intro { display: flex; flex-direction: column; gap: 22px; }

.toolkit-title {
    font-family: var(--display);
    font-size: clamp(38px, 5vw, 58px);
    line-height: .95;
    letter-spacing: -0.03em;
    text-transform: uppercase;
}

.tool-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border: 1px solid rgba(255,255,255,.55);
}

.tool {
    display: flex; align-items: center; gap: 16px;
    padding: 22px 20px;
    background: transparent;
    border: none;
    border-right: 1px solid rgba(255,255,255,.55);
    border-bottom: 1px solid rgba(255,255,255,.55);
    color: #fff;
    text-align: left;
    transition: background .25s ease;
}
.tool:nth-child(2n) { border-right: none; }
.tool:nth-last-child(-n+2) { border-bottom: none; }
.tool:hover { background: var(--red-dark); }

.tool-badge {
    width: 38px; height: 38px; flex-shrink: 0;
    display: grid; place-items: center;
    border: 1px solid #fff;
    font-size: 10px; font-weight: 700; letter-spacing: .04em;
}
.tool-body { flex: 1; display: flex; flex-direction: column; }
.tool-name { font-size: 12px; font-weight: 700; }
.tool-desc { font-size: 10px; opacity: .85; }

/* ---------- Footer ---------- */
.footer {
    display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
    padding: 28px 0 36px;
    font-size: 11px; color: var(--muted);
}

/* ---------- Modal ---------- */
.modal-overlay {
    position: fixed; inset: 0;
    display: flex; justify-content: center; align-items: center;
    background: rgba(17,17,16,.7);
    opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity .25s ease, visibility .25s ease;
    z-index: 1000;
    padding: 20px;
}
.modal-overlay.active { opacity: 1; visibility: visible; pointer-events: all; }

.modal-container {
    width: 100%; max-width: 680px; max-height: 88vh;
    background: var(--paper);
    overflow: hidden;
    transform: translateY(20px);
    transition: transform .3s ease;
    display: flex; flex-direction: column;
}
.modal-overlay.active .modal-container { transform: translateY(0); }

.modal-header {
    background: var(--ink); color: #fff;
    padding: 28px 30px;
    display: flex; justify-content: space-between; align-items: flex-start;
}
.modal-title {
    font-family: var(--display);
    font-size: 30px; letter-spacing: -0.02em;
    margin-top: 12px;
}
.modal-subtitle { font-size: 13px; opacity: .7; }
.modal-close {
    background: none; border: 1px solid rgba(255,255,255,.4);
    color: #fff; width: 36px; height: 36px; font-size: 22px; line-height: 1;
    transition: background .2s ease;
}
.modal-close:hover { background: var(--red); border-color: var(--red); }

.modal-body { padding: 28px 30px 32px; overflow-y: auto; overscroll-behavior: contain; }

.m-section { margin-bottom: 28px; }
.m-title {
    font-size: 10px; font-weight: 700;
    letter-spacing: .14em; text-transform: uppercase;
    color: var(--red);
    padding-bottom: 8px; margin-bottom: 14px;
    border-bottom: 1px solid var(--ink);
}

.algo-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.algo-name { font-family: var(--display); font-size: 20px; letter-spacing: -0.01em; }
.accuracy-badge {
    background: var(--ink); color: #fff;
    font-size: 10px; font-weight: 700;
    letter-spacing: .1em; text-transform: uppercase;
    padding: 8px 14px;
}

.m-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.m-list li {
    font-size: 13px; color: var(--muted);
    padding-left: 18px; position: relative;
}
.m-list li::before {
    content: ''; position: absolute; left: 0; top: 8px;
    width: 8px; height: 2px; background: var(--red);
}
.m-list strong { color: var(--ink); }

.metrics-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.split-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.metric {
    background: var(--card);
    border: 1px solid var(--line);
    padding: 16px;
    transition: border-color .2s ease, transform .2s ease;
}
.metric:hover { border-color: var(--ink); transform: translateY(-3px); }
.metric-label {
    display: block;
    font-size: 9px; font-weight: 700;
    letter-spacing: .12em; text-transform: uppercase;
    color: var(--muted); margin-bottom: 6px;
}
.metric-value { font-family: var(--display); font-size: 26px; }
.metric-value small { font-family: var(--body); font-size: 12px; color: var(--muted); margin-left: 2px; }
.split-value { font-size: 15px; font-weight: 700; }

/* ---------- Loading ---------- */
.loading-overlay {
    position: fixed; inset: 0;
    background: rgba(17,17,16,.85);
    display: none; flex-direction: column;
    justify-content: center; align-items: center;
    z-index: 2000;
}
.loading-spinner {
    width: 52px; height: 52px;
    border: 4px solid rgba(255,255,255,.2);
    border-top-color: var(--red);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
    margin-bottom: 20px;
}
.loading-text { color: #fff; font-size: 14px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
@keyframes spin { to { transform: rotate(360deg); } }

.analyze-btn .loading-spinner {
    width: 16px; height: 16px; border-width: 2px; margin: 0;
}

/* ---------- Focus ---------- */
:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
    .header { grid-template-columns: 1fr auto; }
    .nav { display: none; }
    .hero { grid-template-columns: 1fr; }
    .hero-right { min-height: 340px; }
    .analyzer, .toolkit { grid-template-columns: 1fr; }
    .why { grid-template-columns: 1fr; gap: 24px; padding-top: 60px; }
    .features { grid-template-columns: 1fr 1fr; }
    .feature-cell:nth-child(2) { border-right: none; }
    .feature-cell:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}

@media (max-width: 600px) {
    .page { padding: 0 16px; }
    .analyzer, .toolkit { margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px; }
    .hero-left { padding: 36px 22px; }
    .analyzer-card { padding: 22px; }
    .tool-grid { grid-template-columns: 1fr; }
    .tool { border-right: none !important; border-bottom: 1px solid rgba(255,255,255,.55) !important; }
    .tool:last-child { border-bottom: none !important; }
    .metrics-grid { grid-template-columns: 1fr 1fr; }
    .split-grid { grid-template-columns: 1fr; }
    .card-actions { flex-direction: column; align-items: stretch; }
    .analyze-btn { justify-content: space-between; }
    .footer { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}