/* Tabmeter styles. The look is the Hardware VU site's design system (hardwarevu.com: cream ground,
   one green accent, Inter + DM Mono, 3px radii, uppercase letter-spaced labels), adapted to this
   page. Tokens are copied from that site's colors_and_type.css; keep them in step by hand.
   Fonts: Inter and DM Mono, served from ../fonts (copied from the Hardware VU site). */
@font-face { font-family: 'Inter'; src: url('../fonts/Inter-Regular.ttf') format('truetype'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('../fonts/Inter-Medium.ttf') format('truetype'); font-weight: 500 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'DM Mono'; src: url('../fonts/DMMono-Regular.ttf') format('truetype'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'DM Mono'; src: url('../fonts/DMMono-Light.ttf') format('truetype'); font-weight: 300; font-style: normal; font-display: swap; }

:root {
  --bg:           #f5f3ee;   /* ground */
  --surface:      #e8e6de;   /* recessed / inactive */
  --surface-2:    #ede9e2;
  --border:       #d4d2c8;
  --border-hi:    #b8b6ac;

  --fg:           #1a1a18;
  --fg-2:         #4a4a45;
  --muted:        #6f6f68;
  --muted-2:      #b8b6ac;

  --live:         #1a6e4a;   /* the one accent: active states only */
  --live-bg:      #f0f7f3;
  --live-border:  #1a6e4a;
  --live-text:    #1a3a28;
  --warn:         #c2410c;

  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'DM Mono', 'JetBrains Mono', ui-monospace, Consolas, monospace;

  --r-cell: 2px;
  --r-control: 3px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 22px;
  padding: 18px 40px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.brand { font-family: var(--font-mono); font-size: 15px; letter-spacing: 0.02em; text-decoration: none; color: var(--fg); }
.brand .sep, h1 .sep, .model .sep { color: var(--live); padding-right: 2px; }
.brand .sub-brand { color: var(--muted); }
.nav { margin-left: auto; display: flex; gap: 28px; align-items: center; }
.nav a {
  font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); text-decoration: none; transition: color 120ms;
}
.nav a:hover { color: var(--fg); }
.maker {
  display: inline-flex; align-items: center; gap: 8px;
  padding-left: 22px; border-left: 1px solid var(--border);
  font-family: var(--font-mono); font-size: 13px; color: var(--fg-2); text-decoration: none;
}
.maker:hover { color: var(--fg); }

/* ---------- shell ---------- */
main { max-width: 1080px; margin: 0 auto; padding: 0 40px 64px; }

/* ---------- hero (top page) ---------- */
.hero { padding: 72px 0 40px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 22px; }
.hero h1 {
  margin: 0; font-family: var(--font-mono); font-weight: 400;
  font-size: 56px; line-height: 1.04; letter-spacing: 0.01em;
}
.hero h1 .sep { padding-right: 4px; }
.hero .sub { margin: 0; font-size: 19px; line-height: 1.55; color: var(--fg-2); max-width: 52ch; text-wrap: pretty; }


/* ---------- buttons and badges ---------- */
.btn, button {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 10px 18px; border-radius: var(--r-control);
  font-family: var(--font-sans); font-size: 12px; font-weight: 500;
  letter-spacing: 0.14em; text-transform: uppercase; text-decoration: none;
  cursor: pointer; transition: border-color 120ms, background 120ms, color 120ms;
  border: 1px solid var(--border); background: transparent; color: var(--fg);
}
.btn:hover, button:hover:not(:disabled) { border-color: var(--fg); }
.btn-live { background: var(--live); border-color: var(--live); color: #fff; }
.btn-live:hover { background: #155c3d; border-color: #155c3d; }
button:disabled { opacity: 0.45; cursor: default; }
.btn .arrow { font-family: var(--font-mono); }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); padding: 4px 10px;
  border: 1px solid var(--border); border-radius: 2px; background: var(--bg);
}
.badge .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--muted); }
.is-available .badge { color: var(--live); border-color: var(--live); }
.is-available .badge .dot { background: var(--live); }

/* ---------- product choice (top page) ---------- */
.edition-list { display: flex; flex-direction: column; gap: 12px; }
.edition {
  display: flex; align-items: center; gap: 26px; padding: 20px 24px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-control);
  transition: border-color 160ms;
}
.edition.is-available { background: var(--live-bg); border-color: var(--live-border); }
.edition.is-available:hover { border-color: var(--live); }
.edition .info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.edition .parent { font-family: var(--font-mono); font-size: 13px; color: var(--muted); line-height: 1; }
.edition .model { font-family: var(--font-mono); font-size: 26px; line-height: 1.05; }
.edition .meta { font-family: var(--font-mono); font-size: 13px; color: var(--muted); margin-top: 3px; max-width: 60ch; }
.edition .act { display: flex; flex-direction: column; align-items: flex-end; gap: 9px; flex-shrink: 0; }
.edition:not(.is-available) .model { color: var(--fg-2); }

/* ---------- tool panels ---------- */
/* Two columns: the three settings blocks stacked on the left, the preview on the right. The
   preview stays in view while the settings scroll. Below 900px it is one column. */
.tool { margin-top: 28px; display: grid; gap: 16px; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: start; }
.tool > .preview { grid-column: 2; grid-row: 1 / span 3; position: sticky; top: 88px; }
.row select { max-width: 460px; }
@media (max-width: 900px) {
  .tool { grid-template-columns: minmax(0, 1fr); }
  .tool > .preview { grid-column: 1; grid-row: auto; position: static; }
}
.panel {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-control);
  padding: 18px 20px;
}
h2 { font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.1em; color: var(--live); margin: 0 0 14px; }

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.row label { color: var(--muted); min-width: 90px; font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; }
.row output { min-width: 76px; color: var(--fg-2); font-family: var(--font-mono); font-size: 14px; font-variant-numeric: tabular-nums; }

select {
  font: inherit; font-size: 15px; color: inherit;
  background: var(--bg); border: 1px solid var(--border-hi); border-radius: var(--r-control);
  padding: 7px 9px; max-width: 100%; flex: 1 1 180px;
}
input[type="range"] { flex: 1 1 140px; accent-color: var(--live); }
input[type="checkbox"] { accent-color: var(--live); }

.note { color: var(--muted); font-size: 14px; line-height: 1.6; margin: 8px 0 0; }
.note em { font-style: normal; color: var(--fg-2); }
.note.bad { color: var(--warn); }

canvas { width: 100%; height: auto; display: block; background: #1a1a18; border-radius: var(--r-cell); }

/* ---------- footer ---------- */
footer.site {
  border-top: 1px solid var(--border); padding: 40px; max-width: 1080px; margin: 0 auto;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  font-family: var(--font-mono); font-size: 13px; color: var(--muted);
}
footer.site .maker { padding-left: 0; border-left: none; color: var(--muted); }
footer.site .maker:hover { color: var(--fg); }

/* ---------- responsive: collapse, don't scale ---------- */
@media (max-width: 720px) {
  .topbar { padding: 14px 20px; gap: 14px; }
  .nav a:not(.keep) { display: none; }
  main { padding: 0 20px 48px; }
  .hero { padding: 48px 0 28px; }
  .hero h1 { font-size: 36px; }
  .edition { flex-wrap: wrap; gap: 16px; padding: 16px 18px; }
  .edition .act { width: 100%; flex-direction: row; align-items: center; justify-content: space-between; }
  footer.site { padding: 28px 20px; }
}

/* 60 Works badge in the maker credit */
.maker img { height: 32px; width: auto; display: block; }
footer.site .maker img { height: 28px; }

[hidden] { display: none !important; }

/* Two-way choice, styled like the Hardware VU site's tab bar. */
.seg {
  display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 14px;
  border: 1px solid var(--border); border-radius: var(--r-control); overflow: hidden;
}
.seg label {
  position: relative; display: flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 8px; text-align: center; cursor: pointer;
  font-size: 13px; letter-spacing: 0.05em; white-space: nowrap; text-transform: uppercase; color: var(--muted);
  background: var(--surface);
}
/* The active underline is an inset shadow, not a border, so it cannot nudge the text off-centre. */
.seg label:has(input:checked) { color: var(--fg); background: var(--bg); box-shadow: inset 0 -2px 0 var(--live); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--live); outline-offset: -2px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.btn-live, button.btn-live { background: var(--live); border-color: var(--live); color: #fff; }
button.btn-live:hover:not(:disabled) { background: #155c3d; border-color: #155c3d; color: #fff; }

/* Meter: Boost is the one big control; the rest is small or tucked away. */
.hero-control { margin-bottom: 18px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.hero-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 6px; }
.hero-head label { font-size: 14px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg); font-weight: 500; }
.hero-head .big { font-family: var(--font-mono); font-weight: 300; font-size: 34px; color: var(--fg); font-variant-numeric: tabular-nums; }
.hero-range { width: 100%; height: 36px; margin: 0; }
/* Two or three choices side by side, one picked. Radio inputs underneath, so keys work. */
.segmented { display: flex; margin-bottom: 18px; border: 1px solid var(--border-hi); border-radius: var(--r-control); overflow: hidden; }
.segmented label { flex: 1; position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span {
  display: block; text-align: center; padding: 9px 12px;
  font-size: 12px; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted);
  transition: background 120ms, color 120ms;
}
.segmented label + label span { border-left: 1px solid var(--border-hi); }
.segmented input:checked + span { background: var(--live); color: #fff; }
.segmented input:focus-visible + span { outline: 2px solid var(--fg); outline-offset: -2px; }
details.advanced { margin-top: 6px; border-top: 1px solid var(--border); padding-top: 12px; }
details.advanced summary {
  cursor: pointer; margin-bottom: 12px; color: var(--muted);
  font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase;
}
details.advanced summary:hover { color: var(--fg); }
details.advanced[open] summary { color: var(--fg); }

/* Whole card is the link. */
a.edition { color: inherit; text-decoration: none; cursor: pointer; }
a.edition:hover .btn-live { background: #155c3d; border-color: #155c3d; }
a.edition:focus-visible { outline: 2px solid var(--live); outline-offset: 2px; }

/* Sound block: one big button to start, then a "listening" line with Stop. */
.big-btn { width: 100%; justify-content: center; padding: 18px 20px; font-size: 14px; }
#soundIdle > .note { margin: 10px 0 14px; }
.live { display: flex; align-items: center; gap: 12px; }
.live[hidden] { display: none; }
#liveLabel { font-size: 16px; color: var(--fg); min-width: 0; overflow-wrap: anywhere; }
.live #stopAudio { margin-left: auto; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--live); flex: none; }
@media (prefers-reduced-motion: no-preference) {
  .live-dot { animation: live-pulse 1.6s ease-in-out infinite; }
}
@keyframes live-pulse { 50% { opacity: 0.35; } }
