/* Piltekoder – steampunk theme. Materials over effects: gradients only as
   metal shading, motion only when the machine answers an action. */

@import url("https://fonts.googleapis.com/css2?family=Rye&family=Special+Elite&display=swap");

:root {
  --wood: #2b1a10;
  --wood-light: #4a2c18;
  --brass: #c9a24a;
  --brass-light: #efd98a;
  --brass-dark: #7a5a1e;
  --copper: #a2522b;
  --copper-dark: #5e2d14;
  --steel: #4a4d52;
  --steel-dark: #26282b;
  --cream: #f1e3c0;
  --ink: #1a1208;
  --glow-green: #7dff6a;
  --glow-red: #ff4a3a;
  --font-display: "Rye", "Georgia", serif;
  --font-plate: "Special Elite", "Courier New", monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; min-height: 100%; }

body {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 220, 150, 0.08), transparent 60%),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.12) 0 2px, transparent 2px 23px),
    linear-gradient(180deg, var(--wood-light), var(--wood) 40%, #1c100a);
  color: var(--cream);
  font-family: var(--font-plate);
  font-size: 18px;
  line-height: 1.45;
}

.title {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--brass-light);
  text-shadow: 0 1px 0 var(--brass-dark), 0 3px 8px rgba(0, 0, 0, 0.7);
  margin: 0;
}

/* Pipe frame: copper pipes running along the viewport edges. */
.pipe-frame {
  position: relative;
  min-height: 100vh;
  padding: 28px;
}
.pipe-frame::before,
.pipe-frame::after {
  content: "";
  position: fixed;
  inset: 8px;
  pointer-events: none;
  z-index: 50;
  border: 10px solid transparent;
  border-image: linear-gradient(90deg, var(--copper-dark), var(--copper), #e08a5a, var(--copper), var(--copper-dark)) 1;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.5), 0 0 0 2px rgba(0, 0, 0, 0.5);
}
.pipe-frame::after {
  inset: 18px;
  border-width: 3px;
  border-image: none;
  border-color: var(--brass-dark);
  box-shadow: none;
}

/* Brass plate with rivets. */
.plate {
  position: relative;
  background:
    linear-gradient(170deg, var(--brass-light) 0%, var(--brass) 35%, #a9843a 70%, var(--brass-dark) 100%);
  color: var(--ink);
  border: 2px solid var(--brass-dark);
  border-radius: 6px;
  padding: 22px 24px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    inset 0 -2px 0 rgba(0, 0, 0, 0.35),
    0 10px 24px rgba(0, 0, 0, 0.55);
}
.plate--copper {
  background: linear-gradient(170deg, #e08a5a 0%, var(--copper) 40%, #7a3b1c 75%, var(--copper-dark) 100%);
  border-color: var(--copper-dark);
  color: var(--cream);
}
.plate::before,
.plate::after,
.plate > .rivets::before,
.plate > .rivets::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff2c0, var(--brass) 45%, var(--brass-dark) 100%);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.6), inset 0 -1px 1px rgba(0, 0, 0, 0.4);
}
.plate::before { top: 7px; left: 7px; }
.plate::after { top: 7px; right: 7px; }
.plate > .rivets::before { bottom: 7px; left: 7px; }
.plate > .rivets::after { bottom: 7px; right: 7px; }

.plate .title { color: var(--ink); text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35); }

/* Engraved input slot. */
.slot-input {
  width: 100%;
  font: inherit;
  font-size: 1.35em;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cream);
  background: linear-gradient(180deg, #111, #222 60%, #1a1a1a);
  border: 2px solid var(--brass-dark);
  border-radius: 4px;
  padding: 8px 12px;
  box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.9), 0 1px 0 rgba(255, 255, 255, 0.3);
  outline: none;
}
.slot-input:focus-visible { border-color: var(--brass-light); box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.9), 0 0 0 3px rgba(239, 217, 138, 0.5); }
.slot-input::placeholder { color: #6b6250; letter-spacing: 0.05em; text-transform: none; }

/* Lever: a brass handle. */
.lever {
  font: inherit;
  font-size: 1em;
  color: var(--ink);
  background: linear-gradient(180deg, var(--brass-light), var(--brass) 50%, var(--brass-dark));
  border: 2px solid var(--brass-dark);
  border-radius: 999px;
  padding: 8px 22px;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--brass-dark), 0 6px 10px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: transform 80ms, box-shadow 80ms;
}
.lever:hover { filter: brightness(1.05); }
.lever:active, .lever.is-pulled {
  transform: translateY(4px);
  box-shadow: 0 0 0 var(--brass-dark), 0 2px 4px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.lever:disabled { cursor: not-allowed; filter: saturate(0.4) brightness(0.8); transform: none; }
.lever:focus-visible { outline: 3px solid var(--cream); outline-offset: 2px; }

/* Edison lamp: a small glass bulb in a brass socket. */
.lamp {
  display: inline-block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #555, #222 70%);
  border: 3px solid var(--brass-dark);
  box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.8), 0 1px 2px rgba(0, 0, 0, 0.5);
  transition: background 150ms, box-shadow 150ms;
  vertical-align: middle;
}
.lamp--green.lamp--on {
  background: radial-gradient(circle at 40% 35%, #fff, var(--glow-green) 50%, #2a8a1a);
  box-shadow: 0 0 10px var(--glow-green), 0 0 24px rgba(125, 255, 106, 0.6);
}
.lamp--red.lamp--on {
  background: radial-gradient(circle at 40% 35%, #fff, var(--glow-red) 50%, #8a1a10);
  box-shadow: 0 0 10px var(--glow-red), 0 0 24px rgba(255, 74, 58, 0.6);
}
.lamp--big { width: 40px; height: 40px; border-width: 4px; }

/* Valve: a hand wheel that turns closed. */
.valve {
  display: inline-block;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 6px solid var(--copper);
  position: relative;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.6), inset 0 0 0 2px var(--copper-dark);
  transition: transform 700ms cubic-bezier(0.2, 0.9, 0.3, 1.1);
  background: radial-gradient(circle, var(--brass-dark) 0 20%, transparent 21%);
}
.valve::before, .valve::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 100%; height: 5px;
  background: var(--copper);
  transform: translate(-50%, -50%);
}
.valve::after { transform: translate(-50%, -50%) rotate(90deg); }
.valve--closed { transform: rotate(270deg); }

/* Gauge host: the SVG from gauge.js sits inside. */
.gauge { display: inline-block; filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.6)); }
.gauge .needle { transition: transform 800ms cubic-bezier(0.3, 1.4, 0.4, 1); transform-origin: 50% 50%; }

/* Hanging brass tag. */
.tag {
  display: inline-block;
  background: linear-gradient(180deg, var(--brass-light), var(--brass));
  color: var(--ink);
  border: 2px solid var(--brass-dark);
  border-radius: 4px 4px 14px 14px;
  padding: 6px 18px 8px;
  font-size: 1.1em;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
}

/* Small round brass button for the mute toggle. */
.knob {
  font: inherit;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 2px solid var(--brass-dark);
  background: radial-gradient(circle at 35% 30%, var(--brass-light), var(--brass) 50%, var(--brass-dark));
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.6);
  font-size: 1.2em;
}
.knob:focus-visible { outline: 3px solid var(--cream); outline-offset: 2px; }

/* Full-screen modal plate. */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(10, 5, 2, 0.8);
  display: grid; place-items: center;
  padding: 24px;
}
.modal-backdrop[hidden] { display: none; }
.modal { max-width: 520px; width: 100%; }

@media (prefers-reduced-motion: reduce) {
  .valve, .gauge .needle, .lever, .lamp { transition: none; }
}
