/* ============================================================
 *  Cloth-BRDF dataset webpage styles
 *  Layout inspired by OpenIllumination; adapted to our material grid.
 * ============================================================ */

:root {
    --brand: #2b2b2b;
    --accent: #3367d6;
    --accent-soft: #e8efff;
    --muted: #6e7884;
    --bg: #fafbfc;
    --panel: #ffffff;
    --border: #e6e9ee;
    --hover: #f3f6fa;
}

html, body {
    background: var(--bg);
    color: var(--brand);
    font-family:
        "Inter", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* --------  Header / hero  -------- */

.jumbotron {
    background: linear-gradient(180deg, #ffffff 0%, #f4f6fa 100%);
    padding: 3.5rem 1rem 2rem;
    margin-bottom: 0;
    border-bottom: 1px solid var(--border);
}

.jumbotron h2 {
    font-weight: 700;
    color: var(--brand);
    letter-spacing: -0.01em;
}

.jumbotron .subtitle {
    color: var(--muted);
    font-size: 1rem;
    margin-top: 0.75rem;
}

.author-list {
    margin-top: 1.4rem;
    line-height: 1.9;
    font-size: 0.95rem;
}
.author-list a { color: var(--accent); text-decoration: none; }
.author-list a:hover { text-decoration: underline; }

.affiliations {
    color: var(--muted);
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.btn-group-row {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin: 1.5rem 0 0.5rem;
}

.btn-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 1.05rem;
    border-radius: 999px;
    background: white;
    color: var(--brand);
    border: 1px solid var(--border);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 500;
    transition: all 0.15s ease-in-out;
}

.btn-pill:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(51, 103, 214, 0.15);
}

/* --------  Sections  -------- */

section.page-section {
    padding: 2.5rem 0 1.5rem;
    max-width: 1100px;
    margin: 0 auto;
}

section.page-section h3 {
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.4rem;
}

section.page-section .section-rule {
    width: 60px;
    height: 3px;
    background: var(--accent);
    border-radius: 2px;
    margin: 0 auto 1.5rem;
}

.lead-text {
    line-height: 1.65;
    text-align: justify;
    color: #3a3f47;
    padding: 0 1rem;
}

/* --------  Teaser placeholder  -------- */

.teaser-box {
    margin: 0 auto 1.5rem;
    padding: 2rem;
    background: var(--panel);
    border: 1px dashed var(--border);
    border-radius: 8px;
    text-align: center;
    color: var(--muted);
    max-width: 950px;
}
.teaser-box img { max-width: 100%; border-radius: 4px; }

/* Slots for content to be filled later */
.placeholder-slot {
    margin: 1.5rem auto;
    padding: 1.75rem;
    background: var(--panel);
    border: 1px dashed var(--border);
    border-radius: 8px;
    text-align: center;
    color: var(--muted);
    max-width: 950px;
    font-size: 0.95rem;
}
.placeholder-slot strong { color: var(--brand); }

/* --------  Train / Test split headings + ID pill list  -------- */

.split-heading {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--brand);
    margin: 1.6rem 1rem 0.8rem;
}

.split-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: white;
}
.split-chip.train { background: #3367d6; }   /* blue */
.split-chip.test  { background: #ec4899; }   /* pink */

.split-heading-tail {
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
}

.id-pill-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    padding: 0 1rem;
}

.id-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.4rem;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    background: var(--panel);
    border: 1px solid var(--border);
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.8rem;
    color: var(--brand);
    text-decoration: none;
    transition: all 0.12s ease;
}
.id-pill:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    text-decoration: none;
    transform: translateY(-1px);
}

/* --------  Dataset grid  -------- */

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 14px;
    padding: 0 1rem;
}

.material-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
}

.material-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    border-color: var(--accent);
    text-decoration: none;
    color: inherit;
}

.material-card .thumb-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #0d0f12;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.material-card .thumb-wrap canvas,
.material-card .thumb-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.material-card .thumb-wrap .loading-spinner {
    position: absolute;
    color: rgba(255,255,255,0.5);
    font-size: 0.8rem;
}

.material-card .card-body {
    padding: 0.55rem 0.7rem;
    text-align: center;
    font-size: 0.9rem;
}

.material-card .card-id {
    font-weight: 600;
    color: var(--brand);
}

.material-card .card-label {
    color: var(--muted);
    font-size: 0.78rem;
    margin-top: 0.1rem;
}

/* --------  obj.html (material detail)  -------- */

.material-detail {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.detail-header .title-block h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
}
.detail-header .title-block .subtitle {
    color: var(--muted);
    font-size: 0.92rem;
    margin-top: 0.25rem;
}

.detail-nav {
    display: flex;
    gap: 0.5rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 1.5rem;
}
@media (max-width: 980px) {
    .detail-grid { grid-template-columns: 1fr; }
}

.image-panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.image-panel .image-wrap {
    aspect-ratio: 3 / 2;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.image-panel .image-wrap canvas,
.image-panel .image-wrap img {
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.image-panel .image-meta {
    padding: 0.65rem 0.9rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.86rem;
    color: var(--muted);
}
.image-panel .image-meta code {
    color: var(--brand);
    background: var(--hover);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
}

.right-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.viz-panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0;
    overflow: hidden;
}
.viz-panel .viz-title {
    padding: 0.55rem 0.85rem;
    font-size: 0.86rem;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.viz-panel .viz-title b { color: var(--brand); font-weight: 600; }
.viz-panel canvas {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #f6f7f9;
}

/* sliders */
.slider-panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem 1.1rem 1.2rem;
}

.slider-group { margin-bottom: 0.85rem; }
.slider-group:last-child { margin-bottom: 0; }

.slider-group .slider-label {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 0.92rem;
    margin-bottom: 0.35rem;
}

.slider-group .slider-label b {
    font-weight: 600;
}

.slider-group .slider-label .value-tag {
    color: var(--accent);
    background: var(--accent-soft);
    padding: 0.05rem 0.5rem;
    border-radius: 999px;
    font-size: 0.82rem;
}

.slider-group input[type="range"] {
    width: 100%;
    accent-color: var(--accent);
}

.controls-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.85rem;
}

.btn-mini {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.32rem 0.7rem;
    font-size: 0.82rem;
    border: 1px solid var(--border);
    background: white;
    border-radius: 6px;
    cursor: pointer;
    color: var(--brand);
}
.btn-mini:hover { background: var(--hover); }
.btn-mini.active { background: var(--accent); color: white; border-color: var(--accent); }

/* --------  Footer  -------- */

footer {
    margin-top: 2rem;
    padding: 1.5rem 0;
    text-align: center;
    color: var(--muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
}
footer a { color: var(--accent); text-decoration: none; }

/* --------  Material info panel (obj.html)  -------- */

.material-info {
    padding: 0.85rem 1rem 0.9rem;
    font-size: 0.88rem;
    line-height: 1.5;
}

.material-info .info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    padding: 0.2rem 0;
}

.material-info .info-label {
    color: var(--muted);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.material-info .info-value {
    color: var(--brand);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.material-info .info-value code {
    background: var(--hover);
    padding: 0.05rem 0.4rem;
    border-radius: 4px;
    font-size: 0.84rem;
}

.material-info .color-swatch {
    display: inline-block;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    background: #555;
    border: 1px solid var(--border);
    vertical-align: middle;
}

/* Per-channel BRDF range bars.
 * Each bar's full line is the 0..65 535 capture range; the channel-
 * coloured centre segment is the actual non-zero data range for that
 * channel. Values appear inline to the right of the bar — no absolute
 * positioning floating over neighbouring rows. */

.material-info .channel-bar {
    display: grid;
    grid-template-columns: 14px minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.72rem;
    line-height: 1;
}

.material-info .channel-label {
    font-weight: 700;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.78rem;
    text-align: center;
}

/* Channel colours: applied to the label text, the bar fill, and the
 * inline range numbers via the .ch-r/.ch-g/.ch-b modifier on the row. */
.material-info .ch-r { --ch: #dc2626; }
.material-info .ch-g { --ch: #16a34a; }
.material-info .ch-b { --ch: #2563eb; }
.material-info .channel-bar { color: var(--ch); }

.material-info .channel-track {
    position: relative;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
}

.material-info .channel-fill {
    position: absolute;
    top: 0;
    bottom: 0;
    min-width: 2px;
    background: var(--ch);
    border-radius: 3px;
    transition: left 0.15s ease, width 0.15s ease;
}

.material-info .channel-range {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.70rem;
    white-space: nowrap;
    color: var(--ch);
}
.material-info .channel-range code {
    background: transparent;
    padding: 0;
    color: inherit;
    font-size: inherit;
}
.material-info .channel-range .dash {
    margin: 0 0.2rem;
    color: var(--muted);
}

.material-info .channel-axis {
    display: flex;
    justify-content: space-between;
    font-size: 0.66rem;
    color: var(--muted);
    /* match the track's left edge (label is 14px + 0.45rem gap = ~21px) */
    padding: 0 0 0 calc(14px + 0.45rem);
    margin-top: 0.1rem;
    line-height: 1;
}

/* --------  Inline status / spinner  -------- */

.status-line {
    text-align: center;
    color: var(--muted);
    font-size: 0.88rem;
    padding: 0.5rem;
}
.spinner {
    display: inline-block;
    width: 14px; height: 14px;
    border: 2px solid #d1d5db;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: -3px;
    margin-right: 0.45rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --------  Citation block  -------- */

.citation-block {
    background: #f2f4f8;
    padding: 1.1rem 1.4rem;
    border-radius: 8px;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.85rem;
    overflow-x: auto;
    white-space: pre;
    color: #2d2d2d;
}
