@font-face {
    font-family: "IBM Plex Sans";
    src: url("../fonts/IBMPlexSans-Regular.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "IBM Plex Sans";
    src: url("../fonts/IBMPlexSans-Medium.woff2") format("woff2");
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "IBM Plex Sans";
    src: url("../fonts/IBMPlexSans-SemiBold.woff2") format("woff2");
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg: #f5f3ee;
    --panel: #fffdf8;
    --fg: #1d262b;
    --muted: #5f6b73;
    --line: #d7d2c6;
    --line-strong: #b9b2a2;
    --accent: #1d5f74;
    --accent-ink: #ffffff;
    --warm: #b9503f;
    --ok: #3d7a52;
    --grid: #e6e1d6;
    --chart-1: #1d5f74;
    --chart-2: #b9503f;
    --chart-3: #3d7a52;
    --chart-4: #7b5ea7;
    --shadow: 0 1px 0 rgba(29, 38, 43, 0.06);
    --radius: 4px;
    --content: 1120px;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #15191c;
        --panel: #1b2024;
        --fg: #e6e2d8;
        --muted: #9aa4ab;
        --line: #2c3439;
        --line-strong: #414b52;
        --accent: #6fb8cb;
        --accent-ink: #0f1a1e;
        --warm: #e0836f;
        --ok: #7fbf96;
        --grid: #242b30;
        --chart-1: #6fb8cb;
        --chart-2: #e0836f;
        --chart-3: #7fbf96;
        --chart-4: #b49ad8;
        --shadow: none;
        color-scheme: dark;
    }
}

* {
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    background: var(--bg);
    color: var(--fg);
    font-family: "IBM Plex Sans", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
}

a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid transparent;
}

a:hover {
    border-bottom-color: currentColor;
}

h1, h2, h3 {
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.2;
    margin: 0 0 0.5rem;
}

h1 {
    font-size: 1.9rem;
}

h1:focus:not(:focus-visible) {
    outline: none;
}

h2 {
    font-size: 1.25rem;
    margin-top: 2.2rem;
}

h3 {
    font-size: 1rem;
    margin-top: 1.4rem;
}

p {
    margin: 0 0 0.9rem;
    max-width: 68ch;
}

small, .muted {
    color: var(--muted);
}

code, pre {
    font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
    font-variant-numeric: tabular-nums;
}

pre {
    max-width: 100%;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 0.8rem 1rem;
    overflow-x: auto;
    font-size: 0.9rem;
    line-height: 1.45;
    white-space: pre;
}

pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: inherit;
}

code {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 3px;
    padding: 0 0.3em;
    font-size: 0.93em;
}

.boot {
    display: grid;
    place-items: center;
    min-height: 60vh;
    color: var(--muted);
}

#blazor-error-ui {
    position: fixed;
    inset: auto 0 0 0;
    background: var(--warm);
    color: #fff;
    padding: 0.7rem 1rem;
    z-index: 10;
}

#blazor-error-ui a {
    color: #fff;
    border-bottom-color: #fff;
    margin-left: 0.5rem;
}

/* Frame */

.frame {
    max-width: var(--content);
    margin: 0 auto;
    padding: 0 1.25rem;
}

header.site {
    border-bottom: 1px solid var(--line);
    background: var(--bg);
    position: sticky;
    top: 0;
    z-index: 5;
}

header.site .frame {
    display: flex;
    align-items: center;
    gap: 1.6rem;
    height: 52px;
}

.wordmark {
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--fg);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: none;
}

.wordmark svg {
    width: 20px;
    height: 20px;
}

nav.primary {
    display: flex;
    gap: 1.1rem;
    margin-left: auto;
}

nav.primary a {
    color: var(--muted);
    padding: 0.2rem 0;
    border-bottom: 2px solid transparent;
}

nav.primary a:hover {
    color: var(--fg);
}

nav.primary a.active {
    color: var(--fg);
    border-bottom-color: var(--accent);
}

main {
    padding: 2.2rem 0 4rem;
}

footer.site {
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.85rem;
    padding: 1.2rem 0 2rem;
}

footer.site .frame {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1.5rem;
}

/* Text blocks */

.lede {
    font-size: 1.15rem;
    max-width: 60ch;
    color: var(--fg);
}

.columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem 2.5rem;
}

.figures {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem 1.5rem;
    margin: 1.4rem 0;
}

.figure {
    border-top: 2px solid var(--line-strong);
    padding-top: 0.5rem;
}

.figure .value {
    font-size: 1.5rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

.figure .label {
    color: var(--muted);
    font-size: 0.85rem;
}

/* Tables */

table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
}

th, td {
    text-align: left;
    padding: 0.35rem 0.6rem;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

th {
    font-weight: 500;
    color: var(--muted);
    white-space: nowrap;
}

table.catalog th {
    position: sticky;
    top: 52px;
    background: var(--bg);
}

td.num, th.num {
    text-align: right;
}

td.nowrap, th.nowrap {
    white-space: nowrap;
}

tbody tr:hover {
    background: var(--panel);
}

th.sortable {
    cursor: pointer;
    user-select: none;
}

th.sortable.active {
    color: var(--fg);
}

.table-scroll {
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
}

table.compact th,
table.compact td {
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
}

/* Controls */

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem 1.4rem;
    align-items: end;
    margin: 1rem 0 1.4rem;
}

.control {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.85rem;
    color: var(--muted);
}

.control > span:first-child {
    display: block;
}

.control > span.range-label {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.control output {
    color: var(--fg);
    font-variant-numeric: tabular-nums;
}

input[type="text"],
input[type="search"],
input[type="number"],
select {
    font: inherit;
    color: var(--fg);
    background: var(--panel);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    padding: 0.35rem 0.55rem;
    min-width: 8rem;
}

input[type="range"] {
    width: 220px;
    accent-color: var(--accent);
}

label.check {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--fg);
    font-size: 0.9rem;
}

button {
    font: inherit;
    color: var(--fg);
    background: var(--panel);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    padding: 0.35rem 0.8rem;
    cursor: pointer;
}

button.primary {
    background: var(--accent);
    color: var(--accent-ink);
    border-color: var(--accent);
}

/* Panels and charts */

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    box-shadow: var(--shadow);
}

.chart {
    width: 100%;
    height: auto;
    display: block;
    font-size: 11px;
}

.chart .grid {
    stroke: var(--grid);
    stroke-width: 1;
}

.chart .axis {
    stroke: var(--line-strong);
    stroke-width: 1;
}

.chart text {
    fill: var(--muted);
    font-family: inherit;
}

.chart .series {
    fill: none;
    stroke-width: 1.8;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.chart .band {
    fill: var(--accent);
    opacity: 0.07;
}

.chart .marker {
    stroke: var(--line-strong);
    stroke-dasharray: 3 3;
}

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1.2rem;
    font-size: 0.85rem;
    color: var(--muted);
    margin-top: 0.4rem;
}

.legend .swatch {
    display: inline-block;
    width: 14px;
    height: 3px;
    vertical-align: middle;
    margin-right: 0.4rem;
}

.swatch-block {
    width: 100%;
    height: 72px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
}

.kv {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.25rem 1rem;
    font-size: 0.9rem;
    margin: 0.6rem 0;
}

.kv dt {
    color: var(--muted);
    margin: 0;
}

.kv dd {
    margin: 0;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.equation {
    font-size: 1.05rem;
    padding: 0.6rem 0;
    font-variant-numeric: tabular-nums;
}

.equation sup, .equation sub {
    font-size: 0.75em;
}

.badge {
    display: inline-block;
    font-size: 0.75rem;
    padding: 0.05rem 0.45rem;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    color: var(--muted);
    vertical-align: middle;
}

.notice {
    border-left: 3px solid var(--warm);
    padding: 0.4rem 0.9rem;
    color: var(--fg);
    background: var(--panel);
    margin: 1rem 0;
    max-width: 70ch;
}

@media (max-width: 720px) {
    header.site .frame {
        gap: 0.9rem;
    }

    nav.primary {
        gap: 0.7rem;
        font-size: 0.9rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    input[type="range"] {
        width: 160px;
    }
}

/* Optical bench */

.bench {
    background: #0c1013;
    border-radius: var(--radius);
    overflow: hidden;
    line-height: 0;
}

.prism {
    width: 100%;
    height: auto;
    display: block;
}

.prism .beam {
    stroke: #f4efe4;
    stroke-width: 3;
    stroke-linecap: round;
}

.prism .fan {
    mix-blend-mode: screen;
}

.prism .ray {
    fill: none;
    stroke-width: 1.8;
    stroke-linejoin: round;
    opacity: 0.9;
    stroke-dasharray: 2400;
    stroke-dashoffset: 2400;
    animation: trace 1.8s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}

.prism .fan {
    filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.35));
}

.prism .screen {
    stroke: rgba(244, 239, 228, 0.35);
    stroke-width: 1;
}

.prism .hit {
    stroke-width: 2.4;
    mix-blend-mode: screen;
}

.prism .hits {
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.5));
}

@keyframes trace {
    to {
        stroke-dashoffset: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .prism .ray {
        animation: none;
        stroke-dashoffset: 0;
    }
}

.prism .glass {
    fill: rgba(255, 255, 255, 0.04);
    stroke: rgba(244, 239, 228, 0.55);
    stroke-width: 1.2;
}

.hero {
    display: grid;
    grid-template-columns: minmax(280px, 3fr) minmax(320px, 4fr);
    gap: 2rem 3rem;
    align-items: center;
    margin: 0 0 2.5rem;
}

.hero .readout {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem 1.6rem;
    margin-top: 1rem;
    font-variant-numeric: tabular-nums;
}

.hero .readout .value {
    white-space: nowrap;
}

.hero .readout > div {
    min-width: 7.5rem;
}

.hero .readout .value {
    font-size: 1.35rem;
    font-weight: 600;
}

.hero .readout .label {
    color: var(--muted);
    font-size: 0.8rem;
}

.hero .controls {
    margin: 0.8rem 0 0;
}

@media (max-width: 860px) {
    .hero {
        grid-template-columns: 1fr;
    }
}

.spectrum {
    width: 100%;
    height: 72px;
    display: block;
    border-radius: var(--radius);
    background: #0c1013;
}

.spectrum-axis {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 0.25rem;
    font-variant-numeric: tabular-nums;
}

.abbe-chart {
    background: #0c1013;
    border-radius: var(--radius);
}

.abbe-chart text {
    fill: #9aa4ab;
}

.abbe-chart .grid {
    stroke: #1c2429;
}

.abbe-chart .axis {
    stroke: #414b52;
}

.abbe-chart .dim circle {
    fill: #2a3238;
}

.abbe-chart .pt {
    cursor: pointer;
    opacity: 0.9;
}

.abbe-chart .pt:hover {
    opacity: 1;
    r: 5;
}

.legend .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

/* Render page */

.render-stage {
    display: grid;
    grid-template-columns: minmax(240px, 480px) minmax(260px, 1fr);
    gap: 1.5rem 2.5rem;
    align-items: start;
}

.render-canvas {
    width: 100%;
    height: auto;
    display: block;
    background: #0c1013;
    border-radius: var(--radius);
    image-rendering: auto;
}

.render-facts h2 {
    margin-top: 0;
}

/* Small screens */

@media (max-width: 720px) {
    .render-stage,
    .hero {
        grid-template-columns: 1fr;
    }

    .hero > .bench {
        order: -1;
    }

    header.site .frame {
        height: auto;
        min-height: 48px;
        flex-wrap: wrap;
        padding-top: 0.4rem;
        padding-bottom: 0.4rem;
    }

    nav.primary {
        margin-left: 0;
        width: 100%;
        overflow-x: auto;
        gap: 1rem;
        padding-bottom: 0.2rem;
        -webkit-overflow-scrolling: touch;
    }

    nav.primary a {
        white-space: nowrap;
    }

    nav.primary {
        scrollbar-width: none;
    }

    nav.primary::-webkit-scrollbar {
        display: none;
    }

    main {
        padding-top: 1.4rem;
    }

    .lede {
        font-size: 1.02rem;
    }

    .controls {
        gap: 0.7rem 1rem;
    }

    .control {
        flex: 1 1 100%;
    }

    input[type="range"],
    select,
    input[type="search"],
    input[type="number"] {
        width: 100%;
        min-width: 0;
    }

    .figures {
        grid-template-columns: repeat(2, 1fr);
    }

    table.catalog th {
        top: 0;
    }

    table.catalog th:nth-child(n + 5),
    table.catalog td:nth-child(n + 5) {
        display: none;
    }

    table.compact {
        font-size: 0.8rem;
    }


    pre {
        font-size: 0.8rem;
    }

    .kv {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .kv dt {
        margin-top: 0.4rem;
    }
}

/* Use page */

.use-demo {
    position: relative;
    min-height: 260px;
    border-radius: var(--radius);
    overflow: hidden;
    margin: 1rem 0;
    background: #f3efe6;
}

.use-backdrop {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: 1fr auto;
}

.use-backdrop span {
    display: block;
    min-height: 120px;
}

.use-backdrop p {
    grid-column: 1 / -1;
    margin: 0;
    padding: 1rem 1.2rem 1.4rem;
    max-width: none;
    color: #1d262b;
    font-size: 1.05rem;
}

.glass-panel {
    position: absolute;
    left: 8%;
    right: 8%;
    top: 22%;
    bottom: 22%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.3rem;
    padding: 1.2rem 1.4rem;
    color: #1d262b;
    background: color-mix(in srgb, var(--glass-tint, #ffffff) 30%, transparent);
    -webkit-backdrop-filter: blur(var(--glass-blur, 10px));
    backdrop-filter: blur(var(--glass-blur, 10px));
    border: 1px solid rgb(255 255 255 / var(--glass-edge, 0.3));
    box-shadow: inset 0 1px 0 rgb(255 255 255 / calc(var(--glass-face, 0.04) * 3)), 0 12px 32px rgb(0 0 0 / 0.18);
    border-radius: 16px;
}

.glass-panel strong {
    font-size: 1.3rem;
}

.snippet {
    margin: 0.8rem 0 1.6rem;
}

.snippet-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 0.3rem;
}

.snippet pre {
    margin: 0;
}
