/* ═══════════════════════════════════════════════════════
    simpleTapeStop — page theme
    The plugin's own palette (art/simpletapestop/pixel.lua): cream, ink and
    orange, with the browns of the tape. The hero sits on a tape-brown stage
    in both themes; the rest of the page is cream paper, or dark brown in
    dark mode. Where the hero's pieces sit is /product-hero.css.
    ═══════════════════════════════════════════════════════ */

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

:root {
    color-scheme: light dark;

    --font-display: "Archivo", "Arial Black", sans-serif;
    --font-body: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;

    /* The plugin's colours. */
    --ink: #292432;
    --cream: #fff4d8;
    --cream-dark: #c9b48c;
    --accent: #e8704a;
    --accent-light: #f7a483;
    --accent-dark: #b0502d;

    /* The page. */
    --bg: #f4ead2;
    --panel: #fffaee;
    --text: #292432;
    --muted: #5c5260;
    --line: #292432;
    --shadow: #292432;
    --rule: rgba(41, 36, 50, 0.16);
    --link: #a8401f;
    --counter-shadow: #c9b48c;

    /* The hero's stage, the same in both themes. */
    --stage: #33231f;
    --stage-raised: #4a332b;
    --stage-text: #fff4d8;
    --stage-muted: #dcc9aa;
    --stage-dots: rgba(255, 244, 216, 0.07);
    --stage-shadow: #1c1210;

    --max-w: 1080px;
    --radius: 12px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #1c1412;
        --panel: #2a1e1a;
        --text: #f3e6c8;
        --muted: #c4ae92;
        --line: #4f3a31;
        --shadow: #0d0907;
        --rule: rgba(255, 244, 216, 0.14);
        --link: #f7a483;
        --counter-shadow: #0d0907;
        --stage: #2e201c;
    }
}

/* ── Base ── */
*, *::before, *::after { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 17px/1.6 var(--font-body);
    overflow-x: clip;
}

main { padding-bottom: 104px; }

h1, h2, h3 {
    margin: 0;
    font-family: var(--font-display);
    font-stretch: 115%;
    letter-spacing: -0.015em;
    text-wrap: balance;
}

p { text-wrap: pretty; }

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

/* ── Buttons: the deck's keys, sitting up on their shadow and pressing flat into it ── */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 13px 20px 12px;
    border: 2px solid var(--ink);
    border-radius: 10px;
    background: var(--cream);
    color: var(--ink);
    font: 700 1rem/1.2 var(--font-body);
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    box-shadow: 0 4px 0 var(--ink);
    transition: transform 0.08s ease, box-shadow 0.08s ease, background-color 0.15s ease;
}

.button:hover { background: #fffaf0; }

.button:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 var(--ink);
}

.button-primary { background: var(--accent); }
.button-primary:hover { background: var(--accent-light); }

.button:focus-visible {
    outline: 3px solid var(--accent-light);
    outline-offset: 3px;
}

.btn-icon {
    flex: none;
    width: 14px;
    height: 14px;
}

/* ── The stage ── */
.tape-stage {
    background:
        radial-gradient(circle, var(--stage-dots) 1px, transparent 1.6px) 0 0 / 16px 16px,
        radial-gradient(55% 75% at 76% 48%, rgba(232, 112, 74, 0.2), transparent 72%),
        var(--stage);
    color: var(--stage-text);
}

/* The wordmark at three times its pixels (two on phones), held to the shared logo slot. */
.tape-wordmark {
    display: block;
    width: auto;
    height: 48px;
    margin-block: -2px;
}

.tape-label {
    padding-right: 11px;
    overflow: hidden;
    border: 2px solid var(--ink);
    border-radius: 7px;
    background: var(--cream);
    color: var(--ink);
    font: 700 0.72rem/1 var(--font-display);
    font-stretch: 125%;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    box-shadow: 0 3px 0 var(--stage-shadow);
}

.tape-label-free {
    display: flex;
    align-items: center;
    align-self: stretch;
    margin-right: 10px;
    padding: 0 9px;
    border-right: 2px solid var(--ink);
    background: var(--accent);
}

.tape-stage .product-hero__title {
    font-size: clamp(2.4rem, 1.4rem + 3.2vw, 3.6rem);
    font-weight: 800;
    line-height: 1.02;
}

.tape-stage .product-hero__text {
    color: var(--stage-muted);
    font-size: 1.06rem;
}

.tape-stage .product-hero__text strong { color: var(--stage-text); }

.hero-note {
    color: var(--stage-muted);
    font-size: 0.85rem;
    line-height: 1.5;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 14px;
}

/* Other downloads, opening under its toggle. */
.other-downloads { position: relative; }
.other-downloads > summary { list-style: none; }
.other-downloads > summary::-webkit-details-marker { display: none; }

.other-downloads-chevron {
    width: 12px;
    height: 8px;
    transition: transform 0.15s ease;
}

.other-downloads[open] .other-downloads-chevron { transform: rotate(180deg); }

.tape-stage .other-downloads-toggle {
    border-color: rgba(255, 244, 216, 0.55);
    background: transparent;
    color: var(--stage-text);
    box-shadow: none;
}

.tape-stage .other-downloads-toggle:hover { background: rgba(255, 244, 216, 0.08); }
.tape-stage .other-downloads-toggle:active { transform: none; }

.other-downloads-panel {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    z-index: 5;
    min-width: 100%;
}

.other-downloads.is-fallback .other-downloads-panel {
    position: static;
    margin-top: 10px;
}

.other-downloads-menu {
    display: grid;
    gap: 12px;
    padding: 12px 12px 14px;
    border: 2px solid var(--ink);
    border-radius: var(--radius);
    background: var(--stage-raised);
    box-shadow: 0 6px 0 var(--stage-shadow);
}

.other-downloads-menu .button {
    width: 100%;
    justify-content: flex-start;
}

.platform-download {
    display: grid;
    gap: 6px;
}

.linux-vst3-alt {
    padding-left: 4px;
    color: var(--muted);
    font-size: 0.85rem;
}

.tape-stage .linux-vst3-alt { color: var(--stage-muted); }

/* ── The deck: the plugin's window, with real buttons and sliders over the art ── */
.deck { margin: 0; }

.deck-window {
    position: relative;
    aspect-ratio: 320 / 200;
    border-radius: 10px;
    /* Shown until deck.js has drawn the canvas, and without JavaScript. */
    background: url("./assets/deck-still.png") 0 0 / 100% 100% no-repeat;
    image-rendering: pixelated;
    box-shadow:
        0 0 0 3px var(--ink),
        0 9px 0 3px var(--stage-shadow),
        0 34px 60px -24px rgba(0, 0, 0, 0.65);
}

.deck-window canvas {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    /* deck.js draws it at a whole multiple of the art and lets the browser scale it down
       smoothly, so every art pixel comes out the same width. */
    image-rendering: auto;
}

.deck-control {
    position: absolute;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.deck-control[role="slider"] {
    cursor: ns-resize;
    touch-action: none;
}

.deck-control:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 1px;
}

/* Until the first press, a ring round the key says where to start. */
.deck.is-ready:not(.is-started) .deck-key::after {
    content: "";
    position: absolute;
    inset: -6px;
    border: 3px solid var(--accent);
    border-radius: 9px;
    pointer-events: none;
    animation: deck-hint 1.6s ease-in-out infinite;
}

@keyframes deck-hint {
    0%, 100% { opacity: 0.15; transform: scale(0.97); }
    50% { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .deck.is-ready:not(.is-started) .deck-key::after { animation: none; opacity: 1; }
}

.deck-caption {
    margin-top: 22px;
    color: var(--stage-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

.deck-caption strong { color: var(--accent-light); }
.deck-caption-playing,
.deck-caption-silent { display: none; }
.deck.is-started .deck-caption-sound { display: none; }
.deck.is-started .deck-caption-playing { display: inline; }
.deck.is-silent .deck-caption-playing { display: none; }
.deck.is-silent .deck-caption-silent { display: inline; }

/* ── A length of tape across the page; deck.js runs it at the deck's speed ── */
.tape-strip {
    --tape-pixel: 3px;
    height: calc(12 * var(--tape-pixel));
    background: url("./assets/strip.png") 0 0 / calc(64 * var(--tape-pixel)) 100% repeat-x;
    image-rendering: pixelated;
}

.tape-section + .tape-strip { margin-top: 92px; }

/* ── Sections ── */
.tape-section,
.tape-download {
    width: min(calc(100% - 32px), var(--max-w));
    margin: 0 auto;
    padding-top: 92px;
}

.section-head {
    max-width: 640px;
    margin-bottom: 36px;
}

.section-head h2 {
    font-size: clamp(1.9rem, 1.2rem + 2.4vw, 2.8rem);
    font-weight: 800;
    line-height: 1.05;
}

.section-head p:not(.side-label) {
    margin: 14px 0 0;
    color: var(--muted);
}

/* A cassette's side, with the Stop key's orange square. */
.side-label {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0 0 14px;
    color: var(--muted);
    font: 700 0.75rem/1 var(--font-display);
    font-stretch: 125%;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.side-label::before {
    content: "";
    width: 10px;
    height: 10px;
    background: var(--accent);
    box-shadow: 0 0 0 2px var(--ink);
}

.step h3,
.faq-card h3 {
    font-size: 1.15rem;
    font-weight: 750;
    line-height: 1.25;
}

.step p,
.faq-card p {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 0.97rem;
    line-height: 1.55;
}

/* Side A: steps, numbered on the tape counter. */
.steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 28px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.step-counter {
    display: block;
    width: 75px;
    height: 36px;
    background: url("./assets/counter.png") calc(var(--frame) * -75px) 0 / 225px 36px no-repeat;
    image-rendering: pixelated;
    filter: drop-shadow(3px 3px 0 var(--counter-shadow));
}

.step h3 { margin-top: 20px; }

/* Download, beside the cassette. */
.download-inner {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 48px;
    padding: 40px;
    border: 2px solid var(--line);
    border-radius: 16px;
    background: var(--panel);
    box-shadow: 0 5px 0 var(--shadow);
}

.cassette {
    --px: 3px;
    position: relative;
    width: calc(120 * var(--px));
    height: calc(76 * var(--px));
    background: url("./assets/cassette.png") 0 0 / 100% 100% no-repeat;
    image-rendering: pixelated;
    filter: drop-shadow(var(--px) var(--px) 0 var(--counter-shadow));
}

.cassette-hub {
    position: absolute;
    top: calc(23 * var(--px));
    width: calc(15 * var(--px));
    height: calc(15 * var(--px));
    background: url("./assets/hubs.png") 0 0 / calc(150 * var(--px)) 100% no-repeat;
}

.cassette-hub--left { left: calc(37 * var(--px)); }
.cassette-hub--right { left: calc(69 * var(--px)); }

.download-copy h2 {
    font-size: clamp(1.7rem, 1.2rem + 1.6vw, 2.3rem);
    font-weight: 800;
    line-height: 1.08;
}

.download-copy > p {
    margin: 12px 0 0;
    color: var(--muted);
}

.download-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 14px;
    margin-top: 24px;
}

.download-small {
    margin: 22px 0 0;
    color: var(--muted);
    font-size: 0.85rem;
}

/* Side B: the FAQ. */
.faq-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 44px;
}

.faq-card {
    padding: 22px 0 24px;
    border-top: 2px solid var(--rule);
}

/* ── The remote: stop or start the tape from anywhere on the page ── */
.tape-remote {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 50;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px 10px 13px;
    border: 2px solid var(--ink);
    border-radius: 999px;
    background: var(--cream);
    color: var(--ink);
    font: 700 0.9rem/1 var(--font-body);
    cursor: pointer;
    box-shadow: 0 4px 0 var(--ink), 0 12px 30px -10px rgba(0, 0, 0, 0.5);
}

.tape-remote[hidden] { display: none; }

.tape-remote:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 var(--ink);
}

.tape-remote-icon {
    width: 12px;
    height: 12px;
    background: var(--accent);
    box-shadow: 0 0 0 2px var(--ink);
}

/* A stopped tape shows a play triangle, drawn in pixels. */
.tape-remote.is-stopped .tape-remote-icon {
    background: transparent;
    box-shadow: none;
    border-style: solid;
    border-width: 7px 0 7px 12px;
    border-color: transparent transparent transparent var(--accent);
    width: 0;
    height: 0;
}

/* ── Narrower screens ── */
@media (max-width: 900px) {
    .download-inner {
        grid-template-columns: minmax(0, 1fr);
        justify-items: start;
        gap: 32px;
    }
}

@media (max-width: 760px) {
    .steps,
    .faq-grid { grid-template-columns: minmax(0, 1fr); }
    .steps { gap: 36px; }
}

@media (max-width: 640px) {
    body { font-size: 16px; }
    main { padding-bottom: 72px; }
    .tape-wordmark { height: 32px; margin-block: 2px; }
    .tape-section,
    .tape-download { padding-top: 64px; }
    .tape-section + .tape-strip { margin-top: 64px; }
    .hero-actions > * { flex: 1 1 100%; }
    .hero-actions .button { width: 100%; }
    .other-downloads-panel { position: static; margin-top: 10px; }
    .download-inner { padding: 24px 20px 26px; }
    .download-actions > * { flex: 1 1 100%; }
    .download-actions .button { width: 100%; }
    .cassette { --px: 2px; }
    .tape-strip { --tape-pixel: 2px; }
}
