/* Academic Theme Variables (adapted from the DyT project page) */
:root {
    --primary-color: #0B1F33;
    --secondary-color: #8B4513;
    --accent-color: #1976D1;
    --light-color: #FFFFF0;
    --dark-color: #483D8B;
    --text-color: #333333;
    --background-color: #FFFFF8;
    --card-background: #FFFFF8;
    --header-gradient: none;
    --header-text-color: #333333;
    --font-family: 'Avenir Next', 'Nunito', 'Avenir', 'Segoe UI', sans-serif;
    --base-font-size: 16px;
    --scale-factor: 1;
}

html {
    font-size: var(--base-font-size);
}

body {
    font-family: var(--font-family);
    line-height: 1.8;
    font-size: calc(1.375rem * var(--scale-factor)); /* 22px at default scale */
    background-color: var(--background-color);
    color: var(--text-color);
    transition: all 0.3s ease;
}

/* Header */
.header-section {
    background: var(--header-gradient);
    padding: 60px 0 40px 0;
    margin-bottom: 15px;
    color: var(--header-text-color);
    box-shadow: none;
}

.paper-title {
    font-weight: 700;
    font-size: calc(3rem * var(--scale-factor)); /* 48px at default scale */
    margin-bottom: 1.25rem;
    text-shadow: none;
    color: var(--primary-color);
}

.paper-subtitle {
    font-size: calc(1.5rem * var(--scale-factor));
    font-weight: 400;
    font-style: italic;
    color: rgba(51, 51, 51, 0.85);
    margin-bottom: 1.5rem;
}

/* Authors */
.author-line {
    font-size: calc(1.2rem * var(--scale-factor));
    font-weight: 600;
    margin: 0.625rem 0;
    line-height: 1.5;
    color: var(--text-color);
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    align-items: center;
}

.author-line span {
    display: inline-flex;
    white-space: nowrap;
}

.author-line .mx-2 {
    margin-left: 0.25rem !important;
    margin-right: 0.25rem !important;
}

.author-link {
    text-decoration: none;
    transition: all 0.2s ease;
    padding: 3px 5px;
    border-radius: 4px;
    color: var(--primary-color);
}

.author-link:hover {
    background-color: rgba(11, 31, 51, 0.1);
    text-decoration: underline;
}

.institution-line {
    font-size: calc(1.3rem * var(--scale-factor));
    color: rgba(51, 51, 51, 0.9);
    margin-bottom: 15px;
}

.venue-line {
    font-size: calc(1.25rem * var(--scale-factor));
    color: rgba(51, 51, 51, 0.9);
}

/* CAAI logo + resource links on one line */
.logo-line {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.25rem;
}

.caai-logo {
    height: calc(4rem * var(--scale-factor));
    width: auto;
}

/* Section titles */
.section-title {
    margin: 2.5rem 0 1.25rem 0;
    font-weight: 600;
    font-size: calc(2.375rem * var(--scale-factor)); /* 38px at default scale */
    color: var(--primary-color);
    padding-bottom: 0.625rem;
    text-align: center;
    border-bottom: none;
}

.section-title::after {
    content: "";
    display: block;
    width: 100%;
    height: 2px;
    background-color: var(--secondary-color);
    margin: 15px 0 0 0;
}

h4 {
    font-size: calc(2rem * var(--scale-factor)); /* 32px at default scale */
    margin-top: 1.5625rem;
    margin-bottom: 0.9375rem;
    text-align: center;
}

h1, h2, h3, h5, h6 {
    text-align: center;
}

/* Abstract */
#abstract .section-title {
    margin-bottom: 15px;
}

/* The headline equation */
.headline-eq {
    text-align: center;
    margin: 30px auto;
    font-size: calc(1.6rem * var(--scale-factor));
}

/* Buttons */
.primary-btn { background-color: var(--primary-color); color: white; }
.secondary-btn { background-color: var(--secondary-color); color: white; }
.accent-btn { background-color: var(--accent-color); color: white; }

.btn {
    font-size: calc(1.375rem * var(--scale-factor)); /* 22px at default scale */
    padding: 0.5rem 1rem;
}

/* Figures */
.figure-section {
    margin: 20px 0;
    text-align: center;
}

.figure-container {
    background-color: var(--card-background);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.figure-caption {
    margin-top: 0.9375rem;
    font-size: calc(1.4rem * var(--scale-factor));
    color: var(--text-color);
    max-width: 90%;
    margin-left: auto;
    margin-right: auto;
}

/* Guidelines */
.guidelines-list {
    max-width: 90%;
    margin: 1.25rem auto;
    padding-left: 1.5rem;
}

.guidelines-list li {
    margin-bottom: 1rem;
    font-size: calc(1.375rem * var(--scale-factor)); /* 22px at default scale */
    line-height: 1.6;
}

/* Cards */
.card {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    border: none;
    background-color: var(--card-background);
}

.resources-card {
    height: 100%;
    transition: transform 0.3s ease;
    border-top: 4px solid var(--secondary-color);
    background-color: var(--card-background);
}

.resources-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.card-title {
    font-size: calc(1.875rem * var(--scale-factor)); /* 30px at default scale */
    text-align: center;
}

.card-text {
    font-size: calc(1.625rem * var(--scale-factor)); /* 26px at default scale */
}

/* Tables */
.results-table-wrapper {
    overflow-x: auto;
    margin: 20px 0;
}

table.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: calc(1.15rem * var(--scale-factor));
    background-color: var(--card-background);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    overflow: hidden;
}

table.results-table th,
table.results-table td {
    padding: 10px 16px;
    text-align: center;
    border-bottom: 1px solid #e0e0d8;
}

table.results-table thead th {
    background-color: var(--primary-color);
    color: #fff;
    font-weight: 600;
}

table.results-table tbody tr:hover {
    background-color: rgba(25, 118, 209, 0.06);
}

table.results-table td.highlight {
    font-weight: 700;
    color: var(--accent-color);
}

table.results-table .table-caption {
    font-size: 0.9rem;
}

/* Code blocks */
.code-container {
    position: relative;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.implementation-section pre code,
.citation-section pre code {
    font-size: calc(1rem * var(--scale-factor)); /* 16px at default scale */
    line-height: 1.5;
}

#copy-btn, #copy-citation-btn, #copy-cite-btn {
    transition: all 0.2s ease;
    background-color: var(--primary-color);
    color: white;
}

#copy-btn:hover, #copy-citation-btn:hover, #copy-cite-btn:hover {
    background-color: var(--secondary-color);
}

/* Override Bootstrap text-light to stay readable on the light header */
.text-light, .mx-2.text-light {
    color: var(--text-color) !important;
}

.col-lg-8 {
    max-width: 100%;
}

/* Make the overall page a bit wider than Bootstrap's default container */
.container {
    max-width: 1440px;
}

/* Inline citation links — rendered like footnote numbers */
.cite-link {
    color: var(--accent-color);
    text-decoration: none;
    font-size: 0.7em;
    vertical-align: super;
    line-height: 0;
}

.cite-link:hover {
    text-decoration: underline;
}

/* References list at the bottom */
.ref-list {
    max-width: 90%;
    margin: 1rem auto 0.5rem auto;
    padding-left: 2rem;
}

.ref-list li {
    margin-bottom: 0.75rem;
    font-size: calc(1.15rem * var(--scale-factor));
    line-height: 1.6;
}

.ref-list a {
    color: var(--accent-color);
}

/* Result figures */
.result-figure {
    margin: 1.5rem auto 2rem;
    text-align: center;
}
.result-figure img {
    width: 100%;
    max-width: 900px;
    height: auto;
}
.result-figure figcaption {
    margin-top: 0.5rem;
    font-size: calc(0.95rem * var(--scale-factor));
    line-height: 1.5;
    color: rgba(51, 51, 51, 0.8);
    max-width: 820px;
    margin-left: auto;
    margin-right: auto;
}

/* Segmented tab bar (Utility section) — a pill slides under the active tab */
.seg-tabs {
    position: relative;
    display: flex;
    width: max-content;
    max-width: 100%;
    margin: 1.25rem auto 0.75rem;
    padding: 4px;
    border-radius: 999px;
    background-color: #efede0;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.08);
    overflow-x: auto;
}

.seg-slider {
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 4px;
    width: 0;
    border-radius: 999px;
    background-color: var(--primary-color);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.seg-btn {
    position: relative;
    z-index: 1;
    border: none;
    background: transparent;
    padding: 0.4rem 1.4rem;
    border-radius: 999px;
    font-family: var(--font-family);
    font-size: calc(1.15rem * var(--scale-factor));
    font-weight: 600;
    color: var(--text-color);
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.3s ease;
}

.seg-btn.active {
    color: #fff;
}

.seg-panel {
    display: none;
}

/* Intro text above the look-ahead figures — match figure width, slightly smaller */
.lookahead-note {
    max-width: 900px;
    margin: 0 auto;
    font-size: calc(1.02rem * var(--scale-factor));
    line-height: 1.55;
}

.seg-panel.active {
    display: block;
    animation: seg-fade 0.3s ease;
}

@keyframes seg-fade {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
}

.tab-placeholder {
    margin: 1.5rem auto 2rem;
    max-width: 820px;
    padding: 3rem 1.5rem;
    text-align: center;
    border: 2px dashed #d8d5c4;
    border-radius: 10px;
    color: rgba(51, 51, 51, 0.6);
    font-size: calc(1.15rem * var(--scale-factor));
}

/* Responsive font scaling based on viewport width */
@media (max-width: 1400px) { :root { --scale-factor: 0.9; } }
@media (max-width: 1200px) {
    :root { --scale-factor: 0.85; }
    .author-line { flex-wrap: wrap; justify-content: center; white-space: normal; }
}
@media (max-width: 992px) { :root { --scale-factor: 0.8; } }
@media (max-width: 768px) {
    :root { --scale-factor: 0.75; }
    table.results-table { font-size: 0.85rem; }
}
@media (max-width: 576px) {
    :root { --scale-factor: 0.7; }
    .author-line { font-size: calc(1rem * var(--scale-factor)); }
    .paper-title { font-size: calc(2.5rem * var(--scale-factor)); }
}

/* Example: baseline vs. steered side by side */
.examples-section {
    max-width: 1100px;
    margin: 1.5rem auto 2.5rem;
}

.example-prompt-box {
    border: 1px solid var(--accent-color);
    border-radius: 10px;
    background: rgba(25, 118, 209, 0.05);
    padding: 0.75rem 1.1rem;
    margin-bottom: 1rem;
}

.example-prompt-label {
    display: inline-block;
    margin-bottom: 0.35rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--accent-color);
}

.example-prompt-text {
    margin: 0;
    font-size: calc(1.05rem * var(--scale-factor));
    line-height: 1.6;
    min-height: 1.6em;
}

.examples-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.example-card {
    border: 2px solid var(--accent-color);
    border-radius: 10px;
    background: rgba(25, 118, 209, 0.06);
    padding: 1rem 1.25rem;
    min-height: 9rem;
    box-shadow: 0 4px 15px rgba(25, 118, 209, 0.08);
}

.example-card.steered {
    background: rgba(25, 118, 209, 0.12);
}

.example-label {
    display: inline-block;
    margin-bottom: 0.5rem;
    padding: 0.12rem 0.6rem;
    border-radius: 999px;
    background: var(--accent-color);
    color: #FFFFF8;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.example-response {
    margin: 0;
    font-size: calc(1.05rem * var(--scale-factor));
    line-height: 1.6;
}

@media (max-width: 768px) {
    .examples-row { grid-template-columns: 1fr; }
}

/* Resource links (header) — GitHub, models, etc. */
.resource-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.6rem;
}
.resource-link {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 1.1rem;
    border-radius: 999px;
    background: var(--primary-color);
    color: #FFFFF8;
    font-size: calc(1.05rem * var(--scale-factor));
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.2s ease;
}
.resource-link:hover {
    background: var(--secondary-color);
    color: #FFFFF8;
    transform: translateY(-2px);
}

/* v0 release banner (header) */
.release-banner {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    border: 1px solid var(--accent-color);
    border-radius: 8px;
    background: rgba(25, 118, 209, 0.06);
    font-size: 0.92rem;
    color: var(--text-color);
    max-width: 46rem;
}
.release-tag {
    display: inline-block;
    margin-right: 0.5rem;
    padding: 0.1rem 0.55rem;
    border-radius: 999px;
    background: var(--accent-color);
    color: #FFFFF8;
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    vertical-align: baseline;
}
