/*
 * RAMA L generative visual system
 * -------------------------------
 * This layer supplies the three artwork palettes and constructed panel style.
 * Audio and ordinary control layout remain in the smaller base stylesheet.
 */

/* Night is the closest translation of the supplied artwork: charcoal fields,
   cool cyan construction lines, warm copper accents and soft ivory type. */
body[data-theme="night"] {
  --bg: #17171f;
  --bg-tint: #202029;
  --fg: #e8e5dc;
  --fg-muted: #8e8b85;
  --border: rgba(216, 212, 200, 0.2);
  --border-strong: rgba(98, 200, 216, 0.45);
  --accent: #63cadb;
  --accent-strong: #8fe8f0;
  --accent-soft: rgba(99, 202, 219, 0.12);
  --danger: #e39268;
  --surface: rgba(25, 25, 33, 0.9);
  --surface-solid: #1c1c24;
  --surface-quiet: rgba(31, 31, 40, 0.94);
  --primary-text: #111118;
  --art-bg: #17171f;
  --art-field: #202029;
  --art-cyan: #62c8d8;
  --art-copper: #c58b5e;
  --art-pale: #d8d4c8;
  --art-quiet: #6f7077;
}

/* Day keeps the same geometry but uses drafting-paper colours. Teal and rust
   replace the night palette without turning the page into a generic light UI. */
body[data-theme="day"] {
  --bg: #e8e1d3;
  --bg-tint: #ddd5c6;
  --fg: #202625;
  --fg-muted: #716d65;
  --border: rgba(32, 38, 37, 0.2);
  --border-strong: rgba(18, 105, 111, 0.46);
  --accent: #12696f;
  --accent-strong: #08494d;
  --accent-soft: rgba(18, 105, 111, 0.12);
  --danger: #933f2f;
  --surface: rgba(235, 228, 214, 0.9);
  --surface-solid: #e7dfd0;
  --surface-quiet: rgba(220, 212, 197, 0.94);
  --primary-text: #f5eee2;
  --art-bg: #ded5c5;
  --art-field: #e9e1d3;
  --art-cyan: #187c82;
  --art-copper: #a75d3d;
  --art-pale: #343a38;
  --art-quiet: #8c8579;
}

/* Nautical follows Pat's existing cyan/orange convention. The blue-black
   ground is slightly cooler than Night so each mode has a distinct mood. */
body[data-theme="nautical"] {
  --bg: #061014;
  --bg-tint: #0a1a20;
  --fg: #d5f1ef;
  --fg-muted: #759598;
  --border: rgba(101, 220, 228, 0.2);
  --border-strong: rgba(101, 220, 228, 0.52);
  --accent: #f47a4a;
  --accent-strong: #ff9a6e;
  --accent-soft: rgba(244, 122, 74, 0.13);
  --danger: #ff9a6e;
  --surface: rgba(6, 16, 20, 0.9);
  --surface-solid: #08161b;
  --surface-quiet: rgba(8, 25, 30, 0.95);
  --primary-text: #061014;
  --art-bg: #061014;
  --art-field: #0a1a20;
  --art-cyan: #65dce4;
  --art-copper: #f47a4a;
  --art-pale: #c6e5e3;
  --art-quiet: #45676b;
}

html {
  background: var(--art-bg);
}

body {
  position: relative;
  isolation: isolate;
  background: var(--art-bg);
}

/* The canvas is decorative and cannot intercept clicks or keyboard focus. It
   is absolute, rather than fixed, so the generated frame covers long pages. */
.generative-art {
  position: absolute;
  inset: 0;
  z-index: -2;
  display: block;
  pointer-events: none;
}

.topbar {
  height: var(--topbar-height);
  border-color: var(--border-strong);
  background: color-mix(in srgb, var(--art-bg) 91%, transparent);
  box-shadow: 0 9px 0 color-mix(in srgb, var(--art-bg) 68%, transparent);
  backdrop-filter: blur(14px);
}

.topbar__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  width: min(1120px, calc(100% - 48px));
  gap: 22px;
}

.wordmark {
  min-width: 0;
  color: var(--fg);
  font-weight: 500;
  letter-spacing: 0.11em;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
  justify-self: start;
}

/* RAMA L uses the same central navigation destinations as the WordPress site. */
.rama-site-nav {
  display: flex;
  gap: clamp(14px, 2vw, 28px);
  align-items: center;
  justify-content: center;
}

.rama-site-nav a {
  color: var(--fg-muted);
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rama-site-nav a:hover,
.rama-site-nav a:focus-visible,
.rama-site-nav a[aria-current="page"] {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-color: var(--art-copper);
  text-underline-offset: 4px;
}

.art-controls {
  display: flex;
  min-width: 0;
  gap: 7px;
  align-items: center;
  justify-self: end;
}

.topbar-action {
  min-height: 27px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg-muted);
  font-size: 8px;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.topbar-action {
  padding: 0 10px;
}

.topbar-action:hover,
.topbar-action:focus-visible {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--primary-text);
  outline: 0;
}

/* The guide is a fixed side panel rather than a modal. It has no backdrop, so
   the instrument remains visible and usable while the instructions are open. */
.guide-drawer {
  position: fixed;
  top: var(--topbar-height);
  right: 0;
  bottom: 0;
  z-index: 30;
  width: min(340px, calc(100% - 24px));
  padding: 24px;
  overflow-y: auto;
  border-top: 1px solid var(--border-strong);
  border-left: 1px solid var(--border-strong);
  /* Keep the guide field plain; the cyan dividers provide enough structure
     without notebook-like rules running behind the instructions. */
  background: color-mix(in srgb, var(--surface-solid) 97%, transparent);
  box-shadow: -12px 0 0 color-mix(in srgb, var(--art-bg) 62%, transparent);
  color: var(--fg);
  opacity: 0;
  pointer-events: none;
  transform: translateX(calc(100% + 14px));
  transition:
    opacity 170ms ease,
    transform 220ms ease,
    visibility 0s linear 220ms;
  visibility: hidden;
}

.guide-drawer.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
  transition-delay: 0s;
  visibility: visible;
}

.guide-drawer__head {
  display: flex;
  padding-bottom: 18px;
  border-bottom: 4px solid var(--art-copper);
  gap: 20px;
  align-items: start;
  justify-content: space-between;
}

.guide-kicker,
.guide-steps span,
.guide-feedback {
  color: var(--fg-muted);
  font-size: 8px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.guide-kicker {
  margin-bottom: 8px;
  color: var(--art-copper);
}

.guide-drawer h2 {
  margin: 0;
  color: var(--fg);
  font-size: 20px;
  letter-spacing: 0.04em;
}

.guide-close {
  min-height: 27px;
  padding: 0 9px;
  border: 1px solid var(--border-strong);
  background: var(--surface-solid);
  color: var(--fg-muted);
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.guide-close:hover,
.guide-close:focus-visible {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--primary-text);
  outline: 0;
}

.guide-steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: none;
}

.guide-steps li {
  position: relative;
  padding: 21px 6px 20px 18px;
  border-bottom: 1px solid var(--border-strong);
}

.guide-steps li::before {
  position: absolute;
  top: 23px;
  left: 0;
  width: 5px;
  height: 5px;
  background: var(--art-cyan);
  content: "";
}

.guide-steps span {
  display: block;
  margin-bottom: 9px;
  color: var(--art-copper);
}

.guide-steps p {
  margin: 0;
  color: var(--fg);
  font-size: 11px;
  line-height: 1.65;
}

.guide-steps b {
  color: var(--accent-strong);
  font-weight: 500;
}

.guide-feedback {
  margin: 22px 0 0;
  line-height: 1.7;
}

.guide-feedback a {
  color: var(--art-copper);
}

/* The former rear-frame wrapper is kept invisible so the experiment can be
   restored later without changing the instrument's document structure. */
.instrument-stage {
  position: relative;
  z-index: 0;
  width: min(1560px, calc(100% - 32px));
  margin: 78px auto 52px;
  /* Rear-frame padding, border and field are intentionally paused. The stage
     remains as a harmless wrapper in case the frame experiment returns.
  padding: clamp(32px, 3.2vw, 52px) clamp(48px, 7vw, 220px);
  border: 1px solid var(--border-strong);
  background: color-mix(in srgb, var(--art-field) 8%, transparent);
  */
}

/* The instrument is one central framed object. The generated lines continue
   faintly beneath it, while this surface protects control legibility. */
.machine-shell {
  position: relative;
  z-index: 1;
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 34px;
  border: 1px solid var(--border-strong);
  background:
    linear-gradient(135deg, var(--accent-soft), transparent 22%),
    var(--surface);
  box-shadow:
    0 0 0 9px color-mix(in srgb, var(--art-bg) 66%, transparent),
    0 0 0 10px var(--border);
  backdrop-filter: blur(3px);
}

.machine-shell::before,
.machine-shell::after {
  position: absolute;
  z-index: -1;
  width: 118px;
  height: 74px;
  border-color: var(--art-copper);
  opacity: 0.65;
  pointer-events: none;
  content: "";
}

.machine-shell::before {
  top: 12px;
  right: 12px;
  border-top: 4px solid;
  border-right: 1px solid;
}

.machine-shell::after {
  bottom: 12px;
  left: 12px;
  border-bottom: 4px solid;
  border-left: 1px solid;
}

.page-head {
  position: relative;
  padding: 4px 0 28px;
  border-color: var(--border-strong);
}

.page-head::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  width: 31%;
  border-bottom: 4px solid var(--art-copper);
  content: "";
}

.eyebrow {
  color: var(--art-copper);
}

h1 {
  color: var(--fg);
  font-size: clamp(48px, 8vw, 84px);
  text-shadow: 2px 2px 0 color-mix(in srgb, var(--art-cyan) 26%, transparent);
}

h1 sup {
  color: var(--art-copper);
}

.title-row p {
  padding-left: 18px;
  border-left: 1px solid var(--art-cyan);
  color: var(--fg-muted);
}

/* Panels are deliberately squared and joined visually, like smaller regions
   cut into the reference work's central construction. */
.panel {
  overflow: hidden;
  border-color: var(--border-strong);
  background: var(--surface);
  box-shadow: none;
}

.panel::after {
  position: absolute;
  right: -37px;
  bottom: -37px;
  width: 72px;
  height: 72px;
  border: 1px solid var(--art-copper);
  opacity: 0.28;
  content: "";
  pointer-events: none;
  transform: rotate(45deg);
}

.panel-head {
  border-color: var(--border-strong);
  background:
    repeating-linear-gradient(90deg, transparent 0 13px, var(--border) 13px 14px),
    var(--surface-quiet);
}

.panel-head::before {
  top: auto;
  right: 18px;
  bottom: -1px;
  left: auto;
  width: 84px;
  border-color: var(--art-copper);
  transform: none;
}

.panel-head::after {
  top: 0;
  left: 18px;
  height: 7px;
  border-color: var(--art-cyan);
}

.panel-head h2 {
  display: inline-flex;
  min-height: 23px;
  padding: 0 8px;
  background: var(--surface-solid);
  color: var(--fg);
  align-items: center;
}

.panel-head > span {
  padding: 2px 6px;
  background: var(--surface-solid);
}

.input-empty {
  border-color: var(--border-strong);
}

.drop-zone {
  border-color: var(--border-strong);
  background:
    linear-gradient(152deg, transparent 0 64%, var(--accent-soft) 64% 65%, transparent 65%),
    repeating-linear-gradient(90deg, transparent 0 47px, var(--border) 47px 48px),
    var(--surface-solid);
}

.drop-zone::before,
.drop-zone::after {
  width: 38px;
  height: 38px;
  border-color: var(--art-copper);
}

.drop-label {
  max-width: 390px;
  color: var(--fg);
  font-size: clamp(20px, 2.8vw, 30px);
  line-height: 1.2;
}

.picker-button,
.button {
  border-color: var(--border-strong);
  background: var(--surface-solid);
}

.picker-button {
  border-color: var(--accent);
  color: var(--accent);
}

.drop-zone:hover .picker-button,
.drop-zone:focus-within .picker-button,
.button-primary {
  background: var(--accent);
  color: var(--primary-text);
}

.sample-library {
  background: var(--surface-quiet);
}

.sample-library__head {
  border-color: var(--border-strong);
}

.sample-list {
  background:
    repeating-linear-gradient(0deg, transparent 0 31px, var(--border) 31px 32px);
}

.sample-button {
  border-color: var(--border-strong);
  background: var(--surface-solid);
}

.sample-button::before {
  width: 22px;
  height: 3px;
  background: var(--art-copper);
}

.waveform-frame {
  border-color: var(--border-strong);
  background:
    repeating-linear-gradient(90deg, transparent 0 31px, var(--border) 31px 32px),
    var(--surface-solid);
}

.loop-selection {
  background: var(--art-copper);
  box-shadow: 0 -4px 0 color-mix(in srgb, var(--art-copper) 14%, transparent),
    0 4px 0 color-mix(in srgb, var(--art-copper) 14%, transparent);
}

.loop-values span:nth-child(2),
.control output,
.site-footer a {
  color: var(--art-copper);
}

.playback-body {
  background:
    linear-gradient(116deg, transparent 0 58%, var(--accent-soft) 58% 58.2%, transparent 58.2%),
    var(--surface);
}

.control {
  min-height: 62px;
  padding: 0 14px;
  border: 1px solid var(--border);
  background: var(--surface-solid);
}

.transport-row {
  padding-top: 18px;
  border-top: 1px solid var(--border-strong);
}

.button-primary:hover,
.button-primary:focus-visible {
  background: var(--art-copper);
  color: var(--primary-text);
}

.site-footer {
  padding-top: 18px;
  border-top: 1px solid var(--border-strong);
}

@media (max-width: 720px) {
  :root {
    --topbar-height: 88px;
  }

  body {
    /* Two compact rows keep every site destination available on small screens. */
    padding-top: calc(var(--topbar-height) + 10px);
  }

  .topbar {
    position: fixed;
    height: var(--topbar-height);
    min-height: 0;
  }

  .topbar__inner {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: 54px 34px;
    width: calc(100% - 24px);
    min-height: var(--topbar-height);
    padding: 0;
    gap: 10px;
    align-items: center;
  }

  .wordmark {
    grid-column: 1;
    grid-row: 1;
  }

  .rama-site-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    align-self: stretch;
    border-top: 1px solid var(--border);
    gap: 10px;
    justify-content: space-between;
  }

  .art-controls {
    grid-column: 2;
    grid-row: 1;
    width: auto;
    flex-wrap: nowrap;
  }

  .guide-drawer {
    top: var(--topbar-height);
    padding: 20px;
  }

  .instrument-stage {
    width: calc(100% - 24px);
    margin: 18px auto 28px;
    /* Rear-frame padding is paused with the desktop frame. */
  }

  .machine-shell {
    width: 100%;
    padding: 18px;
  }

  .title-row p {
    padding-left: 12px;
  }
}

@media (max-width: 460px) {
  body {
    padding-top: calc(var(--topbar-height) + 10px);
  }

  /* The shorter label gives the controls enough room on a narrow phone. */
  .wordmark__context {
    display: none;
  }

  .topbar-action {
    flex: 0 0 auto;
    padding: 0 7px;
  }

  .instrument-stage {
    margin-top: 16px;
  }

  .machine-shell {
    padding: 12px;
  }

  .page-head {
    padding-top: 0;
  }

  .panel-head {
    min-height: 43px;
  }

  .drop-label {
    font-size: 19px;
  }

  .control {
    padding: 10px;
  }
}
