:root {
    --paper: #F3F5F2;
    --paper-raised: #FFFFFF;
    --mist: #E6ECE8;
    --ink: #15211F;
    --slate: #5D6B67;
    --line: #D6DDD9;
    --green: #1F7A5C;
    --green-dark: #17614A;

    --drug: #1F7A5C;
    --gene: #4A5DA6;
    --process: #A7771C;
    --effect: #8A5A86;
    --disease: #A9523D;

    --font: "Instrument Sans", system-ui, sans-serif;
    --font-display: "PT Serif", Georgia, serif;
    --radius: 6px;
    --gutter: 5rem;
}

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

html {
    scroll-behavior: smooth;
}

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--gutter);
}

h1,
h2,
h3 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.01em;
    text-wrap: balance;
}

:focus-visible {
    outline: 2px solid var(--green);
    outline-offset: 3px;
}

/* Wordmark */
.wordmark {
    font-weight: 600;
    font-size: 1.125rem;
    letter-spacing: -0.01em;
    color: inherit;
    text-decoration: none;
}

.wordmark span {
    opacity: 0.55;
    font-weight: 400;
}

/* Nav */
.site-nav {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 10;
    color: #FFFFFF;
    padding: 1.75rem 0;
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Buttons */
.btn-primary,
.btn-ghost {
    display: inline-block;
    font-family: var(--font);
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.btn-primary {
    background-color: var(--green);
    color: #FFFFFF;
    padding: 0.8rem 1.4rem;
    border: none;
}

.btn-primary:hover {
    background-color: var(--green-dark);
}

.btn-ghost {
    color: inherit;
    padding: 0.55rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.4);
    font-size: 0.9375rem;
}

.btn-ghost:hover {
    border-color: #FFFFFF;
    background-color: rgba(255, 255, 255, 0.08);
}

/* Hero */
.hero {
    min-height: 100vh;
    min-height: 100svh;
    background:
        linear-gradient(90deg, rgba(14, 22, 20, 0.82) 0%, rgba(14, 22, 20, 0.55) 55%, rgba(14, 22, 20, 0.25) 100%),
        url('background.webp') center / cover no-repeat;
    color: #FFFFFF;
    display: flex;
    align-items: flex-end;
    padding: 9rem 0 7rem;
}

.hero-content {
    width: 100%;
}

.hero h1 {
    font-size: clamp(2.75rem, 6.4vw, 5.5rem);
    line-height: 1.05;
    font-weight: 700;
    letter-spacing: -0.02em;
    max-width: 13ch;
    margin-bottom: 2rem;
}

.hero-lead {
    font-size: 1.375rem;
    font-weight: 500;
    margin-bottom: 0.75rem;
}

.hero-text {
    font-size: 1.125rem;
    line-height: 1.6;
    max-width: 34rem;
    color: rgba(255, 255, 255, 0.78);
    margin-bottom: 2.5rem;
}

/* Sections */
.section {
    padding: 7.5rem 0;
}

.section-head {
    max-width: 40rem;
    margin-bottom: 3.5rem;
}

.section h2 {
    font-size: clamp(2rem, 3.6vw, 3rem);
    line-height: 1.05;
    font-weight: 700;
    margin-bottom: 1.25rem;
}

.section-description {
    font-size: 1.125rem;
    line-height: 1.6;
    color: var(--slate);
}

/* Features */
.section.section-features {
    padding: 1.5rem 0 7rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3rem;
}

.feature-item {
    border-top: 2px solid var(--ink);
    padding-top: 1.5rem;
}

.feature-item h3 {
    font-size: 1.375rem;
    line-height: 1.2;
    font-weight: 700;
    margin-bottom: 0.875rem;
}

.feature-item p {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--slate);
}

/* Rendered product UI */
.app-window {
    --serif: Georgia, "Times New Roman", serif;
    background: var(--paper-raised);
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 1px 0 rgba(21, 33, 31, 0.04), 0 24px 48px -32px rgba(21, 33, 31, 0.28);
}

.app-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--line);
    font-size: 0.875rem;
}

.app-title {
    font-weight: 600;
}

.app-search {
    flex: 1;
    min-width: 0;
    padding: 0.5rem 0.85rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-mode {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--slate);
    white-space: nowrap;
}

.app-mode i {
    width: 28px;
    height: 16px;
    border-radius: 8px;
    background: var(--green);
    position: relative;
}

.app-mode i::after {
    content: "";
    position: absolute;
    top: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #FFFFFF;
}

.cite {
    display: inline-block;
    min-width: 1.35em;
    padding: 0 0.3em;
    font-family: var(--font);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.5;
    text-align: center;
    color: var(--green);
    border: 1px solid color-mix(in srgb, var(--green) 35%, transparent);
    border-radius: 4px;
    vertical-align: 0.1em;
}

.cite.is-active {
    color: #FFFFFF;
    background: var(--green);
    border-color: var(--green);
}

.paper {
    position: relative;
}

.paper-kicker {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--slate);
    margin-bottom: 0.6rem;
}

.paper h4 {
    font-family: var(--serif);
    font-size: 1.25rem;
    line-height: 1.3;
    font-weight: 700;
    margin-bottom: 1.25rem;
    text-wrap: balance;
}

.paper-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem 1rem;
    padding: 1rem 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    margin-bottom: 1.5rem;
}

.paper-meta dt {
    font-size: 0.75rem;
    color: var(--slate);
}

.paper-meta dd {
    font-size: 0.9375rem;
    font-weight: 500;
}

.paper-label {
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 0.6rem;
}

.paper-quote {
    font-family: var(--serif);
    font-size: 0.9375rem;
    line-height: 1.7;
    color: #3A4744;
    border-left: 3px solid var(--green);
    padding: 0.25rem 0 0.25rem 1rem;
    margin-bottom: 1.5rem;
}

.paper-quote mark {
    color: var(--ink);
    background: color-mix(in srgb, var(--green) 14%, transparent);
    border-radius: 3px;
    padding: 0.05em 0.1em;
}

/* Research demo */
.app-window.demo {
    display: flex;
    flex-direction: column;
}

.app-bar {
    justify-content: space-between;
    padding: 0 1.25rem;
    min-height: 3.25rem;
}

.app-tabs {
    display: flex;
    align-self: stretch;
    gap: 1.5rem;
}

.app-tab {
    font-family: var(--font);
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--slate);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0 0.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.app-tab[aria-selected="true"] {
    color: var(--ink);
    border-bottom-color: var(--green);
}

.app-count {
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--mist);
    color: var(--ink);
    border-radius: 999px;
    padding: 0.05rem 0.45rem;
}

.demo-note {
    font-size: 0.8125rem;
    color: var(--slate);
}

.demo-query {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem 0.5rem;
}

.demo-query .app-search {
    font-family: var(--font);
    font-size: 1rem;
    color: var(--ink);
    padding: 0.7rem 0.9rem;
}

.demo-query .app-search:focus {
    outline: none;
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(31, 122, 92, 0.18);
    background: var(--paper-raised);
}

.demo-run {
    white-space: nowrap;
    padding: 0.7rem 1.2rem;
}

.demo-run:disabled {
    opacity: 0.65;
    cursor: default;
}

.demo-scope,
.demo-hint {
    padding: 0 1.25rem 0.9rem;
    font-size: 0.875rem;
    color: var(--slate);
}

.demo-hint {
    color: var(--ink);
}

.text-link {
    font: inherit;
    color: var(--green);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, var(--green) 40%, transparent);
    text-underline-offset: 2px;
}

.demo-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
    height: 38rem;
    border-top: 1px solid var(--line);
}

/* Report column */
.demo-report {
    overflow-y: auto;
    padding: 1.5rem 1.75rem 2rem;
    border-right: 1px solid var(--line);
    scrollbar-width: thin;
}

.demo-empty {
    color: var(--slate);
    font-size: 0.9375rem;
    max-width: 22rem;
}

.demo-steps {
    list-style: none;
    display: grid;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.demo-steps:not(:empty) {
    padding-bottom: 1.25rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--line);
}

.demo-step {
    display: grid;
    grid-template-columns: 1rem 1fr auto;
    align-items: center;
    gap: 0.6rem;
}

.step-detail {
    color: var(--slate);
    font-variant-numeric: tabular-nums;
}

.step-icon {
    width: 14px;
    height: 14px;
    border-radius: 50%;
}

.demo-step.is-running .step-icon {
    border: 2px solid var(--line);
    border-top-color: var(--green);
    animation: spin 0.8s linear infinite;
}

.demo-step.is-done .step-icon {
    background: var(--green);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Ccircle cx='7' cy='7' r='7'/%3E%3C/svg%3E") center / contain no-repeat;
    position: relative;
}

.demo-step.is-done .step-icon::after {
    content: "";
    position: absolute;
    left: 4.5px;
    top: 2.5px;
    width: 3.5px;
    height: 6.5px;
    border: solid #FFFFFF;
    border-width: 0 1.75px 1.75px 0;
    transform: rotate(45deg);
}

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

.report {
    font-family: var(--serif);
    font-size: 1rem;
    line-height: 1.75;
    color: #3A4744;
}

.report h4 {
    font-family: var(--font);
    font-size: 1rem;
    font-weight: 600;
    color: var(--ink);
    margin: 1.25rem 0 0.35rem;
}

.report h4:first-child {
    margin-top: 0;
}

.report p + p {
    margin-top: 0.75rem;
}

.entity {
    color: var(--ink);
    cursor: pointer;
    border-radius: 3px;
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
    transition: background-color 0.2s ease, opacity 0.2s ease;
}

.entity.drug { text-decoration-color: color-mix(in srgb, var(--drug) 45%, transparent); }
.entity.gene { text-decoration-color: color-mix(in srgb, var(--gene) 45%, transparent); }
.entity.process { text-decoration-color: color-mix(in srgb, var(--process) 50%, transparent); }
.entity.effect { text-decoration-color: color-mix(in srgb, var(--effect) 45%, transparent); }
.entity.disease { text-decoration-color: color-mix(in srgb, var(--disease) 45%, transparent); }

.entity:hover,
.entity.is-mentioned {
    background: color-mix(in srgb, var(--green) 12%, transparent);
}

.entity.is-mentioned {
    text-decoration-color: var(--ink);
}

.report.has-selection .entity:not(.is-mentioned) {
    text-decoration-color: transparent;
}

button.cite {
    cursor: pointer;
    background: none;
    margin: 0 0.1em;
}

button.cite:hover {
    background: color-mix(in srgb, var(--green) 12%, transparent);
}

button.cite.is-active {
    background: var(--green);
}

.cite.is-internal {
    color: var(--gene);
    border-style: dashed;
    border-color: color-mix(in srgb, var(--gene) 55%, transparent);
}

.cite.is-internal.is-active {
    color: #FFFFFF;
    background: var(--gene);
    border-style: solid;
    border-color: var(--gene);
}

/* Graph column: graph always visible, source slides over it */
.demo-side {
    position: relative;
    min-width: 0;
    overflow: hidden;
}

.demo-side .graph-canvas {
    height: 100%;
}

.graph-empty[hidden] {
    display: none;
}

.graph-empty {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 0.9375rem;
    color: var(--slate);
    pointer-events: none;
}

.source-drawer {
    position: absolute;
    z-index: 2;
    inset: 0 0 0 12%;
    background: var(--paper-raised);
    border-left: 1px solid var(--line);
    box-shadow: -24px 0 48px -32px rgba(21, 33, 31, 0.35);
    overflow-y: auto;
    animation: drawerIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.source-drawer[hidden] {
    display: none;
}

@keyframes drawerIn {
    from { transform: translateX(40px); opacity: 0; }
}

.source-drawer .paper {
    border: none;
    background: none;
    padding: 1.75rem 1.75rem 2rem;
}

.drawer-close {
    position: absolute;
    z-index: 1;
    top: 0.9rem;
    right: 1rem;
    width: 2rem;
    height: 2rem;
    font-size: 1.4rem;
    line-height: 1;
    color: var(--slate);
    background: none;
    border: 1px solid var(--line);
    border-radius: 50%;
    cursor: pointer;
}

.drawer-close:hover {
    color: var(--ink);
    border-color: var(--ink);
}

.source-drawer.is-internal .paper-quote {
    border-left-color: var(--gene);
}

.source-drawer.is-internal .paper-quote mark {
    background: color-mix(in srgb, var(--gene) 14%, transparent);
}

/* Library */
/* Same height as the Discovery view so switching tabs doesn't resize the window */
.demo-view.library {
    padding: 1.25rem 1.25rem 1.5rem;
    min-height: calc(38rem + 6.5rem);
}

.library-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
}

.library-table th {
    text-align: left;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--slate);
    padding: 0 0.75rem 0.6rem;
    border-bottom: 1px solid var(--line);
}

.library-table td {
    padding: 0.9rem 0.75rem;
    border-bottom: 1px solid var(--line);
}

.library-table td:first-child {
    font-family: var(--serif);
}

.library-table td:nth-child(2) {
    color: var(--slate);
    white-space: nowrap;
}

.doc-status {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.875rem;
    white-space: nowrap;
}

.doc-status::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
}

.doc-status.processing {
    color: var(--slate);
}

.doc-status.processing::before {
    width: 10px;
    height: 10px;
    background: none;
    border: 2px solid var(--line);
    border-top-color: var(--green);
    animation: spin 0.8s linear infinite;
}

.library-footer {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.library-footer p {
    font-size: 0.875rem;
    color: var(--slate);
    max-width: 36rem;
}

.upload-btn {
    font-family: var(--font);
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--green);
    background: none;
    border: 1.5px dashed color-mix(in srgb, var(--green) 60%, transparent);
    border-radius: var(--radius);
    padding: 0.65rem 1.1rem;
    cursor: pointer;
    white-space: nowrap;
}

.upload-btn:hover:not(:disabled) {
    background: color-mix(in srgb, var(--green) 8%, transparent);
}

.upload-btn:disabled {
    cursor: default;
    opacity: 0.7;
}

/* Graph explorer */
.explorer-toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem 0.75rem;
}

.explorer-search {
    flex: 1;
    max-width: 22rem;
    font-family: var(--font);
    font-size: 0.9375rem;
    color: var(--ink);
    padding: 0.6rem 0.85rem;
}

.explorer-search:focus {
    outline: none;
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(31, 122, 92, 0.18);
    background: var(--paper-raised);
}

.segmented {
    display: inline-flex;
    margin-left: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 3px;
    background: var(--paper);
}

.segmented button {
    font-family: var(--font);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--slate);
    background: none;
    border: none;
    border-radius: 4px;
    padding: 0.4rem 0.8rem;
    cursor: pointer;
    white-space: nowrap;
}

.segmented button[aria-pressed="true"] {
    color: var(--ink);
    background: var(--paper-raised);
    box-shadow: 0 1px 2px rgba(21, 33, 31, 0.12);
}

.explorer-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0 1.25rem 1rem;
}

.filter-chip {
    font-family: var(--font);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--slate);
    background: var(--paper-raised);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.35rem 0.8rem;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.filter-chip[aria-pressed="true"] {
    color: #FFFFFF;
    background: var(--ink);
    border-color: var(--ink);
}

.explorer-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 21rem;
    height: 40rem;
    border-top: 1px solid var(--line);
}

.explorer-canvas {
    position: relative;
    overflow: hidden;
}

.explorer-svg {
    width: 100%;
    height: 100%;
    display: block;
    cursor: grab;
    touch-action: pan-y;
    user-select: none;
}

.explorer-svg:active {
    cursor: grabbing;
}

.x-edge-line {
    fill: none;
    stroke-width: 1.4;
    stroke-opacity: 0.55;
    transition: stroke-opacity 0.2s ease, stroke-width 0.2s ease, opacity 0.3s ease;
}

.x-edge-arrow {
    transition: opacity 0.3s ease;
}

.x-edge.is-internal .x-edge-line {
    stroke: var(--gene);
    stroke-dasharray: 5 5;
}

.x-edge.is-hidden,
.x-node.is-hidden {
    opacity: 0;
    pointer-events: none;
}

.x-edge,
.x-node {
    transition: opacity 0.3s ease;
}

.explorer-svg.has-focus .x-edge:not(.is-related) {
    opacity: 0.12;
}

.explorer-svg.has-focus .x-edge.is-hidden {
    opacity: 0;
}

.x-edge.is-related .x-edge-line {
    stroke-opacity: 1;
    stroke-width: 2.2;
}

.explorer-svg.has-focus .x-node:not(.is-related):not(.is-hidden) {
    opacity: 0.25;
}

.x-edge-label {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.x-edge-label.is-shown {
    opacity: 1;
}

.x-edge-label rect {
    fill: #FFFFFF;
    stroke: var(--line);
}

.x-edge-label text {
    font-family: var(--font);
    font-size: 11px;
    font-weight: 500;
    fill: var(--slate);
    text-anchor: middle;
    dominant-baseline: central;
}

.x-edge-label.is-related rect {
    fill: var(--ink);
    stroke: var(--ink);
}

.x-edge-label.is-related text {
    fill: #FFFFFF;
}

.x-edge-label.is-internal.is-related rect {
    fill: var(--gene);
    stroke: var(--gene);
}

.x-node .node-halo {
    opacity: 0.14;
}

.x-node text {
    font-size: 13px;
}

.x-node.disease text {
    font-size: 15px;
}

.x-node.is-match .node-ring {
    opacity: 1;
    stroke-width: 2.5;
    stroke-dasharray: 3 3;
}

.zoom-controls {
    position: absolute;
    right: 1rem;
    bottom: 1rem;
    display: flex;
    flex-direction: column;
    background: var(--paper-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(21, 33, 31, 0.08);
}

.zoom-controls button {
    font-family: var(--font);
    font-size: 1rem;
    color: var(--ink);
    background: none;
    border: none;
    width: 2.5rem;
    height: 2.25rem;
    cursor: pointer;
}

.zoom-controls button + button {
    border-top: 1px solid var(--line);
}

.zoom-controls button[data-zoom="reset"] {
    font-size: 0.75rem;
    font-weight: 600;
}

.zoom-controls button:hover {
    background: var(--paper);
}

.explorer-hint {
    position: absolute;
    left: 1rem;
    bottom: 1rem;
    font-size: 0.8125rem;
    color: var(--slate);
    pointer-events: none;
}

/* Entity panel */
.explorer-panel {
    border-left: 1px solid var(--line);
    overflow-y: auto;
    padding: 1.5rem 1.5rem 2rem;
    scrollbar-width: thin;
}

.panel-kicker {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.8125rem;
    color: var(--slate);
    margin-bottom: 0.35rem;
}

.explorer-panel h3 {
    font-size: 1.375rem;
    line-height: 1.2;
    margin-bottom: 0.5rem;
}

.panel-text {
    font-size: 0.9375rem;
    color: var(--slate);
    margin-bottom: 1.25rem;
}

.panel-label {
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.panel-list {
    list-style: none;
}

.panel-node {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    font-family: var(--font);
    font-size: 0.9375rem;
    color: var(--ink);
    text-align: left;
    background: none;
    border: none;
    border-bottom: 1px solid var(--line);
    padding: 0.6rem 0;
    cursor: pointer;
}

.panel-node span {
    margin-left: auto;
    font-size: 0.8125rem;
    color: var(--slate);
    font-variant-numeric: tabular-nums;
}

.panel-node:hover {
    color: var(--green);
}

.panel-back {
    font-family: var(--font);
    font-size: 0.8125rem;
    color: var(--green);
    background: none;
    border: none;
    padding: 0;
    margin-bottom: 1rem;
    cursor: pointer;
}

.panel-back::before {
    content: "‹ ";
}

.panel-relations {
    list-style: none;
}

.panel-relations li {
    border-top: 1px solid var(--line);
    padding: 0.85rem 0;
}

.panel-relation {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.4rem;
    font-family: var(--font);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ink);
    text-align: left;
    background: none;
    border: none;
    padding: 0;
    margin-bottom: 0.35rem;
    cursor: pointer;
}

.panel-relation em {
    font-style: normal;
    font-weight: 400;
    color: var(--slate);
}

.panel-relation .is-self {
    color: var(--slate);
    font-weight: 500;
}

.panel-relation:hover span:not(.is-self) {
    color: var(--green);
    text-decoration: underline;
}

.panel-evidence {
    font-family: var(--serif, Georgia, serif);
    font-size: 0.875rem;
    line-height: 1.6;
    color: #3A4744;
}

.panel-evidence + .panel-evidence {
    margin-top: 0.5rem;
}

.panel-evidence.is-internal {
    border-left: 2px dashed var(--gene);
    padding-left: 0.6rem;
}

.panel-doc {
    display: block;
    font-family: var(--font);
    font-size: 0.75rem;
    color: var(--gene);
    margin-top: 0.2rem;
}

/* Link from the demo graph to the explorer */
.graph-expand {
    position: absolute;
    top: 0.9rem;
    right: 1rem;
    z-index: 1;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--ink);
    text-decoration: none;
    background: var(--paper-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 0.35rem 0.7rem;
}

.graph-expand:hover {
    border-color: var(--ink);
}

/* Evidence: a referenced report, sources listed per statement */
.evidence-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    height: 42rem;
}

.evidence-report {
    overflow-y: auto;
    padding: 2rem 2.25rem 2.5rem;
    border-right: 1px solid var(--line);
    scrollbar-width: thin;
}

.evidence-report p {
    line-height: 1.9;
}

.statement {
    cursor: pointer;
    border-radius: 3px;
    padding: 0.1em 0;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
    transition: background-color 0.2s ease;
}

.statement:hover {
    background: color-mix(in srgb, var(--green) 7%, transparent);
}

.statement.is-active {
    color: var(--ink);
    background: color-mix(in srgb, var(--green) 12%, transparent);
}

.cite.ref {
    cursor: pointer;
    background: none;
    margin: 0 0 0 0.2em;
}

.cite.ref:hover {
    background: color-mix(in srgb, var(--green) 12%, transparent);
}

.cite.ref.is-group {
    border-color: var(--green);
}

.cite.ref.is-active {
    color: #FFFFFF;
    background: var(--green);
}

.evidence-panel {
    position: relative;
    overflow-y: auto;
    padding: 1.75rem 2rem 2rem;
    background: #FAFBFA;
    scrollbar-width: thin;
}

.evidence-panel h3 {
    font-size: 1.25rem;
    line-height: 1.3;
    margin-bottom: 0.4rem;
}

.quote-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.quote-card.is-active {
    background: var(--paper-raised);
    box-shadow: 0 0 0 1px var(--line), 0 8px 24px -16px rgba(21, 33, 31, 0.35);
    border-radius: 0 8px 8px 0;
    padding: 0.9rem 1rem 0.9rem 1.1rem;
}

.quote-list {
    list-style: none;
}

.quote-card {
    margin-top: 1.25rem;
    padding: 0.2rem 0 0.2rem 1.1rem;
    border-left: 3px solid var(--green);
}

.quote-card.is-nuance {
    border-left-color: var(--process);
}

.quote-card blockquote {
    font-family: var(--serif);
    font-size: 1rem;
    line-height: 1.65;
    color: #3A4744;
    margin-bottom: 0.75rem;
}

.quote-card mark {
    color: var(--ink);
    background: color-mix(in srgb, var(--green) 14%, transparent);
    border-radius: 3px;
    padding: 0.05em 0.1em;
}

.quote-card.is-nuance mark {
    background: color-mix(in srgb, var(--process) 18%, transparent);
}

.quote-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.9rem;
    font-size: 0.8125rem;
    color: var(--slate);
}

.quote-meta em {
    font-style: italic;
}

.quote-meta a {
    color: var(--green);
    font-weight: 500;
    text-underline-offset: 2px;
}

.stance-tag,
.preprint-tag {
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
    padding: 0.1rem 0.45rem;
}

.stance-tag {
    color: var(--green);
    background: color-mix(in srgb, var(--green) 12%, transparent);
}

.quote-card.is-nuance .stance-tag {
    color: #7A5710;
    background: color-mix(in srgb, var(--process) 18%, transparent);
}

.preprint-tag {
    color: var(--slate);
    border: 1px solid var(--line);
}

.quote-title {
    font-size: 0.8125rem;
    color: var(--slate);
    margin-top: 0.35rem;
}

.paper-link {
    display: inline-block;
    margin: 1rem 1.25rem 0 0;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--green);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Knowledge graph */
/* Graph canvas */
.graph-canvas {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background-color: #FAFBFA;
    background-image: radial-gradient(circle, #D3DAD6 1px, transparent 1.2px);
    background-size: 22px 22px;
    background-position: 11px 11px;
}

.graph-scroll {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem 0;
}

.graph-svg {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
}

/* Edges */
.edge-line {
    fill: none;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-opacity: 0.6;
    stroke-dasharray: var(--len);
    stroke-dashoffset: var(--len);
    transition: stroke-dashoffset 0.9s cubic-bezier(0.55, 0, 0.25, 1), stroke-opacity 0.25s ease, stroke-width 0.25s ease;
}

.graph-edge.is-visible .edge-line {
    stroke-dashoffset: 0;
}

.edge-arrow,
.edge-label {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.graph-edge.is-visible .edge-arrow,
.edge-label.is-visible {
    opacity: 1;
    transition-delay: 0.65s;
}

.edge-label rect {
    fill: #FFFFFF;
    stroke: var(--line);
    stroke-width: 1;
    transition: stroke 0.25s ease, fill 0.25s ease;
}

.edge-label text {
    font-family: var(--font);
    font-size: 11.5px;
    font-weight: 500;
    fill: var(--slate);
    text-anchor: middle;
    dominant-baseline: central;
    transition: fill 0.25s ease;
}

.graph-edge.is-related .edge-line {
    stroke-opacity: 1;
    stroke-width: 2.4;
}

.edge-label.is-related rect {
    fill: var(--ink);
    stroke: var(--ink);
}

.edge-label.is-related text {
    fill: #FFFFFF;
}

.graph-svg.has-selection .graph-edge.is-visible:not(.is-related) .edge-line {
    stroke-opacity: 0.18;
}

.graph-svg.has-selection .graph-edge.is-visible:not(.is-related) .edge-arrow,
.graph-svg.has-selection .edge-label.is-visible:not(.is-related) {
    opacity: 0.15;
    transition-delay: 0s;
}

/* Nodes */
.graph-node {
    cursor: pointer;
    outline: none;
}

.graph-node.drug { color: var(--drug); }
.graph-node.gene { color: var(--gene); }
.graph-node.process { color: var(--process); }
.graph-node.effect { color: var(--effect); }
.graph-node.disease { color: var(--disease); }

.node-body {
    transform-box: fill-box;
    transform-origin: center;
    transform: scale(0.3);
    opacity: 0;
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

.graph-node.is-visible .node-body {
    transform: scale(1);
    opacity: 1;
}

.node-hit {
    fill: transparent;
}

.node-halo {
    fill: currentColor;
    opacity: 0.12;
    transition: opacity 0.25s ease;
}

.node-dot {
    fill: currentColor;
    stroke: #FFFFFF;
    stroke-width: 2.5;
}

.node-ring {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.graph-node text {
    font-family: var(--font);
    font-size: 15px;
    font-weight: 500;
    fill: var(--ink);
    paint-order: stroke;
    stroke: #FAFBFA;
    stroke-width: 5px;
    stroke-linejoin: round;
}

.graph-node.disease text {
    font-weight: 650;
    font-size: 16px;
}

.graph-node:hover .node-halo,
.graph-node.is-related .node-halo {
    opacity: 0.22;
}

.graph-node:hover .node-ring,
.graph-node:focus-visible .node-ring,
.graph-node.is-selected .node-ring {
    opacity: 1;
}

.graph-node:focus-visible .node-ring {
    stroke-width: 2.5;
}

.graph-node .node-inner {
    transition: opacity 0.25s ease;
}

.graph-svg.has-selection .graph-node:not(.is-related) .node-inner {
    opacity: 0.3;
}

/* Instant reset before a replay */
.graph-svg.is-resetting * {
    transition: none !important;
}

.graph-legend {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    padding: 0.9rem 1.5rem 1.1rem;
    font-size: 0.8125rem;
    color: var(--slate);
}

.graph-legend li {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.dot.drug { background: var(--drug); }
.dot.gene { background: var(--gene); }
.dot.process { background: var(--process); }
.dot.effect { background: var(--effect); }
.dot.disease { background: var(--disease); }

.dash {
    width: 18px;
    border-top: 2px dashed var(--gene);
}

/* Relations extracted from the user's own documents */
.graph-edge.is-internal .edge-line {
    stroke: var(--gene);
    stroke-dasharray: 5 5;
    stroke-dashoffset: 0;
    opacity: 0;
    transition: opacity 0.6s ease, stroke-opacity 0.25s ease, stroke-width 0.25s ease;
}

.graph-edge.is-internal.is-visible .edge-line {
    opacity: 1;
}

.edge-label.is-internal rect {
    stroke: var(--gene);
    stroke-dasharray: 3 2;
}

.edge-label.is-internal text {
    fill: var(--gene);
}

/* CTA */
.section-cta {
    background-color: var(--ink);
    color: #FFFFFF;
}

.cta-content h2,
.cta-content p {
    max-width: 40rem;
}

.section-cta h2 {
    margin-bottom: 1rem;
}

.section-cta p {
    font-size: 1.125rem;
    color: rgba(255, 255, 255, 0.72);
    margin-bottom: 2.25rem;
}

/* Footer */
.site-footer {
    background-color: var(--ink);
    color: rgba(255, 255, 255, 0.6);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1.75rem 0;
    font-size: 0.875rem;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-footer .wordmark {
    font-size: 1rem;
    color: #FFFFFF;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    inset: 0;
    background-color: rgba(21, 33, 31, 0.6);
    backdrop-filter: blur(4px);
    overflow-y: auto;
}

.modal-content {
    background-color: var(--paper-raised);
    color: var(--ink);
    margin: 10vh auto;
    padding: 2.25rem;
    width: calc(100% - 2rem);
    max-width: 30rem;
    border-radius: 10px;
    position: relative;
}

.close {
    position: absolute;
    right: 1.25rem;
    top: 1rem;
    font-size: 1.75rem;
    line-height: 1;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--slate);
}

.modal h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1.75rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.9375rem;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 0.7rem 0.85rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
    font-family: var(--font);
    font-size: 1rem;
    color: var(--ink);
}

.form-group input:focus {
    outline: none;
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(31, 122, 92, 0.18);
    background: var(--paper-raised);
}

.btn-submit {
    width: 100%;
    background-color: var(--green);
    color: #FFFFFF;
    padding: 0.85rem;
    border: none;
    border-radius: var(--radius);
    font-weight: 500;
    cursor: pointer;
    font-size: 1rem;
    font-family: var(--font);
    margin-top: 0.5rem;
    transition: background-color 0.2s ease;
}

.btn-submit:hover {
    background-color: var(--green-dark);
}

.btn-submit:disabled {
    opacity: 0.6;
    cursor: default;
}

.success-message {
    font-size: 1.0625rem;
    padding: 1rem 0 0.5rem;
}

/* Responsive */
@media (max-width: 1000px) {
    .demo-body {
        grid-template-columns: minmax(0, 1fr);
        height: auto;
    }

    .demo-side {
        order: -1;
        border-bottom: 1px solid var(--line);
        min-height: 24rem;
    }

    .demo-report {
        border-right: none;
        max-height: 34rem;
    }

    .source-drawer {
        inset: 0;
    }

    .explorer-body {
        grid-template-columns: minmax(0, 1fr);
        height: auto;
    }

    .explorer-canvas {
        height: 30rem;
    }

    .evidence-layout {
        grid-template-columns: minmax(0, 1fr);
        height: auto;
    }

    .evidence-report {
        border-right: none;
        border-bottom: 1px solid var(--line);
        max-height: 30rem;
    }

    .evidence-panel {
        max-height: 36rem;
    }

    .explorer-panel {
        border-left: none;
        border-top: 1px solid var(--line);
        max-height: 30rem;
    }
}

@media (max-width: 900px) {
    :root {
        --gutter: 1.25rem;
    }

    .section {
        padding: 4.5rem 0;
    }

    .hero {
        padding: 7rem 0 4rem;
    }

    .hero-lead {
        font-size: 1.125rem;
    }

    .hero-text {
        font-size: 1rem;
    }

    .grid-3 {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .section.section-features {
        padding: 0 0 4.5rem;
    }

    .app-window {
        margin: 0 calc(-1 * var(--gutter));
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .demo-note,
    .app-mode {
        display: none;
    }

    .demo-query {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .demo-query .app-search {
        flex-basis: 100%;
    }

    .demo-report {
        padding: 1.25rem;
    }

    .source-drawer .paper {
        padding: 1.5rem 1.25rem;
    }

    /* Keep node labels legible: scroll the graph sideways inside its frame */
    .graph-scroll {
        overflow-x: auto;
        padding: 1rem 1rem 0;
    }

    .graph-svg {
        min-width: 520px;
        height: auto;
        flex-shrink: 0;
    }

    .graph-legend {
        padding: 0.75rem 1rem 1rem;
    }

    .library-table th:nth-child(2),
    .library-table td:nth-child(2) {
        display: none;
    }

    .library-footer {
        flex-direction: column;
    }

    .explorer-toolbar {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .explorer-search {
        max-width: none;
        flex-basis: 100%;
    }

    .segmented {
        margin-left: 0;
    }

    .explorer-filters {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .filter-chip {
        white-space: nowrap;
    }

    .explorer-hint {
        display: none;
    }

    .evidence-report,
    .evidence-panel {
        padding: 1.25rem;
    }

    .demo-view.library {
        min-height: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}
