/* revvy.se switchboard — deep-fjord control room, amber lamps on a patch rail. */
:root {
  --bg: #1e2637;
  --bg-raise: #242e42;
  --panel: #2a3650;
  --line: #394766;
  --rail: #445475;
  --ink: #eaeef6;
  --muted: #94a1ba;
  --faint: #6b7893;
  --amber: #ffbe5c;
  --amber-glow: rgba(255, 190, 92, 0.45);
  --red: #e86a5e;
  --red-glow: rgba(232, 106, 94, 0.4);
  --ice: #8fc3d9;
  --display: 'Bricolage Grotesque', 'Avenir Next', 'Segoe UI', sans-serif;
  --body: 'Spline Sans', 'Segoe UI', system-ui, sans-serif;
  --mono: 'Spline Sans Mono', ui-monospace, 'Cascadia Mono', monospace;
}

* { box-sizing: border-box; margin: 0; }

html { color-scheme: dark; }

body {
  background: var(--bg);
  background-image: radial-gradient(90rem 40rem at 50% -20rem, rgba(64, 82, 122, 0.35) 0%, transparent 60%);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.5;
  min-height: 100vh;
  padding: clamp(2.5rem, 8vh, 6rem) 1.5rem 4rem;
}

.mono { font-family: var(--mono); }

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
  border-radius: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

/* --- masthead --------------------------------------------------------- */
.masthead, main, footer {
  width: 100%;
  max-width: 42rem;
  margin-inline: auto;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--amber);
}

h1 {
  font-family: var(--display);
  font-size: clamp(3rem, 10vw, 4.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin: 0.25rem 0 0.75rem;
}

.summary {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--muted);
}
.summary .lit { color: var(--amber); }
.summary .dark { color: var(--red); }

/* --- groups + rail ------------------------------------------------------ */
main { margin-top: clamp(2rem, 6vh, 3.5rem); }

.group + .group { margin-top: 2.25rem; }

.group-label {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 0.75rem;
}

.rail {
  list-style: none;
  padding: 0;
  border-left: 2px solid var(--rail);
}

.line {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  padding: 0.85rem 0.75rem 0.85rem 1.4rem;
  border-radius: 0 8px 8px 0;
  transition: background-color 140ms ease;
}
.line:hover, .line:focus-within { background: var(--bg-raise); }

/* lamp sits centered on the rail */
.lamp {
  position: absolute;
  left: -7px;
  top: 1.35rem;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--faint);
  flex: none;
}
.lamp.up {
  background: var(--amber);
  box-shadow: 0 0 10px 2px var(--amber-glow);
}
.lamp.down {
  background: var(--red);
  box-shadow: 0 0 10px 2px var(--red-glow);
}
.lamp.coming {
  background: transparent;
  border: 2px solid var(--ice);
  animation: breathe 3.2s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .lamp.coming { animation: none; opacity: 0.8; }
}

.line-body { min-width: 0; flex: 1; }

.name {
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}
a.name:hover { color: var(--amber); }

.addr {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  margin-left: 0.65rem;
  overflow-wrap: anywhere;
}

.desc {
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.line-actions {
  display: flex;
  gap: 0.35rem;
  align-self: center;
  opacity: 0;
  transition: opacity 140ms ease;
}
.line:hover .line-actions,
.line:focus-within .line-actions { opacity: 1; }
@media (hover: none) { .line-actions { opacity: 1; } }

.line-actions button {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  background: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.25rem 0.55rem;
  cursor: pointer;
}
.line-actions button:hover { color: var(--ink); border-color: var(--rail); }
.line-actions button.danger:hover { color: var(--red); border-color: var(--red); }

.empty {
  padding: 0.85rem 0.75rem 0.85rem 1.4rem;
  font-size: 0.9rem;
  color: var(--faint);
  font-style: italic;
}

/* --- add button + editor ---------------------------------------------- */
.add-slot { margin-top: 2.5rem; }

.add-btn {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--amber);
  background: none;
  border: 1px dashed var(--rail);
  border-radius: 8px;
  padding: 0.7rem 1.1rem;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease;
}
.add-btn:hover { border-color: var(--amber); background: var(--bg-raise); }

.editor {
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.1rem;
  display: grid;
  gap: 0.8rem;
  margin: 0.5rem 0;
}
.line .editor { flex: 1; }

.field label {
  display: grid;
  gap: 0.3rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.editor input[type='text'],
.editor input[type='url'],
.editor input:not([type]) {
  font-family: var(--body);
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.5rem 0.65rem;
  width: 100%;
}
.editor input:focus { border-color: var(--amber); outline: none; }

.status-pick {
  border: 0;
  padding: 0;
  display: flex;
  gap: 0.5rem;
}
.status-pick label {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.status-pick input { accent-color: var(--amber); }
.status-pick label:has(input:checked) {
  color: var(--ink);
  border-color: var(--amber);
}

.form-error { font-size: 0.85rem; color: var(--red); }

.editor-actions { display: flex; gap: 0.5rem; }

.editor-actions .primary {
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 500;
  color: #22201a;
  background: var(--amber);
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1.1rem;
  cursor: pointer;
}
.editor-actions .primary:hover { filter: brightness(1.08); }

.editor-actions .ghost {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--muted);
  background: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.5rem 1.1rem;
  cursor: pointer;
}
.editor-actions .ghost:hover { color: var(--ink); }

/* --- footer ------------------------------------------------------------ */
footer {
  margin-top: 3.5rem;
  font-size: 0.78rem;
  color: var(--faint);
}
footer .mono { font-size: 0.74rem; }

@media (max-width: 480px) {
  .line { flex-wrap: wrap; }
  .addr { display: block; margin-left: 0; }
}
