:root {
  --bg: #050505;
  --bg-elevated: #0d0d0d;
  --text: #f5f5f5;
  --muted: #9f9f9f;
  --accent: #e11d48;
  --border: #222;
  --shadow-soft: 0 0 0 1px #111, 0 12px 30px rgba(0, 0, 0, 0.8);
  --radius-lg: 18px;
  --radius-pill: 999px;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
}

body {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 1.25rem;
}

main {
  width: 100%;
  max-width: 900px;
  margin: 0;
  display: flex;
  flex: 1 1 auto; /* <- grow to fill body height */
}

main > section {
  flex: 1 1 auto;
  display: flex;
}

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.terminal-shell {
  background: radial-gradient(circle at top, #111 0, #050505 55%, #000 100%);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border);
  overflow: hidden;
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  flex: 1 1 auto; /* <-- add this */
}

/* Subtle scanline overlay */
.terminal-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(
    rgba(255, 255, 255, 0.03) 1px,
    transparent 1px
  );
  background-size: 100% 2px;
  mix-blend-mode: soft-light;
  opacity: 0.4;
  pointer-events: none;
  z-index: 0;
}

.terminal-header {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(to bottom, #111, #050505);
}

.terminal-dots {
  display: inline-flex;
  gap: 0.3rem;
  align-items: center;
}

.terminal-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  border: 1px solid #444;
  background: transparent;
}

.terminal-title {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  text-align: center;
  flex: 1;
}

.terminal-header-right {
  font-size: 0.7rem;
  color: var(--muted);
  text-align: right;
  flex-shrink: 0;
  white-space: nowrap;
}

.terminal-header-right a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px dotted transparent;
  font-size: 0.75rem;
}

.terminal-header-right a:hover,
.terminal-header-right a:focus-visible {
  color: var(--text);
  border-bottom-color: var(--text);
  outline: none;
}

.terminal-header-sep {
  margin: 0 0.25rem;
  color: var(--muted);
}

.terminal-body {
  position: relative;
  z-index: 1;
  padding: 1rem 0.9rem 0.9rem;
  flex: 1;
  min-height: 0; /* important so flexbox allows it to shrink */
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: #555 transparent;
}

.terminal-body::-webkit-scrollbar {
  width: 6px;
}

.terminal-body::-webkit-scrollbar-track {
  background: transparent;
}

.terminal-body::-webkit-scrollbar-thumb {
  background: #555;
  border-radius: 999px;
}

.line {
  font-size: 0.82rem;
  line-height: 1.6;
  margin-bottom: 0.15rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.line--muted {
  color: var(--muted);
}

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

.line--section {
  margin-top: 0.6rem;
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.7rem;
}

.line a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted var(--accent);
}

.line a:hover,
.line a:focus-visible {
  border-bottom-style: solid;
}

.prompt-row {
  position: sticky;
  bottom: 0;
  /* top, horizontal, bottom */
  padding: 0.55rem 0.9rem 0.75rem;
  margin-top: 0.5rem;
  border-top: 1px solid var(--border);
  background: linear-gradient(
    to top,
    rgba(5, 5, 5, 0.98),
    rgba(5, 5, 5, 0.9) 60%,
    transparent
  );
  backdrop-filter: blur(8px);
}

/* Prompt line: label + input on one CLI-style row */
.prompt-form {
  display: flex;
  align-items: baseline; /* align text baselines */
  gap: 0.25rem;
  margin: 0;
}

.prompt-label {
  font-size: 0.82rem;
  line-height: 1.4;
  white-space: nowrap;
}

.prompt-user,
.prompt-path {
  color: var(--muted);
}

.prompt-cursor {
  display: inline-block;
  width: 0.6rem;
  text-align: center;
}

.blink {
  animation: blink 1s steps(2, start) infinite;
}

@keyframes blink {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0;
  }
}

/* Wrapper holds input + hint stacked vertically */
.prompt-input-wrapper {
  flex: 1;
}

.prompt-input {
  width: 100%;
  font-size: 0.82rem;
  line-height: 1.4;
  /* keep a bit of horizontal padding, minimal vertical so it hugs the baseline */
  padding: 0.06rem 0.6rem 0.02rem;
  color: var(--text);

  /* blend into the terminal until active */
  background: transparent;

  /* no box border, just a faint underline */
  border: none;
  border-bottom: 1px solid #151515;

  border-radius: 0;
  outline: none;
  transition: border-bottom-color 0.15s ease, background 0.15s ease;
}

.prompt-input::placeholder {
  color: #555;
}

.prompt-input:focus-visible {
  /* still basically same bg, just a hair brighter */
  background: rgba(0, 0, 0, 0.4);

  /* stronger underline on focus */
  border-bottom-color: #666;

  /* no glow box */
  box-shadow: none;
}

/* Hint on its own line, below the input */
.prompt-hint {
  margin-top: 0.18rem;
  font-size: 0.7rem;
  color: var(--muted);
}

.command-suggestions {
  margin-top: 0.55rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.command-chip {
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  font-size: 0.68rem;
  padding: 0.16rem 0.6rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  white-space: nowrap;
  user-select: none;
}

.command-chip span {
  opacity: 0.65;
}

.command-chip:hover,
.command-chip:focus-visible {
  border-color: #666;
  color: var(--text);
  outline: none;
  background: rgba(255, 255, 255, 0.04);
}

/* Slide-out demo panel (for future video / animation) */
.demo-panel {
  position: fixed;
  left: 50%;
  top: 50%;
  max-width: 720px;
  width: min(720px, 100% - 2.5rem);
  background: radial-gradient(circle at top, #111 0, #050505 55%, #000 100%);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 1rem 1.1rem 0.9rem;
  box-shadow: var(--shadow-soft);
  transform: translate(-50%, 110%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.38s cubic-bezier(0.22, 0.61, 0.36, 1),
    opacity 0.28s ease-out;
  z-index: 30;
}

.demo-video-wrapper {
  margin-bottom: 0.6rem;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.7);
}

.demo-video {
  display: block;
  width: 100%;
  height: auto;
}

/* When visible, slide into the centre */
.demo-panel.is-visible {
  transform: translate(-50%, -50%);
  opacity: 1;
  pointer-events: auto;
}

.demo-panel-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  margin-bottom: 0.3rem;
  color: var(--muted);
}

.demo-panel-body {
  font-size: 0.8rem;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.demo-panel-footer {
  display: flex;
  justify-content: flex-end;
}

.btn-ghost {
  font: inherit;
  font-size: 0.7rem;
  border-radius: var(--radius-pill);
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.btn-ghost:hover,
.btn-ghost:focus-visible {
  border-color: #666;
  color: var(--text);
  outline: none;
}

/* Mobile layout tweaks for the header */
@media (max-width: 600px) {
  .terminal-header {
    flex-wrap: wrap;
    row-gap: 0.25rem;
  }

  .terminal-title {
    flex-basis: 100%;
    text-align: center;
    margin-top: 0.35rem;
  }

  .terminal-header-right {
    flex-basis: 100%;
    text-align: center;
    white-space: normal; /* allow wrapping */
    font-size: 0.68rem;
  }

  .terminal-header-sep {
    margin: 0 0.18rem;
  }
}

/* Layout tweaks for larger screens */
@media (min-width: 640px) {
  .terminal-header {
    padding-inline: 1.1rem;
  }

  .terminal-body {
    padding-inline: 1.1rem;
  }

  .line {
    font-size: 0.85rem;
  }
}

@media (min-width: 900px) {
  body {
    padding: 2.25rem;
  }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
