:root {
    --brand: #0c5c6b;
    --brand-dark: #083b45;
    --brand-soft: #e4f2f5;
    --accent: #f29b2b;
    --text-main: #222222;
    --text-body: #222222;
    --text-muted: #555555;
    --border-soft: #dddddd;
    --page-bg: #f7f7f9;
    --topbar-text: #eaf6f8;
    --layout-max: 1100px;
    --layout-pad: 1.5rem;

    /* Type scale */
    --text-2xl: 1.9rem;   /* page titles */
    --text-xl:  1.4rem;   /* brand title */
    --text-lg:  1.25rem;  /* h2 */
    --text-md:  1.05rem;  /* h3 */
    --text-base: 1rem;    /* body */
    --text-sm:  0.875rem; /* meta, labels, captions */
    --text-xs:  0.75rem;  /* tiny uppercase labels, footer */
}

* {
    box-sizing: border-box;
}

/* Always reserve scrollbar gutter to prevent layout shift between short and long pages */
html {
    overflow-y: scroll;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: var(--text-base);
    line-height: 1.65;
    color: var(--text-main);
    background: radial-gradient(circle at top, #ffffff 0, var(--page-bg) 55%);
}

a {
    color: var(--brand);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Layout shell */
.site-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Top bar */
.top-bar {
    background: linear-gradient(135deg, var(--brand-dark), var(--brand));
    border-bottom: 1px solid rgba(8, 59, 69, 0.65);
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: box-shadow 0.25s ease;
}

/* Scrolled / compact state — applied by JS on scroll */
.top-bar--scrolled {
    box-shadow: 0 4px 18px rgba(0,0,0,0.22);
}

.top-bar--scrolled .top-bar-inner {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

.top-bar--scrolled .brand-title {
    font-size: 1.1rem;
}

.top-bar--scrolled .brand-subtitle {
    max-height: 0;
    opacity: 0;
}

.top-bar-inner,
.page-hero-inner,
.page-body,
.site-footer-inner {
    width: min(100%, var(--layout-max));
    margin: 0 auto;
    padding-left: var(--layout-pad);
    padding-right: var(--layout-pad);
}

.top-bar-inner {
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
    transition: padding-top 0.25s ease, padding-bottom 0.25s ease;
}

.brand-block {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.brand-title {
    font-weight: 700;
    letter-spacing: 0.06em;
    font-size: 1.4rem;
    text-transform: uppercase;
    color: #ffffff;
    transition: font-size 0.25s ease;
}

.brand-subtitle {
    font-size: var(--text-sm);
    color: var(--topbar-text);
    line-height: 1.4;
    white-space: nowrap;
    max-height: 3rem;
    opacity: 1;
    overflow: hidden;
    transition: max-height 0.25s ease, opacity 0.2s ease;
}

.nav-links {
    display: flex;
    gap: 1rem;
    font-size: 0.95rem;
    margin-left: auto;
    flex-wrap: wrap;
    justify-content: flex-end;
}

@media (max-width: 1100px) {
    .brand-subtitle {
        white-space: normal;
        max-width: 430px;
    }
}

.nav-toggle {
    display: none;
    padding: 0.45rem 0.75rem;
    border: 1px solid rgba(255,255,255,0.45);
    border-radius: 6px;
    background: rgba(255,255,255,0.12);
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
}

.nav-toggle:hover {
    background: rgba(255,255,255,0.2);
}

.nav-link {
    color: var(--topbar-text);
    padding: 0.3rem 0.55rem;
    border-radius: 999px;
    white-space: nowrap;
    font-weight: 600; /* fixed weight on all links prevents layout shift on active */
    transition: background-color 0.15s ease, color 0.15s ease;
}

.nav-link:hover {
    background: rgba(255,255,255,0.18);
    text-decoration: none;
}

.nav-link.active {
    background: #ffffff;
    color: var(--brand-dark);
}

/* Page hero */
.page-hero {
    background: linear-gradient(120deg, var(--brand-soft), #ffffff);
    border-bottom: 1px solid var(--border-soft);
}

.page-hero-inner {
    padding-top: 1.5rem;
    padding-bottom: 1.2rem;
}

.page-title {
    margin: 0;
    font-size: var(--text-2xl);
    letter-spacing: 0.02em;
    line-height: 1.2;
}

.page-kicker {
    margin: 0.35rem 0 0;
    font-size: 1rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.page-promo {
    margin: 0.6rem 0 0;
    font-size: var(--text-sm);
    color: #2f4b52;
}

.page-promo a {
    font-weight: 600;
}

/* ── Typography ─────────────────────────────────────────── */
p {
    margin: 0 0 0.75rem;
    line-height: 1.7;
}

p:last-child {
    margin-bottom: 0;
}

h1, h2, h3 {
    color: var(--brand);
    line-height: 1.3;
}

h1 {
    font-size: 1.5rem;
    margin-top: 0;
}

h2 {
    font-size: var(--text-lg);
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

h3 {
    font-size: var(--text-md);
    margin-top: 0;
    margin-bottom: 0.4rem;
}

/* Main content */
.page-body {
    flex: 1;
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
}

.content-card {
    background: #ffffff;
    border-radius: 8px;
    padding: 1.6rem 1.8rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
    border: 1px solid rgba(12,92,107,0.06);
}

.content-card > :first-child {
    margin-top: 0;
}


ul {
    padding-left: 1.3rem;
}

li + li {
    margin-top: 0.45rem;
}

.stack-section + .stack-section {
    margin-top: 1.75rem;
}

.capability-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.9rem;
    margin-top: 0.8rem;
}

.capability-card {
    border: 1px solid rgba(12,92,107,0.14);
    border-radius: 8px;
    padding: 0.85rem 0.9rem;
    background: #fafcfd;
}

.capability-card h3 {
    margin: 0 0 0.45rem;
    font-size: var(--text-md);
}

.capability-card p {
    margin: 0;
    font-size: var(--text-sm);
}

.workflow-steps {
    margin-top: 0.7rem;
}

.tutorial-list {
    margin-top: 0.7rem;
}

/* Tutorial video */
.tutorial-video {
    display: block;
    margin: 1.5rem auto 0;
    max-width: 100%;
    width: 720px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

/* ── Workshop cards ──────────────────────────────────── */
.workshop-cards {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-top: 0.75rem;
}

.workshop-card {
    border: 1px solid rgba(12,92,107,0.18);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(12,92,107,0.05);
}

.workshop-card-header {
    background: var(--brand);
    color: #ffffff;
    padding: 0.65rem 1.2rem;
    font-size: var(--text-sm);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.workshop-badge {
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
    padding: 0.1rem 0.45rem;
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.04em;
}

.workshop-card-body {
    padding: 1rem 1.2rem 1.2rem;
    background: #ffffff;
}

.workshop-card-body p {
    margin-bottom: 0.6rem;
}

.workshop-downloads {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 0.55rem;
    margin: 0.9rem 0 0.5rem;
}

.workshop-dl-btn {
    min-width: 0;
    width: 100%;
    min-height: 2.7rem;
    padding: 0.5rem 0.9rem;
    font-size: var(--text-sm);
    text-align: center;
}

.workshop-dl-secondary {
    background: #ffffff;
    border: 1px solid rgba(12,92,107,0.25);
}

.workshop-dl-secondary:hover {
    background: #d7eaee;
    color: var(--brand);
}

.workshop-note {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin-top: 0.3rem !important;
}

/* ── Resource grid (mesh library) ────────────────────── */
.resource-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
    margin-top: 0.75rem;
}

.resource-card {
    border: 1px solid rgba(12,92,107,0.14);
    border-radius: 10px;
    overflow: hidden;
    background: #ffffff;
    box-shadow: 0 2px 6px rgba(12,92,107,0.04);
    display: flex;
    flex-direction: column;
}

.resource-card-header {
    background: #1a5c68;
    color: #ffffff;
    padding: 0.55rem 1rem;
    font-size: var(--text-sm);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.resource-card > p {
    padding: 0.75rem 1rem 0;
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.resource-file-list {
    list-style: none;
    padding: 0.5rem 1rem;
    margin: 0;
    flex: 1;
}

.resource-file-list li {
    padding: 0.2rem 0;
    font-size: var(--text-sm);
    border-bottom: 1px solid var(--brand-soft);
}

.resource-file-list li:last-child {
    border-bottom: none;
}

.resource-file-list a {
    color: var(--brand);
}

.resource-download-all {
    display: block;
    margin: 0.75rem 1rem 1rem;
    min-width: auto;
    text-align: center;
    padding: 0.55rem 0.9rem;
    font-size: var(--text-sm);
    font-weight: 700;
}

/* ── Downloads — OS compatibility table ─────────────────── */

.compat-table-wrap {
    overflow-x: auto;
    margin: 1rem 0;
    border-radius: 8px;
    border: 1px solid var(--border-soft);
}

.compat-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
    background: #fff;
}

.compat-table caption.compat-caption {
    text-align: left;
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.6rem 1rem 0.4rem;
    background: rgba(12,92,107,0.04);
    border-bottom: 1px solid var(--border-soft);
}

.compat-table thead tr {
    background: rgba(12,92,107,0.07);
}

.compat-table th {
    text-align: left;
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--brand-dark);
    padding: 0.55rem 1rem;
    border-bottom: 2px solid var(--border-soft);
    white-space: nowrap;
}

.compat-table td {
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--border-soft);
    color: var(--text-body);
    vertical-align: middle;
}

.compat-table tbody tr:last-child td {
    border-bottom: none;
}

.compat-table tbody tr:hover {
    background: rgba(12,92,107,0.03);
}

.compat-note {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-top: 0.5rem;
    line-height: 1.5;
}

.compat-note a {
    color: var(--brand);
}

/* Tutorial download card — used in Downloads, Tutorials, and Resources */
.tutorial-download-card {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    background: var(--brand-soft);
    border: 1px solid rgba(12,92,107,0.18);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    margin: 1rem 0 1.25rem;
    width: 100%;
    box-sizing: border-box;
}

.tutorial-download-icon {
    font-size: 2rem;
    line-height: 1;
    flex-shrink: 0;
    order: 1;
}

.tutorial-download-icon-code {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.2rem;
    height: 2.2rem;
    padding: 0 0.35rem;
    border-radius: 0.55rem;
    border: 1px solid rgba(12,92,107,0.25);
    background: rgba(255,255,255,0.75);
    color: var(--brand);
    font-family: "SF Mono", "Fira Code", "Consolas", monospace;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.tutorial-download-info {
    flex: 1 1 auto;
    min-width: 200px;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    order: 2;
}

.tutorial-download-info strong {
    font-size: var(--text-base);
    color: var(--brand);
}

.tutorial-download-meta {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.tutorial-download-btn {
    flex-shrink: 0;
    min-width: 140px;
    width: auto;
    padding: 0.5rem 1.1rem;
    font-size: var(--text-sm);
    white-space: nowrap;
    text-align: center;
    line-height: 1.3;
    order: 3;
}

.tutorial-download-btn:hover {
    color: var(--brand);
}

/* Inline code */
code {
    font-family: "SF Mono", "Fira Code", "Consolas", monospace;
    font-size: 0.9em;
    background: rgba(12,92,107,0.07);
    border: 1px solid rgba(12,92,107,0.13);
    border-radius: 4px;
    padding: 0.1em 0.4em;
    color: var(--brand);
}

/* Code block (terminal commands) */
.code-block {
    background: #1e2e31;
    border-radius: 8px;
    padding: 1rem 1.2rem;
    margin: 0.75rem 0 1rem;
    overflow-x: auto;
}

.code-block pre {
    margin: 0;
    font-family: "SF Mono", "Fira Code", "Consolas", monospace;
    font-size: var(--text-sm);
    line-height: 1.7;
    color: #d4eef2;
}

@media (max-width: 720px) {
    .tutorial-download-card {
        flex-direction: column;
        align-items: start;
        gap: 0.75rem;
    }

    .tutorial-download-btn {
        width: 100%;
        min-width: 0;
        white-space: normal;
        text-align: center;
    }
}

.flash-message {
  grid-column: 1 / -1;
  margin-top: 0.75rem;
  padding: 0.6rem 0.7rem;
  border-radius: 6px;
  background: #eaf6ea;
  border: 1px solid #b6d8b6;
  color: #1f4d1f;
  font-size: var(--text-sm);
}

.flash-message.error {
  background: #fdecec;
  border-color: #efb7b7;
  color: #7d1f1f;
}

.downloads-list {
    list-style: none;
    padding-left: 0;
    margin: 1rem 0 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0.75rem;
}

.downloads-list li + li {
    margin-top: 0;
}

.downloads-list li {
    display: flex;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: auto;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    background: var(--brand-soft);
    border: 1px solid rgba(12,92,107,0.14);
    color: var(--brand);
    font-weight: 600;
    line-height: 1.4;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.btn:is(a) {
    text-decoration: none;
}

.btn:hover {
    background: #d7eaee;
    border-color: rgba(12,92,107,0.28);
    color: var(--brand);
    text-decoration: none;
    transform: translateY(-1px);
}

.btn:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

.downloads-list .btn {
    width: 100%;
    min-width: 0;
    min-height: 3.1rem;
    text-align: center;
}

/* Footer */
.site-footer {
    border-top: 1px solid var(--border-soft);
    background: #ffffffcc;
    backdrop-filter: blur(4px);
}

.site-footer-inner {
    padding-top: 0.8rem;
    padding-bottom: 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.footer-links {
    display: flex;
    gap: 0.75rem;
}

.site-maintainer {
    margin-top: 0.2rem;
    font-size: var(--text-xs);
    line-height: 1.45;
}

.site-maintainer a {
    color: var(--brand);
}

@media (max-width: 720px) {
    :root {
        --layout-pad: 1rem;
    }

    .top-bar-inner {
        flex-direction: row;
        align-items: center;
        flex-wrap: nowrap;
        position: relative;  /* anchor the dropdown */
    }

    .site-footer-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.45rem;
    }


    .nav-links {
        position: absolute;
        top: calc(100% + 0.4rem);
        right: 0;
        width: 200px;
        flex-direction: column;
        gap: 0.25rem;
        margin-top: 0;
        padding: 0.6rem 0.6rem;
        background: #ffffff;
        border: 1px solid var(--border-soft);
        border-radius: 10px;
        box-shadow: 0 8px 24px rgba(0,0,0,0.13);
        opacity: 0;
        transform: translateY(-0.5rem);
        pointer-events: none;
        transition: opacity 0.2s ease, transform 0.2s ease;
        z-index: 200;
    }

    body.nav-ready .nav-toggle {
        display: inline-block;
        align-self: center;
        margin-left: auto;
        z-index: 201;
    }

    body.nav-ready .nav-links {
        display: flex;
    }

    body.nav-ready .nav-links.open {
        opacity: 1;
        transform: translateY(0);
        pointer-events: auto;
    }

    /* No full-page backdrop — dropdown is small enough to not need one */
    body.nav-menu-open {
        background-color: transparent;
        pointer-events: auto;
    }

    .nav-link {
        color: var(--brand);
        display: block;
        width: 100%;
        padding: 0.55rem 0.75rem;
        border-radius: 6px;
    }

    .nav-link.active {
        background: var(--brand-soft);
    }

    .page-promo {
        font-size: 0.84rem;
    }

    .btn {
        width: 100%;
        min-width: 0;
    }

    .capability-card {
        padding: 0.8rem;
    }
}

/* Very small screens — hide subtitle to preserve space */
@media (max-width: 480px) {
    .brand-subtitle {
        display: none;
    }
}

/* How-to-cite callout */
.cite-box {
    background: var(--brand-soft);
    border-left: 4px solid var(--brand);
    border-radius: 6px;
    padding: 1rem 1.2rem;
    margin: 1rem 0;
    font-size: 0.9rem;
    line-height: 1.6;
}

.cite-box p {
    margin: 0 0 0.4rem;
}

.cite-box p:last-child {
    margin: 0;
}

.cite-box .cite-label {
    font-weight: 700;
    font-size: var(--text-xs);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--brand);
    margin-bottom: 0.5rem;
}

.cite-box .cite-ref {
    font-family: Georgia, "Times New Roman", serif;
    color: var(--text-main);
}

.cite-box .cite-doi {
    margin-top: 0.4rem;
    font-size: var(--text-sm);
}

/* Publications list */
.pub-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.pub-item {
    padding: 0.9rem 0;
    border-bottom: 1px solid var(--border-soft);
}

.pub-item:last-child {
    border-bottom: none;
}

.pub-title {
    font-weight: 600;
    font-size: var(--text-base);
    margin-bottom: 0.25rem;
    line-height: 1.4;
}

.pub-title a {
    color: var(--brand);
}

.pub-title a:hover {
    text-decoration: underline;
}

.pub-meta {
    font-size: var(--text-sm);
    color: var(--text-muted);
    line-height: 1.5;
}

.pub-year {
    font-weight: 600;
    color: var(--text-main);
}

.pub-citations {
    color: var(--accent);
    font-weight: 500;
}

/* ── FORCINN panel (wraps the form) ──────────────────────── */
.forcinn-panel {
  border: 1px solid rgba(12,92,107,0.18);
  border-radius: 10px;
  overflow: hidden;
  margin-top: 1.25rem;
  box-shadow: 0 2px 8px rgba(12,92,107,0.06);
}

.forcinn-panel-header {
  background: var(--brand);
  color: #ffffff;
  padding: 0.65rem 1.2rem;
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.forcinn-panel-header::before {
  content: "▶";
  font-size: 0.7rem;
  opacity: 0.75;
}

.forcinn-panel-body {
  padding: 1.2rem 1.4rem 1.4rem;
  background: #ffffff;
}

/* ── FORCINN form grid ───────────────────────────────────── */
/*
  Layout:
    file   | mode
    sample | label
    slope-correction (full)
    submit (full)
*/
.forcinn-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "file   mode"
    "sample runlabel"
    "slope  slope"
    "submit submit"
    "progress progress";
  gap: 1.1rem 1.5rem;
  align-items: start;
}

/* assign each label to its named area */
.forcinn-form .field-file     { grid-area: file; }
.forcinn-form .field-mode     { grid-area: mode; }
.forcinn-form .field-sample   { grid-area: sample; }
.forcinn-form .field-runlabel { grid-area: runlabel; }

.forcinn-form label {
  display: flex;
  flex-direction: column;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-main);
  gap: 0.25rem;
}

.forcinn-form .field-hint {
  font-size: var(--text-xs);
  font-weight: 400;
  color: var(--text-muted);
  min-height: 1.1em;   /* reserve space even on labels without hint so rows line up */
}

/* shared input/select appearance */
.forcinn-form input[type="file"],
.forcinn-form input[type="text"],
.forcinn-form select {
  padding: 0.5rem 0.7rem;
  border-radius: 6px;
  border: 1px solid var(--border-soft);
  font-size: var(--text-base);
  font-family: inherit;
  width: 100%;
  box-sizing: border-box;
  background: #fdfdfd;
  color: var(--text-main);
  height: 2.45rem;           /* uniform height for all controls */
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* file input needs its own tweaks to feel consistent */
.forcinn-form input[type="file"] {
  padding: 0.35rem 0.5rem;
  cursor: pointer;
  color: var(--text-muted);
}

.forcinn-form input[type="text"]:focus,
.forcinn-form select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(12,92,107,0.12);
}

/* Checkbox row — full width */
.forcinn-form label.checkbox {
  grid-area: slope;
  flex-direction: row;
  align-items: center;
  gap: 0.55rem;
  font-weight: 500;
  font-size: var(--text-sm);
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.55rem 0.7rem;
  background: #f5f9fa;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
}

.forcinn-form label.checkbox input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--brand);
  cursor: pointer;
  flex-shrink: 0;
}

/* Submit button */
.forcinn-submit-row {
  grid-area: submit;
  margin-top: 0.25rem;
  display: flex;
  gap: 0.6rem;
  align-items: stretch;
}

/* collapse to single column on narrow screens */
@media (max-width: 560px) {
  .forcinn-form {
    grid-template-columns: 1fr;
    grid-template-areas:
      "file"
      "mode"
      "sample"
      "runlabel"
      "slope"
      "submit"
      "progress";
  }
}

.forcinn-form button[type="submit"] {
  flex: 1;                     /* grows to fill the row; shrinks beside Stop */
  padding: 0.75rem 1.5rem;
  font-size: var(--text-base);
  font-weight: 600;
  font-family: inherit;
  border-radius: 8px;
  border: none;
  background: var(--brand);
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: background 0.2s ease, transform 0.15s ease, opacity 0.2s ease;
}

.forcinn-form button[type="submit"]:hover:not(:disabled) {
  background: #084854;
  transform: translateY(-1px);
}

.forcinn-form button[type="submit"]:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

/* Stop analysis button — appears next to submit while running */
.forcinn-stop-btn {
  padding: 0.4rem 0.9rem;
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: inherit;
  border-radius: 6px;
  border: 1.5px solid #b91c1c;
  background: transparent;
  color: #b91c1c;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.forcinn-stop-btn:hover:not(:disabled) {
  background: #b91c1c;
  color: #ffffff;
}

.forcinn-stop-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Spinner shown during submission */
.forcinn-spinner {
  display: none;
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

.forcinn-form.submitting .forcinn-spinner {
  display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── FORCINN progress card ───────────────────────────────── */
.forcinn-progress {
  grid-area: progress;
  display: grid;
  gap: 0.65rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: #f5f9fa;
}

.forcinn-progress[hidden] {
  display: none !important;
}

/* Row 1: spinner + label on left, percentage bold on right */
.forcinn-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.forcinn-progress-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-main);
}

/* Mini spinner ring */
.bar-spinner {
  flex-shrink: 0;
  width: 0.9rem;
  height: 0.9rem;
  border: 2px solid rgba(12,92,107,0.18);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

.forcinn-progress-pct {
  font-variant-numeric: tabular-nums;
  color: var(--brand);
  font-size: 1.05rem;
  font-weight: 800;
  min-width: 3.5ch;
  text-align: right;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}

/* Row 2: the track */
.forcinn-progress-track {
  height: 10px;
  border-radius: 99px;
  background: rgba(12,92,107,0.10);
  overflow: visible;
  position: relative;
}

/* Animated striped fill */
@keyframes progress-stripes {
  from { background-position: 0 0; }
  to   { background-position: 40px 0; }
}

.forcinn-progress-bar {
  height: 100%;
  border-radius: 99px;
  position: relative;
  background: repeating-linear-gradient(
    -45deg,
    var(--brand)  0px,
    var(--brand)  12px,
    #1a9aad       12px,
    #1a9aad       24px
  );
  background-size: 40px 40px;
  animation: progress-stripes 0.55s linear infinite;
  transition: width 0.25s ease-out;
  box-shadow: 0 0 6px rgba(12,92,107,0.30);
  clip-path: inset(0 0 0 0 round 99px);
}

/* Pulsing dot at leading edge */
.forcinn-progress-bar::after {
  content: '';
  position: absolute;
  right: -5px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--brand);
  box-shadow: 0 0 0 3px rgba(12,92,107,0.20);
  animation: pulse-dot 1.1s ease-in-out infinite alternate;
}

@keyframes pulse-dot {
  from { box-shadow: 0 0 0 2px rgba(12,92,107,0.15); }
  to   { box-shadow: 0 0 0 5px rgba(12,92,107,0.38); }
}

.forcinn-progress-bar[style*="width:0%"]::after,
.forcinn-progress-bar[style*="width: 0%"]::after {
  display: none;
}

/* Row 3: note text */
.forcinn-progress-note {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin: 0;
  line-height: 1.5;
}

/* Row 4: stop button right-aligned */
.forcinn-progress-actions {
  display: flex;
  justify-content: flex-end;
}

/* ── FORCINN result ──────────────────────────────────────── */
.forcinn-result {
  max-width: 900px;
  margin: 2rem auto 0;
  border: 1px solid rgba(12,92,107,0.18);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(12,92,107,0.06);
}

.result-header {
  background: #1a7a5e;
  color: #ffffff;
  padding: 0.65rem 1.2rem;
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.result-header::before {
  content: "✓";
  font-weight: 700;
  margin-right: 0.3rem;
}

/* Download button row inside result-header */
.result-downloads {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.result-dl-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.35);
  color: #ffffff;
  font-size: var(--text-xs);
  font-weight: 600;
  text-decoration: none;
  letter-spacing: 0.03em;
  transition: background 0.15s;
}

.result-dl-btn:hover {
  background: rgba(255,255,255,0.28);
  text-decoration: none;
}

.result-body {
  padding: 1.2rem 1.4rem;
  background: #ffffff;
}

/* Sample/model data badges */
.result-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.result-badge {
  background: var(--brand-soft);
  border: 1px solid rgba(12,92,107,0.15);
  border-radius: 4px;
  padding: 0.2rem 0.6rem;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--brand);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* Metric pills */
.result-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.result-metric {
  background: #fafcfd;
  border: 1px solid rgba(12,92,107,0.14);
  border-radius: 8px;
  padding: 0.55rem 0.9rem;
  min-width: 110px;
  text-align: center;
}

.result-metric-label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.2rem;
}

.result-metric-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--brand);
  line-height: 1.2;
}

.result-metric-unit {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: 400;
}

.forcinn-figure {
  margin: 0 0 1rem;
  text-align: center;
}

.forcinn-figure figcaption {
  margin-top: 0.5rem;
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-style: italic;
}

.forcinn-image {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: 4px;
}

.forcinn-figure-main {
  margin: 0 auto 1.1rem;
  padding: 0.9rem;
  max-width: 760px;
  border: 1px solid rgba(12,92,107,0.14);
  border-radius: 10px;
  background: linear-gradient(180deg, #fbfdfd 0%, #f4fafb 100%);
  box-shadow: 0 4px 14px rgba(12,92,107,0.08);
}

.forcinn-image-main {
  width: min(100%, 690px);
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.12);
}

.forcinn-figure-main figcaption {
  margin-top: 0.7rem;
  color: #435a61;
  font-style: normal;
  line-height: 1.45;
}

.forcinn-image-qc {
  border-radius: 6px;
}

/* ── Preprocessing QC collapsible ─────────────────────────── */
.result-qc {
  margin-top: 1.25rem;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  overflow: hidden;
}

.result-qc-toggle {
  padding: 0.6rem 1rem;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--brand);
  cursor: pointer;
  background: var(--brand-soft);
  list-style: none;
  user-select: none;
}

.result-qc-toggle::-webkit-details-marker { display: none; }

.result-qc-toggle::before {
  content: "▸ ";
  font-size: 0.75rem;
}

details[open] .result-qc-toggle::before {
  content: "▾ ";
}

.result-qc-body {
  padding: 1rem 1rem 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  background: #ffffff;
}

.result-qc-body .forcinn-figure {
  flex: 1 1 280px;
}

/* ── Zoom hint label under zoomable images ─────────────────── */
.zoom-hint {
  display: inline-block;
  margin-left: 0.4rem;
  font-size: var(--text-xs);
  color: var(--brand);
  opacity: 0.75;
  font-style: normal;
}

/* ── Lightbox overlay ──────────────────────────────────────── */
#img-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.82);
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  cursor: zoom-out;
}

#img-lightbox.open {
  display: flex;
}

.lightbox-img {
  max-width: 100%;
  max-height: 90vh;
  border-radius: 6px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
  object-fit: contain;
  cursor: default;
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  font-size: 1.1rem;
  line-height: 1;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.lightbox-close:hover {
  background: rgba(255,255,255,0.25);
}

/* ── Roadmap page ─────────────────────────────────────── */
.roadmap-note {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.roadmap-caption {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: var(--brand-soft);
    border-left: 3px solid var(--brand);
    border-radius: 0 6px 6px 0;
    font-size: var(--text-sm);
    color: #2f4b52;
}

/* Timeline container — vertical stack with left accent line */
.roadmap-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
    padding-left: 1.5rem;
    margin-top: 0.9rem;
}

.roadmap-timeline::before {
    content: "";
    position: absolute;
    left: 0;
    top: 1.4rem;
    bottom: 1.4rem;
    width: 3px;
    border-radius: 99px;
    background: linear-gradient(to bottom,
        var(--brand) 0%,
        rgba(12,92,107,0.2) 100%);
}

/* Individual phase card */
.roadmap-phase-card {
    border: 1px solid rgba(12,92,107,0.18);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(12,92,107,0.05);
    margin-bottom: 1.25rem;
    position: relative;
}

/* Dot on the vertical line */
.roadmap-phase-card::before {
    content: "";
    position: absolute;
    left: -1.82rem;
    top: 1.1rem;
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 50%;
    background: var(--brand);
    border: 2px solid var(--brand-soft);
    box-shadow: 0 0 0 2px var(--brand);
}

.roadmap-phase-card:last-child {
    margin-bottom: 0;
}

.roadmap-phase-highlight .roadmap-phase-header {
    background: var(--brand-dark);
}

.roadmap-phase-header {
    background: var(--brand);
    color: #ffffff;
    padding: 0.65rem 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.roadmap-quarter-badge {
    background: rgba(255,255,255,0.22);
    border-radius: 5px;
    padding: 0.15rem 0.55rem;
    font-size: var(--text-xs);
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    flex-shrink: 0;
}

.roadmap-quarter-dates {
    font-size: var(--text-sm);
    font-weight: 600;
    opacity: 0.88;
    flex-shrink: 0;
}

.roadmap-quarter-label {
    font-size: var(--text-sm);
    font-weight: 700;
    margin-left: auto;
    opacity: 0.92;
}

.roadmap-phase-body {
    padding: 1rem 1.25rem 1.2rem;
    background: #ffffff;
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 0.5rem 1.75rem;
}

.roadmap-col-heading {
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--brand);
    margin: 0 0 0.45rem;
}

.roadmap-phase-body ul {
    margin: 0;
    padding-left: 1.1rem;
}

.roadmap-phase-body li {
    font-size: var(--text-sm);
    color: var(--text-main);
    margin-bottom: 0.3rem;
}

.roadmap-lead {
    font-size: var(--text-xs);
    color: var(--text-muted);
    font-style: italic;
}

/* Contributors grid */
.contributors-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    margin-top: 0.8rem;
}

.contributor-card {
    flex: 1 1 190px;
    max-width: 230px;
    border: 1px solid rgba(12,92,107,0.14);
    border-radius: 8px;
    padding: 1rem 1.1rem;
    background: #fafcfd;
    display: flex;
    flex-direction: column;
}

.contributor-card--verify {
    border-style: dashed;
    background: #f7f7f9;
    opacity: 0.6;
}

h3.contributor-name {
    font-weight: 700;
    font-size: var(--text-md);
    color: var(--brand);
    margin: 0 0 0.2rem;
}

.contributor-role {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin: 0;
    line-height: 1.4;
}

.contributor-org {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin: 0.3rem 0 0;
    line-height: 1.4;
}

.contributor-org--tbc {
    font-style: italic;
    color: var(--text-muted);
}

/* Collaboration CTA */
.collab-cta {
    background: var(--brand-soft);
    border: 1px solid rgba(12,92,107,0.18);
    border-radius: 10px;
    padding: 1.25rem 1.4rem;
    margin-top: 0.8rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.collab-cta-text {
    flex: 1;
    min-width: 200px;
}
    display: block;
    font-size: var(--text-md);
    color: var(--brand);
    margin-bottom: 0.4rem;
}

.collab-cta-text p {
    margin: 0;
    font-size: var(--text-sm);
    color: var(--text-main);
}

.collab-cta-action {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.collab-cta-action a {
    display: inline-block;
    background: var(--brand);
    color: #ffffff;
    padding: 0.55rem 1.2rem;
    border-radius: 999px;
    font-size: var(--text-sm);
    font-weight: 600;
    white-space: nowrap;
    transition: background 0.15s;
}

.collab-cta-action a:hover {
    background: var(--brand-dark);
    text-decoration: none;
}

@media (max-width: 640px) {
    .roadmap-phase-body {
        grid-template-columns: 1fr;
    }
    .roadmap-quarter-label {
        margin-left: 0;
        width: 100%;
    }
    .roadmap-timeline {
        padding-left: 1rem;
    }
}

/* ── Changelog ───────────────────────────────────────────── */

.changelog-entry {
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    padding: 1rem 1.2rem;
    margin-bottom: 0.75rem;
    background: #fff;
}

.changelog-entry--current {
    border-color: var(--brand);
    border-width: 2px;
    background: rgba(12,92,107,0.04);
    box-shadow: 0 2px 8px rgba(12,92,107,0.1);
}

.changelog-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.6rem;
}

.changelog-version {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--brand-dark);
}

.changelog-date {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.changelog-badge {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
}

.changelog-badge--stable {
    background: var(--brand);
    color: #fff;
}

.changelog-list {
    margin: 0;
    padding-left: 1.2rem;
    font-size: var(--text-sm);
    color: var(--text-body);
    line-height: 1.6;
}

.changelog-dl-note {
    margin: 0.6rem 0 0;
    font-size: var(--text-xs);
}

.changelog-dl-note a {
    color: var(--brand);
    font-weight: 600;
}

/* ── Glossary ──────────────────────────────────────────────── */
.glossary-index {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.6rem;
    margin: 0.5rem 0 0;
}

.glossary-index a {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border: 1px solid var(--brand);
    border-radius: 4px;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--brand);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.glossary-index a:hover {
    background: var(--brand);
    color: #fff;
    text-decoration: none;
}

.glossary-section h2 {
    font-size: var(--text-xl);
    color: var(--brand);
    border-bottom: 2px solid var(--brand-soft);
    padding-bottom: 0.3rem;
    margin-bottom: 1rem;
}

.glossary-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 0;
    padding: 0;
}

.glossary-item {
    border-left: 3px solid var(--brand-soft);
    padding-left: 1rem;
}

.glossary-item dt {
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.2rem;
}

.glossary-item dd {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.6;
}