/* ==========================================================================
   Terminal CV — Theme tokens & layout
   Extension point: add new themes as [data-theme="name"] blocks below.
   ========================================================================== */

/* Self-hosted JetBrains Mono (no third-party font CDN — see fonts/README.txt) */
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("./fonts/JetBrainsMono-Regular.woff2") format("woff2");
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("./fonts/JetBrainsMono-Medium.woff2") format("woff2");
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("./fonts/JetBrainsMono-SemiBold.woff2") format("woff2");
}

/* --- Default / dark theme --- */
[data-theme="dark"] {
  --bg-page: #141419;
  --bg: #1c1c24;
  --fg: #e4e4ef;
  --muted: #8b8b9e;
  --accent: #7c9eff;
  --accent-2: #a6e3a1;
  --prompt-user: #7c9eff;
  --prompt-host: #a6e3a1;
  --link: #89b4fa;
  --border: #2e2e3a;
  --header: #cba6f7;
  --date: #f9e2af;
  --company: #89b4fa;
  --placeholder: #fab387;
  --dot-red: #ff5f57;
  --dot-yellow: #febc2e;
  --dot-green: #28c840;
  --scanline: rgba(255, 255, 255, 0.025);
  --glow: rgba(124, 158, 255, 0.35);
}

[data-theme="dracula"] {
  --bg-page: #191724;
  --bg: #282a36;
  --fg: #f8f8f2;
  --muted: #6272a4;
  --accent: #bd93f9;
  --accent-2: #50fa7b;
  --prompt-user: #ff79c6;
  --prompt-host: #50fa7b;
  --link: #8be9fd;
  --border: #44475a;
  --header: #bd93f9;
  --date: #f1fa8c;
  --company: #8be9fd;
  --placeholder: #ffb86c;
  --dot-red: #ff5555;
  --dot-yellow: #f1fa8c;
  --dot-green: #50fa7b;
  --scanline: rgba(255, 255, 255, 0.03);
  --glow: rgba(189, 147, 249, 0.35);
}

[data-theme="gruvbox"] {
  --bg-page: #1d2021;
  --bg: #282828;
  --fg: #ebdbb2;
  --muted: #928374;
  --accent: #fe8019;
  --accent-2: #b8bb26;
  --prompt-user: #fe8019;
  --prompt-host: #b8bb26;
  --link: #83a598;
  --border: #3c3836;
  --header: #d3869b;
  --date: #fabd2f;
  --company: #83a598;
  --placeholder: #fb4934;
  --dot-red: #fb4934;
  --dot-yellow: #fabd2f;
  --dot-green: #b8bb26;
  --scanline: rgba(255, 255, 255, 0.025);
  --glow: rgba(254, 128, 25, 0.3);
}

[data-theme="matrix"] {
  --bg-page: #050805;
  --bg: #0a0f0a;
  --fg: #c8f0c8;
  --muted: #5a8f5a;
  --accent: #33ff33;
  --accent-2: #22cc22;
  --prompt-user: #33ff33;
  --prompt-host: #22cc22;
  --link: #66ff66;
  --border: #1a3a1a;
  --header: #44ee44;
  --date: #88dd88;
  --company: #66ff66;
  --placeholder: #ffaa33;
  --dot-red: #ff4444;
  --dot-yellow: #cccc00;
  --dot-green: #33ff33;
  --scanline: rgba(51, 255, 51, 0.04);
  --glow: rgba(51, 255, 51, 0.25);
}

/* --- Reset & base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: ui-monospace, "JetBrains Mono", "Fira Code", "SF Mono", Menlo, Consolas, monospace;
  font-size: 15px;
  line-height: 1.5;
  color: var(--fg);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
}

/* --- Page layout --- */
.page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 16px;
  overflow: auto;
}

/* --- Terminal window (fixed 2× footprint: 1840×900) --- */
.terminal-window {
  position: relative;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  width: min(1840px, calc(100vw - 32px));
  height: min(900px, calc(100dvh - 32px));
  min-width: min(1840px, calc(100vw - 32px));
  min-height: min(900px, calc(100dvh - 32px));
  max-width: min(1840px, calc(100vw - 32px));
  max-height: min(900px, calc(100dvh - 32px));
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.45),
    0 2px 8px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

/* Subtle CRT scanline overlay */
.terminal-window::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    var(--scanline) 2px,
    var(--scanline) 4px
  );
  z-index: 2;
}

.terminal-window.terminal-closed {
  opacity: 0.85;
}

.cursor-hidden {
  display: none;
}

/* --- Title bar --- */
.title-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
  padding: 10px 16px;
  background: var(--border);
  border-bottom: 1px solid var(--border);
  z-index: 3;
}

.title-bar-dots {
  position: absolute;
  left: 14px;
  display: flex;
  gap: 7px;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.dot-red { background: var(--dot-red); }
.dot-yellow { background: var(--dot-yellow); }
.dot-green { background: var(--dot-green); }

.title-bar-text {
  font-size: 13px;
  color: var(--muted);
  user-select: none;
}

/* --- Command chips (primary navigation) --- */
.command-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 3;
}

.chip {
  font: inherit;
  font-size: 12px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.chip-primary {
  border-color: var(--accent);
  font-weight: 500;
}

.chip:hover,
.chip:focus-visible {
  background: var(--border);
  border-color: var(--accent);
  outline: none;
}

/* --- Clickable command links in output --- */
.cmd-link {
  font: inherit;
  font-size: inherit;
  padding: 0;
  margin: 0;
  border: none;
  background: none;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.cmd-link:hover,
.cmd-link:focus-visible {
  color: var(--fg);
  outline: none;
}

.landing-cta {
  line-height: 1.6;
}

/* --- Boot animation --- */
.boot-progress {
  font-variant-numeric: tabular-nums;
}

.boot-status-label {
  color: var(--fg);
}

.boot-bar-fill {
  color: var(--accent);
}

.boot-bar-empty {
  color: var(--muted);
}

.boot-percent {
  color: var(--muted);
}

.boot-status-ok {
  color: var(--fg);
}

.boot-ok {
  color: var(--accent-2);
}

.boot-tagline {
  margin-top: 4px;
}

.boot-hint {
  margin-top: 4px;
}

/* --- Terminal body --- */
.terminal-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 22px 24px;
  z-index: 1;
}

.terminal-output {
  flex: 1 1 0;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  margin-bottom: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

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

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

/* --- Output typography --- */
.out-line {
  margin: 0 0 2px;
  white-space: pre-wrap;
  word-break: break-word;
}

.out-line:last-child {
  margin-bottom: 0;
}

.out-block {
  margin: 0 0 8px;
}

.out-spacer {
  height: 8px;
}

.out-header {
  color: var(--header);
  font-weight: 600;
}

.out-company {
  color: var(--company);
  font-weight: 600;
  margin-bottom: 6px;
}

.out-date {
  color: var(--date);
}

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

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

.out-accent-2 {
  color: var(--accent-2);
}

.out-dir {
  color: var(--accent);
}

.out-link {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.out-link:hover,
.out-link:focus-visible {
  color: var(--fg);
  outline: none;
}

.out-placeholder {
  color: var(--placeholder);
  text-decoration: underline dashed;
  text-underline-offset: 3px;
}

.out-error {
  color: #f38ba8;
}

.out-success {
  color: var(--accent-2);
}

.out-echo {
  margin-bottom: 4px;
}

.out-bullet {
  padding-left: 2ch;
}

.out-bullet::before {
  content: "• ";
  color: var(--muted);
}

/* --- Prompt --- */
.prompt {
  text-shadow: 0 0 6px var(--glow);
  white-space: nowrap;
  flex-shrink: 0;
}

.prompt-gap {
  white-space: pre;
  flex-shrink: 0;
}

.prompt-user { color: var(--prompt-user); }
.prompt-at,
.prompt-path { color: var(--fg); }
.prompt-host { color: var(--prompt-host); }

.input-row {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  flex-shrink: 0;
  line-height: 1.5;
  min-height: calc(1.5em + 2px);
}

.prompt,
.prompt-gap,
.input-display {
  line-height: 1.5;
}

.input-display {
  white-space: pre;
  min-width: 0;
  min-height: 1.5em;
}

.input-row.input-disabled {
  opacity: 0.5;
}

/* --- Blinking cursor --- */
.cursor {
  display: block;
  width: 0.55em;
  height: 1.5em;
  flex-shrink: 0;
  background: var(--accent);
  animation: blink 1s step-end infinite;
}

.command-output-start {
  height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  pointer-events: none;
}

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

/* --- Neofetch layout --- */
.neofetch {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.neofetch-logo {
  color: var(--accent);
  white-space: pre;
  line-height: 1.2;
  font-size: 13px;
}

.neofetch-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.neofetch-line .nf-key {
  color: var(--accent);
}

.neofetch-line .nf-val {
  color: var(--fg);
}

/* --- Help two-column --- */
.help-table {
  display: grid;
  grid-template-columns: 14ch 1fr;
  gap: 2px 16px;
}

.help-cmd-cell {
  display: flex;
  align-items: baseline;
}

.help-cmd-link {
  display: inline-block;
  width: 100%;
  text-align: left;
}

.help-desc {
  color: var(--muted);
}

/* --- Skills grid --- */
.skills-grid {
  display: grid;
  gap: 12px;
}

.skill-category {
  margin: 0;
}

.skill-name {
  color: var(--header);
  font-weight: 600;
  margin-bottom: 4px;
}

.skill-items {
  color: var(--fg);
  padding-left: 0;
  margin: 0;
  list-style: none;
}

.skill-items li::before {
  content: "▸ ";
  color: var(--muted);
}

/* --- Experience block --- */
.job-block {
  margin-bottom: 16px;
}

.job-block:last-child {
  margin-bottom: 0;
}

.job-role {
  margin-left: 0.75rem;
  padding-left: 0.85rem;
  border-left: 2px solid var(--border);
}

.job-role + .job-role {
  margin-top: 12px;
}

.job-title {
  margin: 2px 0;
}

.job-meta {
  margin-bottom: 6px;
}

.job-bullets {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* --- Hidden input (mobile keyboard) --- */
.terminal-input-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  .cursor {
    animation: none;
    opacity: 1;
  }

  .terminal-window::after {
    display: none;
  }

  .prompt {
    text-shadow: none;
  }

  .chip {
    transition: none;
  }
}

/* --- Print: clean readable CV --- */
@media print {
  :root {
    color-scheme: light;
  }

  body {
    background: #fff;
    color: #111;
    font-size: 11pt;
  }

  .page {
    padding: 0;
    display: block;
    min-height: auto;
  }

  .terminal-window {
    max-width: none;
    max-height: none;
    box-shadow: none;
    border: none;
    border-radius: 0;
    background: #fff;
  }

  .terminal-window::after {
    display: none !important;
  }

  .title-bar-dots,
  .command-chips,
  .input-row,
  .terminal-input-hidden,
  .out-echo,
  .cursor,
  label.sr-only {
    display: none !important;
  }

  .title-bar {
    background: #fff;
    border-bottom: 1px solid #ccc;
    padding: 0 0 8px;
    justify-content: flex-start;
  }

  .title-bar-text {
    color: #333;
    font-size: 10pt;
  }

  .terminal-body {
    padding: 0;
  }

  .terminal-output {
    overflow: visible;
    min-height: auto;
    margin: 0;
  }

  .out-line,
  .out-header,
  .out-company,
  .out-accent,
  .out-muted,
  .out-date,
  .skill-name,
  .nf-key,
  .nf-val {
    color: #111 !important;
    text-shadow: none !important;
  }

  .out-link,
  .cmd-link {
    color: #111 !important;
    text-decoration: underline;
  }

  .out-placeholder {
    color: #666 !important;
  }

  .out-error,
  .out-success {
    color: #111 !important;
  }

  .prompt {
    text-shadow: none;
  }

  .job-block,
  .print-block,
  .skill-category {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .landing-cta {
    display: none !important;
  }

  .neofetch {
    display: none !important;
  }
}
