/* ── layout.css — Two-panel grid layout ── */

/* ── Fonts ── */

@font-face {
  font-family: "Orbitron";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("../assets/fonts/Orbitron.ttf") format("truetype");
}

@font-face {
  font-family: "Seven Segment";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/Seven Segment.ttf") format("truetype");
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  display: grid;
  grid-template-columns: 520px 1fr;
  height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-display, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
}

/* ── Left Panel — Global Controls ── */

.panel-left {
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 16px;
  background: var(--bg-2, #1a1a1a);
  border-right: 1px solid var(--bg-7, #333);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel-left h1 {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  opacity: 0.8;
  margin-bottom: 0;
}

.version-tag {
  font: 400 10px/1 var(--font-display, system-ui, sans-serif);
  color: var(--fg);
  opacity: 0.35;
  letter-spacing: 0.04em;
}

.panel-left .control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.panel-left .control-group label {
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.45;
}

.panel-left .spacer {
  flex: 1;
}

/* ── Palette selector (smaller text for 5-col grid) ── */

#paletteSelect {
  --seg-font-size: 11px;
  --seg-padding: 6px 4px;
}

/* ── Side-by-side control rows ── */

.ctrl-row {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.ctrl-row > .control-group {
  flex: 1;
  min-width: 0;
}

/* ── Right Panel ── */

.panel-right {
  height: 100vh;
  overflow: hidden;
  padding: 12px;
  min-height: 0;
}

/* ── 2×2 variant grid ── */

.variant-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 12px;
  height: 100%;
}

/* ── Variant panels (swatch view) ── */

.variant-panel {
  background: var(--bg, #1a1a1a);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
}

.variant-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 2px;
  opacity: 0.7;
}

/* ── Swatch rows ── */

.swatch-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.swatch-label {
  font-size: 0.6rem;
  opacity: 0.5;
  min-width: 52px;
  text-align: right;
  flex-shrink: 0;
}

.swatch-strip {
  display: flex;
  flex: 1;
  gap: 2px;
  height: 18px;
}

.swatch {
  flex: 1;
  border-radius: 3px;
  cursor: default;
  transition: transform 0.1s;
}

.swatch:hover {
  transform: scaleY(1.4);
  z-index: 1;
}

/* ── Layout preview cards ── */

.layout-card {
  border-radius: 10px;
  padding: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.layout-panel {
  border-radius: 8px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.85rem;
  flex: 1;
  overflow: hidden;
  justify-content: center;
}

.layout-title-row {
  display: flex;
  gap: 1em;
}

.layout-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1.3;
}

.layout-heading {
  font-size: 0.82rem;
  font-weight: 600;
  margin: 0;
}

.layout-heading span {
  margin-right: 0.8em;
}

.layout-text {
  font-size: 0.78rem;
  margin: 0;
  line-height: 1.4;
}

.layout-text span {
  margin-right: 1em;
}

/* ── Layout pseudo-3D buttons ── */

.layout-btn-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.layout-btn {
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 5px;
  cursor: default;
  letter-spacing: 0.02em;
  white-space: nowrap;
  border: none;
}

/* ── Layout slider / progress bar ── */

.layout-slider {
  position: relative;
  width: 100%;
  height: 16px;
  margin: 4px 0;
}

.layout-slider-track {
  position: absolute;
  top: 5px;
  left: 0;
  right: 0;
  height: 6px;
  border-radius: 3px;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.5);
}

.layout-slider-fill {
  position: absolute;
  top: 5px;
  left: 0;
  height: 6px;
  border-radius: 3px;
}

.layout-slider-thumb {
  position: absolute;
  top: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  transform: translateX(-50%);
}

/* ── Layout glowing text ── */

.layout-glow {
  font-size: 0.82rem;
  font-weight: 700;
}

.layout-glow span {
  margin-right: 1em;
}

/* ── Mode buttons ── */

.mode-buttons {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.mode-btn {
  font-family: inherit;
  font-size: 0.68rem;
  padding: 5px 10px;
  border: 1px solid var(--bg-5, #444);
  border-radius: 4px;
  background: var(--bg-3, #2a2a2a);
  color: var(--fg-2, #aaa);
  cursor: pointer;
  transition: all 0.15s;
}

.mode-btn:hover {
  background: var(--bg-5, #3a3a3a);
  color: var(--fg, #eee);
}

.mode-btn.active {
  background: var(--fg, #eee);
  color: #111;
  border-color: var(--fg, #eee);
  font-weight: 700;
}

/* ── Toggle group ── */

.toggle-group {
  display: inline-flex;
  gap: 4px;
}

.toggle-btn {
  font-family: inherit;
  font-size: 0.65rem;
  padding: 4px 8px;
  border: 1px solid var(--bg-5, #444);
  border-radius: 3px;
  background: var(--bg-3, #2a2a2a);
  color: var(--fg-2, #aaa);
  cursor: pointer;
  transition: all 0.15s;
}

.toggle-btn:hover {
  background: var(--bg-5, #3a3a3a);
  color: var(--fg, #eee);
}

.toggle-btn.active {
  background: var(--fg, #eee);
  color: #111;
  border-color: var(--fg, #eee);
  font-weight: 700;
}

.toggle-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

/* ── Action buttons ── */

.action-btn {
  padding: 8px 14px;
  font: 500 12px/1 system-ui, sans-serif;
  color: var(--fg, #e8e8e8);
  background: var(--bg-3, #2a2a2a);
  border: 1px solid var(--bg-7, #444);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.action-btn:hover {
  background: var(--bg-5, #3a3a3a);
}

/* ── Palette metadata fields ── */

.meta-fields {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.meta-input {
  min-width: 0;
  width: 100%;
  padding: 5px 8px;
  font: 12px/1 system-ui, sans-serif;
  background: var(--bg-3, #2a2a2a);
  color: var(--fg, #e8e8e8);
  border: 1px solid var(--bg-7, #444);
  border-radius: 4px;
}

.meta-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Info note ── */

.disable-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 0.75rem;
  opacity: 0.7;
  user-select: none;
}

.disable-toggle:hover {
  opacity: 1;
}

.disable-toggle input[type="checkbox"] {
  accent-color: var(--primary-1, #888);
  cursor: pointer;
}

.info-note {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-note-text {
  display: none;
  font-size: 0.7rem;
  line-height: 1.5;
  opacity: 0.75;
}

.info-note-text p {
  margin: 0 0 6px 0;
}

.info-note-text p:last-child {
  margin-bottom: 0;
}

.info-note-text a {
  color: var(--primary-1, #88aacc);
  text-decoration: underline;
}

/* ── Lightness sliders ── */

.slider-grid {
  display: grid;
  grid-template-columns: 52px 1fr 30px;
  gap: 4px 8px;
  align-items: center;
}

.slider-label {
  font-size: 0.6rem;
  opacity: 0.6;
  text-align: right;
  white-space: nowrap;
}

.slider-val {
  font: 11px/1 monospace;
  opacity: 0.7;
  text-align: center;
}

.range-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--bg-5, #333);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--fg-2, #aaa);
  border: 2px solid var(--bg-7, #555);
  cursor: pointer;
}

.range-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--fg-2, #aaa);
  border: 2px solid var(--bg-7, #555);
  cursor: pointer;
}

/* ── Picker row ── */

.picker-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.picker-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.picker-label-row {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
}

.swatch-preview {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  border: 1px solid var(--bg-7, #444);
  flex-shrink: 0;
}

.hex-input {
  width: 64px;
  padding: 3px 6px;
  font: 11px/1 monospace;
  background: var(--bg-3, #2a2a2a);
  color: var(--fg, #e8e8e8);
  border: 1px solid var(--bg-7, #444);
  border-radius: 4px;
  text-align: center;
}

.variant-grid.mobile-mode {
  display: flex;
  align-items: center;
  justify-content: center;
  grid-template-columns: unset;
  grid-template-rows: unset;
}

.variant-grid.procedural-mode {
  display: block;
  grid-template-columns: unset;
  grid-template-rows: unset;
  position: relative;
  overflow: hidden;
}

.synthwave-canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
}

/* ── Mobile mockup mode ── */

.mobile-grid {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  width: 100%;
  height: 100%;
  padding: 16px;
}

.phone-frame {
  width: min(320px, 44vh);
  height: min(88%, 640px);
  aspect-ratio: 9 / 17;
  border-radius: 28px;
  border: 3px solid #555;
  padding: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow:
    0 8px 32px rgba(0,0,0,0.5),
    inset 0 0 0 1px rgba(255,255,255,0.06);
  position: relative;
}

.phone-notch {
  width: 60px;
  height: 6px;
  border-radius: 3px;
  margin: 4px auto 6px;
  opacity: 0.4;
}

.phone-screen {
  flex: 1;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 12px 10px 8px;
  gap: 8px;
}

.phone-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px 6px;
}

.phone-title {
  font-size: 0.82rem;
  font-weight: 700;
}

.phone-subtitle {
  font-size: 0.55rem;
  opacity: 0.6;
}

.phone-card {
  border-radius: 10px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.phone-card-title {
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.7;
}

.phone-stat-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.phone-stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1;
}

.phone-stat-unit {
  font-size: 0.55rem;
  opacity: 0.6;
}

.phone-bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 50px;
  padding-top: 4px;
}

.phone-bar {
  flex: 1;
  border-radius: 3px 3px 0 0;
  min-height: 4px;
}

.phone-bar-labels {
  display: flex;
  gap: 3px;
}

.phone-bar-labels span {
  flex: 1;
  text-align: center;
  font-size: 0.42rem;
  opacity: 0.5;
}

.phone-progress-ring {
  width: 70px;
  height: 70px;
  margin: 0 auto;
}

.phone-ring-bg {
  fill: none;
  stroke-width: 6;
  opacity: 0.2;
}

.phone-ring-fill {
  fill: none;
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.3s;
}

.phone-ring-text {
  font-size: 10px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: central;
}

.phone-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
}

.phone-list-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 700;
  flex-shrink: 0;
}

.phone-list-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.phone-list-primary {
  font-size: 0.62rem;
  font-weight: 600;
}

.phone-list-secondary {
  font-size: 0.48rem;
  opacity: 0.5;
}

.phone-nav {
  display: flex;
  justify-content: space-around;
  padding: 6px 0 0;
  margin-top: auto;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.phone-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 0.44rem;
  opacity: 0.5;
}

.phone-nav-item.active {
  opacity: 1;
}

.phone-nav-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.55rem;
}

.phone-pill-row {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.phone-pill {
  font-size: 0.5rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 10px;
}

.phone-mini-card {
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.phone-mini-title {
  font-size: 0.52rem;
  font-weight: 600;
  opacity: 0.7;
}

.phone-mini-value {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}

.phone-mini-sub {
  font-size: 0.44rem;
  opacity: 0.5;
}

.phone-row {
  display: flex;
  gap: 6px;
}

.phone-row > * {
  flex: 1;
}

.phone-macros {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 2px;
}

.phone-macro-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.phone-macro-row span {
  width: 28px;
  flex-shrink: 0;
}

.phone-macro-bar {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  overflow: hidden;
}

.phone-mind-chip {
  border-radius: 8px;
  padding: 6px 4px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.phone-mind-val {
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1;
}

.phone-mind-label {
  font-size: 0.4rem;
  opacity: 0.6;
}
