/* ============================================
   timb.us — Industrial Control Panel Styles
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: #1a1a1a;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  font-family: "Courier New", Courier, monospace;
  overflow-x: hidden;
  padding: 20px;
}

/* --- Chassis --- */
.chassis {
  position: relative;
  width: 960px;
  max-width: 100%;
  background:
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 1px,
      rgba(255,255,255,0.03) 1px,
      rgba(255,255,255,0.03) 2px
    ),
    linear-gradient(180deg, #b0b0b0 0%, #8a8a8a 40%, #909090 60%, #a0a0a0 100%);
  border-radius: 8px;
  padding: 20px;
  box-shadow:
    0 0 0 2px #606060,
    0 0 0 4px #404040,
    0 4px 20px rgba(0,0,0,0.6),
    inset 0 1px 0 rgba(255,255,255,0.3),
    inset 0 -1px 0 rgba(0,0,0,0.2);
}

/* --- Rivets --- */
.rivet {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #c0c0c0, #707070 60%, #505050);
  box-shadow:
    inset 0 1px 2px rgba(255,255,255,0.4),
    0 1px 2px rgba(0,0,0,0.5);
  z-index: 10;
}
.rivet::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, #a0a0a0, #606060);
}
.rivet-tl { top: 12px; left: 12px; }
.rivet-tr { top: 12px; right: 12px; }
.rivet-bl { bottom: 12px; left: 12px; }
.rivet-br { bottom: 12px; right: 12px; }

/* --- Screws --- */
.screw {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #b0b0b0, #606060 70%);
  box-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.screw::after {
  content: "";
  position: absolute;
  top: 6px;
  left: 2px;
  width: 10px;
  height: 2px;
  background: #404040;
  border-radius: 1px;
}
.screw-bl { bottom: 12px; left: 50px; }
.screw-br { bottom: 12px; right: 50px; }

/* --- Ventilation Slots --- */
.vent-slots {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 6px 0;
}
.vent-slot {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: #404040;
  box-shadow:
    inset 0 1px 2px rgba(0,0,0,0.6),
    0 1px 0 rgba(255,255,255,0.15);
}

/* --- Nameplate --- */
.nameplate {
  display: flex;
  justify-content: center;
  margin: 10px 0 16px;
}
.nameplate-inner {
  background:
    linear-gradient(180deg, #d0d0d0 0%, #b8b8b8 50%, #c0c0c0 100%);
  border: 1px solid #808080;
  border-radius: 3px;
  padding: 10px 30px;
  text-align: center;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.5),
    0 2px 4px rgba(0,0,0,0.3);
}
.nameplate-title {
  font-size: 24px;
  font-weight: bold;
  letter-spacing: 8px;
  color: #1a1a1a;
  text-shadow: 0 1px 0 rgba(255,255,255,0.4);
}
.nameplate-subtitle {
  font-size: 11px;
  letter-spacing: 4px;
  color: #404040;
  margin-top: 2px;
}
.nameplate-model {
  font-size: 9px;
  letter-spacing: 2px;
  color: #606060;
  margin-top: 6px;
  border-top: 1px solid #a0a0a0;
  padding-top: 4px;
}

/* --- Panel Body --- */
.panel-body {
  display: flex;
  gap: 20px;
  background: #2a2a2a;
  border-radius: 4px;
  padding: 20px;
  box-shadow:
    inset 0 2px 6px rgba(0,0,0,0.5),
    0 1px 0 rgba(255,255,255,0.1);
}

/* --- CRT Section --- */
.crt-section {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.crt-bezel {
  background: radial-gradient(ellipse at 30% 30%, #3a3a3a, #1a1a1a 70%);
  border-radius: 24px;
  padding: 16px;
  box-shadow:
    0 0 0 3px #404040,
    0 0 0 5px #1a1a1a,
    inset 0 2px 8px rgba(0,0,0,0.8),
    0 4px 12px rgba(0,0,0,0.5);
}

.crt-inner {
  position: relative;
  width: 480px;
  height: 480px;
  border-radius: 12px;
  overflow: hidden;
  background: #0a1a0a;
}

#crt-main, #crt-bloom {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 12px;
}

#crt-bloom {
  filter: blur(4px);
  mix-blend-mode: screen;
  opacity: 0.5;
  pointer-events: none;
}

.graticule {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  pointer-events: none;
  /* Graticule is drawn by JS on the main canvas */
}

.scanlines {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.08) 2px,
    rgba(0,0,0,0.08) 4px
  );
  pointer-events: none;
  z-index: 3;
}

.crt-glass {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  background: radial-gradient(
    ellipse at 35% 30%,
    rgba(255,255,255,0.06) 0%,
    transparent 60%
  );
  pointer-events: none;
  z-index: 4;
}

.crt-label {
  margin-top: 10px;
  font-size: 11px;
  letter-spacing: 3px;
  color: #e0e0e0;
  text-transform: uppercase;
}

/* --- BNC Connectors --- */
.bnc-row {
  display: flex;
  gap: 20px;
  margin-top: 12px;
}
.bnc-connector {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.bnc-ring {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #b0b0b0, #505050 70%);
  box-shadow:
    inset 0 -1px 2px rgba(0,0,0,0.4),
    0 1px 3px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}
.bnc-center {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #d0a020;
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.3);
}
.bnc-label {
  font-size: 8px;
  color: #e0e0e0;
  letter-spacing: 1px;
  margin-top: 4px;
}

/* --- Controls Section --- */
.controls-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* --- Readout Panel --- */
.readout-panel {
  display: flex;
  flex-direction: column;
}
.readout-label {
  font-size: 10px;
  letter-spacing: 3px;
  color: #e0e0e0;
  margin-bottom: 6px;
}
.readout-screen {
  background: #0a1a0a;
  border: 2px solid #404040;
  border-radius: 3px;
  padding: 12px;
  min-height: 140px;
  max-height: 200px;
  overflow-y: auto;
  box-shadow:
    inset 0 2px 6px rgba(0,0,0,0.6),
    0 1px 0 rgba(255,255,255,0.05);
}
.readout-text {
  font-family: "Courier New", Courier, monospace;
  font-size: 13px;
  line-height: 1.5;
  color: #39ff14;
  text-shadow: 0 0 4px rgba(57, 255, 20, 0.4);
  white-space: pre-wrap;
}

/* --- Selector Section --- */
.selector-section {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.selector-label {
  font-size: 10px;
  letter-spacing: 3px;
  color: #e0e0e0;
  margin-bottom: 10px;
}

.selector-ring {
  position: relative;
  width: 180px;
  height: 180px;
}

.selector-position {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  user-select: none;
}
.selector-position:hover .selector-dot {
  background: #39ff14;
  box-shadow: 0 0 6px #39ff14;
}

/* Position the 4 selector positions around the knob: top, right, bottom, left */
.selector-position[data-mode="about"] {
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
}
.selector-position[data-mode="projects"] {
  right: -12px;
  top: 50%;
  transform: translateY(-50%);
}
.selector-position[data-mode="resume"] {
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
}
.selector-position[data-mode="contact"] {
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
}

.selector-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #808080;
  transition: all 0.2s;
}
.selector-position.active .selector-dot {
  background: #39ff14;
  box-shadow: 0 0 8px #39ff14;
}

.selector-pos-label {
  font-size: 9px;
  letter-spacing: 2px;
  color: #e0e0e0;
  margin-top: 2px;
  white-space: nowrap;
}

/* Knob */
.knob {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background:
    conic-gradient(
      from 0deg,
      #707070, #909090 10%, #606060 20%, #808080 30%,
      #707070 40%, #909090 50%, #606060 60%, #808080 70%,
      #707070 80%, #909090 90%, #606060 100%
    );
  box-shadow:
    0 2px 8px rgba(0,0,0,0.5),
    inset 0 1px 2px rgba(255,255,255,0.2),
    inset 0 -1px 2px rgba(0,0,0,0.3),
    0 0 0 3px #404040;
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.knob-indicator {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  height: 16px;
  background: #e0e0e0;
  border-radius: 1px;
  box-shadow: 0 0 4px rgba(255,255,255,0.3);
}

/* Knob rotation states */
.knob[data-angle="0"]   { transform: translate(-50%, -50%) rotate(0deg); }
.knob[data-angle="90"]  { transform: translate(-50%, -50%) rotate(90deg); }
.knob[data-angle="180"] { transform: translate(-50%, -50%) rotate(180deg); }
.knob[data-angle="270"] { transform: translate(-50%, -50%) rotate(270deg); }

/* --- LED Row --- */
.led-row {
  display: flex;
  gap: 20px;
  justify-content: center;
  padding: 8px 0;
}
.led-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.led {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid #404040;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.5);
}
.led-label {
  font-size: 8px;
  letter-spacing: 2px;
  color: #e0e0e0;
}

/* LED colors */
.led-power {
  background: radial-gradient(circle at 40% 35%, #600000, #300000);
}
.led-power.on {
  background: radial-gradient(circle at 40% 35%, #ff3333, #cc0000);
  box-shadow:
    0 0 6px #cc0000,
    0 0 12px rgba(204,0,0,0.4),
    inset 0 1px 2px rgba(255,255,255,0.2);
}

.led-signal {
  background: radial-gradient(circle at 40% 35%, #1a3300, #0a1a00);
}
.led-signal.on {
  background: radial-gradient(circle at 40% 35%, #66ff33, #33cc00);
  box-shadow:
    0 0 6px #33cc00,
    0 0 12px rgba(51,204,0,0.4),
    inset 0 1px 2px rgba(255,255,255,0.2);
}

.led-trig {
  background: radial-gradient(circle at 40% 35%, #332200, #1a1100);
}
.led-trig.on {
  background: radial-gradient(circle at 40% 35%, #ff8833, #ff6600);
  box-shadow:
    0 0 6px #ff6600,
    0 0 12px rgba(255,102,0,0.4),
    inset 0 1px 2px rgba(255,255,255,0.2);
}

.led-ready {
  background: radial-gradient(circle at 40% 35%, #1a3300, #0a1a00);
}
.led-ready.on {
  background: radial-gradient(circle at 40% 35%, #66ff33, #33cc00);
  box-shadow:
    0 0 6px #33cc00,
    0 0 12px rgba(51,204,0,0.4),
    inset 0 1px 2px rgba(255,255,255,0.2);
}

/* --- Toggle Switches --- */
.toggle-section {
  margin-top: auto;
}
.toggle-label-header {
  font-size: 10px;
  letter-spacing: 3px;
  color: #e0e0e0;
  margin-bottom: 10px;
  text-align: center;
}

.toggle-row {
  display: flex;
  justify-content: center;
  gap: 28px;
}

.toggle-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.toggle-switch {
  cursor: pointer;
  user-select: none;
}

.toggle-body {
  width: 20px;
  height: 32px;
  background: linear-gradient(180deg, #505050, #2a2a2a);
  border-radius: 3px;
  position: relative;
  box-shadow:
    inset 0 1px 2px rgba(0,0,0,0.5),
    0 1px 0 rgba(255,255,255,0.05);
  display: flex;
  justify-content: center;
}

.toggle-bat {
  position: absolute;
  top: -10px;
  width: 8px;
  height: 22px;
  background: linear-gradient(90deg, #c0c0c0, #909090);
  border-radius: 3px 3px 2px 2px;
  box-shadow:
    0 -2px 4px rgba(0,0,0,0.3),
    inset 0 1px 0 rgba(255,255,255,0.3);
  transition: transform 0.15s ease-in-out;
  transform-origin: bottom center;
}

.toggle-switch.flipped .toggle-bat {
  top: auto;
  bottom: -10px;
  transform: rotate(180deg);
  background: linear-gradient(90deg, #909090, #c0c0c0);
}

.toggle-name {
  font-size: 8px;
  letter-spacing: 2px;
  color: #e0e0e0;
  text-align: center;
}

/* --- Responsive --- */
@media (max-width: 900px) {
  .panel-body {
    flex-direction: column;
    align-items: center;
  }
  .crt-inner,
  #crt-main,
  #crt-bloom {
    width: 360px;
    height: 360px;
  }
  .crt-bezel {
    padding: 12px;
  }
  .selector-ring {
    width: 160px;
    height: 160px;
  }
  .readout-screen {
    min-height: 100px;
  }
}

@media (max-width: 500px) {
  body {
    padding: 8px;
  }
  .chassis {
    padding: 12px;
  }
  .crt-inner,
  #crt-main,
  #crt-bloom {
    width: 280px;
    height: 280px;
  }
  .nameplate-title {
    font-size: 18px;
    letter-spacing: 4px;
  }
  .nameplate-subtitle {
    font-size: 9px;
    letter-spacing: 2px;
  }
  .panel-body {
    padding: 12px;
    gap: 14px;
  }
  .selector-ring {
    width: 140px;
    height: 140px;
  }
  .knob {
    width: 60px;
    height: 60px;
  }
}
