/* ==========================================
   Interactive Terminal Resume — Zakaria EL BAZI
   ========================================== */

:root {
  --t-bg: #0b0e14;
  --t-window: #0e1320;
  --t-border: rgba(255, 255, 255, 0.08);
  --t-text: #c8d3e8;
  --t-dim: #5c6a85;
  --t-green: #50fa7b;
  --t-cyan: #6fd6ff;
  --t-yellow: #f1fa8c;
  --t-magenta: #ff79c6;
  --t-red: #ff5555;
  --t-prompt-user: #50fa7b;
  --t-prompt-host: #6fd6ff;
  --t-selection: rgba(80, 250, 123, 0.25);
  --t-glow: rgba(80, 250, 123, 0.06);
}

/* Themes */
.term-theme-dracula {
  --t-bg: #14111e;
  --t-window: #1b1727;
  --t-text: #f8f8f2;
  --t-dim: #6d6a85;
  --t-green: #50fa7b;
  --t-cyan: #8be9fd;
  --t-yellow: #f1fa8c;
  --t-magenta: #ff79c6;
  --t-prompt-user: #ff79c6;
  --t-prompt-host: #bd93f9;
  --t-glow: rgba(189, 147, 249, 0.07);
}
.term-theme-matrix {
  --t-bg: #020a02;
  --t-window: #041204;
  --t-text: #7dff9c;
  --t-dim: #2c5b38;
  --t-green: #50fa7b;
  --t-cyan: #50fa7b;
  --t-yellow: #c8ffd4;
  --t-magenta: #97ffb2;
  --t-prompt-user: #50fa7b;
  --t-prompt-host: #2fdc5d;
  --t-glow: rgba(80, 250, 123, 0.09);
}
.term-theme-paper {
  --t-bg: #ece8df;
  --t-window: #fbf9f4;
  --t-border: rgba(0, 0, 0, 0.12);
  --t-text: #2c3036;
  --t-dim: #8a8f98;
  --t-green: #1a7f37;
  --t-cyan: #0969da;
  --t-yellow: #9a6700;
  --t-magenta: #8250df;
  --t-red: #cf222e;
  --t-prompt-user: #1a7f37;
  --t-prompt-host: #0969da;
  --t-selection: rgba(9, 105, 218, 0.18);
  --t-glow: rgba(9, 105, 218, 0.05);
}

/* ── Hero shell ── */
.term-hero {
  min-height: 100svh;
  background:
    radial-gradient(ellipse 70% 55% at 50% -10%, var(--t-glow), transparent),
    var(--t-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 38px 18px 30px;
  position: relative;
  overflow: hidden;
  transition: background 0.4s ease;
}
.term-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(127, 156, 245, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(127, 156, 245, 0.04) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, black 30%, transparent 75%);
  pointer-events: none;
}
.term-theme-paper .term-hero::before {
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.05) 1px, transparent 1px);
}

/* ── Window ── */
.term-window {
  width: min(880px, 100%);
  height: min(72svh, 640px);
  min-height: 420px;
  background: var(--t-window);
  border: 1px solid var(--t-border);
  border-radius: 14px;
  box-shadow:
    0 30px 90px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(0, 0, 0, 0.2),
    0 0 120px var(--t-glow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  z-index: 1;
  transition: background 0.4s ease;
}
.term-titlebar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--t-border);
  flex-shrink: 0;
  user-select: none;
}
.term-dot { width: 12px; height: 12px; border-radius: 50%; }
.term-dot--r { background: #ff5f57; }
.term-dot--y { background: #febc2e; }
.term-dot--g { background: #28c840; }
.term-title {
  flex: 1;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--t-dim);
  letter-spacing: 0.4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.term-titlebar .term-net {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--t-green);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.term-net::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--t-green);
  animation: netPulse 2.4s ease-in-out infinite;
}
@keyframes netPulse { 0%, 100% { opacity: 1 } 50% { opacity: 0.25 } }

/* ── Screen ── */
.term-screen {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px 14px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--t-text);
  scrollbar-width: thin;
  scrollbar-color: var(--t-dim) transparent;
  cursor: text;
  position: relative;
}
.term-screen::-webkit-scrollbar { width: 8px; }
.term-screen::-webkit-scrollbar-thumb { background: rgba(127, 140, 170, 0.25); border-radius: 4px; }
.term-screen ::selection { background: var(--t-selection); }

/* subtle CRT scanlines (dark themes only) */
.term-scan {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0 2px,
    rgba(0, 0, 0, 0.08) 2px 4px
  );
  opacity: 0.5;
  mix-blend-mode: multiply;
}
.term-theme-paper .term-scan { display: none; }

.term-screen .line { white-space: pre-wrap; word-break: break-word; }
.term-screen a { color: var(--t-cyan); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(111, 214, 255, 0.4); }
.term-screen a:hover { text-decoration-color: currentColor; }

.t-green { color: var(--t-green); }
.t-cyan { color: var(--t-cyan); }
.t-yellow { color: var(--t-yellow); }
.t-magenta { color: var(--t-magenta); }
.t-red { color: var(--t-red); }
.t-dim { color: var(--t-dim); }
.t-bold { font-weight: 700; }

.term-banner {
  color: var(--t-green);
  font-size: clamp(6.5px, 1.5vw, 12px);
  line-height: 1.25;
  text-shadow: 0 0 18px var(--t-glow);
}

/* bar charts */
.t-bar { color: var(--t-green); letter-spacing: -1px; }
.t-bar-bg { color: var(--t-dim); opacity: 0.35; letter-spacing: -1px; }

/* prompt row */
.term-input-row { display: flex; flex-wrap: wrap; align-items: baseline; }
.term-prompt { white-space: nowrap; }
.term-prompt .u { color: var(--t-prompt-user); font-weight: 700; }
.term-prompt .h { color: var(--t-prompt-host); font-weight: 700; }
.term-input {
  flex: 1;
  min-width: 40px;
  background: transparent;
  border: none;
  outline: none;
  font: inherit;
  color: inherit;
  caret-color: transparent;
  padding: 0;
}
.term-caret {
  display: inline-block;
  width: 8px;
  height: 1.1em;
  background: var(--t-text);
  vertical-align: text-bottom;
  margin-left: 1px;
  animation: caretBlink 1.05s steps(1) infinite;
}
@keyframes caretBlink { 50% { opacity: 0 } }

/* ── Quick command chips ── */
.term-chips {
  width: min(880px, 100%);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
  position: relative;
  z-index: 1;
}
.term-chip {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--t-text);
  background: rgba(127, 156, 245, 0.07);
  border: 1px solid var(--t-border);
  border-radius: 8px;
  padding: 7px 13px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease, color 0.2s ease;
  user-select: none;
}
.term-chip:hover {
  border-color: var(--t-green);
  color: var(--t-green);
  transform: translateY(-1px);
}
.term-chip--accent { color: var(--t-green); border-color: rgba(80, 250, 123, 0.35); }
.term-theme-paper .term-chip { background: rgba(0, 0, 0, 0.04); }

.term-hint {
  position: relative;
  z-index: 1;
  margin-top: 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--t-dim);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}
.term-hint .arr { animation: hintBob 1.8s ease-in-out infinite; }
@keyframes hintBob { 0%, 100% { transform: translateY(0) } 50% { transform: translateY(4px) } }

/* matrix rain canvas */
.term-matrix {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .term-hero { padding: 16px 10px 22px; }
  .term-window { height: 70svh; min-height: 380px; border-radius: 12px; }
  .term-screen { font-size: 12px; padding: 14px 12px 10px; }
  .term-banner { font-size: 5.2px; }
  .term-chips { gap: 6px; }
  .term-chip { font-size: 11px; padding: 6px 10px; }
  .term-titlebar .term-net { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .term-caret, .term-net::before, .term-hint .arr { animation: none !important; }
}
