/* pedal.css — every pedal page: the layout, the pedal's enclosure, knobs, footswitch, meters,
   the fretboard and the Controls panel. A pedal's style.css sets its enclosure's colours
   (--enclosure, --enclosure-ink, --accent). */

:root {
  --bg: #f4f1ec; --panel: #ffffff; --ink: #1d1b19; --ink-2: #6b655e; --line: #ddd6cc; --grid: #ebe5dc;
  --accent: #c2410c; --accent-2: #2563eb; --good: #15803d; --enclosure: #3f6f5a; --enclosure-ink: #f5f1e8; --led: #ff3b2f;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121212; --panel: #1b1b1d; --ink: #ece8e1; --ink-2: #a39d94; --line: #2e2e31; --grid: #262629;
    --accent: #fb923c; --accent-2: #60a5fa; --good: #4ade80; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121212; --panel: #1b1b1d; --ink: #ece8e1; --ink-2: #a39d94; --line: #2e2e31; --grid: #262629;
  --accent: #fb923c; --accent-2: #60a5fa; --good: #4ade80; color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
#app { max-width: 1200px; margin: 0 auto; padding: 0 16px 24px; }
button, select, input { font: inherit; color: inherit; }
button, select { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; cursor: pointer; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.ghost { background: transparent; }
button:disabled { opacity: 0.6; cursor: default; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

header.top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 0; }
header.top .home { font-weight: 700; color: var(--ink); text-decoration: none; letter-spacing: 0.3px; }
header.top h1 { font-size: 20px; margin: 0 4px 0 0; }
header.top .spacer { flex: 1; }
.pill { font-size: 12px; color: var(--ink-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px 9px; white-space: nowrap; }
.pill.warn { color: var(--accent); border-color: var(--accent); }
.status { font-size: 13px; color: var(--accent); }

.stage { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 16px; align-items: start; }
@media (max-width: 760px) { .stage { grid-template-columns: 1fr; } }

/* the enclosure */
.pedal {
  background: var(--enclosure); color: var(--enclosure-ink); border-radius: 18px; padding: 16px 18px 20px;
  box-shadow: inset 0 2px 0 rgb(255 255 255 / 0.15), inset 0 -3px 0 rgb(0 0 0 / 0.25);
  display: flex; flex-direction: column; align-items: center; gap: 14px; position: relative;
}
.pedal .jacks { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.meter { display: grid; grid-template-columns: 28px 1fr 64px; align-items: center; gap: 8px; font-size: 12px; }
.meter .track { height: 6px; border-radius: 3px; background: rgb(0 0 0 / 0.3); overflow: hidden; }
.meter .bar { display: block; height: 100%; width: 0; background: #a7f3d0; transition: width 60ms linear; }
.meter.clip .bar { background: var(--led); }
.meter .mtxt { text-align: right; font-variant-numeric: tabular-nums; }
.knobs { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px 18px; }
.knob { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 84px; text-align: center; }
.dial {
  --turn: 0deg; width: 62px; height: 62px; border-radius: 50%; position: relative; touch-action: none; cursor: grab;
  background: radial-gradient(circle at 40% 35%, #4a4a4a, #111 70%); box-shadow: 0 3px 6px rgb(0 0 0 / 0.45);
}
.dial:focus-visible { outline: 3px solid var(--enclosure-ink); outline-offset: 3px; }
.dial .mark { position: absolute; left: 50%; top: 50%; width: 3px; height: 26px; margin-left: -1.5px; background: #f5f1e8;
  transform-origin: 50% 0; transform: rotate(calc(var(--turn) + 180deg)); border-radius: 2px; }
.klabel { font-size: 12px; font-weight: 600; letter-spacing: 0.3px; text-transform: uppercase; }
.kval { font-size: 12px; opacity: 0.85; font-variant-numeric: tabular-nums; }
.pedal .name { text-align: center; }
.pedal .name span { display: block; font: 800 26px/1 Georgia, "Times New Roman", serif; letter-spacing: 1px; }
.pedal .name small { opacity: 0.8; font-size: 12px; }
.switchrow { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.led { width: 12px; height: 12px; border-radius: 50%; background: #5a1a16; box-shadow: inset 0 1px 2px rgb(0 0 0 / 0.5); }
.led.on { background: var(--led); box-shadow: 0 0 10px var(--led); }
.footswitch { width: 64px; height: 64px; border-radius: 50%; border: none;
  background: radial-gradient(circle at 40% 35%, #f1f1f1, #9a9a9a 70%); box-shadow: 0 4px 0 #555, 0 6px 10px rgb(0 0 0 / 0.4); }
.footswitch:active { transform: translateY(3px); box-shadow: 0 1px 0 #555, 0 2px 6px rgb(0 0 0 / 0.4); }

/* the tuner: 1 % of the scale's width is one cent, the green zone ±3 cents */
.tunercard figcaption { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.tunercard figcaption span { display: inline-flex; align-items: center; gap: 5px; }
.tunercard figcaption input { width: 62px; padding: 2px 5px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); font: inherit; }
.tunercard .mute { margin-left: auto; font-size: 13px; padding: 4px 10px; }
.tunercard .mute[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.t-body { display: grid; grid-template-columns: auto 1fr; grid-template-areas: "name scale" "name read"; gap: 2px 14px; align-items: center; padding: 4px 2px 2px; }
.t-name { grid-area: name; min-width: 2.2em; text-align: center; font: 700 50px/1 Georgia, "Times New Roman", serif; }
.t-name sub { font: 600 18px/1 system-ui, sans-serif; vertical-align: baseline; margin-left: 1px; }
.t-scale { grid-area: scale; position: relative; height: 34px; margin: 0 14px 18px; border-bottom: 2px solid var(--line); }
.t-zone { position: absolute; left: 47%; width: 6%; top: 0; bottom: 0; border-radius: 4px 4px 0 0; background: color-mix(in srgb, var(--good) 25%, transparent); }
.t-tick { position: absolute; bottom: 0; width: 2px; height: 10px; margin-left: -1px; background: var(--ink-2); }
.t-tick i { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); font: 11px/1 system-ui, sans-serif; font-style: normal; color: var(--ink-2); white-space: nowrap; }
.t-needle { position: absolute; bottom: 0; left: 50%; width: 4px; height: 32px; margin-left: -2px; border-radius: 2px; background: var(--accent); transition: left 90ms linear; }
.t-read { grid-area: read; display: flex; flex-wrap: wrap; gap: 2px 14px; margin: 0 14px; font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.t-cents { color: var(--ink); font-weight: 600; min-width: 5.5ch; }
.tunercard.intune .t-name, .tunercard.intune .t-cents { color: var(--good); }
.tunercard.intune .t-needle { background: var(--good); }
.tunercard.idle .t-needle { opacity: 0; }
.tunercard.stale .t-name, .tunercard.stale .t-needle, .tunercard.stale .t-cents { opacity: 0.45; }
@media (max-width: 420px) { .t-name { font-size: 40px; } .t-scale, .t-read { margin-left: 4px; margin-right: 8px; } }

/* views */
.views { display: grid; gap: 16px; }
.card { margin: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.card figcaption { font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.card figcaption b { color: var(--ink); }
.card .canvas { height: 230px; }
.card canvas { width: 100%; height: 100%; display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--ink-2); margin-top: 6px; }
.legend i { display: inline-block; width: 16px; height: 3px; vertical-align: middle; margin-right: 5px; border-radius: 2px; }

/* the test bass */
.fretboard { margin-top: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.fret-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; font-size: 13px; color: var(--ink-2); margin-bottom: 8px; }
.fret-head b { color: var(--ink); }
.fret-head button { margin-left: auto; }
.frets { display: grid; gap: 4px; }
.string { display: grid; grid-template-columns: 18px repeat(10, 1fr); gap: 4px; align-items: center; }
.sname { font-size: 12px; font-weight: 700; color: var(--ink-2); text-align: center; }
.string button { height: 30px; padding: 0; border-radius: 6px; touch-action: none; position: relative; }
.string button::after { content: ""; position: absolute; left: 4px; right: 4px; top: 50%; height: 2px; background: var(--ink-2); opacity: 0.5; }
.string button.open { background: var(--grid); }
.string button:active { background: var(--accent); }

/* controls */
.controls { margin-top: 16px; }
.controls-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 10px; }
.controls-bar .inline { font-size: 13px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.controls-bar input[type="number"] { width: 70px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
.groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.group { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; margin: 0; padding: 8px 12px 10px; min-width: 0; }
.group legend { font-weight: 700; padding: 0 4px; }
.row { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "label info" "input value" "hint hint"; gap: 2px 8px; padding: 6px 0; border-top: 1px solid var(--grid); }
.row:first-of-type { border-top: none; }
.row[hidden] { display: none; }
.row label { grid-area: label; font-size: 13px; }
.row .info { grid-area: info; padding: 0 6px; border: none; background: none; color: var(--ink-2); }
.row input[type="range"], .row select { grid-area: input; width: 100%; min-width: 0; accent-color: var(--accent); }
.row input[type="checkbox"] { grid-area: input; justify-self: start; width: 18px; height: 18px; accent-color: var(--accent); }
.row output { grid-area: value; font-size: 13px; font-variant-numeric: tabular-nums; min-width: 72px; text-align: right; }
.row .hint { grid-area: hint; margin: 4px 0 0; font-size: 13px; color: var(--ink-2); }

footer { margin-top: 24px; font-size: 13px; color: var(--ink-2); }
footer a { color: inherit; }

/* How it works */
dialog.notes { width: min(820px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--ink); }
dialog.notes::backdrop { background: rgb(0 0 0 / 0.45); }
.notes-bar { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: var(--panel); border-bottom: 1px solid var(--line); }
.notes-body { padding: 4px 18px 18px; overflow-wrap: anywhere; }
.notes-body table { border-collapse: collapse; display: block; overflow-x: auto; }
.notes-body td, .notes-body th { border: 1px solid var(--line); padding: 4px 8px; }
.notes-body pre { overflow-x: auto; background: var(--grid); padding: 8px; border-radius: 8px; }
