:root {
    --ink: #16211d;
    --ink-soft: #25352f;
    --paper: #f8faf7;
    --wash: #edf4f1;
    --panel: #ffffff;
    --muted: #66736e;
    --border: rgba(22, 33, 29, 0.13);
    --green: #0b4f49;
    --green-2: #0f766e;
    --amber: #b7791f;
    --red: #9f2d2d;
    --shadow: 0 18px 55px rgba(22, 33, 29, 0.12);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background:
        radial-gradient(circle at top right, rgba(15, 118, 110, 0.11), transparent 36rem),
        linear-gradient(180deg, var(--paper) 0%, var(--wash) 54%, var(--paper) 100%);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    margin: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

.site-header {
    align-items: center;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    left: 0;
    padding: 1rem clamp(1rem, 4vw, 3rem);
    position: fixed;
    right: 0;
    top: 0;
    z-index: 10;
}

.site-header.compact {
    background: rgba(248, 250, 247, 0.92);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(16px);
}

.brand {
    align-items: center;
    display: inline-flex;
    gap: 0.75rem;
    min-width: 0;
}

.brand-mark {
    align-items: center;
    background: var(--ink);
    border-radius: 8px;
    color: #ffffff;
    display: inline-flex;
    font-size: 1.05rem;
    font-weight: 850;
    height: 2.35rem;
    justify-content: center;
    line-height: 1;
    width: 2.35rem;
}

.brand strong {
    display: block;
    font-size: 1.02rem;
    letter-spacing: 0;
}

.brand small {
    color: var(--muted);
    display: block;
    font-size: 0.75rem;
    margin-top: 0.05rem;
}

.hero .brand small,
.site-header:not(.compact) .brand small {
    color: rgba(255, 255, 255, 0.72);
}

.site-header:not(.compact) .brand {
    color: #ffffff;
}

.site-header:not(.compact) .brand-mark {
    background: #ffffff;
    color: var(--ink);
}

.nav-links {
    align-items: center;
    display: flex;
    gap: 0.7rem;
}

.nav-links > a:not(.button) {
    color: rgba(255, 255, 255, 0.86);
    font-size: 0.92rem;
    font-weight: 750;
    padding: 0.55rem 0.4rem;
}

.compact .nav-links > a:not(.button) {
    color: var(--ink-soft);
}

.button {
    align-items: center;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    display: inline-flex;
    font-weight: 800;
    justify-content: center;
    min-height: 2.75rem;
    padding: 0.72rem 1rem;
    transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
    white-space: nowrap;
}

.button:hover {
    transform: translateY(-1px);
}

.button-primary {
    background: var(--green);
    color: #ffffff;
}

.button-light {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.24);
    color: #ffffff;
}

.button-ghost {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.18);
    color: #ffffff;
}

.compact .button-ghost {
    background: var(--panel);
    border-color: var(--border);
    color: var(--green);
}

.button-secondary {
    background: var(--panel);
    border-color: var(--border);
    color: var(--ink);
}

.hero {
    align-items: center;
    display: flex;
    min-height: 92vh;
    overflow: hidden;
    padding: 8.5rem clamp(1.25rem, 6vw, 5rem) 5.5rem;
    position: relative;
}

.hero-bg {
    background-image: url("/static/justika-hero.png");
    background-position: center;
    background-size: cover;
    inset: 0;
    position: absolute;
}

.hero-overlay {
    background:
        linear-gradient(90deg, rgba(10, 20, 17, 0.9) 0%, rgba(10, 20, 17, 0.68) 45%, rgba(10, 20, 17, 0.08) 100%),
        linear-gradient(180deg, rgba(10, 20, 17, 0.10), rgba(10, 20, 17, 0.40));
    inset: 0;
    position: absolute;
}

.hero-content {
    color: #ffffff;
    max-width: 650px;
    position: relative;
    z-index: 1;
}

.eyebrow {
    color: #d5b36b;
    font-size: 0.8rem;
    font-weight: 850;
    letter-spacing: 0.08em;
    margin: 0 0 0.8rem;
    text-transform: uppercase;
}

.eyebrow.dark {
    color: var(--green);
}

.hero h1 {
    font-size: clamp(3.8rem, 9vw, 8rem);
    letter-spacing: 0;
    line-height: 0.9;
    margin: 0 0 1rem;
}

.hero-copy {
    color: rgba(255, 255, 255, 0.88);
    font-size: clamp(1rem, 1.7vw, 1.22rem);
    line-height: 1.7;
    margin: 0;
}

.hero-actions,
.hero-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    margin-top: 1.5rem;
}

.hero-chips span {
    background: rgba(255, 255, 255, 0.13);
    border: 1px solid rgba(255, 255, 255, 0.17);
    border-radius: 999px;
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 760;
    padding: 0.52rem 0.75rem;
}

.data-disclaimer {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.55;
    margin: 0.95rem 0 0;
}

.hero .data-disclaimer {
    color: rgba(255, 255, 255, 0.74);
    max-width: 620px;
}

.section {
    margin: 0 auto;
    max-width: 1160px;
    padding: 4.2rem clamp(1rem, 4vw, 2rem);
}

.section-heading {
    max-width: 760px;
}

.section h2,
.workflow h2,
.workspace-heading h1 {
    font-size: clamp(2rem, 4vw, 3.2rem);
    letter-spacing: 0;
    line-height: 1.05;
    margin: 0 0 0.9rem;
}

.section-heading p:last-child,
.workflow p,
.workspace-heading p,
.analysis-panel p,
.empty-state p {
    color: var(--muted);
    line-height: 1.6;
}

.feature-grid {
    display: grid;
    gap: 0.9rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 1.3rem;
}

.feature-card,
.analysis-panel,
.result-panel,
.metric-card,
.source-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(22, 33, 29, 0.07);
}

.feature-card {
    padding: 1.1rem;
}

.feature-icon {
    color: var(--amber);
    display: block;
    font-size: 0.82rem;
    font-weight: 850;
    margin-bottom: 1.2rem;
}

.feature-card h3 {
    font-size: 1.1rem;
    margin: 0 0 0.45rem;
}

.feature-card p {
    color: var(--muted);
    line-height: 1.55;
    margin: 0;
}

.band {
    background: transparent;
    max-width: 1160px;
    padding-top: 1rem;
}

.workflow {
    align-items: center;
    background: #13211d;
    border-radius: 10px;
    color: #ffffff;
    display: flex;
    gap: 2rem;
    justify-content: space-between;
    padding: clamp(1.3rem, 4vw, 2.4rem);
}

.workflow p {
    color: rgba(255, 255, 255, 0.76);
    margin: 0;
    max-width: 690px;
}

.site-footer {
    align-items: center;
    border-top: 1px solid var(--border);
    color: var(--muted);
    display: flex;
    font-size: 0.9rem;
    justify-content: space-between;
    margin: 0 auto;
    max-width: 1160px;
    padding: 1.2rem clamp(1rem, 4vw, 2rem) 1.7rem;
}

.workspace-shell {
    margin: 0 auto;
    max-width: 1280px;
    padding: 7.4rem clamp(1rem, 3vw, 2rem) 2rem;
}

.workspace-heading {
    margin-bottom: 1.3rem;
    max-width: 850px;
}

.workspace-heading p {
    font-size: 1.02rem;
    margin: 0;
}

.workspace-layout {
    align-items: start;
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(330px, 0.9fr) minmax(0, 1.35fr);
}

.analysis-panel,
.result-panel {
    padding: 1.1rem;
}

.analysis-panel {
    position: sticky;
    top: 5.4rem;
}

.panel-head {
    align-items: start;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 0.9rem;
}

.panel-head h2,
.empty-state h2 {
    font-size: 1.25rem;
    margin: 0 0 0.2rem;
}

.panel-head p {
    font-size: 0.92rem;
    margin: 0;
}

.icon-button {
    align-items: center;
    background: var(--green);
    border: 0;
    border-radius: 8px;
    color: #ffffff;
    cursor: pointer;
    display: inline-flex;
    font-size: 1.25rem;
    font-weight: 850;
    height: 2.4rem;
    justify-content: center;
    width: 2.4rem;
}

label {
    color: var(--ink-soft);
    display: block;
    font-size: 0.88rem;
    font-weight: 760;
}

textarea,
input,
select {
    background: #fbfcfb;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--ink);
    display: block;
    margin-top: 0.42rem;
    outline: 0;
    padding: 0.78rem 0.82rem;
    width: 100%;
}

textarea:focus,
input:focus,
select:focus {
    border-color: rgba(15, 118, 110, 0.55);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

textarea {
    min-height: 220px;
    resize: vertical;
}

.form-grid {
    display: grid;
    gap: 0.8rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 0.9rem;
}

.controls-grid {
    align-items: end;
}

.toggle-row {
    align-items: center;
    background: #fbfcfb;
    border: 1px solid var(--border);
    border-radius: 8px;
    display: flex;
    gap: 0.7rem;
    min-height: 3.15rem;
    padding: 0.75rem 0.8rem;
}

.toggle-row input {
    accent-color: var(--green);
    margin: 0;
    width: auto;
}

.form-actions {
    display: grid;
    gap: 0.7rem;
    grid-template-columns: 1fr 0.65fr;
    margin-top: 1rem;
}

.fine-print {
    font-size: 0.84rem;
    margin: 0.75rem 0 0;
}

.advanced-options {
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-top: 0.9rem;
    padding: 0.8rem;
}

.advanced-options summary {
    color: var(--green);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 850;
}

.result-panel {
    min-height: 620px;
}

.hidden {
    display: none !important;
}

.empty-state,
.loading-state {
    align-items: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 560px;
    text-align: center;
}

.loading-state p,
.empty-state p {
    max-width: 430px;
}

.loader {
    animation: spin 900ms linear infinite;
    border: 3px solid rgba(15, 118, 110, 0.16);
    border-radius: 999px;
    border-top-color: var(--green);
    display: block;
    height: 2.5rem;
    width: 2.5rem;
}

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

.error-state {
    background: rgba(159, 45, 45, 0.10);
    border: 1px solid rgba(159, 45, 45, 0.18);
    border-radius: 8px;
    color: var(--red);
    font-weight: 760;
    padding: 1rem;
}

.metric-grid {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 1rem;
}

.decision-hero {
    border-radius: 8px;
    margin-bottom: 1rem;
    padding: 1.05rem;
}

.decision-hero span {
    display: block;
    font-size: 0.78rem;
    font-weight: 850;
    margin-bottom: 0.45rem;
    text-transform: uppercase;
}

.decision-hero h2 {
    color: var(--ink);
    font-size: clamp(1.25rem, 2.4vw, 1.8rem);
    line-height: 1.18;
    margin: 0 0 0.55rem;
}

.decision-hero p {
    color: var(--ink-soft);
    line-height: 1.55;
    margin: 0;
}

.metric-card {
    box-shadow: none;
    padding: 0.9rem;
}

.metric-card b {
    color: var(--muted);
    display: block;
    font-size: 0.78rem;
    margin-bottom: 0.32rem;
    text-transform: uppercase;
}

.metric-card strong {
    color: var(--green);
    display: block;
    font-size: 1.05rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.status-badge {
    border-radius: 999px;
    display: inline-flex;
    font-size: 0.78rem;
    font-weight: 850;
    margin-bottom: 0.8rem;
    padding: 0.48rem 0.72rem;
    text-transform: uppercase;
}

.status-ok {
    background: rgba(15, 118, 110, 0.12);
    color: var(--green);
}

.status-warn {
    background: rgba(183, 121, 31, 0.14);
    color: #8a5a12;
}

.status-danger {
    background: rgba(159, 45, 45, 0.12);
    color: var(--red);
}

.tabs {
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 0.3rem;
    margin-top: 0.2rem;
}

.tab-button {
    background: transparent;
    border: 0;
    border-bottom: 3px solid transparent;
    color: var(--muted);
    cursor: pointer;
    font-weight: 850;
    padding: 0.78rem 0.85rem;
}

.tab-button.active {
    border-color: var(--green);
    color: var(--green);
}

.tab-panel {
    display: none;
    padding: 1rem 0 0;
}

.tab-panel.active {
    display: block;
}

.markdown-body {
    color: var(--ink-soft);
    line-height: 1.65;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
    color: var(--ink);
    letter-spacing: 0;
    line-height: 1.18;
}

.markdown-body h1 {
    font-size: 1.65rem;
}

.markdown-body h2 {
    font-size: 1.35rem;
    margin-top: 1.25rem;
}

.markdown-body h3 {
    font-size: 1.08rem;
    margin-top: 1.1rem;
}

.markdown-body code {
    background: rgba(15, 118, 110, 0.10);
    border-radius: 5px;
    padding: 0.08rem 0.24rem;
}

.source-card {
    box-shadow: none;
    margin-bottom: 0.8rem;
    overflow: hidden;
}

.source-summary {
    align-items: center;
    cursor: pointer;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    padding: 0.9rem;
}

.source-summary b {
    overflow-wrap: anywhere;
}

.source-summary span {
    color: var(--muted);
    font-size: 0.86rem;
    white-space: nowrap;
}

.source-body {
    border-top: 1px solid var(--border);
    display: none;
    padding: 0.9rem;
}

.source-card.open .source-body {
    display: block;
}

.subarticle-list {
    display: grid;
    gap: 0.5rem;
    list-style: none;
    margin: 0.6rem 0 0.9rem;
    padding: 0;
}

.subarticle-list li {
    background: rgba(15, 118, 110, 0.07);
    border: 1px solid var(--border);
    border-radius: 8px;
    display: grid;
    gap: 0.2rem;
    padding: 0.65rem 0.75rem;
}

.subarticle-list b {
    color: var(--green);
    font-size: 0.86rem;
}

.subarticle-list span {
    color: var(--ink-soft);
    line-height: 1.45;
}

.source-body pre,
#json-output {
    background: #111d19;
    border-radius: 8px;
    color: #e9f4ef;
    line-height: 1.5;
    max-height: 460px;
    overflow: auto;
    padding: 1rem;
    white-space: pre-wrap;
}

.source-body table {
    border-collapse: collapse;
    font-size: 0.9rem;
    margin-top: 0.75rem;
    width: 100%;
}

.source-body th,
.source-body td {
    border: 1px solid var(--border);
    padding: 0.55rem;
    text-align: left;
    vertical-align: top;
}

.source-body th {
    background: rgba(15, 118, 110, 0.08);
}

@media (max-width: 940px) {
    .site-header {
        position: absolute;
    }

    .workspace-shell {
        padding-top: 6.4rem;
    }

    .workspace-layout,
    .feature-grid,
    .metric-grid {
        grid-template-columns: 1fr;
    }

    .analysis-panel {
        position: static;
    }

    .workflow {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 620px) {
    .site-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.8rem;
    }

    .nav-links {
        flex-wrap: wrap;
    }

    .hero {
        min-height: 88vh;
        padding-top: 9.8rem;
    }

    .hero-overlay {
        background: linear-gradient(180deg, rgba(10, 20, 17, 0.90), rgba(10, 20, 17, 0.72) 58%, rgba(10, 20, 17, 0.36));
    }

    .form-grid,
    .form-actions {
        grid-template-columns: 1fr;
    }

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