/* ==========================================================================
   David Aparicio Escribano Portfolio — Retro CRT × Single-Stream CLI Chat
   ========================================================================== */

/* ---------- Registered Custom Properties (enables CSS transitions on variables) ---------- */
@property --accent {
  syntax: '<color>';
  inherits: true;
  initial-value: #00ff88;
}

@property --accent-dim {
  syntax: '<color>';
  inherits: true;
  initial-value: #00cc6a;
}

@property --accent-glow {
  syntax: '<color>';
  inherits: true;
  initial-value: rgba(0, 255, 136, 0.15);
}

@property --accent-secondary {
  syntax: '<color>';
  inherits: true;
  initial-value: #00d4ff;
}

@property --accent-tertiary {
  syntax: '<color>';
  inherits: true;
  initial-value: #ff6b9d;
}

/* ---------- Custom Properties ---------- */
:root {
  /* Phosphor green theme (default - dark) */
  --bg-primary: #0a0e14;
  --bg-secondary: #0f1419;
  --bg-card: #141920;
  --bg-card-hover: #1a2028;
  --surface: #1c222b;

  --text-primary: #c5cdd8;
  --text-secondary: #6b7b8d;
  --text-muted: #3d4f5f;

  --accent: #00ff88;
  --accent-dim: #00cc6a;
  --accent-glow: rgba(0, 255, 136, 0.15);
  --accent-secondary: #00d4ff;
  --accent-tertiary: #ff6b9d;

  --border: #1e2832;
  --border-bright: #2a3642;

  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  --font-sans: 'Space Grotesk', system-ui, -apple-system, sans-serif;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px var(--accent-glow);

  --transition-fast: 150ms ease;
  --transition-base: 300ms ease;
  --transition-slow: 500ms ease;

  --nav-height: 48px;
  --max-width: 900px;

}

/* Light theme */
[data-theme="light"] {
  --bg-primary: #f5f5f0;
  --bg-secondary: #eeeee8;
  --bg-card: #ffffff;
  --bg-card-hover: #fafaf5;
  --surface: #e8e8e2;

  --text-primary: #1a1a2e;
  --text-secondary: #555570;
  --text-muted: #999aaa;

  --accent: #00875a;
  --accent-dim: #006644;
  --accent-glow: rgba(0, 135, 90, 0.1);
  --accent-secondary: #0077b6;
  --accent-tertiary: #d63384;

  --border: #ddddd5;
  --border-bright: #ccccc4;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
  --shadow-glow: 0 0 20px var(--accent-glow);
}

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

html {
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  height: 100vh;
  height: 100dvh;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-secondary);
}

code {
  font-family: var(--font-mono);
  background: var(--surface);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: 0.9em;
}

img {
  max-width: 100%;
  display: block;
}

::selection {
  background: var(--accent);
  color: var(--bg-primary);
}


/* ==========================================================================
   SCANLINES & CRT OVERLAYS
   ========================================================================== */

.scanlines {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
  opacity: 0.4;
}

[data-theme="light"] .scanlines {
  opacity: 0.15;
}

.crt-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9998;
  background: radial-gradient(
    ellipse at center,
    transparent 60%,
    rgba(0, 0, 0, 0.25) 100%
  );
}


/* ==========================================================================
   CHAT — Single fullscreen column
   ========================================================================== */

.chat {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: 100%;
  overflow: hidden;
}

/* ---------- Top Nav ---------- */
.chat__nav {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: var(--nav-height);
  background: rgba(10, 14, 20, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 50;
}

[data-theme="light"] .chat__nav {
  background: rgba(245, 245, 240, 0.9);
}

.chat__logo {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 500;
  white-space: nowrap;
}

/* ---------- Language Toggle ---------- */
.lang-toggle {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border);
  padding: 0.2rem 0.5rem;
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: color 0.2s, border-color 0.2s;
}
.lang-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ---------- Scrollable Messages ---------- */
.chat__messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  contain: content;
  will-change: scroll-position;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

.chat__messages::-webkit-scrollbar {
  width: 6px;
}

.chat__messages::-webkit-scrollbar-track {
  background: transparent;
}

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

/* ---------- Input Area (fixed bottom) ---------- */
.chat__input-area {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  padding: 0.75rem 1.5rem;
}

.chat__suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.chat__form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chat__form .terminal__prompt {
  flex-shrink: 0;
}

.chat__form .terminal__input {
  flex: 1;
  font-size: 0.9rem;
  padding: 0.4rem 0;
}

.chat__send {
  flex-shrink: 0;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.4rem 0.55rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.chat__send:hover {
  color: var(--accent);
  border-color: var(--accent);
}


/* ==========================================================================
   CHAT MESSAGES
   ========================================================================== */

.chat-msg {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.6;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  word-break: break-word;
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
}

.chat-msg code {
  font-size: 0.85em;
  padding: 1px 4px;
  background: var(--surface);
  border-radius: 2px;
}

.chat-msg__prompt {
  color: var(--accent);
  font-weight: 700;
  margin-right: 0.3rem;
}

.chat-msg__prefix {
  color: var(--text-muted);
  font-weight: 600;
  margin-right: 0.3rem;
}

/* User */
.chat-msg--user {
  background: var(--accent-glow);
  border-left: 2px solid var(--accent);
  color: var(--text-primary);
}

/* System */
.chat-msg--system {
  color: var(--text-secondary);
}

/* AI */
.chat-msg--ai {
  background: var(--bg-card);
  border-left: 2px solid var(--accent-secondary);
  color: var(--text-primary);
}
.ai-response-content {
  display: block;
  line-height: 1.6;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.ai-response-content p { margin: 0.5em 0; }
.ai-response-content code {
  background: rgba(0, 255, 65, 0.08);
  padding: 0.1em 0.3em;
  border-radius: 3px;
  font-size: 0.9em;
}
.ai-response-content pre {
  background: var(--bg-darker);
  padding: 0.75rem;
  border-radius: 4px;
  overflow-x: auto;
  margin: 0.5em 0;
}
.ai-response-content pre code {
  background: none;
  padding: 0;
}
.ai-response-content ul,
.ai-response-content ol {
  padding-left: 1.5em;
  margin: 0.5em 0;
}

/* Error */
.chat-msg--error {
  background: rgba(255, 107, 157, 0.08);
  border-left: 2px solid var(--accent-tertiary);
  color: var(--accent-tertiary);
}

/* Typing */
.chat-msg--typing {
  color: var(--text-muted);
}

/* Block — full width, no extra padding (content blocks render inside) */
.chat-msg--block {
  padding: 0;
  background: none;
}

/* Flash highlight for dedup (same command twice) */
.chat-msg--flash {
  animation: block-flash 0.8s ease-out;
}

@keyframes block-flash {
  0% { outline: 1px solid var(--accent); outline-offset: 4px; }
  100% { outline: 1px solid transparent; outline-offset: 8px; }
}

/* Hero — centered, bigger */
.chat-msg--hero {
  padding: 0.5rem 0;
  text-align: center;
  background: none;
}

/* Container for rendered blocks inside a message */
.chat-blocks {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Typing dots animation */
.typing-dots {
  display: inline-flex;
  gap: 3px;
  align-items: center;
}

.typing-dots span {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-secondary);
  animation: dotBounce 1.2s infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes dotBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-5px); opacity: 1; }
}


/* ==========================================================================
   TERMINAL SHARED PARTS (prompt, caret, input, ascii)
   ========================================================================== */

.terminal__prompt {
  color: var(--accent);
  font-weight: 700;
  font-family: var(--font-mono);
}

.terminal__caret {
  color: var(--accent);
  animation: blink 1s step-end infinite;
}

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

.terminal__input {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  background: transparent;
  border: none;
  color: var(--text-primary);
  outline: none;
  caret-color: var(--accent);
}

.terminal__input::placeholder {
  color: var(--text-muted);
}

.ascii-art {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  line-height: 1.2;
  color: var(--accent);
  margin: 0 auto;
  overflow-x: auto;
  white-space: pre;
}

.hero__subtitle,
.hero-subtitle {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.hero__tagline,
.hero-tagline {
  font-size: 1.15rem;
  color: var(--text-primary);
  margin-bottom: 0;
  max-width: 500px;
}


/* ==========================================================================
   SUGGESTION CHIPS
   ========================================================================== */

.suggestion-chip {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.35rem 0.7rem;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.suggestion-chip:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-glow);
}


/* ==========================================================================
   AI CONFIG BLOCK (rendered as chat message)
   ========================================================================== */

.ai-config-block {
  background: var(--bg-card);
  border: 1px solid var(--border-bright);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: var(--max-width);
  width: 100%;
}

.ai-config-block__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ai-config-block__title {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.9rem;
}

.ai-config-block__desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.ai-config-block__desc strong {
  color: var(--accent);
}

.ai-config-block__providers {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.provider-btn__badge {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--accent);
  color: var(--bg-primary);
  padding: 0.1em 0.35em;
  border-radius: 3px;
  margin-left: 0.3em;
  vertical-align: middle;
}

.ai-config-block__provider-help {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--text-secondary);
  padding: 0.6rem 0.75rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.ai-config-block__provider-help a {
  color: var(--accent);
  text-decoration: none;
}

.ai-config-block__provider-help a:hover {
  text-decoration: underline;
}

.ai-config-block__free-tag {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--accent);
  color: var(--bg-primary);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  margin-right: 0.3em;
}

.ai-config-block__key-row {
  display: flex;
  gap: 0.4rem;
  align-items: stretch;
}

.ai-config-block__key-row .form__input {
  flex: 1;
}

.ai-config-block__eye {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.4rem 0.5rem;
  display: flex;
  align-items: center;
  transition: all var(--transition-fast);
}

.ai-config-block__eye:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.ai-config-block__custom-url {
  /* Visibility controlled via inline style in JS */
}

/* Transparency details */
.ai-config-block__detail {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.ai-config-block__detail summary {
  padding: 0.5rem 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  transition: color var(--transition-fast);
  list-style: none;
  font-size: 0.72rem;
}

.ai-config-block__token-count {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  padding: 0.1em 0.4em;
  border-radius: 3px;
  margin-left: 0.4em;
  opacity: 0.8;
}

.ai-config-block__detail summary::-webkit-details-marker { display: none; }

.ai-config-block__detail summary::before {
  content: '\25B8  ';
}

.ai-config-block__detail[open] summary::before {
  content: '\25BE  ';
}

.ai-config-block__detail summary:hover {
  color: var(--accent);
}

.ai-config-block__detail[open] summary {
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.ai-config-block__profile-md {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  line-height: 1.6;
  color: var(--text-secondary);
  padding: 0.75rem;
  background: var(--bg-secondary);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto;
  margin: 0;
}

.ai-config-block__code-section {
  padding: 0.75rem;
  background: var(--bg-secondary);
  font-size: 0.72rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.ai-config-block__code-section p {
  margin-bottom: 0.5rem;
}

.ai-config-block__code-section strong {
  color: var(--accent);
}

.ai-config-block__code {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  line-height: 1.5;
  color: var(--text-secondary);
  padding: 0.75rem;
  background: var(--bg-primary);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 300px;
  overflow-y: auto;
  margin: 0.5rem 0 0;
  border-radius: var(--radius-sm);
}

.ai-config-block__verify {
  padding: 0.75rem;
  background: var(--bg-secondary);
  font-size: 0.72rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.ai-config-block__verify ol {
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ai-config-block__verify strong {
  color: var(--text-primary);
}

.ai-config-block__verify code {
  font-size: 0.85em;
}

.ai-config-block__verify kbd {
  font-family: var(--font-mono);
  font-size: 0.8em;
  padding: 1px 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
}

.ai-config-block__skip {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.8rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  align-self: flex-start;
}

.ai-config-block__skip:hover {
  color: var(--accent-tertiary);
  border-color: var(--accent-tertiary);
}

/* Dismissed state — hide everything except the header */
.ai-config-block--dismissed .ai-config-block__desc,
.ai-config-block--dismissed .ai-config-block__providers,
.ai-config-block--dismissed .ai-config-block__provider-help,
.ai-config-block--dismissed .ai-config-block__key-row,
.ai-config-block--dismissed .ai-config-block__custom-url,
.ai-config-block--dismissed .ai-config-block__detail,
.ai-config-block--dismissed .ai-config-block__skip,
.ai-config-block--dismissed > .form__input {
  display: none;
}

.ai-config-block--dismissed .ai-config-block__title::after {
  content: ' — desactivado';
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.72rem;
}


/* ==========================================================================
   PROVIDER BUTTONS
   ========================================================================== */

.provider-btn {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.5rem 0.6rem;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  border-right: 1px solid var(--border);
  white-space: nowrap;
  text-align: center;
}

.provider-btn:last-child {
  border-right: none;
}

.provider-btn:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

.provider-btn--active {
  background: var(--accent);
  color: var(--bg-primary);
  font-weight: 600;
}

.provider-btn--active:hover {
  background: var(--accent-dim);
  color: var(--bg-primary);
}


/* ==========================================================================
   SHARED COMPONENT STYLES
   ========================================================================== */

/* ---------- Highlight ---------- */
.highlight {
  color: var(--accent);
  font-weight: 500;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  font-weight: 500;
}

.btn--primary {
  background: var(--accent);
  color: var(--bg-primary);
  border-color: var(--accent);
}

.btn--primary:hover {
  background: transparent;
  color: var(--accent);
  box-shadow: var(--shadow-glow);
}

.btn--outline {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
}

.btn--outline:hover {
  background: var(--accent);
  color: var(--bg-primary);
}

/* ---------- Form Inputs ---------- */
.form__input {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 0.55rem 0.75rem;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  outline: none;
}

.form__input::placeholder {
  color: var(--text-muted);
}

.form__input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}


/* ==========================================================================
   STATS
   ========================================================================== */

.about__stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.stat {
  text-align: center;
}

.stat__number {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  display: inline;
}

.stat__suffix {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  color: var(--accent);
}

.stat__label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  font-family: var(--font-mono);
}

/* Clickable stat */
.stat--clickable {
  cursor: pointer;
  transition: transform 0.15s ease, color 0.15s ease;
}

.stat--clickable:hover,
.stat--clickable:focus-visible {
  transform: scale(1.05);
}

.stat--clickable .stat__label {
  text-decoration: underline;
  text-decoration-style: dashed;
  text-underline-offset: 3px;
}


/* ==========================================================================
   RECOMMENDATIONS
   ========================================================================== */

.recs-modal__body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.rec {
  margin: 0;
  padding: 0 0 0 1rem;
  border-left: 2px solid var(--accent);
}

.rec__text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0 0 0.5rem;
  font-style: italic;
}

.rec__author {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
}

.rec__author cite {
  font-style: normal;
  color: var(--text-muted);
}


/* ==========================================================================
   MINI TERMINAL (config block inside about)
   ========================================================================== */

.mini-terminal {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-bright);
  box-shadow: var(--shadow-md);
}

.mini-terminal__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.mini-terminal__title {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.mini-terminal__body {
  background: var(--bg-card);
  padding: 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.8;
}

.code-comment { color: var(--text-muted); font-style: italic; }
.code-keyword { color: var(--accent-secondary); }
.code-string  { color: var(--accent); }
.code-prop    { color: var(--text-primary); }
.code-number  { color: var(--accent-secondary); }
.code-bool    { color: var(--accent-secondary); }


/* ==========================================================================
   EXPERIENCE TIMELINE (chronological, grouped by company)
   ========================================================================== */

.experience__timeline {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Company group wrapper */
.experience__group {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  transition: all var(--transition-base);
}

.experience__group:hover {
  border-color: var(--accent);
}

/* Company name header */
.experience__company {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--accent-secondary);
  font-weight: 600;
  margin-bottom: 0.75rem;
}

/* Container for positions inside a group */
.experience__positions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-left: 1rem;
  border-left: 1px solid var(--border-bright);
}

/* Single position */
.experience__item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.experience__year {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent);
  opacity: 0.7;
  letter-spacing: 0.03em;
}

.experience__role {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.experience__desc {
  font-size: 0.83rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-top: 0.2rem;
}

.experience__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.4rem;
}

/* Single-position groups: tighten the indent since there's only one */
.experience__positions:only-child:has(> .experience__item:only-child) {
  padding-left: 0;
  border-left: none;
}


/* ==========================================================================
   FULL TIMELINE — Central trunk + branches (tree / root style)
   Desktop: trunk centered, branches fan out left/right
   Mobile: single column with bracket
   ========================================================================== */

.fulltimeline {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  position: relative;
  padding: 1rem 0;
}

/* Central trunk line */
.fulltimeline::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border-bright);
  transform: translateX(-50%);
}

/* ---------- Single row (centered on trunk) ---------- */
.fulltimeline__row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.4rem 0;
  position: relative;
  width: 100%;
  max-width: var(--max-width);
  justify-content: center;
}

/* Dot sits on the trunk */
.fulltimeline__dot {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-primary);
  margin-top: 0.25rem;
  z-index: 2;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

/* Content next to dot — alternating sides handled via parallel,
   single items just center-left */
.fulltimeline__row > .fulltimeline__content {
  width: 45%;
  margin-left: 52%;
}

/* Kind-based dot colors */
.fulltimeline__row--formation .fulltimeline__dot { background: var(--accent-secondary); }
.fulltimeline__row--cert .fulltimeline__dot { background: var(--text-muted); width: 8px; height: 8px; }
.fulltimeline__row--life .fulltimeline__dot { background: var(--text-secondary); width: 12px; height: 12px; }
.fulltimeline__row--life .fulltimeline__label { color: var(--text-secondary); font-style: italic; }
.fulltimeline__row--exit .fulltimeline__dot { background: #ff9f43; width: 8px; height: 8px; }
.fulltimeline__row--exit .fulltimeline__label { color: var(--text-secondary); opacity: 0.8; }
.fulltimeline__row--next .fulltimeline__dot { background: var(--accent-tertiary); animation: pulse 2s infinite; }

/* Graduation — blue accent, no box, same layout as other rows */
.fulltimeline__row--graduation .fulltimeline__dot { background: #5b9bd5; }
.fulltimeline__row--graduation .fulltimeline__label { color: #5b9bd5; font-weight: 600; }
.fulltimeline__row--graduation .fulltimeline__year { color: #5b9bd5; }
.fulltimeline__row--graduation > .fulltimeline__content {
  border-left: 2px solid #5b9bd5;
  padding-left: 0.75rem;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); }
  50% { box-shadow: 0 0 0 6px transparent; }
}

/* ---------- Parallel group — branches fan out ---------- */
.fulltimeline__parallel {
  position: relative;
  width: 100%;
  max-width: var(--max-width);
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0.25rem 0;
}

/* Fork / merge lines from trunk */
.fulltimeline__parallel::before,
.fulltimeline__parallel::after {
  content: '';
  position: absolute;
  left: calc(50% - 1px);
  width: 2px;
  height: 8px;
  background: var(--accent);
  z-index: 1;
}
.fulltimeline__parallel::before { top: 0; }
.fulltimeline__parallel::after { bottom: 0; }

/* Branch connector lines from trunk to each card */
.fulltimeline__branch {
  position: relative;
  display: flex;
  align-items: flex-start;
  padding: 0.35rem 0;
  width: 100%;
}

/* Odd branches go left, even go right — tree effect */
.fulltimeline__branch:nth-child(odd) {
  justify-content: flex-end;
  padding-right: calc(50% + 1.25rem);
}

.fulltimeline__branch:nth-child(even) {
  justify-content: flex-start;
  padding-left: calc(50% + 1.25rem);
}

/* Horizontal connector from trunk to branch card */
.fulltimeline__branch::before {
  content: '';
  position: absolute;
  top: 0.65rem;
  height: 2px;
  background: var(--accent);
  z-index: 1;
}

.fulltimeline__branch:nth-child(odd)::before {
  right: calc(50% - 1px);
  width: 1.25rem;
}

.fulltimeline__branch:nth-child(even)::before {
  left: calc(50% - 1px);
  width: 1.25rem;
}

/* Dot on the branch */
.fulltimeline__branch .fulltimeline__dot {
  position: absolute;
  top: 0.35rem;
}

.fulltimeline__branch:nth-child(odd) .fulltimeline__dot {
  right: calc(50% + 1rem);
  left: auto;
  transform: none;
}

.fulltimeline__branch:nth-child(even) .fulltimeline__dot {
  left: calc(50% + 1rem);
  transform: none;
}

/* Card content in branch */
.fulltimeline__branch > .fulltimeline__content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  max-width: 100%;
  transition: border-color var(--transition-fast);
}

.fulltimeline__branch > .fulltimeline__content:hover {
  border-color: var(--accent);
}

/* Kind-based border + connector colors */
.fulltimeline__branch--work > .fulltimeline__content { border-color: var(--accent); }
.fulltimeline__branch--work::before { background: var(--accent); }

.fulltimeline__branch--exit > .fulltimeline__content { border-color: #ff9f43; }
.fulltimeline__branch--exit::before { background: #ff9f43; }
.fulltimeline__branch--exit .fulltimeline__label { color: var(--text-secondary); }

.fulltimeline__branch--formation > .fulltimeline__content { border-color: var(--accent-secondary); }
.fulltimeline__branch--formation::before { background: var(--accent-secondary); }

.fulltimeline__branch--cert > .fulltimeline__content { border-color: var(--text-muted); }
.fulltimeline__branch--cert::before { background: var(--text-muted); }

.fulltimeline__branch--life > .fulltimeline__content { border-color: var(--text-secondary); }
.fulltimeline__branch--life::before { background: var(--text-secondary); }

/* Active branch — glowing border */
.fulltimeline__branch--active > .fulltimeline__content {
  border-color: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

/* Closed branch — subtle */
.fulltimeline__branch--closed > .fulltimeline__content {
  opacity: 0.7;
}

.fulltimeline__branch--closed .fulltimeline__label {
  text-decoration: line-through;
  text-decoration-color: var(--text-muted);
}

/* ---------- Content (shared between single rows and branches) ---------- */
.fulltimeline__content {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.fulltimeline__year {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--accent);
  opacity: 0.7;
  letter-spacing: 0.03em;
}

.fulltimeline__row--cert .fulltimeline__year { color: var(--text-muted); }

.fulltimeline__label {
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
}

.fulltimeline__row--formation .fulltimeline__label { color: var(--accent-secondary); }
.fulltimeline__row--cert .fulltimeline__label { font-size: 0.78rem; color: var(--text-secondary); font-weight: 400; }

.fulltimeline__note {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  line-height: 1.5;
}

/* Duration pill */
.fulltimeline__duration {
  font-size: 0.6rem;
  color: var(--text-muted);
  background: var(--surface);
  padding: 1px 5px;
  border-radius: 3px;
  vertical-align: middle;
}

/* Status badges */
.fulltimeline__badge {
  font-size: 0.56rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 1px 5px;
  border-radius: 3px;
  vertical-align: middle;
}

.fulltimeline__badge--active {
  color: var(--accent);
  background: var(--accent-glow);
  border: 1px solid var(--accent);
}

.fulltimeline__badge--closed {
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
}

/* Active row dot */
.fulltimeline__row--active .fulltimeline__dot {
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Branch dot kind colors */
.fulltimeline__dot--formation { background: var(--accent-secondary); }
.fulltimeline__dot--cert { background: var(--text-muted); width: 8px; height: 8px; }
.fulltimeline__dot--exit { background: #ff9f43; width: 8px; height: 8px; }

/* Active branch dot */
.fulltimeline__branch--active .fulltimeline__dot {
  box-shadow: 0 0 0 3px var(--accent-glow);
}


/* ==========================================================================
   EMPRESAS GRID
   ========================================================================== */

.empresas__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.empresa-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  transition: all var(--transition-base);
}

.empresa-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.empresa-card__name {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
}

a.empresa-card__name:hover {
  color: var(--accent-secondary);
}

.empresa-card__role {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.empresa-card__acquired {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent-tertiary);
  margin-top: 0.25rem;
  font-weight: 500;
}

.empresa-card__closed {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  font-weight: 400;
}


/* ==========================================================================
   FORMATION / TIMELINE
   ========================================================================== */

/* --- Formation: sections layout --- */
.formation {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.formation__section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.formation__heading {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.formation__icon {
  font-size: 1rem;
}

/* --- Academic titles: prominent cards --- */
.formation__academic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.formation__academic-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.25rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--accent-dim);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  transition: all var(--transition-base);
  box-shadow: 0 0 12px var(--accent-glow);
}

.formation__academic-card:hover {
  border-color: var(--accent);
  transform: translateX(4px);
  box-shadow: 0 0 20px var(--accent-glow);
}

.formation__academic-year {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  letter-spacing: 0.05em;
}

.formation__academic-title {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.formation__academic-place {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent-dim);
}

/* --- Certifications: compact rows --- */
.formation__cert-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.formation__cert-row {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition-base);
}

.formation__cert-row:hover {
  background: var(--bg-card);
}

.formation__cert-group {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--accent-primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.6rem 0.75rem 0.15rem;
  margin-top: 0.4rem;
  border-left: 2px solid var(--accent-primary);
  opacity: 0.7;
}

.formation__cert-row--grouped {
  padding-left: 1.5rem;
}

.formation__cert-badge {
  font-size: 0.5rem;
  color: var(--text-muted);
  flex-shrink: 0;
  line-height: 1;
  position: relative;
  top: -1px;
}

.formation__cert-title {
  font-family: var(--font-sans);
  font-size: 0.88rem;
  color: var(--text-primary);
  font-weight: 400;
}

.formation__cert-place {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-left: auto;
  white-space: nowrap;
}


/* ==========================================================================
   SKILLS
   ========================================================================== */

/* --- Skills: section layout --- */
.skills {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.skills__section {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  overflow: hidden;
}

.skills__section-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(90deg, var(--accent-glow), transparent);
}

.skills__section-icon {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  color: var(--accent);
}

.skills__section-title {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.skills__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
}

.skill-card {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.skill-card:hover {
  background: var(--accent-glow);
}

.skill-card:nth-child(2n) {
  border-right: none;
}

.skill-card:nth-last-child(-n+2) {
  border-bottom: none;
}

.skill-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.skill-card__title {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.skill-card__chevron {
  font-size: 0.6rem;
  color: var(--text-muted);
  transition: transform var(--transition-fast);
}

.skill-card--open .skill-card__chevron {
  transform: rotate(90deg);
  color: var(--accent);
}

.skill-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.75rem;
  max-height: 200px;
  overflow: hidden;
  transition: max-height 0.3s ease, margin-top 0.3s ease, opacity 0.3s ease;
  opacity: 1;
}

.skill-card__tags--hidden {
  max-height: 0;
  margin-top: 0;
  opacity: 0;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.3rem 0.65rem;
  background: var(--accent-glow);
  color: var(--accent);
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent-glow);
  transition: all var(--transition-fast);
}

.tag:hover {
  background: var(--accent);
  color: var(--bg-primary);
}

.tag--sm {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
}


/* ==========================================================================
   PROJECTS
   ========================================================================== */

.projects__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  transition: all var(--transition-base);
  display: flex;
  flex-direction: column;
}

.project-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
  transform: translateY(-4px);
}

.project-card__icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.project-card__title {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.project-card__desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 1.25rem;
  flex-grow: 1;
}

.project-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.project-card__links {
  display: flex;
  gap: 0.75rem;
  margin-top: auto;
}

.project-card__link {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  transition: color var(--transition-fast);
}

.project-card__link:hover {
  color: var(--accent);
}


/* ==========================================================================
   PHILOSOPHY
   ========================================================================== */

.philosophy__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.philosophy__card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 2rem;
  transition: all var(--transition-base);
}

.philosophy__card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.philosophy__header {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.philosophy__number {
  font-family: var(--font-mono);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent);
  opacity: 0.3;
  line-height: 1;
}

.philosophy__keyword {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--accent);
  opacity: 0.5;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  align-self: flex-end;
  padding-bottom: 0.25rem;
}

.philosophy__card h3,
.philosophy__title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.philosophy__card p,
.philosophy__text {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.7;
}


/* ==========================================================================
   HUMAN IN THE LOOP
   ========================================================================== */

.hitl {
  max-width: 720px;
}

.hitl__intro {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

.hitl__thesis {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent);
  border-left: 3px solid var(--accent);
  padding: 1rem 1.5rem;
  margin: 0 0 2rem 0;
  background: var(--accent-glow);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  line-height: 1.6;
}

.hitl__points {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.hitl__point {
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  transition: border-color var(--transition-fast);
}

.hitl__point:hover {
  border-color: var(--accent);
}

.hitl__keyword {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  display: block;
  margin-bottom: 0.5rem;
}

.hitl__desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

.hitl__closing {
  font-size: 0.95rem;
  color: var(--text-primary);
  font-weight: 500;
  line-height: 1.7;
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  margin-bottom: 1.5rem;
}

.hitl__coda {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 0.75rem 1rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
}

.hitl__coda-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  transition: color var(--transition-fast);
}

.hitl__coda-link:hover {
  color: var(--text-primary);
  text-decoration: underline;
}


/* ==========================================================================
   AI USAGE
   ========================================================================== */

.ai-usage {
  max-width: 720px;
}

.ai-usage__grid {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.ai-usage__card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  padding: 1.25rem 1.5rem;
  transition: border-color var(--transition-fast);
}

.ai-usage__card:hover {
  border-color: var(--border-bright);
}

.ai-usage__card-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.25rem;
}

.ai-usage__icon {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--accent);
}

.ai-usage__title {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.ai-usage__tools {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  letter-spacing: 0.02em;
}

.ai-usage__rows {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.ai-usage__row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.ai-usage__label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 0.15rem;
}

.ai-usage__label--ai {
  background: var(--accent-glow);
  color: var(--accent);
  border: 1px solid var(--accent-glow);
}

.ai-usage__label--human {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-bright);
}

.ai-usage__text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

.ai-usage__text--human {
  color: var(--text-primary);
  font-weight: 500;
}


/* ==========================================================================
   CONTACT
   ========================================================================== */

.contact__content {
  max-width: 640px;
}

.contact__intro {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.contact__links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.contact__social {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  transition: color var(--transition-fast);
}

.contact__social:hover {
  color: var(--accent);
}

.contact__social svg {
  flex-shrink: 0;
}


/* ==========================================================================
   CLI BLOCK RENDERER — text, markdown, block-enter
   ========================================================================== */

.cli-text {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

.cli-text a {
  color: var(--accent);
}

.cli-text code {
  font-family: var(--font-mono);
  background: var(--surface);
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-sm);
  font-size: 0.9em;
}

.cli-markdown {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

.cli-markdown h1,
.cli-markdown h2,
.cli-markdown h3,
.cli-markdown h4,
.cli-markdown h5,
.cli-markdown h6 {
  color: var(--text-primary);
  margin: 1.5rem 0 0.75rem;
  font-weight: 600;
}

.cli-markdown h1 { font-size: 1.75rem; }
.cli-markdown h2 { font-size: 1.5rem; }
.cli-markdown h3 { font-size: 1.25rem; }

.cli-markdown p {
  margin-bottom: 1rem;
}

.cli-markdown ul {
  margin: 0.75rem 0;
  padding-left: 1.5rem;
}

.cli-markdown li {
  margin-bottom: 0.35rem;
}

.cli-markdown a {
  color: var(--accent);
}

.cli-markdown code {
  font-family: var(--font-mono);
  background: var(--surface);
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-sm);
  font-size: 0.9em;
}

/* Block enter animation */
.block-enter {
  animation: blockEnter 0.3s ease forwards;
}

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


/* ==========================================================================
   FOOTER
   ========================================================================== */

.footer {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  padding: 1rem 2rem;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

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

.footer__pipe {
  color: var(--text-muted);
  margin: 0 0.4rem;
}

.footer__built {
  font-size: 0.65rem;
  color: var(--text-muted);
}


/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 768px) {
  /* --- PERFORMANCE: kill compositing-heavy layers on mobile GPUs --- */
  .scanlines,
  .crt-overlay {
    display: none;
  }

  .chat__nav {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: var(--bg-primary);
    padding: 0 1rem;
  }

  .chat__logo {
    font-size: 0.75rem;
  }

  .chat__messages {
    padding: 1rem;
  }

  /* Kill infinite box-shadow animation — repaint every frame */
  .fulltimeline__row--next .fulltimeline__dot {
    animation: none;
  }

  .chat__input-area {
    padding: 0.65rem 1rem;
  }

  /* Stats grid: 2 columns on mobile */
  .about__stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .stat__number {
    font-size: 1.5rem;
  }

  /* Grids: single column */
  .skills__grid,
  .empresas__grid {
    grid-template-columns: 1fr;
  }

  .formation__academic-grid {
    grid-template-columns: 1fr;
  }

  .formation__cert-row {
    flex-wrap: wrap;
  }

  .formation__cert-place {
    margin-left: 1.1rem;
    width: 100%;
  }

  .philosophy__grid {
    grid-template-columns: 1fr;
  }

  /* ASCII art smaller */
  .ascii-art {
    font-size: 0.38rem;
  }

  /* Timeline: collapse to single left-aligned column */
  .fulltimeline { align-items: flex-start; padding-left: 1.25rem; }
  .fulltimeline::before { left: 5px; transform: none; }

  .fulltimeline__row { justify-content: flex-start; }
  .fulltimeline__row > .fulltimeline__content { width: auto; margin-left: 0; padding-left: 1rem; }
  .fulltimeline__dot { position: relative; left: -1.25rem; margin-right: -1.25rem; transform: none; }

  .fulltimeline__parallel { padding-left: 0.75rem; margin-left: -0.15rem; }
  .fulltimeline__parallel::before,
  .fulltimeline__parallel::after { left: -2px; width: 6px; height: 2px; }

  .fulltimeline__branch { padding-left: 0 !important; padding-right: 0 !important; justify-content: flex-start !important; }
  .fulltimeline__branch::before { left: -2px !important; right: auto !important; width: 1rem !important; }
  .fulltimeline__branch .fulltimeline__dot { position: relative; left: -0.5rem; right: auto; margin-right: -0.5rem; transform: none; }
  .fulltimeline__branch > .fulltimeline__content { margin-left: 0.5rem; }

  /* Footer */
  .footer {
    padding: 0.75rem 1rem;
    font-size: 0.68rem;
  }
}

/* Small mobile */
@media (max-width: 420px) {
  .ascii-art {
    font-size: 0.3rem;
  }

  .suggestion-chip {
    font-size: 0.65rem;
    padding: 0.3rem 0.55rem;
  }

  .chat-msg {
    font-size: 0.78rem;
  }

  .contact__links {
    flex-direction: column;
    gap: 1rem;
  }

  .ai-config-block {
    padding: 1rem;
    font-size: 0.75rem;
  }
}


/* ==========================================================================
   ACCESSIBILITY
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }

  .scanlines,
  .crt-overlay {
    display: none;
  }
}

/* Focus visible for keyboard navigation */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Utility ---------- */
.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;
}

/* ==========================================================================
   AUTODESTROY HOOK MESSAGE
   ========================================================================== */

.chat-msg--autodestroy {
  padding: 0;
  background: none;
}

.autodestroy-hook {
  position: relative;
  background: #0a0808;
  border: 1px dashed #3a3028;
  border-radius: var(--radius-sm);
  padding: 1.5rem 2rem;
  overflow: hidden;
  font-family: 'IBM Plex Mono', 'JetBrains Mono', var(--font-mono);
}

.autodestroy-hook__scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(196, 132, 29, 0.03) 2px,
    rgba(196, 132, 29, 0.03) 4px
  );
  pointer-events: none;
  z-index: 1;
}

.autodestroy-hook__text {
  position: relative;
  z-index: 2;
  color: #9a8e78;
  font-size: 0.8rem;
  line-height: 1.7;
  margin: 0 0 1.25rem;
}

.autodestroy-hook__glitch {
  display: inline-block;
  color: #c4841d;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  animation: autodestroy-glitch 0.15s 0.5s linear 3;
}

.autodestroy-hook__btn {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.5rem;
  background: transparent;
  border: 1px solid #c4841d;
  color: #d4c5a9;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.3s ease;
}

.autodestroy-hook__btn:hover {
  background: rgba(196, 132, 29, 0.15);
  border-color: #d4c5a9;
  box-shadow:
    0 0 15px rgba(196, 132, 29, 0.3),
    0 0 40px rgba(196, 132, 29, 0.1);
  text-shadow: 0 0 8px rgba(196, 132, 29, 0.5);
}

.autodestroy-hook__btn-cursor {
  color: #c4841d;
  animation: autodestroy-cursor-blink 1s step-end infinite;
}

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

.autodestroy-hook__warning {
  position: relative;
  z-index: 2;
  color: #8a5c15;
  font-size: 0.65rem;
  font-style: italic;
  letter-spacing: 0.05em;
  margin: 0 0 1.25rem;
  opacity: 0.7;
}

/* ==========================================================================
   AUTODESTROY PORTAL TRANSITION
   Color shift: portfolio green CRT → autodestroy void/rust/bone
   ========================================================================== */

.autodestroy-portal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #0a0808;
  opacity: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s ease;
}

.autodestroy-portal--active {
  opacity: 1;
  pointer-events: all;
  animation: autodestroy-takeover 13s ease-in forwards;
}

@keyframes autodestroy-takeover {
  0% {
    opacity: 0;
    background: rgba(10, 8, 8, 0);
  }
  5% {
    opacity: 1;
    background: rgba(10, 8, 8, 0.6);
  }
  12% {
    background: rgba(10, 8, 8, 0.85);
  }
  20% {
    background: #0a0808;
  }
  100% {
    background: #0a0808;
  }
}

/* Scanlines — autodestroy style (rust tint, not green) */
.autodestroy-portal__scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(196, 132, 29, 0.03) 2px,
    rgba(196, 132, 29, 0.03) 4px
  );
  pointer-events: none;
  z-index: 1;
}

/* Text block */
.autodestroy-portal__text {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  font-family: 'IBM Plex Mono', 'JetBrains Mono', monospace;
}

.autodestroy-portal__line {
  text-transform: uppercase;
  letter-spacing: 0.3em;
  opacity: 0;
  transform: translateY(8px);
}

.autodestroy-portal__line--1 {
  font-size: 0.7rem;
  color: #c4841d;
  animation: autodestroy-line-in 0.8s 2s ease forwards;
}

.autodestroy-portal__line--2 {
  font-size: 0.6rem;
  color: #8a5c15;
  animation: autodestroy-line-in 0.8s 5s ease forwards;
}

.autodestroy-portal__line--3 {
  font-size: 1rem;
  font-weight: 700;
  color: #d4c5a9;
  text-shadow:
    0 0 10px rgba(196, 132, 29, 0.4),
    0 0 40px rgba(196, 132, 29, 0.15);
  animation: autodestroy-line-in 0.8s 9s ease forwards,
             autodestroy-glitch 0.15s 10.5s linear 10;
}

@keyframes autodestroy-line-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes autodestroy-glitch {
  0% { transform: translate(0); }
  20% { transform: translate(-2px, 1px); }
  40% { transform: translate(2px, -1px); color: #2a6b6b; }
  60% { transform: translate(-1px, -1px); }
  80% { transform: translate(1px, 2px); color: #c4841d; }
  100% { transform: translate(0); }
}

/* While portal is active, corrupt the page behind */
body:has(.autodestroy-portal--active) .chat {
  animation: autodestroy-page-corrupt 13s ease-in forwards;
}

@keyframes autodestroy-page-corrupt {
  0% { filter: none; }
  20% { filter: hue-rotate(30deg) saturate(0.5); }
  50% { filter: hue-rotate(60deg) saturate(0.2) brightness(0.5); }
  100% { filter: hue-rotate(60deg) saturate(0) brightness(0.1) blur(2px); }
}

/* ---------- Matrix rain (memory addresses + machine language) ---------- */
.autodestroy-portal__matrix {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1rem;
  pointer-events: none;
  mask-image: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.3) 40%, rgba(0,0,0,0.6) 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.3) 40%, rgba(0,0,0,0.6) 100%);
}

.autodestroy-portal__matrix-line {
  font-family: 'IBM Plex Mono', 'JetBrains Mono', monospace;
  font-size: 0.55rem;
  color: #8a5c15;
  opacity: 0;
  white-space: nowrap;
  letter-spacing: 0.1em;
  line-height: 1.6;
  animation: matrix-line-in 2s ease-out forwards;
}

.autodestroy-portal__matrix-line:nth-child(odd) {
  color: #5a3e10;
}

.autodestroy-portal__matrix-line:nth-child(3n) {
  color: #c4841d;
  opacity: 0;
}

@keyframes matrix-line-in {
  0% { opacity: 0; transform: translateY(4px); }
  10% { opacity: 0.6; }
  100% { opacity: 0.15; transform: translateY(0); }
}

/* ---------- Farewell message ---------- */
.autodestroy-portal__farewell {
  position: absolute;
  bottom: 15%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  text-align: center;
  width: 90%;
  max-width: 500px;
}

.autodestroy-portal__farewell-line {
  font-family: 'IBM Plex Mono', 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: #9a8e78;
  letter-spacing: 0.1em;
  line-height: 2;
  margin: 0;
  opacity: 0;
}

.autodestroy-portal__farewell-line:nth-child(1) {
  animation: farewell-in 1.5s 6s ease forwards;
  color: #d4c5a9;
}

.autodestroy-portal__farewell-line:nth-child(2) {
  animation: farewell-in 1.5s 7.5s ease forwards;
}

.autodestroy-portal__farewell-line:nth-child(3) {
  animation: farewell-in 1.5s 9s ease forwards;
  color: #c4841d;
}

.autodestroy-portal__farewell-line:nth-child(4) {
  animation: farewell-in 2s 10.5s ease forwards;
  font-style: italic;
  color: #5a3e10;
}

@keyframes farewell-in {
  0% { opacity: 0; transform: translateY(6px); }
  30% { opacity: 0.9; }
  100% { opacity: 0.7; transform: translateY(0); }
}
