/* ── Hero canvas ── */

#hero {
  position: relative;
  overflow: hidden;
}

#hero > .container {
  position: relative;
  z-index: 1;
  width: 100%;
}

.hero-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  -webkit-mask-image: radial-gradient(ellipse 90% 80% at 50% 40%, #000 40%, transparent 100%);
  mask-image: radial-gradient(ellipse 90% 80% at 50% 40%, #000 40%, transparent 100%);
}

.hero-hint {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #000;
  background: var(--color-accent);
  pointer-events: none;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.4s;
}

.hero-hint::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #000;
  animation: hero-hint-pulse 1.2s ease-in-out infinite;
}

.hero-hint.is-visible {
  opacity: 1;
}

@keyframes hero-hint-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.8); opacity: 0.4; }
}

.status-clickable {
  cursor: pointer;
  width: fit-content;
}

.status-clickable:hover .status-text,
.status-clickable:focus-visible .status-text {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.status-clickable:focus-visible {
  outline: 1px dashed var(--color-accent);
  outline-offset: 6px;
}

/* ── Launcher ── */

.term-launcher {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.85rem 1.2rem;
  background: var(--color-accent);
  border: none;
  color: #000;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  box-shadow: 0 8px 30px rgba(200, 241, 53, 0.25);
  animation: launcher-pulse 2.2s ease-out infinite;
  transition: transform 0.2s, opacity 0.2s, box-shadow 0.2s;
}

.term-launcher.seen {
  animation: none;
}

.term-launcher:hover,
.term-launcher:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(200, 241, 53, 0.45);
}

.term-launcher:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
}

.term-launcher.hidden {
  opacity: 0;
  pointer-events: none;
}

.term-launcher-icon {
  font-size: 1rem;
}

.term-launcher kbd {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.05rem 0.4rem;
  background: rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(0, 0, 0, 0.35);
  color: #000;
}

@keyframes launcher-pulse {
  0% {
    box-shadow: 0 8px 30px rgba(200, 241, 53, 0.25), 0 0 0 0 rgba(200, 241, 53, 0.55);
  }

  70%,
  100% {
    box-shadow: 0 8px 30px rgba(200, 241, 53, 0.25), 0 0 0 16px rgba(200, 241, 53, 0);
  }
}

@media (max-width: 600px) {
  .term-launcher {
    right: 1rem;
    bottom: 1rem;
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
  }

  .term-launcher kbd {
    display: none;
  }
}

/* ── Overlay & window ── */

.term-locked {
  overflow: hidden;
}

.term-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}

.term-overlay.open {
  opacity: 1;
  visibility: visible;
}

.term {
  width: min(46rem, 100%);
  height: min(30rem, 80vh);
  display: flex;
  flex-direction: column;
  background: #0a0a0a;
  border: 1px solid var(--color-border);
  box-shadow: 0 0 0 1px rgba(200, 241, 53, 0.05), 0 30px 80px rgba(0, 0, 0, 0.6),
    0 0 60px rgba(200, 241, 53, 0.06);
  transform: translateY(16px) scale(0.98);
  transition: transform 0.25s;
}

.term-overlay.open .term {
  transform: none;
}

.term-bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-card);
}

.term-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: none;
  padding: 0;
  background: #2f2f2a;
}

.term-close {
  background: #ff5f57;
  cursor: pointer;
}

.term-title {
  flex: 1;
  text-align: center;
  margin-right: 2.2rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--color-text);
  letter-spacing: 0.1em;
}

.term-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.1rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.65;
  color: var(--color-primary);
  user-select: text;
  cursor: text;
}

.term-out {
  white-space: pre-wrap;
  word-break: break-word;
}

.term-echo {
  margin-top: 0.5rem;
}

.term-out a {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.term-accent {
  color: var(--color-accent);
}

.term-muted {
  color: var(--color-text);
}

.term-error {
  color: #ff7a6b;
}

.term-line {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.term-prompt {
  color: var(--color-accent);
  white-space: nowrap;
}

.term-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--color-primary);
  font: inherit;
  caret-color: var(--color-accent);
}

/* iOS zooms into inputs smaller than 16px */
@media (max-width: 600px) {
  .term {
    height: 85vh;
  }

  .term-body {
    font-size: 0.78rem;
  }

  .term-input {
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .term-overlay,
  .term,
  .term-launcher {
    transition: none;
    animation: none;
  }
}
