/* ═══════════════════════════════════════════════════════════════════════════
   terminal.css  –  Full terminal-portfolio stylesheet
   Fonts: JetBrains Mono (monospace) loaded via Google Fonts in HTML
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── CSS Variables / Themes ────────────────────────────────────────────────── */
:root,
[data-theme="default"] {
  --bg:           #0d0d0d;
  --bg-subtle:    #141414;
  --bg-panel:     #181818;
  --border:       #2a2a2a;

  --text:         #e8e8e8;
  --text-dim:     #555;
  --text-muted:   #777;

  --accent:       #7aa2f7;      /* soft blue */
  --accent2:      #bb9af7;      /* lavender */
  --success:      #9ece6a;
  --warn:         #e0af68;
  --error:        #f7768e;
  --prompt:       #73daca;      /* teal prompt */

  --cursor-color: #e8e8e8;
  --selection-bg: rgba(122, 162, 247, 0.25);

  --font-size:    14px;
  --line-height:  1.7;
  --font-family:  'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

  --scanline-opacity: 0.02;
}

[data-theme="hacker"] {
  --bg:           #000;
  --bg-subtle:    #050f05;
  --bg-panel:     #071007;
  --border:       #0f3010;

  --text:         #00ff41;
  --text-dim:     #004d14;
  --text-muted:   #008c26;

  --accent:       #00ff41;
  --accent2:      #39ff14;
  --success:      #00ff41;
  --warn:         #c8ff00;
  --error:        #ff0055;
  --prompt:       #00ff41;

  --cursor-color: #00ff41;
  --selection-bg: rgba(0, 255, 65, 0.2);

  --scanline-opacity: 0.04;
}

/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

::selection {
  background: var(--selection-bg);
}

/* ── Body / Root ────────────────────────────────────────────────────────────── */
html, body {
  height: 100%;
  background: #000;
  overflow: hidden;
}

/* Mobile: allow full page scroll */
@media (max-width: 768px) {
  html, body {
    overflow: auto;
    height: auto;
  }
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size);
  line-height: var(--line-height);
  color: var(--text);
  background: var(--bg);
  /* CRT scanline overlay */
  background-image: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0, var(--scanline-opacity)) 2px,
    rgba(0,0,0, var(--scanline-opacity)) 4px
  );
}

/* ── Terminal wrapper ───────────────────────────────────────────────────────── */
#terminal {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 16px 16px;
  cursor: text;
}

/* Ensure buttons always show pointer, even inside cursor:text containers */
button, a { cursor: pointer; }

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

.tb-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}
.tb-dot.red   { background: #ff5f56; }
.tb-dot.amber { background: #ffbd2e; }
.tb-dot.green { background: #27c93f; }

#titlebar-text {
  margin-left: 8px;
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}

/* ── Output area ────────────────────────────────────────────────────────────── */
#terminal-output {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 8px;
  /* Custom scrollbar */
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

#terminal-output::-webkit-scrollbar       { width: 4px; }
#terminal-output::-webkit-scrollbar-track { background: transparent; }
#terminal-output::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ── Output line types ───────────────────────────────────────────────────────── */
.output-line,
.prompt-line,
.ai-line,
.thinking-line {
  display: block;
  padding: 1px 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.output-spacer {
  display: block;
  height: calc(var(--line-height) * var(--font-size) * 0.4);
}

.prompt-line {
  color: var(--prompt);
  margin-top: 12px;
}

.prompt-line::before {
  content: "";  /* prompt symbol already included in typed text */
}

.thinking-line {
  color: var(--text-muted);
  font-style: italic;
}

.ai-line {
  color: var(--text);
}

/* ── Inline colour helpers ───────────────────────────────────────────────────── */
.accent       { color: var(--accent); }
.accent2      { color: var(--accent2); }
.success      { color: var(--success); }
.warn         { color: var(--warn); }
.error        { color: var(--error); }
.dim          { color: var(--text-dim); }
.muted        { color: var(--text-muted); }

.label        { color: var(--accent2); }
.cmd-name     { color: var(--success); font-weight: 600; }
.job-title    { color: var(--accent); font-weight: 600; }
.company      { color: var(--text); }
.period       { color: var(--text-muted); font-size: 0.9em; }
.project-name { color: var(--accent); font-weight: 700; }
.link         { color: var(--accent); text-decoration: none; }
.link:hover   { text-decoration: underline; }

.big-name {
  font-size: 1.5em;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.04em;
}

/* ── Input line ──────────────────────────────────────────────────────────────── */
#input-line {
  display: flex;
  align-items: center;
  margin-top: 12px;
  flex-shrink: 0;
  position: relative;
}

#input-line.hidden {
  visibility: hidden;   /* hidden, not display:none — keeps layout stable */
}

#input-prefix {
  color: var(--prompt);
  flex-shrink: 0;
  margin-right: 0;
  user-select: none;
}

/* Invisible native input — captures keystrokes */
#terminal-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
  border: none;
  background: transparent;
  color: transparent;
  caret-color: transparent;
  outline: none;
  /* Keep it in the flow so mobile keyboards may appear */
  font-size: 16px; /* prevent iOS zoom */
}

/* Styled visible "input" area */
#input-display {
  display: flex;
  align-items: center;
  flex: 1;
  color: var(--text);
  min-height: 1.4em;
}

#input-prompt {
  white-space: pre;
}

/* Blinking cursor */
#cursor {
  display: inline-block;
  width: 0.6em;
  height: 1.1em;
  background: var(--cursor-color);
  margin-left: 1px;
  vertical-align: text-bottom;
  animation: blink 1.1s step-end infinite;
}

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

/* ── Mobile ─────────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  :root { --font-size: 12px; }

  #terminal { padding: 0 10px 10px; }

  #titlebar { padding: 8px 0 8px; }

  .big-name { font-size: 1.2em; }
}

/* ── Fade-in on page load ───────────────────────────────────────────────────── */
#terminal {
  animation: fadeIn 0.6s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── SEO content block — visible to crawlers, invisible to users ────────── */
#seo-content {
  display: none !important;
}

/* ── Print / no-animation preference ───────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  #cursor { animation: none; opacity: 1; }
  #terminal { animation: none; }
}


/* ═══════════════════════════════════════════════════════════════════════════
   LAYMAN LAYER  —  Welcome banner, action panel, nav buttons, suggestions,
   CTA. All non-terminal UI lives below this comment.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Page shell: stacks terminal above action panel ──────────────────────── */
#page-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

@media (max-width: 768px) {
  #page-shell {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }
}

/* Terminal now fills remaining space above the panel */
#page-shell #terminal {
  flex: 1;
  min-height: 0;   /* allow shrinking */
  height: auto;    /* override the 100vh from standalone use */
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
}

/* ── Welcome banner ──────────────────────────────────────────────────────── */
#welcome-banner {
  flex-shrink: 0;
  background: linear-gradient(135deg, #1a1f3a 0%, #0d0d0d 100%);
  border-bottom: 1px solid var(--border);
  padding: 10px 20px;
  display: flex;
  justify-content: center;
  animation: slideDown 0.4s ease;
  overflow: hidden;
  transition: max-height 0.35s ease, opacity 0.3s ease, padding 0.35s ease;
  max-height: 80px;
}

#welcome-banner.banner-gone {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  pointer-events: none;
}

@keyframes slideDown {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}

#welcome-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 860px;
  width: 100%;
}

#welcome-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
  letter-spacing: 0.04em;
}

#welcome-text {
  flex: 1;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

#welcome-heading {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

#welcome-sub {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

#welcome-sub strong {
  color: var(--accent);
}

#welcome-dismiss {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-family);
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s;
}

#welcome-dismiss:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Skip intro button (in titlebar) ─────────────────────────────────────── */
#skip-intro-btn {
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-family);
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  user-select: none;
}

#skip-intro-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Action panel ────────────────────────────────────────────────────────── */
#action-panel {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: var(--bg-panel);
  padding: 14px 20px 16px;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: flex-start;
}

/* Hidden until intro completes */
#action-panel.panel-hidden {
  display: none;
}

#action-panel.panel-visible {
  display: flex;
  animation: panelReveal 0.4s ease;
}

@keyframes panelReveal {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Panel sections ──────────────────────────────────────────────────────── */
.panel-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.panel-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  user-select: none;
}

/* ── Nav buttons ─────────────────────────────────────────────────────────── */
#panel-nav {
  flex-shrink: 0;
}

.btn-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.nav-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-family);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  white-space: nowrap;
}

.nav-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--bg-panel);
}

.nav-btn:active {
  transform: scale(0.97);
}

/* ── Suggested questions ─────────────────────────────────────────────────── */
#panel-questions {
  flex: 1;
  min-width: 200px;
}

.suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.suggestion-btn {
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--text-muted);
  font-family: var(--font-family);
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 20px;   /* pill shape — distinct from nav buttons */
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  text-align: left;
}

.suggestion-btn:hover {
  border-color: var(--accent2);
  color: var(--accent2);
  border-style: solid;
}

.suggestion-btn:active {
  transform: scale(0.97);
}

/* ── Contact CTA ─────────────────────────────────────────────────────────── */
#panel-cta {
  flex-shrink: 0;
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cta-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: var(--bg);
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 700;
  padding: 8px 18px;
  border-radius: 4px;
  text-decoration: none;
  transition: opacity 0.15s, transform 0.1s;
  white-space: nowrap;
}

.cta-button:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}

.cta-button:active {
  transform: scale(0.97);
}

.cta-button.cta-whatsapp {
  background: #25d366;
  color: #fff;
}

.cta-button.cta-whatsapp:hover {
  background: #1ebe5d;
  opacity: 1;
}

.cta-sub {
  font-size: 10px;
  color: var(--text-dim);
  text-align: center;
  margin-top: 4px;
}

/* ── Hacker theme overrides for layman layer ─────────────────────────────── */
[data-theme="hacker"] .cta-button {
  background: var(--accent);
  color: #000;
}

[data-theme="hacker"] .suggestion-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  #welcome-inner { gap: 10px; }
  #welcome-heading { font-size: 13px; }
  #welcome-sub { display: none; } /* keeps banner compact on small screens */

  #action-panel {
    padding: 12px 12px 14px;
    gap: 14px;
    flex-direction: column;
  }

  #panel-cta {
    width: 100%;
  }

  .cta-button {
    width: 100%;
    justify-content: center;
  }

  .btn-grid { gap: 5px; }

  .nav-btn { font-size: 11px; padding: 5px 10px; }
}