@font-face {
    font-family: "Archivo";
    src: url("/fonts/archivo.woff2") format("woff2");
    font-weight: 100 900;
    font-stretch: 62% 125%;
    font-display: swap;
}

@font-face {
    font-family: "Courier Prime";
    src: url("/fonts/courier-prime-400.woff2") format("woff2");
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: "Courier Prime";
    src: url("/fonts/courier-prime-700.woff2") format("woff2");
    font-weight: 700;
    font-display: swap;
}

:root {
    /* Schrank: lichtgrauer Emaillelack, Stahl im Schubladenschacht */
    --enamel: #c9cdc5;
    --enamel-hi: #d7dad3;
    --enamel-lo: #a9aea5;
    --steel: #3d4543;
    --steel-deep: #262b2a;

    /* Karten: Manila-Karton */
    --manila: #e6d193;
    --manila-lo: #d4bb74;
    --manila-edge: #b99d56;

    --ink: #1d1b16;
    --ink-2: #4a4330;
    --ink-enamel: #353a36;
    --rule: rgb(74 67 48 / 0.3);

    --red: #b3261e;
    --red-dk: #8c1c16;

    --sans: "Archivo", "Helvetica Neue", Arial, sans-serif;
    --typed: "Courier Prime", "Courier New", monospace;

    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --gutter: clamp(1rem, 4vw, 3rem);

    color-scheme: light;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scrollbar-color: var(--steel) var(--enamel-lo);
}

body {
    margin: 0;
    background: var(--enamel);
    color: var(--ink-enamel);
    font-family: var(--sans);
    font-size: 1.0625rem;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

::selection {
    background: var(--red);
    color: #fff;
}

input {
    caret-color: var(--red);
}

a {
    color: inherit;
    text-underline-offset: 0.2em;
    text-decoration-thickness: 1px;
}

a:hover {
    text-decoration-color: var(--red);
}

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

code, pre {
    font-family: var(--typed);
    font-variant-numeric: tabular-nums;
}

h1, h2, h3 {
    color: var(--ink);
    text-wrap: balance;
}

/* ---------- Schubladenschild ---------- */

.plate {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem 2rem;
    padding: 1.25rem var(--gutter);
    background: var(--enamel-hi);
    border-bottom: 1px solid var(--enamel-lo);
}

/* Einsteckkarte im Metallrahmen */
.plate-label {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.35rem 1rem 0.35rem 0.55rem;
    background: var(--manila);
    color: var(--ink);
    text-decoration: none;
    border-style: solid;
    border-color: var(--steel);
    border-width: 7px 5px;
    border-radius: 2px;
    box-shadow:
        inset 0 2px 3px rgb(0 0 0 / 0.3),
        0 1px 0 rgb(255 255 255 / 0.7);
}

.plate-label .logo {
    color: var(--red);
    width: 2.25rem;
    height: 2.25rem;
    margin: -0.25rem 0;
}

.wordmark {
    font-size: 1.35rem;
    font-weight: 400;
    font-stretch: 85%;
    letter-spacing: 0.01em;
}

.wordmark b {
    font-weight: 800;
}

.plate-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    font-stretch: 90%;
}

.plate-nav a {
    text-decoration: none;
    color: var(--ink-enamel);
    padding: 0.25rem 0;
    border-bottom: 2px solid transparent;
}

.plate-nav a:hover {
    border-bottom-color: var(--red);
}

/* ---------- Kopfbereich ---------- */

main {
    max-width: 78rem;
    margin: 0 auto;
    padding: 0 var(--gutter);
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    grid-template-areas: "text drawer" "uses drawer";
    grid-template-rows: auto 1fr;
    gap: 0 clamp(2rem, 5vw, 4.5rem);
    align-items: start;
    padding: clamp(2.5rem, 6vw, 5rem) 0 clamp(3rem, 7vw, 6rem);
}

h1 {
    margin: 0 0 1.25rem;
    font-size: clamp(2.5rem, 5.2vw, 4.4rem);
    line-height: 0.98;
    font-weight: 800;
    font-stretch: 72%;
    letter-spacing: -0.015em;
}

.lede {
    margin: 0 0 2rem;
    max-width: 34rem;
    font-size: 1.2rem;
    line-height: 1.5;
    color: var(--ink);
}

.hero-text { grid-area: text; }
.drawer { grid-area: drawer; }

.uses {
    grid-area: uses;
    list-style: none;
    margin: 0;
    padding: 0;
    max-width: 34rem;
}

.uses li {
    padding: 0.85rem 0;
    border-top: 1px solid var(--enamel-lo);
}

.uses b {
    display: block;
    color: var(--ink);
    font-weight: 700;
}

/* ---------- Schubladenschacht mit Karten ---------- */

.drawer {
    position: relative;
    padding: 1.25rem clamp(0.75rem, 2vw, 1.5rem) 1.75rem;
    background: var(--steel);
    border-radius: 6px;
    box-shadow:
        inset 0 10px 18px rgb(0 0 0 / 0.45),
        inset 0 -2px 0 rgb(255 255 255 / 0.06),
        0 1px 0 rgb(255 255 255 / 0.5);
    scroll-margin-top: 1rem;
}

/* Abgelegte Karten: nur die Oberkante mit Reiter ist sichtbar */
.filed {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.filed li {
    height: 2.1rem;
    margin-bottom: -0.35rem;
    background: var(--manila-lo);
    border-radius: 3px 3px 0 0;
    box-shadow: 0 -1px 0 var(--manila-edge), 0 -6px 10px rgb(0 0 0 / 0.25);
    position: relative;
}

.filed li:nth-child(3n + 1) .tab { margin-left: 4%; }
.filed li:nth-child(3n + 2) .tab { margin-left: 36%; }
.filed li:nth-child(3n + 3) .tab { margin-left: 68%; }

.tab {
    position: relative;
    top: -0.55rem;
    display: inline-block;
    max-width: 30%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0.2rem 0.75rem 0.35rem;
    font: 700 0.9rem/1.2 var(--typed);
    color: var(--ink);
    background: var(--manila);
    border: 0;
    border-radius: 4px 4px 0 0;
    box-shadow: 0 -1px 0 var(--manila-edge);
    cursor: pointer;
    transition: transform 0.25s var(--ease-out), background-color 0.2s;
}

.tab:hover {
    transform: translateY(-3px);
}

.tab.is-current {
    background: var(--red);
    color: #fff;
    box-shadow: none;
}

/* Vorderste Karte */
.card {
    position: relative;
    perspective: 1600px;
    margin-top: 0.1rem;
}

.card-inner {
    display: grid;
    transform-style: preserve-3d;
    transition: transform 0.7s var(--ease-out), translate 0.45s var(--ease-out);
}

.card.is-pulled .card-inner {
    translate: 0 -0.6rem;
}

.card.is-flipped .card-inner {
    transform: rotateY(180deg);
}

.face {
    grid-area: 1 / 1;
    position: relative;
    padding: 1.1rem clamp(1rem, 3vw, 2rem) 2.4rem;
    background-color: var(--manila);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .3 0 0 0 0 .15 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E");
    color: var(--ink);
    border-radius: 4px;
    box-shadow:
        0 -1px 0 var(--manila-edge),
        0 2px 3px rgb(0 0 0 / 0.25),
        0 14px 28px -8px rgb(0 0 0 / 0.45);
    backface-visibility: hidden;
    transition: box-shadow 0.45s var(--ease-out);
}

.card.is-pulled .face {
    box-shadow:
        0 -1px 0 var(--manila-edge),
        0 4px 6px rgb(0 0 0 / 0.25),
        0 26px 40px -10px rgb(0 0 0 / 0.55);
}

/* Lochung für die Karteistange */
.face::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 0.9rem;
    width: 1rem;
    height: 1rem;
    margin-left: -0.5rem;
    border-radius: 50%;
    background: var(--steel-deep);
    box-shadow: inset 0 2px 3px rgb(0 0 0 / 0.6), 0 1px 0 rgb(255 255 255 / 0.35);
}

.face-back {
    position: absolute;
    inset: 0;
    overflow: hidden;
    transform: rotateY(180deg);
}

/* Die sichtbare Seite bestimmt die Kartenhöhe */
.card.is-flipped .face-back {
    position: relative;
}

.card.is-flipped .face-front {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.card-head {
    margin: 0 0 1rem;
    padding-bottom: 0.45rem;
    font-size: 0.85rem;
    font-weight: 700;
    font-stretch: 90%;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--red-dk);
    border-bottom: 2px solid var(--red);
}

/* Formularzeilen als liniierte Karte */
.lookup {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0 1.5rem;
    align-items: end;
}

.field {
    display: grid;
    grid-template-columns: 5.5rem minmax(0, 1fr);
    align-items: baseline;
    border-bottom: 1px solid var(--rule);
    padding-top: 0.35rem;
}

.field-name {
    grid-column: 1 / -1;
}

.field label {
    font-size: 0.95rem;
    font-weight: 600;
    font-stretch: 90%;
    color: var(--ink-2);
}

.field input {
    width: 100%;
    min-width: 0;
    padding: 0.35rem 0;
    font: 400 clamp(1.4rem, 2.6vw, 1.9rem)/1.2 var(--typed);
    color: var(--ink);
    background: transparent;
    border: 0;
    border-radius: 0;
}

.field input::placeholder {
    color: rgb(74 67 48 / 0.86);
}

.field input:focus {
    outline: none;
}

.field:focus-within {
    border-bottom-color: var(--red);
    box-shadow: 0 1px 0 var(--red);
}

.field-culture {
    grid-template-columns: 5.5rem 3.2rem minmax(0, 1fr);
}

.field-culture input {
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.field-culture output {
    font: 400 1rem/1.3 var(--typed);
    color: var(--ink-2);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.field-culture output.is-unknown {
    color: var(--red-dk);
}

.pull, .copy, .flip, .mail {
    font-family: var(--sans);
    font-weight: 700;
    font-stretch: 90%;
    cursor: pointer;
}

.pull {
    margin-top: 0.75rem;
    padding: 0.75rem 1.4rem;
    font-size: 1.05rem;
    color: #fff;
    background: var(--red);
    border: 0;
    border-radius: 3px;
    box-shadow: 0 1px 0 var(--red-dk), 0 3px 8px -2px rgb(80 10 5 / 0.45);
    transition: background-color 0.2s, transform 0.2s var(--ease-out);
}

.pull:hover {
    background: var(--red-dk);
}

.pull:active {
    transform: translateY(1px);
}

.pull:disabled {
    cursor: progress;
    background: var(--red-dk);
    opacity: 0.8;
}

/* Getipptes Ergebnis */
.result:empty {
    display: none;
}

.result {
    margin-top: 1.5rem;
    font-family: var(--typed);
    font-size: 1.05rem;
}

.result p {
    margin: 0;
    display: grid;
    grid-template-columns: 7rem minmax(0, 1fr);
    gap: 0 0.75rem;
    align-items: center;
    min-height: 2.2rem;
    padding: 0.2rem 0;
    border-bottom: 1px solid var(--rule);
    animation: type 0.5s steps(22, end) both;
    animation-delay: calc(var(--i, 0) * 140ms);
}

.result p > span:first-child {
    font-family: var(--sans);
    font-size: 0.95rem;
    font-weight: 600;
    font-stretch: 90%;
    color: var(--ink-2);
}

.result .value {
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.result .is-lead {
    font-weight: 700;
}

.result .verdict {
    font-weight: 700;
    font-size: 1.15rem;
}

.result .pending, .result .error {
    grid-template-columns: minmax(0, 1fr);
}

.result .error {
    color: var(--red-dk);
    font-weight: 700;
}

.result .pending::after {
    content: "";
    display: inline-block;
    width: 0.6em;
    height: 1.1em;
    margin-left: 0.25em;
    vertical-align: -0.15em;
    background: var(--ink);
    animation: caret 0.9s steps(1) infinite;
}

.scale-row {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
}

.scale {
    display: inline-grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 3px;
    width: clamp(8rem, 22vw, 13rem);
}

.scale i {
    aspect-ratio: 1;
    border: 1.5px solid var(--ink);
    border-radius: 1px;
}

.scale i.on {
    background: var(--ink);
}

@keyframes type {
    from { clip-path: inset(0 100% 0 0); }
    to { clip-path: inset(0 0 0 0); }
}

@keyframes caret {
    50% { opacity: 0; }
}

/* Rückseite */
.back-label {
    margin: 0 0 0.35rem;
    font-size: 0.95rem;
    font-weight: 600;
    font-stretch: 90%;
    color: var(--ink-2);
}

.request {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--rule);
}

.request code {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 1rem;
}

.copy {
    flex: none;
    padding: 0.35rem 0.8rem;
    font-size: 0.9rem;
    color: var(--ink);
    background: transparent;
    border: 1.5px solid var(--ink);
    border-radius: 3px;
}

.copy:hover {
    background: var(--ink);
    color: var(--manila);
}

.json {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.35;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.flip {
    position: absolute;
    right: clamp(1rem, 3vw, 2rem);
    bottom: 0.7rem;
    z-index: 2;
    padding: 0.2rem 0;
    font-size: 0.9rem;
    color: var(--red-dk);
    background: none;
    border: 0;
    border-bottom: 1.5px solid currentColor;
}

.card.is-pulled .flip {
    translate: 0 -0.6rem;
}

/* ---------- Folgeabschnitte ---------- */

.section {
    padding: clamp(2.5rem, 6vw, 4.5rem) 0;
    border-top: 1px solid var(--enamel-lo);
    scroll-margin-top: 1rem;
}

.section h2 {
    display: inline-block;
    margin: 0 0 0 clamp(0.75rem, 3vw, 2.25rem);
    padding: 0.5rem 1.1rem 0.3rem;
    background: var(--manila);
    border-radius: 5px 5px 0 0;
    box-shadow: 0 -1px 0 var(--manila-edge);
    font-size: clamp(1.6rem, 3vw, 2.3rem);
    line-height: 1.05;
    font-weight: 800;
    font-stretch: 72%;
    letter-spacing: -0.01em;
}

.sheet {
    position: relative;
    padding: clamp(1.25rem, 3vw, 2.25rem);
    background-color: var(--manila);
    color: var(--ink);
    border-radius: 4px;
    box-shadow: 0 -1px 0 var(--manila-edge), 0 2px 3px rgb(0 0 0 / 0.18), 0 16px 32px -14px rgb(0 0 0 / 0.35);
}

.slip {
    list-style: none;
    margin: 0 0 1.5rem;
    padding: 0;
}

.slip li {
    display: grid;
    grid-template-columns: 7rem minmax(0, 1fr);
    gap: 0.25rem 1.25rem;
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--rule);
}

.slip-key {
    font-family: var(--typed);
    font-weight: 700;
    font-size: 1.1rem;
}

.slip code, .params code, .api-note code, .api-block h3 code {
    font-size: 0.95em;
}

.sheet-note {
    margin: 0;
    max-width: 62ch;
    color: var(--ink-2);
}

.sheet-api {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: clamp(1.5rem, 4vw, 3.5rem);
}

.api-block h3 {
    margin: 0 0 0.6rem;
    font-size: 0.95rem;
    font-weight: 700;
    font-stretch: 90%;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--red-dk);
}

.api-block h3 code {
    text-transform: none;
    letter-spacing: 0;
}

.api-block h3:not(:first-child) {
    margin-top: 2rem;
}

.endpoint {
    margin: 0;
    padding: 0.75rem 0;
    font-size: 1rem;
    line-height: 1.7;
    white-space: pre-wrap;
    overflow-x: auto;
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
}

.params {
    width: 100%;
    border-collapse: collapse;
}

.params th, .params td {
    padding: 0.6rem 0;
    text-align: left;
    vertical-align: baseline;
    border-bottom: 1px solid var(--rule);
}

.params th {
    width: 6.5rem;
    padding-right: 1rem;
    font-weight: 700;
}

.sheet-api .json {
    padding: 1rem 0;
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
}

.api-note {
    margin: 1rem 0 0;
    color: var(--ink-2);
}

.sheet-access {
    max-width: 48rem;
}

.sheet-access p {
    margin: 0 0 1rem;
    max-width: 62ch;
}

.mail {
    display: inline-block;
    margin-top: 0.5rem;
    padding: 0.7rem 1.3rem;
    font-size: 1.05rem;
    color: #fff;
    text-decoration: none;
    background: var(--red);
    border-radius: 3px;
}

.mail:hover {
    background: var(--red-dk);
}

.site-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem 2rem;
    max-width: 78rem;
    margin: 0 auto;
    padding: 2rem var(--gutter) 3rem;
    font-size: 0.95rem;
    border-top: 1px solid var(--enamel-lo);
}

.site-footer p {
    margin: 0;
}

/* ---------- Schmale Bildschirme ---------- */

@media (max-width: 60rem) {
    .hero {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas: "text" "drawer" "uses";
        grid-template-rows: auto;
    }

    .uses {
        margin-top: 2.5rem;
    }

    .sheet-api {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 34rem) {
    .plate-nav {
        gap: 0.25rem 1rem;
        font-size: 0.9rem;
    }

    .lookup {
        grid-template-columns: minmax(0, 1fr);
    }

    .pull {
        width: 100%;
    }

    .field, .field-culture {
        grid-template-columns: 4.5rem minmax(0, 1fr);
    }

    .field-culture output {
        grid-column: 2;
        padding-bottom: 0.35rem;
    }

    .result p, .slip li {
        grid-template-columns: minmax(0, 1fr);
    }

    .result p > span:first-child {
        font-size: 0.85rem;
    }

    .tab {
        max-width: 46%;
        font-size: 0.8rem;
    }

    .filed li:nth-child(3n + 2) .tab { margin-left: 28%; }
    .filed li:nth-child(3n + 3) .tab { margin-left: 52%; }
}

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

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

.nowrap {
    white-space: nowrap;
}
