/* OP-1 Field look for the page chrome (top bar). The device itself is the 3D view;
   the 2D panel these rules also style is hidden and only holds state. */

/* ---- OP-1 family: shared tokens ---- */

[data-skin^="op1"] {
  /* the four encoder caps */
  --op-navy: #1e2a4c;
  --op-sand: #c8a679;
  --op-grey: #a9abae;
  --op-orange: #ff5a1f;
  --accent: #4f8a5b;   /* Braun green: on, here, now */

  --c-mod: var(--op-navy);
  --c-osc: var(--op-orange);
  --c-mix: var(--op-sand);
  --c-util: var(--op-grey);
  --c-filt: var(--op-navy);
  --c-env: var(--op-sand);
  --c-arp: var(--op-orange);
  --c-out: var(--op-grey);

  --oled: #060606;
  --oled-ink: #f2f2f0;
  --op-font: 'Inter', 'Helvetica Neue', Helvetica, system-ui, sans-serif;
  --op-mono: 'Space Mono', ui-monospace, monospace;
}

[data-skin="op1"] {
  --bg: #e9e9e7;
  --panel: #f3f2ee;          /* tile */
  --panel-2: #f3f2ee;
  --line: #d3d2ce;           /* tile seams */
  --ink: #2c2c2c;
  --muted: #8d8d8a;
  --op-frame: linear-gradient(180deg, #dcdddf, #c9cacc);
  --op-tile-shade: #dddcd7;
  --op-pressed: #e4e3de;
  --op-plate: #fbfaf7;       /* encoder plate */
  --op-ring: #cfcecb;
  --op-dot: #111;
  --op-led-off: #dad9d4;
  --op-led-on: #2c2c2c;
  --op-cap-top: #ffffff;
  --op-cap-shadow: rgba(0, 0, 0, 0.13);
  --op-cap-lip: rgba(0, 0, 0, 0.06);
}

/* ---- typography ---- */

[data-skin^="op1"],
[data-skin^="op1"] body { font-family: var(--op-font); }

[data-skin^="op1"] .sub,
[data-skin^="op1"] .section h2,
[data-skin^="op1"] .control .label,
[data-skin^="op1"] .opt,
[data-skin^="op1"] button,
[data-skin^="op1"] select,
[data-skin^="op1"] .ptitle,
[data-skin^="op1"] .jlabel,
[data-skin^="op1"] .wlabel,
[data-skin^="op1"] .oct-label,
[data-skin^="op1"] .klabel {
  text-transform: lowercase;
  letter-spacing: 0.01em;
  font-weight: 400;
}

[data-skin^="op1"] .logo {
  font-family: var(--op-font);
  font-weight: 500;
  font-size: 24px;
  letter-spacing: -0.02em;
  background: none;
  color: var(--ink);
}
[data-skin^="op1"] .sub { letter-spacing: 0.04em; }
[data-skin^="op1"] .hint { color: var(--op-orange); }

/* ---- device body: aluminium frame around a grid of tiles ---- */

[data-skin^="op1"] .synth { background: var(--op-frame); }
[data-skin^="op1"] .panel { gap: 1px; padding: 0; background: var(--line); align-content: stretch; }
[data-skin^="op1"] .section {
  border-top: none;
  border-radius: 0;
  background: var(--panel);
  box-shadow: none;
  flex-grow: 1;
}
[data-skin^="op1"] .section h2 { color: var(--muted); font-size: 12px; }
[data-skin^="op1"] .section h2 .indicator { background: var(--op-orange); box-shadow: none; width: 6px; height: 6px; }
[data-skin^="op1"] .control .label { font-size: 12px; color: var(--ink); }
[data-skin^="op1"] .control .value { font-family: var(--op-mono); font-size: 10px; }
[data-skin^="op1"] .control.active .value { color: var(--ink); }

/* buttons: soft tiles */
[data-skin^="op1"] button,
[data-skin^="op1"] select {
  font-family: var(--op-font);
  font-size: 13px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: inset 0 -2px 0 var(--op-tile-shade);
}
[data-skin^="op1"] button:not(:disabled):active { transform: none; background: var(--op-pressed); box-shadow: none; }
[data-skin^="op1"] button.on { box-shadow: inset 0 -2px 0 var(--op-tile-shade); }

/* encoders: small coloured cap on a white plate inside a hairline ring */
[data-skin^="op1"] .ring path { stroke-width: 2; }
[data-skin^="op1"] .ring .track { stroke: var(--op-ring); }
[data-skin^="op1"] .ring .fill { stroke: var(--ink); }
[data-skin^="op1"] .cap {
  inset: 14%;
  background: radial-gradient(circle, var(--hue) 0 46%, var(--op-plate) 48% 100%);
  box-shadow: inset 0 0 0 1px var(--op-ring), 0 1px 2px rgba(0, 0, 0, 0.08);
}
[data-skin^="op1"] .pointer {
  top: 30%;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
}

/* switches: tiny square LEDs, monochrome */
[data-skin^="op1"] .opt,
[data-skin^="op1"] .opt.on { background: none; border: none; box-shadow: none; border-radius: 4px; color: var(--muted); }
[data-skin^="op1"] .opt.on { color: var(--ink); }
[data-skin^="op1"] .opt:not(:disabled):active { background: none; }
[data-skin^="op1"] .opt .led { width: 6px; height: 6px; border-radius: 1px; background: var(--op-led-off); box-shadow: none; }
[data-skin^="op1"] .opt.on .led { background: var(--op-led-on); box-shadow: none; }

/* the only black surfaces: displays */
[data-skin^="op1"] .scope { background: var(--oled); color: var(--oled-ink); border-radius: 6px; box-shadow: none; }
[data-skin^="op1"] .seq-bpm { background: var(--oled); color: var(--oled-ink); font-family: var(--op-mono); font-weight: 400; border-radius: 6px; }
[data-skin^="op1"] .seq-bpm::after { color: #777; }
[data-skin^="op1"] .seq-steps { background: var(--oled); border-radius: 6px; padding: 6px 8px; }
[data-skin^="op1"] .sled { background: #1d1d1d; box-shadow: none; border-radius: 50%; }
[data-skin^="op1"] .sled.has { background: #4a4a4a; }
[data-skin^="op1"] .sled.beat { outline: none; }
[data-skin^="op1"] .sled.now { background: var(--op-orange); box-shadow: none; }

/* SEQ-1 strip and performance area are part of the same tile grid */
[data-skin^="op1"] .seqbar,
[data-skin^="op1"] .perform { background: var(--panel); border-top: 1px solid var(--line); box-shadow: none; }
[data-skin^="op1"] .seq-title { font-family: var(--op-font); font-weight: 500; color: var(--ink); letter-spacing: 0; }
[data-skin^="op1"] .seq-play .tri { border-left-color: var(--ink); }
[data-skin^="op1"] .seq-play.on .tri { background: var(--op-orange); }
[data-skin^="op1"] .seq-sound .led { background: var(--op-led-off); border-radius: 1px; width: 6px; height: 6px; }
[data-skin^="op1"] .seq-sound.on .led { background: var(--op-orange); box-shadow: none; }

/* keyboard: white tiles with a recessed pill; sharps are black dots */
[data-skin^="op1"] .keyboard { background: transparent; border-radius: 0; overflow: visible; }
[data-skin^="op1"] .key.white {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: inset 0 -2px 0 var(--op-tile-shade);
}
[data-skin^="op1"] .key.white::after {
  content: '';
  position: absolute;
  left: 15%; right: 15%;
  top: 50%; bottom: 9%;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--op-cap-top), var(--op-plate));
  /* raised cap: soft drop shadow, hairline edge, darker lower lip */
  box-shadow:
    0 3px 5px var(--op-cap-shadow),
    0 1px 1px var(--op-cap-shadow),
    0 0 0 1px var(--op-ring),
    inset 0 -2px 0 var(--op-cap-lip);
  transition: transform 0.05s, box-shadow 0.05s;
}
[data-skin^="op1"] .key.black {
  height: 48%;
  background: transparent;
  border: none;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
[data-skin^="op1"] .key.black::after {
  content: '';
  width: min(78%, 30px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--op-dot);
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.25), inset 0 1px 1px rgba(255, 255, 255, 0.12);
}
[data-skin^="op1"] .key.white.down { background: var(--op-pressed); box-shadow: none; }
[data-skin^="op1"] .key.white.down::after {
  transform: translateY(1px);
  box-shadow: 0 1px 1px var(--op-cap-shadow), 0 0 0 1px var(--op-ring), inset 0 -1px 0 var(--op-cap-lip);
}
[data-skin^="op1"] .key.black.down::after { background: #444; }
[data-skin^="op1"] .key.white.seq::after { background: var(--op-orange); }
[data-skin^="op1"] .key.black.seq::after { background: var(--op-orange); }
[data-skin^="op1"] .klabel { color: var(--muted); font-size: 10px; bottom: 3px; z-index: 1; }

/* wheels become slim sliders */
[data-skin^="op1"] .wheel-slot { background: var(--op-pressed); box-shadow: inset 0 0 0 1px var(--line); border-radius: 999px; }
[data-skin^="op1"] .wheel-center { background: var(--line); }
[data-skin^="op1"] .wheel-thumb {
  left: 4px; right: 4px;
  border-radius: 999px;
  background: var(--op-plate);
  box-shadow: inset 0 0 0 1px var(--op-ring), 0 1px 3px rgba(0, 0, 0, 0.18);
}
[data-skin^="op1"] .wheel:not(.spring) .wheel-thumb { background: radial-gradient(circle, var(--op-orange) 0 5px, var(--op-plate) 6px); }

/* patch bay */
[data-skin^="op1"] .hue-patch { --hue: var(--muted); }
[data-skin^="op1"] .pgroup { border-left: 1px solid var(--line); }
[data-skin^="op1"] .ptitle { color: var(--muted); }
[data-skin^="op1"] .socket {
  background: radial-gradient(circle, #000 0 28%, var(--op-ring) 31% 40%, var(--op-plate) 43% 100%);
  box-shadow: inset 0 0 0 1px var(--op-ring);
}
[data-skin^="op1"] .jack.out .jlabel { background: var(--ink); color: var(--panel); }
[data-skin^="op1"] .jack.hover { background: var(--op-pressed); }
[data-skin^="op1"] .bay.want-in .jack.in .socket,
[data-skin^="op1"] .bay.want-out .jack.out .socket { box-shadow: 0 0 0 2px var(--op-orange); }
[data-skin^="op1"] .cable-shadow { stroke: rgba(0, 0, 0, 0.15); }

@media (max-width: 600px) {
  [data-skin^="op1"] .panel { gap: 1px; padding: 0; }
}

/* view lock toggle in the top bar */
.lock { display: inline-flex; align-items: center; gap: 8px; }
.lock .led { width: 7px; height: 7px; border-radius: 1px; background: var(--op-led-off); }
.lock.on .led { background: var(--accent); }

/* selects: own chevron, inset like the text (the native arrow hugs the edge) */
[data-skin^="op1"] select {
  -webkit-appearance: none;
  appearance: none;
  padding-left: 14px;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%236f6f6c' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 12px 8px;
}

/* ---- 3D view: a quiet studio page --------------------------------------------
   Small text links floating over the scene, no boxes; the device carries the look. */

body.view-3d {
  /* soft backdrop, brightest behind the device */
  background:
    radial-gradient(ellipse 70% 60% at 50% 46%, #f7f6f3 0%, #ebeae6 45%, #d6d5d1 100%);
}
.view-3d .synth { max-width: none; background: none; position: relative; }

.view-3d .topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 2;
  padding: max(18px, env(safe-area-inset-top)) 28px 0;
  flex-wrap: nowrap;
  align-items: center;
  pointer-events: none;   /* the scene stays draggable between the links */
}
.view-3d .topbar > * { pointer-events: auto; }
.view-3d .logo {
  /* the name in dot-matrix, like the device's greetings */
  font-family: 'Doto', 'Space Mono', monospace;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.view-3d .sub { font-size: 13px; color: #a3a29e; }
.view-3d .sub .concept { opacity: 0.6; }   /* a quiet status mark: the synth is real, the device a concept */

.view-3d .brand { align-items: center; }
.view-3d .topbar [hidden] { display: none; }
.view-3d .top-controls { gap: 14px; flex-wrap: nowrap; align-items: center; }
/* groups: view options · pattern · patch · save (+ delete) · midi */
.view-3d .top-controls > :is(.menu-label, #save, #midi) { margin-left: 22px; }
.view-3d .menu-label { font-size: 12px; line-height: 1; color: #a3a29e; }
.view-3d .top-controls > .menu-label + select { margin-left: -6px; }   /* the name sits close to its menu */
html.dark .view-3d .menu-label { color: #6d6c69; }
.view-3d .top-controls > .hint { margin-right: 22px; }
.view-3d .top-controls button,
.view-3d .top-controls select {
  font-size: 13px;
  color: #7c7b78;
  background-color: transparent;
  border: none;
  box-shadow: none;
  border-radius: 0;
  /* one box for every item, so links, toggles and menus share a centre line */
  display: inline-flex;
  align-items: center;
  height: 24px;
  line-height: 1;
  padding: 0;
  min-height: 0;
  transition: color 0.2s;
}
.view-3d .top-controls button:hover,
.view-3d .top-controls select:hover,
.view-3d .top-controls .lock.on { color: var(--ink); }
.view-3d .top-controls button:not(:disabled):active { background: none; color: var(--ink); }
.view-3d .top-controls select {
  padding-right: 16px; background-position: right 0 center; background-size: 9px 6px;
  field-sizing: content;   /* as wide as the chosen name */
  max-width: 170px;
}
.view-3d .topbar * { white-space: nowrap; }
.view-3d .lock { gap: 6px; }
.view-3d .lock .led { width: 5px; height: 5px; border-radius: 50%; }
.view-3d .hint { font-size: 12px; line-height: 1; color: #a3a29e; margin: 0; }
.view-3d .logo, .view-3d .sub { line-height: 1; }

/* room light: a thin line icon; in the dark a stroke crosses it out */
.view-3d .light svg { fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; }
.view-3d .light .strike { opacity: 0; transition: opacity 0.2s; }
.view-3d .light[aria-pressed="false"] .strike { opacity: 1; }
.view-3d .top-controls > :is(#langToggle, #lightView) { margin-left: 22px; }

/* language: both shown, the active one in ink */
.view-3d .lang { gap: 5px; }
.view-3d .lang [data-l] { opacity: 0.45; transition: opacity 0.2s; }
.view-3d .lang [data-l].on { opacity: 1; color: var(--ink); }
.view-3d .lang .dot { opacity: 0.45; }
html.dark .view-3d .lang [data-l].on { color: #e6e5e1; }

/* dark room: the page dims with the device */
html.dark body.view-3d {
  background: radial-gradient(ellipse 70% 60% at 50% 46%, #2b2b2a 0%, #1c1c1b 50%, #111110 100%);
}
html.dark .view-3d .logo { color: #e6e5e1; }
html.dark .view-3d .sub,
html.dark .view-3d .hint { color: #6d6c69; }
html.dark .view-3d .top-controls button,
html.dark .view-3d .top-controls select { color: #8d8c88; }
html.dark .view-3d .top-controls button:hover,
html.dark .view-3d .top-controls select:hover,
html.dark .view-3d .top-controls .lock.on { color: #e6e5e1; }
html.dark .view-3d .top-controls select option { color: #2c2c2c; }
html.dark .view-3d .lock .led { background: #3c3c3a; }
html.dark .view-3d .lock.on .led { background: var(--accent); }

/* on the device already, or nothing to do right now */
.view-3d #undo, .view-3d #redo, .view-3d #del:disabled { display: none; }

/* the bar gives way step by step: the subtitle, then the spacing, then it stacks */
@media (max-width: 1240px) {
  .view-3d .sub { display: none; }
}
@media (max-width: 1100px) {
  .view-3d .top-controls > :is(.menu-label, #save, #midi, #langToggle, #lightView) { margin-left: 8px; }
}
@media (max-width: 760px) {
  .view-3d .topbar { padding: max(12px, env(safe-area-inset-top)) 16px 0; }
  .view-3d .sub { display: none; }
  .view-3d .top-controls { gap: 10px; }
  .view-3d .top-controls > :is(.menu-label, #save, #midi) { margin-left: 10px; }
  .view-3d .top-controls select { max-width: 110px; }
}

@media (max-width: 1000px) {
  /* tablets upright: the name above, the controls on a row of their own */
  .view-3d .topbar { flex-direction: column; align-items: flex-start; gap: 14px; }
  .view-3d .top-controls { flex-wrap: wrap; row-gap: 8px; }
}

/* stats: a dim line along the bottom, out of the way */
.stats { display: none; }
.view-3d .stats {
  display: block;
  position: fixed;
  left: 0; right: 0;
  bottom: max(14px, env(safe-area-inset-bottom));
  text-align: center;
  font: 11px 'Space Mono', monospace;
  font-variant-numeric: tabular-nums;
  white-space: pre;
  color: #b5b4b0;
  pointer-events: none;
}
html.dark .view-3d .stats { color: #4d4c49; }

/* the corners: the credit bottom left, in line with the logo above, and the version
   bottom right, set alike; one line each, the © kept with the year */
.credit, .version { display: none; }
.view-3d :is(.credit, .version) {
  display: block;
  position: fixed;
  bottom: max(14px, env(safe-area-inset-bottom));
  font-size: 11px;
  line-height: 1;
  color: #a3a29e;
  white-space: nowrap;
  z-index: 2;
}
.view-3d .credit { left: 28px; }
.view-3d .version { right: 28px; pointer-events: none; }
.view-3d .credit a { color: inherit; text-decoration: none; transition: color 0.2s; }
.view-3d .credit a:hover { color: var(--ink); }
html.dark .view-3d :is(.credit, .version) { color: #5d5c59; }
html.dark .view-3d .credit a:hover { color: #e6e5e1; }
@media (max-width: 760px) { .view-3d .credit { left: 16px; } .view-3d .version { right: 16px; } }
/* narrower screens: the stats sit beside the version, clear of the credit */
@media (max-width: 1000px) { .view-3d .stats { left: auto; right: 100px; text-align: right; } }
@media (max-width: 760px) { .view-3d .stats { right: 84px; } }

/* phones: a note instead of a device that can't fit */
.too-small { display: none; }
@media (pointer: coarse) and (max-width: 599px), (pointer: coarse) and (max-height: 499px) {
  /* the rest of the page would widen the layout past the screen */
  .synth, .view-3d .stats, .view-3d .credit, .view-3d .version { display: none; }
  .too-small {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 100;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 24px;
    text-align: center;
    background: radial-gradient(ellipse 70% 60% at 50% 46%, #f7f6f3 0%, #ebeae6 45%, #d6d5d1 100%);
    color: var(--ink);
  }
  .too-small .logo {
    font-family: 'Doto', 'Space Mono', monospace;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 18px;
  }
  .too-small p { margin: 0; font-size: 15px; line-height: 1.4; color: #7c7b78; }
  .too-small .too-small-title { color: var(--ink); }
  html.dark .too-small { background: radial-gradient(ellipse 70% 60% at 50% 46%, #2b2b2a 0%, #1c1c1b 50%, #111110 100%); color: #e6e5e1; }
  html.dark .too-small .too-small-title { color: #e6e5e1; }
}
