/* the tokens: every color, size and space a page uses is one of these */
:root {
    --ink: #0f1b2d;
    --ink-2: #6e6a66;
    --ink-3: #a8a39e;
    --paper: #ffffff;
    --canvas: #f0f0ee;
    --canvas-2: #e9e8e5;
    --line: #e4e1dc;
    --brand: #e8490f;
    --brand-ink: #ffffff;
    --on-ink: #ffffff;
    --on-ink-2: rgba(255, 255, 255, 0.6);
    --on-ink-3: rgba(255, 255, 255, 0.4);
    --on-ink-field: rgba(255, 255, 255, 0.08);
    --on-ink-line: rgba(255, 255, 255, 0.25);

    --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-display: "Space Grotesk", var(--font);
    --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    --weight-medium: 500;
    --weight-strong: 600;
    --weight-display: 700;
    --size-micro: 0.75rem;
    --size-small: 0.8125rem;
    --size-body: 0.9375rem;
    --size-lead: 1.0625rem;
    --size-heading: 1.25rem;
    --size-title: 1.75rem;
    --size-hero: 2.25rem;
    --line-height: 1.5;
    --line-height-heading: 1.2;
    --tracking-label: 0.06em;
    --tracking-display: -0.015em;

    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;
    --space-7: 3rem;
    --card: 24rem;
    --rail: 18rem;
    --border: 1px;
    --border-strong: 2px;
    --bar: 0.5rem;
    --mark: 2rem;
    --icon: 1.25rem;

    --content: 72rem;
    --column: 36rem;
    --reading: 44rem;
    --gutter: 1.25rem;
    --label: 9rem;
    --radius: 0.75rem;
    --radius-sm: 0.5rem;
    --shadow: 0 2px 8px -2px rgba(15, 27, 45, 0.08), 0 1px 3px rgba(15, 27, 45, 0.04);
    --shadow-slab: inset 0 1px 0 0 rgba(255, 255, 255, 0.12), 0 4px 12px -2px rgba(15, 27, 45, 0.24), 0 2px 4px -1px rgba(15, 27, 45, 0.16);
}

/* the shell */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-family: var(--font);
    font-size: 100%;
    line-height: var(--line-height);
    color: var(--ink);
    background: var(--canvas);
    -webkit-text-size-adjust: 100%;
    font-variant-numeric: tabular-nums;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: var(--size-body);
}

.topbar {
    background: var(--ink);
    color: var(--on-ink);
}

.topbar > div, .foot > div {
    display: flex;
    align-items: center;
    gap: var(--space-5);
    max-width: var(--content);
    margin-inline: auto;
    padding: var(--space-3) var(--gutter);
}

.topbar .brand {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-family: var(--font-display);
    font-weight: var(--weight-display);
    font-size: var(--size-lead);
    letter-spacing: var(--tracking-display);
    color: var(--on-ink);
    text-decoration: none;
}

.topbar nav {
    margin-left: auto;
}

.topbar nav a {
    font-weight: var(--weight-medium);
    color: var(--on-ink-2);
    text-decoration: none;
}

.topbar nav a:hover {
    color: var(--on-ink);
}

.topbar .mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--mark);
    height: var(--mark);
    border-radius: var(--radius-sm);
    background: var(--brand);
    color: var(--brand-ink);
}

main {
    flex: 1;
    min-width: 0;
}

.content {
    width: 100%;
    max-width: var(--content);
    margin-inline: auto;
    padding: var(--space-6) var(--gutter);
}

.content.reading, .content.run {
    max-width: var(--reading);
}

.foot {
    border-top: var(--border) solid var(--line);
    color: var(--ink-2);
}

.foot > div {
    display: block;
}

.foot p {
    margin: var(--space-1) 0;
}

h1, h2, h3 {
    line-height: var(--line-height-heading);
}

h1:focus {
    outline: 0;
}

h1 {
    margin: 0 0 var(--space-2);
    font-family: var(--font-display);
    font-size: var(--size-title);
    font-weight: var(--weight-display);
    letter-spacing: var(--tracking-display);
}

h2 {
    margin: var(--space-6) 0 var(--space-3);
    font-size: var(--size-heading);
}

h3 {
    margin: 0 0 var(--space-2);
    font-size: var(--size-body);
}

p {
    margin: 0 0 var(--space-3);
}

a {
    color: var(--ink);
}

code, .mono {
    font-family: var(--mono);
    word-break: break-all;
}

.muted {
    color: var(--ink-2);
}

.right {
    text-align: right;
}

.card {
    background: var(--paper);
    border: var(--border) solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: var(--space-5);
}

button {
    padding: var(--space-2) var(--space-4);
    border: 0;
    border-radius: var(--radius-sm);
    background: var(--brand);
    color: var(--brand-ink);
    font: inherit;
    font-weight: var(--weight-strong);
    cursor: pointer;
}

/* the search */
form.search {
    margin-bottom: var(--space-4);
}

form.search .field {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-1) var(--space-1) var(--space-3);
    background: var(--paper);
    border: var(--border) solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--ink-2);
}

form.search svg {
    width: var(--icon);
    height: var(--icon);
    flex: none;
}

form.search input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    font: inherit;
    color: var(--ink);
}

/* the header's search: the field in the plate's palette, the order field's list dropped over the page */
.topbar .brand {
    flex: none;
}

.topbar form.lookup {
    position: relative;
    flex: 0 1 var(--column);
    margin: 0 0 0 auto;
}

.topbar form.lookup .field {
    background: var(--on-ink-field);
    border-color: var(--on-ink-line);
    color: var(--on-ink-2);
}

.topbar form.lookup input {
    color: var(--on-ink);
}

.topbar form.lookup input::placeholder {
    color: var(--on-ink-3);
}

.lookup-drop {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1;
    margin-top: var(--space-1);
}

.topbar .lookup-drop .matches, .topbar .lookup-drop .match-note {
    margin: 0;
    background: var(--ink);
    border: var(--border) solid var(--on-ink-line);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-slab);
}

.topbar .lookup-drop .match-note {
    padding: var(--space-2) var(--space-3);
}

/* the home page: the slab and the example under it */
.home .offer {
    margin-top: 0;
}

.example-line {
    margin: 0 0 var(--space-3);
    font-size: var(--size-small);
    color: var(--ink-2);
}

/* the company page */
.company .identity {
    color: var(--ink-2);
}

.registers dl {
    margin: 0;
}

.registers dl > div {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-1) 0;
}

.registers dt {
    flex: none;
    width: var(--label);
    color: var(--ink-2);
    hyphens: auto;
    overflow-wrap: anywhere;
}

.registers dd {
    margin: 0;
}

.offer {
    max-width: var(--content);
    margin: var(--space-5) 0 var(--space-6);
    padding: var(--space-5);
    background: var(--ink);
    color: var(--on-ink);
    border-radius: var(--radius);
    box-shadow: var(--shadow-slab);
}

.offer h1, .offer h2 {
    margin: 0 0 var(--space-2);
    font-family: var(--font-display);
    font-size: var(--size-heading);
    font-weight: var(--weight-display);
    letter-spacing: normal;
}

.offer .lines {
    color: var(--on-ink-2);
}

.offer label {
    display: block;
    margin: var(--space-4) 0 var(--space-2);
    font-size: var(--size-micro);
    text-transform: uppercase;
    letter-spacing: var(--tracking-label);
    color: var(--on-ink-2);
}

.offer textarea, .offer input {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    background: var(--on-ink-field);
    border: var(--border) solid var(--on-ink-line);
    border-radius: var(--radius-sm);
    color: var(--on-ink);
    font: inherit;
    resize: vertical;
}

.offer textarea::placeholder, .offer input::placeholder {
    color: var(--on-ink-3);
}

.offer .buy {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
}

.offer .buy input {
    flex: 1 1 var(--label);
    width: auto;
}

.offer .aside {
    margin: var(--space-3) 0 0;
    font-size: var(--size-small);
    color: var(--on-ink-2);
}

.offer .matches, .lookup .matches {
    list-style: none;
    margin: var(--space-1) 0 0;
    padding: var(--space-1) 0;
    background: var(--on-ink-field);
    border-radius: var(--radius-sm);
}

.offer .matches li, .lookup .matches li {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: var(--space-1) var(--space-4);
    padding: var(--space-2) var(--space-3);
    cursor: pointer;
}

.offer .matches li:hover, .offer .matches li[aria-selected="true"], .lookup .matches li:hover, .lookup .matches li[aria-selected="true"] {
    background: var(--on-ink-field);
}

.offer .matches .detail, .offer .match-note, .offer .code-note, .lookup .matches .detail, .lookup .match-note {
    color: var(--on-ink-2);
}

.offer .match-note, .offer .code-note {
    margin: var(--space-2) 0 0;
}

.summary .answer {
    font-size: var(--size-lead);
}

.points {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--column), 1fr));
    gap: var(--space-1) var(--space-5);
}

.points p {
    margin: 0;
}

.points > div {
    padding: var(--space-2) 0;
    border-top: var(--border) solid var(--line);
}

.facts .group + .group {
    margin-top: var(--space-5);
}

.fact {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-1) 0;
}

.fact + .fact {
    border-top: var(--border) solid var(--canvas-2);
}

.fact .label {
    flex: none;
    width: var(--label);
    color: var(--ink-2);
    hyphens: auto;
    overflow-wrap: anywhere;
}

.fact .value {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    min-width: 0;
}

.chip {
    display: inline-block;
    padding: 0 var(--space-2);
    border: var(--border) solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--ink-2);
}

.table {
    background: var(--paper);
    border: var(--border) solid var(--line);
    border-radius: var(--radius);
}

.table .head, .table .line {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-4);
}

.sources-table .head, .sources-table .line {
    grid-template-columns: 1fr 3fr 1fr;
}

.table .head {
    color: var(--ink-2);
}

.table .line {
    border-top: var(--border) solid var(--line);
    text-decoration: none;
    color: var(--ink);
}

.table a.line:hover {
    background: var(--canvas);
}

/* the page behind the button */
.run .name {
    font-size: var(--size-lead);
}

.bar {
    appearance: none;
    display: block;
    width: 100%;
    height: var(--bar);
    margin: var(--space-5) 0 var(--space-3);
    border: 0;
    border-radius: var(--bar);
    background: var(--line);
    overflow: hidden;
}

.bar::-webkit-progress-bar {
    background: var(--line);
    border-radius: var(--bar);
}

.bar::-webkit-progress-value {
    background: var(--brand);
    border-radius: var(--bar);
}

.bar::-moz-progress-bar {
    background: var(--brand);
    border-radius: var(--bar);
}

.run .status {
    color: var(--ink-2);
}

.phases, .fields {
    list-style: none;
    margin: 0;
    padding: 0;
}

.phases > li {
    padding: var(--space-1) 0;
}

.phases > li.now {
    color: var(--brand);
}

.phases > li.waiting {
    color: var(--ink-3);
}

.phases .mark {
    display: inline-block;
    width: var(--space-5);
}

.fields {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-3);
    margin: var(--space-1) 0 var(--space-2) var(--space-5);
    color: var(--ink-2);
}

.phases > li.waiting .fields {
    color: var(--ink-3);
}

.note {
    margin: var(--space-6) 0;
    padding: var(--space-4);
    background: var(--canvas-2);
    border-radius: var(--radius-sm);
}

.note p:last-child {
    margin: 0;
}

.seller-page {
    max-width: var(--reading);
    margin-inline: auto;
    font-family: var(--font);
    background: var(--paper);
    border: var(--border) solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-slab);
    padding: var(--space-7);
}

.seller-page .kicker, .seller-page .label {
    font-size: var(--size-body);
    font-weight: var(--weight-medium);
    color: var(--ink-2);
}

.seller-page .kicker {
    margin: 0 0 var(--space-4);
}

.seller-page .head {
    padding-bottom: var(--space-5);
    border-bottom: var(--border) solid var(--ink);
}

.seller-page .head h1 {
    margin: 0 0 var(--space-1);
}

.seller-page .identity {
    margin: 0;
    color: var(--ink-2);
}

.seller-page .row {
    display: grid;
    grid-template-columns: var(--label) 1fr;
    gap: var(--space-5);
    margin-top: var(--space-6);
}

.seller-page .label {
    margin: 0;
    line-height: var(--line-height);
}

.seller-page .prose > :first-child {
    margin-top: 0;
}

.seller-page .prose > :last-child {
    margin-bottom: 0;
}

.seller-page .predictions .label {
    color: var(--brand);
}

.seller-page .predictions .prose {
    border-top: var(--border-strong) solid var(--brand);
    padding-top: var(--space-3);
}

.seller-page .predictions ol {
    padding-left: var(--space-5);
}

.seller-page .predictions li + li {
    margin-top: var(--space-3);
}

.seller-page .predictions li::marker, .seller-page .need {
    font-weight: var(--weight-strong);
}

.seller-page .lines {
    background: var(--canvas);
    border-radius: var(--radius-sm);
    padding: var(--space-4);
}

.seller-page blockquote {
    margin: 0;
    font-style: italic;
}

.seller-page blockquote + blockquote {
    margin-top: var(--space-2);
}

.seller-page .marks {
    white-space: nowrap;
    font-size: var(--size-micro);
    line-height: 0;
    vertical-align: super;
}

.seller-page .marks::before {
    content: "\2060";
}

.seller-page a.ref {
    color: var(--brand);
    text-decoration: none;
}

.seller-page a.ref.is-carded {
    text-decoration: underline dotted var(--brand);
}

html:not([data-viitteet="on"]) .seller-page .marks, .seller-page:not(.desk *) .marks {
    display: none;
}

/* the Reader: a rail at the page's right in the slab's mono, the Lähteet list under it; on a phone one line above the
   page that opens to it, the list under the page; the fact numbers in the text on <html data-viitteet="on"> */
.content.run.has-reader {
    max-width: var(--content);
}

.desk {
    display: grid;
    grid-template-columns: minmax(0, var(--reading)) var(--rail);
    grid-template-rows: auto 1fr;
    column-gap: var(--space-6);
    justify-content: center;
    align-items: start;
}

.desk .seller-page {
    grid-column: 1;
    grid-row: 1 / span 2;
    margin-inline: 0;
}

.reader {
    grid-column: 2;
    grid-row: 1;
    padding-top: var(--space-7);
    font-family: var(--mono);
    font-size: var(--size-body);
    line-height: var(--line-height);
    color: var(--ink);
}

.reader-line {
    display: none;
}

.reader ul {
    margin: 0 0 var(--space-4);
    padding: 0;
    list-style: none;
}

.reader-facts {
    margin: 0 0 var(--space-4);
    color: var(--ink-2);
}

.reader button {
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.reader .switch::before {
    content: "[ ] ";
    white-space: pre;
}

html[data-viitteet="on"] .reader .switch::before {
    content: "[x] ";
}

.reader a.action {
    color: inherit;
    text-decoration: none;
}

.reader .switch:hover, .reader .action:hover, .reader-line:hover {
    color: var(--brand);
}

.reader .action.is-off, .reader .action.is-off:hover {
    color: var(--ink-3);
}

html:not([data-viitteet]) .reader-switch, html:not([data-viitteet]) .reader button.action {
    display: none;
}

.source-list {
    grid-column: 2;
    grid-row: 2;
    padding-top: var(--space-4);
    border-top: var(--border) solid var(--ink-3);
    font-family: var(--mono);
    font-size: var(--size-small);
    line-height: var(--line-height);
    color: var(--ink);
}

.source-list .label {
    display: none;
    margin: 0 0 var(--space-4);
    font-family: var(--font);
    font-size: var(--size-body);
    font-weight: var(--weight-medium);
    color: var(--ink-2);
}

.source-list ol {
    margin: 0;
    padding: 0;
    list-style: none;
    overflow-wrap: anywhere;
}

.source-list li + li {
    margin-top: var(--space-2);
}

.source-list li::before {
    content: "[" attr(value) "] ";
    color: var(--brand);
}

.source-list li:target {
    background: var(--canvas);
}

.source-list a, .source-card a {
    color: inherit;
}

.source-card {
    position: absolute;
    z-index: 10;
    max-width: var(--card);
    padding: var(--space-3) var(--space-4);
    background: var(--paper);
    border: var(--border) solid var(--line);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    font-family: var(--font);
    font-size: var(--size-small);
    line-height: var(--line-height);
    color: var(--ink);
    overflow-wrap: anywhere;
}

.source-card-line {
    margin: 0;
}

.source-card-line + .source-card-line {
    margin-top: var(--space-2);
}

.source-card .source-card-number {
    color: var(--brand);
    margin-right: var(--space-1);
}

article h2 {
    margin-top: var(--space-5);
}

@media (max-width: 64rem) {
    .desk {
        display: block;
    }

    .reader {
        padding-top: 0;
        margin-bottom: var(--space-4);
    }

    .reader-line {
        display: block;
    }

    .reader-line .when-open, .reader[data-open] .reader-line .when-shut {
        display: none;
    }

    .reader[data-open] .reader-line .when-open {
        display: inline;
    }

    html[data-viitteet] .reader:not([data-open]) .reader-body {
        display: none;
    }

    .reader-body {
        margin-top: var(--space-3);
    }

    .source-list {
        max-width: var(--reading);
        margin: var(--space-5) auto 0;
        padding: var(--space-7);
        background: var(--paper);
        border: var(--border) solid var(--line);
        border-radius: var(--radius);
        box-shadow: var(--shadow-slab);
        font-family: var(--font);
    }

    .source-list .label {
        display: block;
    }
}

@media print {
    .reader, .source-card, html:not([data-viitteet="on"]) .source-list {
        display: none;
    }

    .desk {
        display: block;
    }
}

@media (max-width: 40rem) {
    .seller-page, .source-list {
        padding: var(--space-5);
    }

    .topbar > div {
        flex-wrap: wrap;
        gap: var(--space-3);
    }

    .topbar form.lookup {
        flex-basis: 100%;
        margin-left: 0;
    }

    .offer .buy > * {
        flex: 1 1 100%;
    }

    .seller-page .row {
        grid-template-columns: 1fr;
        gap: var(--space-2);
    }

    .fact, .registers dl > div {
        flex-direction: column;
        gap: 0;
    }

    .fact .label, .registers dt {
        width: auto;
    }

    .table .head, .table .line, .sources-table .head, .sources-table .line {
        grid-template-columns: 1fr;
    }

    .points {
        grid-template-columns: 1fr;
    }
}

/* hallinta: the private pages, the site's tokens on the ink bar and the canvas */
.hallinta-nav {
    display: flex;
    align-items: center;
    gap: var(--space-5);
}

.hallinta-nav .who {
    color: var(--on-ink-3);
    font-size: var(--size-small);
}

.content.hallinta h1 {
    margin-bottom: var(--space-5);
}

.hallinta .note {
    color: var(--ink-2);
    font-size: var(--size-small);
    max-width: var(--reading);
}

.hallinta .totals {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-4);
    margin: 0 0 var(--space-3);
}

.hallinta .totals > div, .hallinta .keys > div {
    background: var(--paper);
    border: var(--border) solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: var(--space-4);
}

.hallinta dt {
    font-size: var(--size-micro);
    letter-spacing: var(--tracking-label);
    text-transform: uppercase;
    color: var(--ink-2);
}

.hallinta dd {
    margin: var(--space-1) 0 0;
}

.hallinta .figure {
    font-family: var(--font-display);
    font-weight: var(--weight-display);
    font-size: var(--size-title);
    letter-spacing: var(--tracking-display);
}

.hallinta .keys {
    display: grid;
    gap: var(--space-4);
    margin: 0 0 var(--space-4);
}

.hallinta .key {
    overflow-wrap: anywhere;
}

.hallinta .table {
    overflow-x: auto;
    margin-top: var(--space-5);
    background: var(--paper);
    border: var(--border) solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.hallinta table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--size-small);
}

.hallinta th {
    text-align: left;
    font-weight: var(--weight-medium);
    color: var(--ink-2);
    white-space: nowrap;
    padding: var(--space-3);
    border-bottom: var(--border) solid var(--line);
}

.hallinta td {
    padding: var(--space-3);
    border-bottom: var(--border) solid var(--line);
    vertical-align: top;
}

.hallinta tbody tr:last-child td {
    border-bottom: 0;
}

.hallinta .number {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.hallinta .sub {
    display: block;
    color: var(--ink-2);
}

.hallinta .when {
    white-space: nowrap;
}

.hallinta .models span {
    display: block;
    white-space: nowrap;
    color: var(--ink-2);
}

.hallinta .failure {
    max-width: 16rem;
    color: var(--ink-2);
    overflow-wrap: anywhere;
}

.hallinta .mint {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
}

.hallinta .mint input {
    width: 6rem;
    padding: var(--space-2) var(--space-3);
    border: var(--border) solid var(--line);
    border-radius: var(--radius-sm);
    font: inherit;
}

.hallinta .mint button {
    padding: var(--space-2) var(--space-4);
    border: 0;
    border-radius: var(--radius-sm);
    background: var(--brand);
    color: var(--brand-ink);
    font: inherit;
    font-weight: var(--weight-strong);
    cursor: pointer;
}

.hallinta .mint .validation-errors {
    flex-basis: 100%;
    margin: 0;
    color: var(--brand);
}

.hallinta .minted {
    display: grid;
    gap: var(--space-2);
    margin-top: var(--space-5);
}

.hallinta .minted label {
    font-size: var(--size-micro);
    letter-spacing: var(--tracking-label);
    text-transform: uppercase;
    color: var(--ink-2);
}

.hallinta .minted textarea {
    width: 100%;
    font-family: var(--mono);
    font-size: var(--size-micro);
    padding: var(--space-3);
    border: var(--border) solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--canvas-2);
    resize: vertical;
    white-space: pre;
}

@media (max-width: 48rem) {
    .hallinta .totals {
        grid-template-columns: 1fr;
    }
}
