/* oplug1 — one stylesheet, no build step. Light and dark follow the visitor's system setting. */

:root {
  --bg: #f6f6f4;
  --surface: #ffffff;
  --surface-2: #eeeeeb;
  --text: #16181d;
  --muted: #5d636e;
  --line: #d9d9d4;
  --accent: #d9461a;
  --accent-text: #ffffff;
  --link: #a8330f;
  --ok: #1d7a46;
  --ok-bg: #e2f3e8;
  --warn: #8a5a00;
  --warn-bg: #fbf0d3;
  --danger: #b3261e;
  --danger-bg: #fbe4e2;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  --key-face-top: #ffffff;
  --key-face: #ecece8;
  --key-edge: #c4c4bd;
  --key-synth: #1f6fd0;
  --key-drum: #15803d;
  --key-effect: #c2610c;
  --key-sequencer: #4b515c;
  --key-other: #c62f2f;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121317;
    --surface: #1a1c22;
    --surface-2: #23262e;
    --text: #eceef2;
    --muted: #9aa1ad;
    --line: #2f333d;
    --accent: #ff6b3d;
    --accent-text: #16181d;
    --link: #ff8a63;
    --ok: #5fd38d;
    --ok-bg: #173323;
    --warn: #f0c060;
    --warn-bg: #3a2f12;
    --danger: #ff8f88;
    --danger-bg: #3d1a18;
    --shadow: none;
    --key-face-top: #2c2f38;
    --key-face: #22252c;
    --key-edge: #0c0d10;
    --key-synth: #5aa7ff;
    --key-drum: #4fd08a;
    --key-effect: #ffa352;
    --key-sequencer: #c3c8d2;
    --key-other: #ff7a73;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; padding-top: 28px; padding-bottom: 56px; }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
.narrow { max-width: 560px; }
.narrow-prose { max-width: 720px; }

a { color: var(--link); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

h1 { font-size: 1.9rem; line-height: 1.2; margin: 0 0 12px; letter-spacing: -0.01em; }
h2 { font-size: 1.25rem; margin: 32px 0 12px; }
h3 { font-size: 1.05rem; margin: 0 0 4px; }
p { margin: 0 0 12px; }
code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.9em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.hash { word-break: break-all; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }

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

.muted, .fine, .help, .optional { color: var(--muted); }
.fine, .help { font-size: 0.875rem; }
.optional { font-weight: 400; font-size: 0.8rem; }
.lede { font-size: 1.1rem; color: var(--muted); max-width: 62ch; }
.crumbs { font-size: 0.9rem; margin-bottom: 4px; }
.crumbs a { color: var(--muted); }
.empty { color: var(--muted); padding: 28px 0; }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; padding-top: 12px; padding-bottom: 12px; }
.brand { font-weight: 800; font-size: 1.2rem; color: var(--text); text-decoration: none; letter-spacing: -0.02em; }
.sections { display: flex; flex-wrap: wrap; gap: 8px; }
.account a { color: var(--text); text-decoration: none; font-size: 0.95rem; }
.account a:hover { color: var(--link); }

/* Section tabs: round keys with a pictogram. Each section has its own colour. */
.key-synth { --key: var(--key-synth); }
.key-drum { --key: var(--key-drum); }
.key-effect { --key: var(--key-effect); }
.key-sequencer { --key: var(--key-sequencer); }
.key-other { --key: var(--key-other); }
.section-icon { display: block; }
.key {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%;
  color: var(--key); background: linear-gradient(var(--key-face-top), var(--key-face));
  border: 1px solid var(--key-edge); box-shadow: 0 2px 0 var(--key-edge), var(--shadow);
  transition: transform 0.06s ease, box-shadow 0.06s ease;
}
.key:hover { border-color: var(--key); }
.key:active, .key.on { transform: translateY(2px); box-shadow: 0 0 0 var(--key-edge); }
.key.on { border-color: var(--key); box-shadow: 0 0 0 2px var(--key); }
.key:focus-visible { outline: 2px solid var(--key); outline-offset: 3px; }
.search { flex: 1 1 160px; min-width: 140px; }
.search input { width: 100%; }
.account { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.dot { background: var(--accent); color: var(--accent-text); border-radius: 999px; font-size: 0.75rem; padding: 0 6px; font-weight: 700; }
.announcement { background: var(--warn-bg); color: var(--warn); padding: 8px 0; font-size: 0.95rem; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); padding: 24px 0 32px; font-size: 0.9rem; }
.footer-grid { display: grid; gap: 14px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }

/* Forms and buttons */
input[type="text"], input[type="search"], input[type="url"], input[type="number"], select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  max-width: 100%;
}
textarea { width: 100%; resize: vertical; }
input[type="file"] { font: inherit; max-width: 100%; }

.button, button.button {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}
.button:hover { border-color: var(--muted); }
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.button.primary:hover { filter: brightness(1.06); }
.button.danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.button.donate { border-color: var(--ok); color: var(--ok); }

/* The author's thank-you, shown after a download. */
.thanks-region { position: fixed; left: 0; right: 0; bottom: 16px; z-index: 20; display: flex; justify-content: center; padding: 0 16px; pointer-events: none; }
.thanks { pointer-events: auto; position: relative; width: 100%; max-width: 460px; padding: 16px 44px 16px 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--ok); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); }
.thanks p { margin: 0 0 10px; }
.thanks-from { font-size: 0.85rem; color: var(--muted); }
.thanks-text { overflow-wrap: anywhere; }
.thanks > :last-child { margin-bottom: 0; }
.thanks-close { position: absolute; top: 8px; right: 10px; background: none; border: 0; padding: 4px 8px; font-size: 1.3rem; line-height: 1; color: var(--muted); cursor: pointer; }
.thanks-close:hover { color: var(--text); }
.button.small { padding: 5px 10px; font-size: 0.875rem; }
.button.big { padding: 13px 20px; font-size: 1.05rem; width: 100%; text-align: center; }
.button[disabled] { opacity: 0.5; cursor: not-allowed; }
.linklike { background: none; border: 0; padding: 0; font: inherit; font-size: 0.95rem; color: var(--muted); cursor: pointer; text-decoration: underline; }
form.inline { display: inline; }

.form .field { margin-bottom: 18px; }
.form label { display: block; font-weight: 600; margin-bottom: 4px; }
.form .field input[type="text"], .form .field input[type="url"], .form .field select { width: 100%; }
.form .field.check label { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.form .field.check input { margin-top: 5px; }
.form .help { margin: 4px 0 0; }
.form ul, .form div[id^="id_"] { list-style: none; padding: 0; margin: 0; }
.form div[id^="id_"] label { font-weight: 400; display: flex; gap: 8px; margin-bottom: 6px; }
.error-text { color: var(--danger); font-size: 0.9rem; margin: 4px 0 0; }
.has-error input, .has-error textarea, .has-error select { border-color: var(--danger); }
.inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; }
.upload-form { max-width: 760px; }
.upload-form section { margin-bottom: 28px; }
.upload-form textarea { width: 100%; }
.works-on { border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px 2px; margin: 0 0 18px; min-width: 0; }
.works-on legend { font-weight: 600; padding: 0 6px; }
.works-on .table { margin-bottom: 8px; }
.works-on tr:last-child td { border-bottom: 0; }
.works-on td .muted { display: block; font-size: 0.88rem; }
.optional-fields { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin: 0 0 24px; }
.optional-fields > summary { cursor: pointer; padding: 14px 16px; font-weight: 700; font-size: 1.05rem; }
.optional-fields > summary .muted { display: block; font-weight: 400; font-size: 0.9rem; margin-top: 2px; }
.optional-fields[open] > summary { border-bottom: 1px solid var(--line); }
.optional-fields > .optional-body { padding: 18px 16px 2px; }
.optional-fields .optional { display: none; }

.filters { display: flex; flex-wrap: wrap; align-items: end; gap: 12px 18px; margin: 8px 0 22px; }
.filters label { font-size: 0.85rem; color: var(--muted); display: grid; gap: 3px; }
.result-count { margin-left: auto; color: var(--muted); font-size: 0.9rem; }

/* Messages */
.messages { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 8px; }
.message { padding: 10px 14px; border-radius: 8px; background: var(--surface-2); margin-bottom: 12px; }
.messages .message { margin: 0; }
.message.success { background: var(--ok-bg); color: var(--ok); }
.message.warning { background: var(--warn-bg); color: var(--warn); }
.message.error { background: var(--danger-bg); color: var(--danger); }
.message a { color: inherit; }
.message p:last-child, .message ul { margin-bottom: 0; }
.notice form { margin-top: 8px; }

/* Pills */
.pill { display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--ok-bg); color: var(--ok); text-decoration: none; white-space: nowrap; }
.pill.quiet { background: var(--surface-2); color: var(--muted); }
.tag-picks { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -8px 0 18px; }
.tag-picks[hidden] { display: none; }
.tag-picks .muted { font-size: 0.85rem; margin-right: 2px; }
.tag-picks button.pill { border: 1px solid transparent; font-family: inherit; font-size: 0.8rem; padding: 3px 10px; cursor: pointer; }
.tag-picks button.pill:hover { border-color: var(--muted); }
.tag-picks button.pill[aria-pressed="true"] { background: var(--ok-bg); color: var(--ok); border-color: var(--ok); }
.tag-picks button.pill:disabled { opacity: 0.45; cursor: not-allowed; }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.danger { background: var(--danger-bg); color: var(--danger); }

/* Home */
.hero { padding: 16px 0 8px; }
.hero h1 { font-size: 2.3rem; }
.hero p { font-size: 1.15rem; color: var(--muted); max-width: 60ch; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin: 20px 0 8px; }
.tile { display: grid; gap: 2px; padding: 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--text); box-shadow: var(--shadow); }
.tile:hover { border-color: var(--accent); }
.tile strong { font-size: 1.1rem; }
.tile span { color: var(--muted); font-size: 0.9rem; }
.tile .tile-icon { color: var(--key); margin-bottom: 6px; }
.tile:hover { border-color: var(--key, var(--accent)); }
.row-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.row-head h1 { margin-bottom: 16px; }

/* Cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.card-cover { display: block; aspect-ratio: 2 / 1; background: #000; }
.card-cover img { width: 100%; height: 100%; object-fit: contain; display: block; }
.no-cover { display: grid; place-items: center; height: 100%; color: #6b7280; font-size: 2.2rem; font-weight: 800; }
.card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card h3 a { color: var(--text); text-decoration: none; }
.card h3 a:hover { color: var(--link); }
.card .by { font-size: 0.85rem; color: var(--muted); margin: 0; }
.card .by a { color: var(--muted); }
.card .summary { font-size: 0.92rem; margin: 2px 0 8px; flex: 1; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0; }
.count { margin-left: auto; color: var(--muted); font-size: 0.85rem; }
.pager { display: flex; justify-content: center; gap: 20px; margin-top: 28px; color: var(--muted); }

/* Plugin page */
.plugin-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.plugin-head .by { color: var(--muted); }
.plugin-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 32px; align-items: start; }
.plugin-main > section:first-child h2, .plugin-main > .shots + section h2 { margin-top: 20px; }
.shots { background: #000; border-radius: var(--radius); overflow: hidden; }
.shot-main { display: block; width: 100%; height: auto; max-height: 520px; object-fit: contain; }
.shot-strip { display: flex; gap: 6px; padding: 6px; overflow-x: auto; background: var(--surface-2); }
.shot-strip img { height: 72px; width: auto; display: block; border-radius: 4px; }
.audio audio { width: 100%; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow); }
.panel h2 { margin: 0 0 8px; font-size: 1rem; }
.panel p:last-child { margin-bottom: 0; }
.download-panel .muted { font-size: 0.85rem; margin: 6px 0 14px; }
.plugin-main > section { margin-top: 24px; }
.prose table { margin-bottom: 12px; }
.stat { margin-top: 12px; }
.risk { border-color: var(--warn); background: var(--warn-bg); color: var(--warn); font-size: 0.92rem; }
.risk a { color: inherit; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0; font-size: 0.92rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; min-width: 0; }
.inline-facts { margin-bottom: 12px; }
.author-link { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 600; margin-bottom: 12px; }
.author-link img, .avatar { border-radius: 50%; }
.report-link { font-size: 0.9rem; }
.report-link a { color: var(--muted); }

.release { border-top: 1px solid var(--line); padding: 16px 0; }
.release header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.release header h3 { font-size: 1.15rem; }
.release time { color: var(--muted); font-size: 0.9rem; }
.release.withdrawn .files { opacity: 0.6; }
.withdrawn-note { color: var(--danger); }
.files { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 10px; }
.file { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.file-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; }
.filename { font-weight: 700; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.compat { list-style: none; padding: 0; margin: 8px 0 0; font-size: 0.92rem; display: grid; gap: 4px; }
.file-facts { margin-top: 8px; font-size: 0.9rem; }
.file-facts summary { cursor: pointer; color: var(--muted); }
.file-facts dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; margin: 8px 0 0; }
.file-facts dt { color: var(--muted); }
.file-facts dd { margin: 0; min-width: 0; }

/* Prose (rendered Markdown) */
.prose { max-width: 72ch; overflow-wrap: anywhere; }
.prose.small { font-size: 0.95rem; }
.prose h2 { font-size: 1.2rem; }
.prose pre { background: var(--surface-2); padding: 12px; border-radius: 8px; overflow-x: auto; }
.prose pre code { background: none; padding: 0; }
.prose blockquote { margin: 0 0 12px; padding-left: 14px; border-left: 3px solid var(--line); color: var(--muted); }
.prose table { border-collapse: collapse; display: block; overflow-x: auto; overflow-wrap: normal; }
.prose th, .prose td { border: 1px solid var(--line); padding: 4px 10px; }

/* Tables */
.table { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
.table th { text-align: left; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; }
.table th, .table td { padding: 9px 10px 9px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.table input[type="text"] { width: 100%; min-width: 90px; }

/* Manage pages */
.status-panel ul { margin: 0 0 12px; padding-left: 20px; }
.shot-manage { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.shot-manage figure { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.shot-manage img { width: 100%; display: block; background: #000; aspect-ratio: 2 / 1; object-fit: contain; }
.shot-manage figcaption { padding: 8px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.file-edit h3 { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; margin-bottom: 10px; }
.file-edit h3 .muted { font-family: system-ui, sans-serif; font-weight: 400; font-size: 0.85rem; }
.compat-form { margin-bottom: 10px; }
.danger-zone { margin-top: 40px; padding-top: 4px; border-top: 1px solid var(--line); }
.danger-zone h2 { color: var(--danger); }
.meter { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 6px 0 10px; }
.meter span { display: block; height: 100%; background: var(--accent); }
.usage { margin-top: 32px; }

/* Profile and misc */
.profile-head { display: flex; gap: 20px; align-items: flex-start; margin-bottom: 8px; }
.profile-links { display: flex; flex-wrap: wrap; gap: 8px; }
.bio { max-width: 60ch; }
.signin form { margin-bottom: 12px; }

@media (max-width: 820px) {
  .plugin-layout { grid-template-columns: minmax(0, 1fr); }
  .plugin-side { order: -1; }
  .hero h1 { font-size: 1.8rem; }
  .account { margin-left: 0; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; }
  .table tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  .table td { border: 0; padding: 3px 0; }
}

/* The upload API page and the tokens page */
.api-docs th, .api-docs td:first-child { white-space: nowrap; }
.api-docs td:last-child { min-width: 16rem; }
.api-docs pre { overflow-x: auto; }
.token-key { background: var(--surface-2); padding: 12px; border-radius: 8px; overflow-x: auto; user-select: all; }
.token-key code { background: none; padding: 0; }
.new-token .help { overflow-wrap: anywhere; }

/* Ports */
.pill.port { background: var(--warn-bg); color: var(--warn); }
.port-of { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.port-intro ul { margin: 8px 0 0; padding-left: 20px; }
.port-intro li { margin-bottom: 4px; }
.port-credit { border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 16px 12px; margin: 16px 0; }
.port-credit legend { font-weight: 600; padding: 0 6px; }
.port-list { list-style: none; padding: 0; margin: 0 0 12px; }
.port-list li { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.port-list li > a { font-weight: 600; }
.message.stale { font-size: 0.875rem; margin: 10px 0 0; }

/* Automatic updates from GitHub */
.source-status p { margin-bottom: 8px; }
.source-addresses { list-style: none; padding: 0; margin: 0 0 8px; overflow-wrap: anywhere; }
.source-change { margin: 12px 0; }
.source-change summary { cursor: pointer; color: var(--muted); }
ul.help { padding-left: 20px; margin: 0 0 12px; }
ul.help li { margin-bottom: 4px; }
