/* Terminal component support (toggle, typewriter, helper effects) */

.site-toggle {
  position: fixed;
  top: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(2px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  color: #ddd;
  z-index: 100;
}

.site-toggle .label {
  font-size: 13px;
  margin: 0;
  opacity: 0.9;
}

.terminal-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(10, 35, 63, 0.55);
  border: 1px solid rgba(136, 170, 204, 0.25);
  color: rgba(222, 228, 240, 0.82);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  flex-shrink: 0;
}

.terminal-toggle .label {
  margin: 0;
  opacity: 0.9;
}

.terminal-window {
  display: flex;
  flex-direction: column;
}

.toggle-chip {
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(2px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #ddd;
  font-size: 13px;
}

.toggle-chip.pref-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  z-index: 100;
}

.switch {
  position: relative;
  width: 36px;
  height: 18px;
}

.switch input {
  appearance: none;
  -webkit-appearance: none;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  inset: 0;
  cursor: pointer;
  border-radius: 999px;
  background: var(--rail-green);
  transition: background 0.2s ease;
}

.switch input:checked + .slider {
  background: var(--rail-amber);
}

.slider::before {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  left: 2px;
  top: 2px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s ease;
}

.switch input:checked + .slider::before {
  transform: translateX(16px);
}

.label-left,
.label-right {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.highlight {
  color: var(--brand-accent);
  font-weight: 600;
  text-shadow: none;
}

.terminal-statusbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 0.65rem 1.35rem;
  background: linear-gradient(135deg, rgba(9, 26, 49, 0.78), rgba(4, 14, 28, 0.85));
  border-top: 1px solid rgba(136, 170, 204, 0.2);
}

.terminal-statusbar .terminal-toggle {
  margin-left: auto;
  box-shadow: 0 0 18px rgba(0, 0, 0, 0.35);
}

@media (max-width: 576px) {
  .terminal-statusbar {
    justify-content: center;
    padding: 0.75rem 1rem;
  }

  .terminal-statusbar .terminal-toggle {
    width: 100%;
    justify-content: center;
  }
}

p[data-typewriter] {
  visibility: hidden;
}

pre.crt-shimmer {
  margin: 0 0 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 10px;
  white-space: pre;
  display: inline-block;
  isolation: isolate;
  contain: paint;
  background: linear-gradient(
    90deg,
    #ffffff 0%,
    color-mix(in srgb, var(--phosphor) 85%, #ffffff 15%) 10%,
    var(--phosphor) 50%,
    color-mix(in srgb, var(--phosphor) 85%, #000000 15%) 90%,
    #ffffff 100%
  );
  background-size: 200% 100%;
  animation: crt-shimmer 1.1s linear infinite;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

@keyframes crt-shimmer {
  0% {
    background-position: 0% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.caret {
  position: relative;
}

.caret::after {
  content: "";
  display: inline-block;
  width: 0.6ch;
  height: 1em;
  background: currentColor;
  margin-left: 0.1ch;
  vertical-align: -0.15em;
  animation: blink 0.9s steps(1, end) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  pre.crt-shimmer {
    animation: none;
  }
  .caret::after {
    animation: none;
  }
}
