/* Research + interpretability article pages. Builds on style.css (terminal theme). */
:root {
    --c-human: #4ade80;
    --c-optimal: #7fa8e0;
    --c-extended: #8f8f8f;
    --c-red: #ff2a2a;
    --c-green: #1f9d3a;
    --c-a: #d24b5d;
    --c-b: #2c87ac;
    --c-c: #e3a63a;
    --c-d: #5c8d5b;
    --c-sampling: #a78bfa;
    --c-inference: #60a5fa;
    --panel-bg: #070707;
    --grid: rgba(255, 255, 255, 0.07);
}

.article {
    max-width: 980px;
    margin: 0 auto;
    padding: 2.2rem 1.5rem 5rem;
}

/* text keeps a readable measure; boxed blocks span the full article width */
.prose {
    max-width: none;
}

.article p {
    max-width: 720px;
}

.article p strong,
.article li strong {
    color: var(--text-primary);
    font-weight: 500;
}

.keep-case,
.keep-case * {
    text-transform: none !important;
}

.article h1 {
    font-size: 1.9rem;
    line-height: 1.25;
    font-weight: 500;
    max-width: 820px;
    margin-bottom: 1rem;
}

.byline {
    font-size: 0.78rem;
    color: var(--text-light);
    max-width: 760px;
    line-height: 1.7;
    margin-bottom: 1.2rem;
}

.byline .venue {
    color: var(--text-secondary);
}

.link-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 2.4rem;
}

.chip-link {
    display: inline-block;
    font-size: 0.78rem;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 0.3rem 0.8rem;
    text-decoration: none;
    transition: all 0.15s ease;
}

.chip-link:hover {
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

.chip-link.muted {
    color: var(--text-light);
    border-style: dashed;
    cursor: default;
}

.article h2 {
    font-size: 1.15rem;
    font-weight: 500;
    margin: 3.4rem 0 1rem;
    color: var(--text-primary);
}

.article h2 .num {
    color: var(--text-light);
    margin-right: 0.6rem;
    font-weight: 400;
}

.article h3 {
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--text-primary);
    margin: 1.6rem 0 0.6rem;
}

.article a {
    color: var(--text-primary);
}

.article ul.dash {
    list-style: none;
    max-width: 720px;
    margin: 0 0 1rem;
}

.article ul.dash li {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.7;
    padding-left: 1.2rem;
    position: relative;
    margin-bottom: 0.3rem;
}

.article ul.dash li::before {
    content: "-";
    position: absolute;
    left: 0;
    color: var(--text-light);
}

/* tl;dr terminal block */
.tldr {
    border: 1px solid var(--border-color);
    padding: 1.1rem 1.3rem;
    max-width: none;
    background: var(--panel-bg);
}

.tldr .head {
    font-size: 0.72rem;
    color: var(--text-light);
    margin-bottom: 0.6rem;
}

.tldr p {
    font-size: 0.86rem;
    margin-bottom: 0.45rem;
    color: var(--text-secondary);
}

.tldr p::before {
    content: "> ";
    color: var(--accent-green);
}

/* KaTeX inside the lowercase monospace theme: style.css sets font-family and
   text-transform on every span, so restore KaTeX's own fonts and case. */
.katex,
.katex span {
    text-transform: none !important;
    font-family: KaTeX_Main, 'Times New Roman', serif;
}

.article .katex {
    font-size: 1.08em;
}

.tip .katex {
    font-size: 1em;
}

.eq {
    border-left: 2px solid var(--border-color);
    padding: 0.2rem 0 0.2rem 1.1rem;
    margin: 1.1rem 0 1.5rem;
    max-width: none;
}

.eq-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    color: var(--text-primary);
    padding-bottom: 0.55rem;
}

.eq-row + .eq-row {
    border-top: 1px dashed rgba(255, 255, 255, 0.07);
}

.eq-row .katex-display {
    margin: 0.55rem 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.15rem 0;
}

.eq-row .katex-display > .katex {
    font-size: 1.38em;
}

.eq-note {
    font-size: 0.72rem;
    line-height: 1.5;
    color: var(--text-light);
    margin-top: -0.2rem;
}

.eq-note::before {
    content: "% ";
    color: var(--text-light);
}

.eq-note .katex {
    font-size: 1em;
}

.param-card .sym .katex {
    font-size: 1.25em;
}

/* figures */
.figure {
    border: 1px solid var(--border-color);
    background: var(--panel-bg);
    padding: 1rem 1.1rem 0.9rem;
    margin: 1.6rem 0 1.4rem;
    position: relative;
}

.figure .fig-title {
    font-size: 0.82rem;
    color: var(--text-primary);
    margin-bottom: 0.7rem;
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.figure .fig-title .tag {
    color: var(--text-light);
}

.figure .caption {
    font-size: 0.74rem;
    color: var(--text-light);
    line-height: 1.6;
    margin-top: 0.8rem;
    max-width: none;
}

.figure svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}

.figure svg text,
.teaser svg text {
    font-family: 'JetBrains Mono', monospace;
}

.figure svg text:not([fill]),
.teaser svg text:not([fill]) {
    fill: var(--text-secondary);
}

.controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
    margin-bottom: 0.8rem;
}

.seg {
    display: inline-flex;
    flex-wrap: wrap;
    max-width: 100%;
    border: 1px solid var(--border-color);
}

.seg button {
    background: transparent;
    border: none;
    border-right: 1px solid var(--border-color);
    color: var(--text-light);
    font-family: inherit;
    font-size: 0.74rem;
    padding: 0.28rem 0.7rem;
    cursor: pointer;
    text-transform: lowercase;
}

.seg button:last-child {
    border-right: none;
}

.seg button:hover {
    color: var(--text-primary);
}

.seg button.on {
    color: var(--bg);
    background: var(--text-primary);
}

.toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.74rem;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

.toggle input {
    accent-color: var(--text-primary);
}

.ctl-label {
    font-size: 0.72rem;
    color: var(--text-light);
}

select.term {
    background: var(--bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    font-family: inherit;
    font-size: 0.76rem;
    padding: 0.28rem 0.5rem;
    text-transform: lowercase;
    border-radius: 0;
}

.btn-term {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--text-light);
    font-family: inherit;
    font-size: 0.76rem;
    padding: 0.3rem 0.8rem;
    cursor: pointer;
    text-transform: lowercase;
}

.btn-term:hover {
    border-color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.btn-term:disabled {
    opacity: 0.4;
    cursor: default;
}

input[type=range].term {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    background: transparent;
    height: 18px;
}

input[type=range].term::-webkit-slider-runnable-track {
    height: 1px;
    background: var(--text-light);
}

input[type=range].term::-moz-range-track {
    height: 1px;
    background: var(--text-light);
}

input[type=range].term::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 10px;
    height: 10px;
    margin-top: -5px;
    background: var(--text-primary);
    border: none;
    border-radius: 0;
}

input[type=range].term::-moz-range-thumb {
    width: 10px;
    height: 10px;
    background: var(--text-primary);
    border: none;
    border-radius: 0;
}

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem 1rem;
    font-size: 0.7rem;
    color: var(--text-light);
}

.legend .sw {
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-right: 0.35rem;
    vertical-align: -1px;
}

.legend .sw.line {
    height: 2px;
    vertical-align: 3px;
    width: 14px;
}

.legend .sw.dash {
    height: 0;
    border-top: 2px dashed currentColor;
    vertical-align: 3px;
    width: 14px;
}

.legend .sw.ring {
    border: 1.5px solid currentColor;
    border-radius: 50%;
    background: transparent;
}

.legend .sw.dot {
    border-radius: 50%;
}

/* tooltip */
.tip {
    position: fixed;
    pointer-events: none;
    z-index: 100;
    background: #000;
    border: 1px solid var(--text-light);
    padding: 0.45rem 0.6rem;
    font-size: 0.72rem;
    line-height: 1.55;
    color: var(--text-secondary);
    max-width: 280px;
    display: none;
}

.tip b {
    color: var(--text-primary);
    font-weight: 500;
}

.stat-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin: 1.2rem 0 0.4rem;
}

.stat {
    border: 1px solid var(--border-color);
    padding: 0.55rem 0.8rem;
    min-width: 118px;
    flex: 1;
}

.stat .v {
    font-size: 1.25rem;
    color: var(--text-primary);
}

.stat .k {
    font-size: 0.7rem;
    color: var(--text-light);
}

/* parameter cards */
.param-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 0.6rem;
    margin: 1.2rem 0;
}

.param-card {
    border: 1px solid var(--border-color);
    padding: 0.7rem 0.85rem;
}

.param-card .sym {
    font-size: 1rem;
    color: var(--text-primary);
}

.param-card .name {
    font-size: 0.72rem;
    color: var(--text-light);
    margin-bottom: 0.35rem;
}

.param-card p {
    font-size: 0.76rem;
    line-height: 1.55;
    margin: 0;
}

/* ===== model playground ===== */
.playground {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 1.2rem;
}

.pg-board {
    border: 1px solid var(--border-color);
    padding: 0.9rem;
    text-align: center;
}

.pg-round {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.pg-progress {
    height: 2px;
    background: rgba(255, 255, 255, 0.06);
    margin-bottom: 0.7rem;
}

.pg-progress div {
    height: 100%;
    background: var(--accent-green);
    transition: width 0.2s;
}

.pg-cues {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.45rem;
    margin: 0.4rem auto 0.7rem;
    max-width: 230px;
}

.pg-cue {
    aspect-ratio: 1;
    background: var(--btn-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 500;
    position: relative;
    transition: background 0.15s, opacity 0.15s, border-color 0.15s;
    text-transform: uppercase !important;
}

.pg-cue .lab,
.mini-cue span {
    text-transform: uppercase !important;
}

.pg-cue.off {
    opacity: 0.35;
    color: transparent;
}

.pg-cue.chosen {
    border-color: rgba(255, 255, 255, 0.85);
}

.pg-cue.red {
    background: var(--c-red);
    color: #fff;
    font-weight: 700;
}

.pg-cue.green {
    background: var(--c-green);
    color: #fff;
    font-weight: 700;
}

.pg-cue.invalid {
    outline: 1px dashed var(--error-red);
    outline-offset: 2px;
}

.pg-cue .pbar {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    background: var(--c-sampling);
    transition: width 0.15s;
}

.pg-cue .true-mark {
    position: absolute;
    top: 3px;
    right: 5px;
    font-size: 0.62rem;
    color: var(--text-light);
    text-transform: lowercase !important;
}

.pg-status {
    font-size: 0.74rem;
    color: var(--text-secondary);
    min-height: 2.6em;
    margin-bottom: 0.6rem;
}

.pg-buttons {
    display: flex;
    gap: 0.4rem;
    justify-content: center;
    flex-wrap: wrap;
}

.pg-params {
    margin-top: 0.9rem;
    text-align: left;
}

.slider-row {
    display: grid;
    grid-template-columns: 100px 1fr 44px;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.15rem;
}

.slider-row label {
    font-size: 0.74rem;
    color: var(--text-secondary);
}

.slider-row output {
    font-size: 0.72rem;
    color: var(--text-primary);
    text-align: right;
}

.pg-right {
    min-width: 0;
}

.pg-batch {
    border-top: 1px dashed var(--border-color);
    margin-top: 0.9rem;
    padding-top: 0.9rem;
}

/* ===== interpretability ===== */
.scrubber {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(0, 0, 0, 0.92);
    border-bottom: 1px solid var(--border-color);
    padding: 0.55rem 0;
    display: flex;
    align-items: center;
    gap: 0.9rem;
    margin: 0 0 1rem;
}

.scrubber .round-label {
    font-size: 0.8rem;
    color: var(--text-primary);
    white-space: nowrap;
    min-width: 8.5em;
}

.two-col {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1rem;
}

.cond-title {
    font-size: 0.78rem;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
}

.cond-title .sub {
    color: var(--text-light);
}

.mini-cues {
    display: flex;
    gap: 0.35rem;
    margin: 0.2rem 0 0.4rem;
}

.mini-cue {
    width: 34px;
    height: 34px;
    border: 1px solid var(--border-color);
    background: var(--btn-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    color: var(--text-primary);
    text-transform: uppercase !important;
}

.mini-cue.off {
    opacity: 0.3;
    color: transparent;
}

.mini-cue.red {
    background: var(--c-red);
    font-weight: 700;
}

.mini-cue.green {
    background: var(--c-green);
    font-weight: 700;
}

details.methods {
    border: 1px solid var(--border-color);
    padding: 0.7rem 1rem;
    margin: 1rem 0;
    max-width: none;
}

details.methods summary {
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--text-primary);
}

details.methods p,
details.methods li {
    font-size: 0.8rem;
}

.teaser {
    display: grid;
    grid-template-columns: 1fr 240px;
    gap: 1.2rem;
    align-items: center;
    border: 1px solid var(--border-color);
    padding: 1rem 1.2rem;
    text-decoration: none;
    margin: 1.2rem 0;
    transition: border-color 0.15s;
}

.teaser:hover {
    border-color: var(--text-secondary);
}

.teaser p {
    margin: 0;
}

.bibtex {
    font-size: 0.72rem;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 0.9rem 1rem;
    overflow-x: auto;
    white-space: pre;
    text-transform: none;
    max-width: none;
}

.article .mock-note,
.mock-note {
    margin-top: 3rem;
    font-size: 0.72rem;
    color: var(--text-light);
    border-top: 1px dashed var(--border-color);
    padding-top: 1rem;
    max-width: none;
}

@media (max-width: 820px) {
    .playground,
    .two-col,
    .teaser {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 600px) {
    .article {
        padding: 1.4rem 1rem 4rem;
    }

    .article h1 {
        font-size: 1.35rem;
    }

    .figure {
        padding: 0.8rem 0.6rem;
    }
}

/* ===== research landing + section pages ===== */
.section-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 0.8rem;
    margin: 1rem 0 2.6rem;
}

.section-card {
    border: 1px solid var(--border-color);
    background: var(--panel-bg);
    padding: 0.8rem 0.9rem 0.9rem;
    text-decoration: none;
    display: block;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.section-card:hover {
    border-color: var(--text-secondary);
    background: #0c0c0c;
}

.card-anim {
    border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
    margin: -0.2rem -0.2rem 0.7rem;
    padding-bottom: 0.4rem;
}

.card-anim svg {
    display: block;
    width: 100%;
    height: auto;
}

.card-anim svg text {
    font-family: 'JetBrains Mono', monospace;
}

.card-num {
    font-size: 0.72rem;
    color: var(--text-light);
}

.card-title {
    font-size: 0.9rem;
    color: var(--text-primary);
    margin: 0.15rem 0 0.4rem;
    line-height: 1.4;
}

.section-card p {
    font-size: 0.76rem;
    line-height: 1.55;
    margin: 0;
}

.h1-num {
    color: var(--text-light);
    font-weight: 400;
    margin-right: 0.8rem;
}

.section-nav {
    display: flex;
    justify-content: space-between;
    gap: 0.8rem;
    flex-wrap: wrap;
    margin-top: 3rem;
    border-top: 1px dashed var(--border-color);
    padding-top: 1.2rem;
}

/* ===== about: authors as game rounds ===== */
.author-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.8rem;
    margin: 1.6rem 0 1.2rem;
}

.author-card {
    border: 1px solid var(--border-color);
    background: var(--panel-bg);
    padding: 1rem;
    text-decoration: none;
    display: block;
    transition: border-color 0.15s ease;
}

a.author-card:hover {
    border-color: var(--text-secondary);
}

.glyph {
    display: grid;
    grid-template-columns: repeat(2, 38px);
    gap: 4px;
    margin-bottom: 0.9rem;
}

.glyph .cell {
    width: 38px;
    height: 38px;
    background: var(--btn-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.72rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase !important;
    transition: opacity 0.2s ease;
}

.glyph .cell.off {
    opacity: 0.3;
    color: transparent;
}

.glyph .cell.red {
    background: var(--c-red);
    font-weight: 700;
}

.glyph .cell.green {
    background: var(--c-green);
    font-weight: 700;
}

.author-card:hover .cell.red,
.author-card:hover .cell.green {
    animation: cue-flash 0.9s ease-in-out infinite alternate;
}

.author-card:hover .cell:not(.red):not(.green):not(.off) {
    animation: cue-scan 1.6s ease-in-out infinite;
    animation-delay: calc(var(--d) * 0.2s);
}

@keyframes cue-flash {
    from { filter: brightness(1); }
    to { filter: brightness(1.45); }
}

@keyframes cue-scan {
    0%, 70%, 100% { border-color: var(--border-color); }
    35% { border-color: rgba(255, 255, 255, 0.8); }
}

@media (prefers-reduced-motion: reduce) {
    .author-card:hover .cell { animation: none !important; }
}

.author-name {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.author-name sup,
.affils sup {
    font-size: 0.62rem;
    color: var(--text-light);
    margin-left: 0.15rem;
}

.affils sup {
    margin: 0 0.4rem 0 0;
}

.star {
    color: var(--accent-green);
}


.affils {
    list-style: none;
    font-size: 0.76rem;
    color: var(--text-secondary);
    line-height: 1.8;
}
