/* ================================
   Global theme & base
   ================================ */
:root {
  --bg: #0b0f13;
  --panel: #11161c;
  --muted: #93a1b0;
  --text: #e6ecf2;
  --accent: #6ee7ff;
  --accent-2: #b19cff;
  --chip: #19212b;
  --ok: #8cf7a5;
  --warn: #ffe58a;
  --err: #ff8a8a;
  --focus: #f2a900;

  --reveal-dur: .55s;
  --reveal-ease: cubic-bezier(.22, 1, .36, 1);
}

/* Optional background canvas */
#bgfx {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
}

body,
main {
  position: relative;
  z-index: 1;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  background: radial-gradient(1200px 1200px at 10% 10%, #0d1319 50%, #090d11 100%), var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ================================
   A11y
   ================================ */
.skip-link {
  position: absolute;
  left: -999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.skip-link:focus {
  position: static;
  width: auto;
  height: auto;
  padding: .5rem 1rem;
  background: var(--focus);
  color: #000;
}

/* ================================
   Buttons (future use)
   ================================ */
.btn,
.btn-outline,
.btn-ghost {
  border: 1px solid #263142;
  padding: .55rem .9rem;
  border-radius: .6rem;
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  text-decoration: none;
  color: var(--text);
}

.btn {
  background: linear-gradient(180deg, #1b2430, #131a23);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
}

.btn-ghost {
  background: transparent;
  border-color: #2b394d;
  color: var(--muted);
}

.btn-ghost[aria-pressed="true"] {
  color: var(--text);
}

/* ================================
   View toggles (we only show terminal)
   ================================ */
.view {
  display: none;
}

.view.active {
  display: block;
}

/* ================================
   Terminal
   ================================ */
.terminal {
  max-width: 1100px;
  margin: 2rem auto;
  border: 1px solid #1a2431;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(180deg, #0e141b, #0b0f13 40%);
  box-shadow: 0 10px 40px rgba(0, 0, 0, .4);

  display: flex;
  flex-direction: column;
  height: clamp(380px, 56vh, 640px);
}

.terminal-top {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .5rem .75rem;
  border-bottom: 1px solid #15202b;
  background: linear-gradient(180deg, #121923, #0e141b);
}

.traffic {
  display: inline-flex;
  gap: .5rem;
}

.traffic span {
  width: .8rem;
  height: .8rem;
  border-radius: 50%;
  display: inline-block;
}

.traffic .red {
  background: #ff5f56;
}

.traffic .yellow {
  background: #ffbd2e;
}

.traffic .green {
  background: #27c93f;
}

.terminal-title {
  color: var(--muted);
  font-size: .9rem;
}

.terminal-output {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1rem;
  outline: none;
  white-space: pre-wrap;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* Custom scrollbar */
.terminal-output::-webkit-scrollbar {
  width: 10px;
}

.terminal-output::-webkit-scrollbar-track {
  background: #0d1319;
}

.terminal-output::-webkit-scrollbar-thumb {
  background: #202a36;
  border-radius: 8px;
  border: 2px solid #0d1319;
}

.terminal-output::-webkit-scrollbar-thumb:hover {
  background: #2a3748;
}

.terminal-line {
  display: block;
  padding: .25rem 0;
}

.terminal-line .cmd {
  color: var(--accent);
}

.terminal-line .ok {
  color: var(--ok);
}

.terminal-line .warn {
  color: var(--warn);
}

.terminal-line .err {
  color: var(--err);
}

.terminal-input-row {
  display: flex;
  gap: .5rem;
  align-items: center;
  border-top: 1px solid #15202b;
  padding: .75rem;
}

.prompt {
  color: var(--accent);
  font-weight: 700;
}

.terminal-input {
  flex: 1;
  background: var(--panel);
  border: 1px solid #1e2733;
  border-radius: .5rem;
  padding: .6rem .75rem;
  color: var(--text);
}

.terminal-input:focus {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.chips {
  display: flex;
  gap: .5rem;
  padding: .75rem;
  border-top: 1px solid #15202b;
  flex-wrap: wrap;
}

.chip {
  border: 1px solid #1f2937;
  background: var(--chip);
  color: var(--text);
  padding: .35rem .6rem;
  border-radius: .5rem;
  cursor: pointer;
}

.chip:hover {
  filter: brightness(1.2);
}

/* ================================
   Reveal-on-load animation
   ================================ */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(6px);
    filter: blur(1px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

.reveal {
  opacity: 0;
  transform: translateY(6px);
  will-change: opacity, transform, filter;
}

.reveal.show {
  animation: fadeUp var(--reveal-dur) var(--reveal-ease) var(--d, 0s) forwards;
}

/* Staggered settle for terminal view internals */
#terminal-view .terminal-top,
#terminal-view .terminal-output,
#terminal-view .terminal-input-row {
  opacity: 0;
  transform: translateY(2px);
  transition: opacity .35s var(--reveal-ease), transform .35s var(--reveal-ease);
}

#terminal-view.show .terminal-top {
  opacity: 1;
  transform: none;
  transition-delay: .06s;
}

#terminal-view.show .terminal-output {
  opacity: 1;
  transform: none;
  transition-delay: .10s;
}

#terminal-view.show .terminal-input-row {
  opacity: 1;
  transform: none;
  transition-delay: .14s;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {

  .reveal,
  .reveal.show {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }
}

/* ================================
   Big name banner
   ================================ */
.name-hero {
  max-width: 1100px;
  margin: 2.25rem auto 1rem;
  padding: 0 1rem;
  text-align: center;
}

.name-hero h1 {
  margin: 0;
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: clamp(2.5rem, 9vw, 5.2rem);
  color: #ffffff;
}

.name-hero-subtitle {
  margin: .35rem 0 0;
  color: rgba(255, 255, 255, 0.8);
  font-size: clamp(1rem, 2.5vw, 1.25rem);
}

/* Hide (unused) site footer if present */
.site-footer {
  display: none !important;
}

/* Links in terminal output */
a:focus,
button:focus,
input:focus,
textarea:focus {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.contact-email,
.contact-email:visited {
  color: #8cc8ff;
  text-decoration: none;
}

.contact-email:hover,
.contact-email:focus {
  text-decoration: underline;
}

.term-link-ok,
.term-link-ok:visited {
  color: var(--ok);
  text-decoration: none;
}

.term-link-ok:hover,
.term-link-ok:focus {
  text-decoration: underline;
}