/* ── Color Tokens ─────────────────────────────────────── */
:root {
  --bg:           #0a0a0a;
  --surface:      #111111;
  --border:       #1e1e1e;
  --green:        #00ff41;
  --green-dim:    #00aa2c;
  --green-muted:  #005514;
  --amber:        #ffb000;
  --red:          #ff3333;
  --cyan:         #00d4ff;
  --white:        #e0e0e0;
  --cursor:       #00ff41;
  --titlebar-bg:  #161616;
}

:root[data-theme="amber"] {
  --green:       #ffb000;
  --green-dim:   #cc8800;
  --green-muted: #664400;
  --cursor:      #ffb000;
  --amber:       #fff200;
}

:root[data-theme="blood"] {
  --green:       #ff3333;
  --green-dim:   #cc0000;
  --green-muted: #550000;
  --cursor:      #ff3333;
  --surface:     #0d0000;
  --titlebar-bg: #100000;
}

:root[data-theme="ice"] {
  --green:       #00d4ff;
  --green-dim:   #0099bb;
  --green-muted: #003344;
  --cursor:      #00d4ff;
  --surface:     #000d11;
  --titlebar-bg: #000a0f;
}

/* ── Container ────────────────────────────────────────── */
.terminal-container {
  display: flex;
  flex-direction: column;
  width: min(900px, 96vw);
  height: min(640px, 92vh);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow:
    0 0 0 1px #1a1a1a,
    0 0 60px rgba(0, 255, 65, 0.06),
    0 20px 60px rgba(0, 0, 0, 0.8);
  overflow: hidden;
  position: relative;
}

/* ── Title bar ────────────────────────────────────────── */
.terminal-titlebar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--titlebar-bg);
  border-bottom: 1px solid var(--border);
  user-select: none;
  flex-shrink: 0;
}

.traffic-lights {
  display: flex;
  gap: 7px;
  align-items: center;
}

.tl {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  opacity: 0.9;
}

.tl-red   { background: #ff5f57; }
.tl-amber { background: #febc2e; }
.tl-green { background: #28c840; }

.titlebar-text {
  flex: 1;
  text-align: center;
  color: var(--green-dim);
  font-size: 12px;
  letter-spacing: 0.03em;
}

.titlebar-version {
  color: var(--green-muted);
  font-size: 11px;
}

/* ── Output area ──────────────────────────────────────── */
.terminal-output {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 20px;
  color: var(--white);
  line-height: 1.65;
  scrollbar-width: thin;
  scrollbar-color: var(--green-muted) transparent;
}

.terminal-output::-webkit-scrollbar {
  width: 4px;
}

.terminal-output::-webkit-scrollbar-thumb {
  background: var(--green-muted);
  border-radius: 2px;
}

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

/* ── Input line ───────────────────────────────────────── */
.terminal-inputline {
  display: flex;
  align-items: center;
  padding: 10px 20px;
  background: #0d0d0d;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  gap: 0;
}

.prompt {
  color: var(--green-dim);
  white-space: nowrap;
  flex-shrink: 0;
  font-size: 13px;
}

.input-wrapper {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  min-height: 1.4em;
}

.typed-text {
  color: var(--white);
  white-space: pre;
  pointer-events: none;
}

.cursor-block {
  display: inline-block;
  width: 0.55ch;
  height: 1.15em;
  background: var(--cursor);
  vertical-align: text-bottom;
  margin-left: 0px;
  flex-shrink: 0;
}

.hidden-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: inherit;
  color: transparent;
  caret-color: transparent;
  z-index: 1;
}

/* ── Output line types ────────────────────────────────── */
.line {
  min-height: 1.4em;
  word-break: break-word;
  white-space: pre-wrap;
}

.line.echo-line {
  opacity: 0.9;
}

/* Color classes */
.color-green       { color: var(--green); }
.color-green-dim   { color: var(--green-dim); }
.color-green-muted { color: var(--green-muted); }
.color-amber       { color: var(--amber); }
.color-red         { color: var(--red); }
.color-cyan        { color: var(--cyan); }
.color-white       { color: var(--white); }
.bold              { font-weight: 700; }
.italic            { font-style: italic; }

/* Column layout for help table */
.line.columns {
  display: flex;
}

.col-left {
  flex-shrink: 0;
  color: var(--green);
}

.col-right {
  color: var(--white);
}

/* Clickable links inside output */
.link-hover {
  color: var(--cyan);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.link-hover:hover {
  color: var(--green);
}

/* ── Amber / green glow on key elements ───────────────── */
.color-amber.bold {
  text-shadow: 0 0 10px rgba(255, 176, 0, 0.5), 0 0 24px rgba(255, 176, 0, 0.18);
}

.color-green.bold {
  text-shadow: 0 0 8px rgba(0, 255, 65, 0.4);
}

/* ── Pulse effects (triggered by JS) ─────────────────── */
.terminal-container.pulse-amber {
  animation: border-pulse-amber 0.6s ease-in-out 3;
}

.terminal-container.pulse-rainbow {
  animation: border-pulse-rainbow 0.5s linear 4;
}

.terminal-container.glitch-shake {
  animation: shake 0.45s ease-in-out 2;
}

/* ── CV printable region ──────────────────────────────────── */
#cv-printable {
  display: none;
}

@media print {
  .scanlines,
  .terminal-container,
  .mobile-quickbar {
    display: none !important;
  }

  body {
    background: #fff !important;
    color: #111 !important;
    overflow: visible !important;
    display: block !important;
    min-height: unset !important;
    font-family: Arial, Helvetica, sans-serif !important;
  }

  #cv-printable {
    display: block !important;
    max-width: 720px;
    margin: 0 auto;
    padding: 24px 32px;
    font-size: 12px;
    line-height: 1.5;
    color: #111;
  }

  .cv-name {
    font-size: 22px;
    font-weight: bold;
    margin: 0 0 4px;
  }

  .cv-meta {
    color: #555;
    font-size: 12px;
    margin-bottom: 18px;
  }

  .cv-section-title {
    font-size: 10px;
    font-weight: bold;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    border-bottom: 1px solid #aaa;
    padding-bottom: 2px;
    margin: 16px 0 8px;
    color: #333;
  }

  .cv-entry {
    margin-bottom: 10px;
  }

  .cv-entry-title {
    font-weight: bold;
    font-size: 12px;
  }

  .cv-entry-sub {
    color: #666;
    font-size: 11px;
    margin-bottom: 2px;
  }

  .cv-bullets {
    margin: 3px 0 0 18px;
    padding: 0;
  }

  .cv-bullets li {
    list-style-type: disc;
    margin-bottom: 1px;
    font-size: 11px;
  }

  .cv-skills {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px 12px;
  }

  .cv-skill {
    font-size: 11px;
  }
}
