/* Romie, same typeface as qaree.bi */
@font-face {
    font-family: "r-regular";
    src: url("fonts/romie-regular.otf") format("opentype");
    font-display: swap;
}
@font-face {
    font-family: "r-medium";
    src: url("fonts/romie-medium.otf") format("opentype");
    font-display: swap;
}
@font-face {
    font-family: "r-black";
    src: url("fonts/romie-black.otf") format("opentype");
    font-display: block;
}

:root {
    --red-dark: rgb(50, 0, 0);
    --red: rgb(200, 0, 0);
    --led: #ff2a1a;
    --text: #ffffff;
    --text-dim: rgba(255, 255, 255, 0.7);
    --rule: rgba(255, 255, 255, 0.22);
    --card: rgba(14, 0, 0, 0.55);
    --card-edge: rgba(255, 255, 255, 0.1);
    --card-edge-hover: rgba(255, 255, 255, 0.35);
    --inset: rgba(0, 0, 0, 0.35);
    --radius: 18px;
    --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    --sans: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
    color: var(--text);
    font-family: "r-medium", var(--sans);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: var(--red-dark);
    background-image: linear-gradient(107deg, var(--red-dark) 0%, var(--red) 60%);
    background-size: 400% 400%;
    background-attachment: fixed;
    animation: gradient 60s ease-in-out infinite;
}

@keyframes gradient {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* film grain over everything */
.grain {
    position: fixed;
    inset: 0;
    z-index: 50;
    pointer-events: none;
    opacity: 0.12;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

a {
    color: var(--text);
    transition: color 0.25s;
}
a:hover,
a:focus-visible {
    color: #000;
}

/* Romie has no usable @ glyph */
.at {
    font-family: var(--sans);
    font-weight: 600;
}

.page {
    flex: 1 0 auto;
    width: 100%;
    max-width: 68rem;
    margin: 0 auto;
    padding: 3.5rem 16px 2rem;
}

.eyebrow,
.kind,
.readout,
.section-title span,
.specs li {
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-dim);
}

/* hero */

.hero {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    align-items: center;
    gap: 3rem;
}

.eyebrow {
    margin: 0 0 1rem;
}

.wordmark {
    margin: 0;
    font-family: "r-black";
    font-size: clamp(3rem, 8.5vw, 6.25rem);
    line-height: 0.88;
    letter-spacing: -0.02em;
    text-shadow: 0 6px 30px rgba(0, 0, 0, 0.25);
}

.tagline {
    margin: 1.25em 0 0;
    max-width: 30em;
    font-family: "r-regular";
    font-size: 1.1rem;
    line-height: 1.5;
}

.cta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.75rem;
}

.pill {
    display: inline-block;
    padding: 0.6em 1.15em;
    border-radius: 999px;
    background: #000;
    border: 1px solid #000;
    font-family: "r-black";
    text-decoration: none;
    transition: background 0.25s, color 0.25s, transform 0.25s;
}
.pill:hover,
.pill:focus-visible {
    background: #fff;
    color: #000;
    transform: translateY(-2px);
}
.pill.ghost {
    background: transparent;
    border-color: var(--text);
}

/* faceplate */

.faceplate {
    margin: 0;
    justify-self: center;
    width: min(100%, 25rem);
    padding: 1.6rem;
    border-radius: var(--radius);
    background: linear-gradient(160deg, #1d1d1d, #060606);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 30px 60px rgba(0, 0, 0, 0.45),
        0 10px 20px rgba(0, 0, 0, 0.3);
}

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

.knob {
    --a: 0deg;
    position: relative;
    aspect-ratio: 1;
    border-radius: 50%;
    cursor: grab;
    touch-action: none;
    background: radial-gradient(circle at 35% 30%, #3c3c3c, #0d0d0d 70%);
    box-shadow:
        0 6px 10px rgba(0, 0, 0, 0.6),
        inset 0 -2px 3px rgba(0, 0, 0, 0.8),
        inset 0 1px 1px rgba(255, 255, 255, 0.15);
    transform: rotate(var(--a));
}
.knob.grabbed {
    cursor: grabbing;
}
.knob:focus-visible {
    outline: 2px solid var(--led);
    outline-offset: 3px;
}
/* pointer line */
.knob::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 10%;
    width: 3px;
    height: 32%;
    margin-left: -1.5px;
    border-radius: 2px;
    background: #e8e8e8;
}
.knob.grabbed::after {
    background: var(--led);
}

.controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.leds {
    display: flex;
    gap: 0.5rem;
}
.led {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #3a0805;
    transition: background 0.15s, box-shadow 0.15s;
}
.led.on {
    background: var(--led);
    box-shadow: 0 0 6px var(--led), 0 0 14px rgba(255, 42, 26, 0.6);
}

.btn {
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    background: radial-gradient(circle at 40% 35%, #2e2e2e, #070707 75%);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6), inset 0 1px 1px rgba(255, 255, 255, 0.15);
    transition: transform 0.08s;
}
.btn:active {
    transform: scale(0.92);
}
.btn:focus-visible {
    outline: 2px solid var(--led);
    outline-offset: 3px;
}

.readout {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1rem;
    color: rgba(255, 255, 255, 0.5);
}
.hint {
    color: rgba(255, 255, 255, 0.3);
}

/* sections */

section {
    margin-top: 5rem;
}

.section-title {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    margin: 0 0 1.5rem;
    font-family: "r-black";
    font-size: clamp(2rem, 5vw, 3rem);
}

/* cards */

.card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: var(--radius);
    background: var(--card);
    border: 1px solid var(--card-edge);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), border-color 0.3s;
}
.card:hover {
    transform: translateY(-4px);
    border-color: var(--card-edge-hover);
}

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

.card-media {
    display: block;
    aspect-ratio: 4 / 5;
    overflow: hidden;
}

/* square render shown whole, padded with its own backdrop colour */
.photo {
    display: flex;
    align-items: center;
    background: #ddd8dc;
}
.photo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.card:hover .photo img {
    transform: scale(1.05);
}

/* eurorack panels, drawn by script.js from the panel DXF */
.panel {
    position: relative;
    background: radial-gradient(ellipse at 50% 40%, #f1eff0, #d9d6d7);
}
.panel svg {
    position: absolute;
    top: 5%;
    left: 50%;
    height: 90%;
    width: auto;
    aspect-ratio: 50.95 / 128.65;
    transform: translateX(-50%);
    filter: drop-shadow(0 14px 18px rgba(0, 0, 0, 0.35));
}
.panel .print {
    fill: #ececec;
    font-family: var(--mono);
    font-weight: 300;
}
.panel .print.bold {
    font-weight: 800;
}
.panel .pknob {
    cursor: grab;
    touch-action: none;
}
.panel .pknob:active {
    cursor: grabbing;
}
.panel .led-lit {
    animation: tempo 0.9s steps(1) infinite;
}
@keyframes tempo {
    0%,
    30% {
        fill: var(--led);
    }
    31%,
    100% {
        fill: #3a0805;
    }
}

.card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 1.4rem 1.4rem 1.5rem;
}

.kind {
    margin: 0;
}

.card h3 {
    margin: 0.3rem 0 0;
    font-family: "r-black";
    font-size: 1.9rem;
    line-height: 1;
}

.card-body > p:not(.kind) {
    margin: 0.85rem 0 0;
    font-family: "r-regular";
    font-size: 0.95rem;
    line-height: 1.5;
}

.specs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin: 1.25rem 0;
    padding: 0;
    list-style: none;
}
.specs li {
    padding: 0.55rem 0.4rem;
    border-radius: 10px;
    line-height: 1.35;
    background: var(--inset);
    text-align: center;
    font-size: 0.62rem;
}
.specs b {
    display: block;
    font-family: "r-black";
    font-size: 1.25rem;
    letter-spacing: 0;
    text-transform: none;
    color: var(--text);
}

/* pushed to the bottom so links line up across cards */
.device-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: auto;
}
.device-links a {
    padding: 0.35em 0.85em;
    border-radius: 999px;
    border: 1px solid var(--rule);
    font-size: 0.9rem;
    text-decoration: none;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.device-links a:hover,
.device-links a:focus-visible {
    background: #fff;
    border-color: #fff;
    color: #000;
}

/* workshops */

.workshop {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    padding: 1.75rem;
}
.workshop p {
    margin: 0;
    max-width: 34em;
    font-family: "r-regular";
    font-size: 1.1rem;
    line-height: 1.5;
}

/* workshops page */

.crumbs {
    display: flex;
    gap: 0.6rem;
    margin-bottom: 2.5rem;
    font-family: var(--mono);
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-dim);
}
.crumbs a {
    text-decoration: none;
}

.page-head .tagline {
    max-width: 34em;
}

.workshop .cta {
    margin-top: 0;
}

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

.resource {
    text-decoration: none;
}
.resource:hover,
.resource:focus-visible {
    color: var(--text);
}
.resource h3 {
    font-size: clamp(1.6rem, 3vw, 2.1rem);
}

/* drawn covers: a page, a sheet or a slide, on the same black as the panels */
.cover {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 16 / 7;
    background: linear-gradient(160deg, #1d1d1d, #060606);
    overflow: hidden;
}
.doc,
.sheet,
.slides {
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.resource:hover .doc,
.resource:hover .sheet,
.resource:hover .slides {
    transform: translateY(-6px) rotate(-2deg);
}

.doc {
    display: flex;
    flex-direction: column;
    gap: 7px;
    width: 34%;
    padding: 16px 16px 22px;
    border-radius: 4px;
    background: #f1eff0;
    box-shadow: 0 14px 24px rgba(0, 0, 0, 0.5);
}
.doc i {
    height: 5px;
    border-radius: 3px;
    background: #bdb8bb;
}
.doc i.h {
    width: 60%;
    height: 8px;
    margin-top: 4px;
    background: var(--red);
}
.doc i.short {
    width: 70%;
}

.sheet {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 3px;
    width: 46%;
    padding: 5px;
    border-radius: 4px;
    background: #bdb8bb;
    box-shadow: 0 14px 24px rgba(0, 0, 0, 0.5);
}
.sheet i {
    height: 14px;
    background: #f1eff0;
}
.sheet i:nth-child(-n + 4) {
    background: var(--red);
}
.sheet i:nth-child(4n + 1) {
    width: 100%;
}

.slides {
    width: 52%;
    aspect-ratio: 16 / 9;
    padding: 10%;
    border-radius: 4px;
    background: #f1eff0;
    box-shadow: 0 14px 24px rgba(0, 0, 0, 0.5);
}
.slides svg {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
}
.slides path {
    fill: none;
    stroke: var(--red);
    stroke-width: 6;
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;
}

.open {
    align-self: flex-start;
    margin-top: auto;
    padding: 0.35em 0.85em;
    border-radius: 999px;
    border: 1px solid var(--rule);
    font-size: 0.9rem;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.open::after {
    content: " →";
    font-family: var(--sans);
}
.resource .card-body > p:not(.kind) {
    margin-bottom: 1.25rem;
}
.resource:hover .open,
.resource:focus-visible .open {
    background: #fff;
    border-color: #fff;
    color: #000;
}

/* midi-64 build page */

.build-hero {
    grid-template-columns: 1.2fr 1fr;
}
.build-photo {
    justify-self: center;
    width: min(100%, 24rem);
}
.build-photo .card-media {
    aspect-ratio: 1;
}

.bom {
    padding: 0.5rem 0;
}
.bom-row {
    display: grid;
    grid-template-columns: 3.5rem minmax(0, 1fr) 8rem 11rem;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--card-edge);
}
.bom-row:first-child {
    border-top: 0;
}
.bom-head {
    padding-block: 0.5rem;
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-dim);
}
.qty {
    font-family: "r-black";
    font-size: 1.4rem;
}
.part b {
    display: block;
    font-family: "r-black";
    font-weight: normal;
    font-size: 1.1rem;
}
.part span {
    display: block;
    margin-top: 0.2rem;
    font-family: "r-regular";
    font-size: 0.9rem;
    color: var(--text-dim);
}
.price {
    font-family: "r-black";
    text-align: right;
}
.price small {
    display: block;
    font-family: var(--mono);
    font-size: 0.7rem;
    color: var(--text-dim);
}
.price.muted {
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--text-dim);
}
.buy {
    justify-self: end;
    white-space: nowrap;
    padding: 0.35em 0.85em;
    border-radius: 999px;
    border: 1px solid var(--rule);
    font-size: 0.9rem;
    text-decoration: none;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.buy::after {
    content: " ↗";
    font-family: var(--sans);
    font-size: 0.8em;
}
.buy:hover,
.buy:focus-visible {
    background: #fff;
    border-color: #fff;
    color: #000;
}
.bom-subtotal .price {
    font-size: 1.15rem;
}
.bom-group {
    padding-block: 1.5rem 0.25rem;
    font-family: "r-black";
    font-size: 1.4rem;
}
.buys {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.4rem;
}
.bom-total {
    background: var(--inset);
}
.bom-total .price {
    font-size: 1.4rem;
}

.note {
    margin: 1rem 0 0;
    max-width: 40em;
    font-family: "r-regular";
    line-height: 1.5;
    color: var(--text-dim);
}

.wiring {
    padding: 0.5rem 1.5rem;
    overflow-x: auto;
}
.wiring table {
    width: 100%;
    border-collapse: collapse;
    font-family: "r-regular";
}
.wiring th {
    padding: 0.75rem 0;
    text-align: left;
    font-family: var(--mono);
    font-weight: normal;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-dim);
}
.wiring td {
    padding: 0.8rem 1rem 0.8rem 0;
    border-top: 1px solid var(--card-edge);
    vertical-align: top;
}
.wiring td:first-child {
    font-family: "r-black";
    white-space: nowrap;
}

code {
    font-family: var(--mono);
    font-size: 0.9em;
}

/* link cards */

.elsewhere {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-top: 5rem;
}
.link-card {
    gap: 0.4rem;
    padding: 1.25rem 1.4rem;
    text-decoration: none;
}
.link-card:hover,
.link-card:focus-visible {
    color: var(--text);
    background: rgba(0, 0, 0, 0.7);
}
.link-title {
    font-family: "r-black";
    font-size: 1.2rem;
    overflow-wrap: anywhere;
}

/* footer, matches qaree.bi */

.footer {
    flex-shrink: 0;
    padding: 1.5em 16px 10px;
    text-align: center;
    font-size: 0.7rem;
    background: linear-gradient(0deg, var(--red-dark) 0%, rgba(0, 0, 0, 0) 80%);
}

/* responsive */

@media (max-width: 960px) {
    .cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .elsewhere {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .page {
        padding-top: 2.5rem;
    }
    .hero,
    .cards,
    .resources {
        grid-template-columns: minmax(0, 1fr);
    }
    .bom-row {
        grid-template-columns: 2.75rem minmax(0, 1fr) auto;
        gap: 0.4rem 0.75rem;
        padding: 1rem;
    }
    .bom-row .buy,
    .bom-row .buys {
        grid-column: 2;
        justify-self: start;
    }
    .buys {
        justify-content: flex-start;
    }
    .bom-group span:nth-child(2) {
        grid-column: 1 / -1;
    }
    .bom-head {
        display: none;
    }
    .wiring {
        padding-inline: 1rem;
    }
    .wiring td:first-child {
        white-space: normal;
    }
    .photo {
        aspect-ratio: 1;
    }
    .hero {
        gap: 2.5rem;
    }
    .faceplate {
        width: min(100%, 22rem);
        padding: 1.25rem;
    }
    .knobs {
        gap: 0.75rem;
    }
    section,
    .elsewhere {
        margin-top: 3.5rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    body {
        animation: none;
    }
    .card,
    .photo img,
    .doc,
    .sheet,
    .slides,
    .pill,
    .panel .led-lit {
        transition: none;
        animation: none;
    }
    .card:hover {
        transform: none;
    }
}
