@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=IBM+Plex+Mono:wght@300;400;600&display=swap');

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

:root {
  --black:        #0a0a0a;
  --white:        #f5f2e8;
  --red:          #D42B2B;
  --blue:         #1B3A8C;
  --yellow:       #F5C800;
  --gray:         #8a8a8a;
  --border:       3px solid var(--black);
  --border-thick: 6px solid var(--black);
}

/* ── Base ── */
body {
  background: var(--white);
  font-family: 'IBM Plex Mono', monospace;
  color: var(--black);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ── */
header {
  border-bottom: var(--border-thick);
  display: grid;
  grid-template-columns: 6px 1fr 6px;
  background: var(--white);
}
.header-bar-left  { background: var(--red);  border-right: var(--border-thick); }
.header-bar-right { background: var(--blue); border-left:  var(--border-thick); }
.header-inner {
  padding: 18px 28px 14px;
  display: flex;
  align-items: baseline;
  gap: 18px;
}
h1 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2.8rem;
  letter-spacing: 0.08em;
  line-height: 1;
}
.subtitle {
  font-size: 0.62rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--gray);
  padding-bottom: 2px;
}

/* ── Layout ── */
main {
  display: grid;
  grid-template-columns: 280px 1fr;
  flex: 1;
}

/* ── Controls sidebar ── */
#controls {
  border-right: var(--border-thick);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.section {
  border-bottom: var(--border);
}

/* summary IS the section title — reset browser defaults */
.section-title {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  font-size: 0.58rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gray);
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid transparent;
  transition: background 0.1s, border-color 0.15s;
}
.section-title::-webkit-details-marker { display: none; }
.section-title::marker               { display: none; }

/* chevron via ::after */
.section-title::after {
  content: '▸';
  font-size: 0.6rem;
  transition: transform 0.2s;
  color: var(--gray);
}
details[open] > .section-title::after {
  transform: rotate(90deg);
}

.section-title:hover {
  background: #edeae0;
  color: var(--black);
  border-color: #ccc;
}
details[open] > .section-title {
  border-bottom-color: #ccc;
  color: var(--black);
}

.section-body {
  padding: 14px 18px 16px;
}

/* ── Background swatches ── */
.bg-swatches {
  display: grid;
  grid-template-columns: repeat(5, 36px);
  gap: 6px;
}
.bg-swatch {
  width: 36px; height: 36px;
  border: var(--border);
  cursor: pointer;
  transition: transform 0.1s;
  position: relative;
}
.bg-swatch:hover { transform: scale(1.12); }
.bg-swatch.active::after {
  content: '';
  position: absolute;
  inset: -5px;
  border: 3px solid var(--black);
  pointer-events: none;
}

/* ── Palette ── */
.palette-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.color-slot {
  width: 32px; height: 32px;
  border: var(--border);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
.color-slot input[type=color] {
  position: absolute;
  inset: 0;
  width: 130%; height: 130%;
  top: -15%; left: -15%;
  border: none; padding: 0;
  cursor: pointer;
  opacity: 0;
}
.color-label {
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  color: var(--gray);
  flex: 1;
}
.color-remove {
  margin-left: auto;
  background: none; border: none;
  font-size: 1rem;
  cursor: pointer;
  color: var(--gray);
  line-height: 1;
  padding: 0 2px;
}
.color-remove:hover { color: var(--red); }

.btn-add {
  width: 100%;
  margin-top: 4px;
  padding: 7px;
  border: var(--border);
  background: var(--white);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-add:hover { background: var(--yellow); }

/* ── Presets ── */
.preset-btn {
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  margin-bottom: 6px;
  border: var(--border);
  background: var(--white);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.12s;
}
.preset-btn:hover { background: #e8e8e0; }
.preset-dots { display: flex; gap: 3px; }
.preset-dot  { width: 12px; height: 12px; border: 1px solid #0006; }

/* ── Sliders ── */
.slider-row { margin-bottom: 10px; }
.slider-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gray);
  margin-bottom: 5px;
}
input[type=range] {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  background: var(--black);
  cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  background: var(--white);
  border: var(--border);
  border-radius: 0;
}
input[type=range]::-moz-range-thumb {
  width: 14px; height: 14px;
  background: var(--white);
  border: var(--border);
  border-radius: 0;
}

/* ── Buttons ── */
.btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.btn {
  flex: 1;
  padding: 12px 8px;
  border: var(--border);
  background: var(--white);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.12s, transform 0.1s;
  min-width: 80px;
}
.btn:hover  { background: var(--yellow); }
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--black); color: var(--white); }
.btn.primary:hover { background: var(--red); }
.btn.blue  { background: var(--blue); color: var(--white); }
.btn.blue:hover { background: #0f2a6a; }

select.btn {
  -webkit-appearance: none;
  appearance: none;
  flex: 0 0 auto;
  padding: 12px 6px;
  min-width: 0;
  text-align: center;
  cursor: pointer;
}

/* ── Canvas area ── */
#canvas-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: repeating-linear-gradient(
    45deg,
    #e8e5dc 0px, #e8e5dc 1px,
    transparent 1px, transparent 10px
  );
  min-height: 500px;
}
canvas {
  border: var(--border-thick);
  box-shadow: 8px 8px 0 var(--black);
  display: block;
  max-width: 100%;
  max-height: 70vh;
}

/* ── Footer ── */
footer {
  border-top: var(--border-thick);
  padding: 8px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
#anim-controls {
  display: flex;
  align-items: center;
  gap: 14px;
}
.anim-speed-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.anim-speed-label {
  font-size: 0.58rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gray);
}
.anim-speed-row input[type=range] {
  width: 100px;
}
.anim-speed-row span:last-child {
  font-size: 0.58rem;
  color: var(--gray);
  min-width: 16px;
}
.btn-play {
  width: 36px; height: 36px;
  border: var(--border);
  background: var(--white);
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, transform 0.1s;
  line-height: 1;
  padding: 0;
}
.btn-play:hover  { background: var(--yellow); }
.btn-play:active { transform: scale(0.93); }
.footer-accent { display: flex; }
.fa  { width: 16px; height: 16px; }
.fa-r { background: var(--red); }
.fa-b { background: var(--blue); }
.fa-y { background: var(--yellow); }
