/* ==========================================
   TERMINAL PERSONAL SITE — Egor Gordeev
   ========================================== */

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

/* === THEME VARIABLES === */
:root {
  /* Green Phosphor (default) */
  --bg: #0a0a0a;
  --bg-surface: #111111;
  --bg-hover: #1a1a1a;
  --fg: #00ff00;
  --fg-dim: #00aa00;
  --fg-bright: #33ff33;
  --accent: #00ff00;
  --accent-dim: #008800;
  --border: #00aa0044;
  --selection-bg: #00ff0030;
  --dot-red: #ff5f56;
  --dot-yellow: #ffbd2e;
  --dot-green: #27c93f;
  --glow: 0 0 5px #00ff0040;
  --tag-bg: #00ff0018;
  --tag-border: #00ff0033;
  --scrollbar-thumb: #00aa00;
  --scrollbar-track: #0a0a0a;
}

[data-color-theme="green-phosphor"] {
  --bg: #0a0a0a;
  --bg-surface: #111111;
  --bg-hover: #1a1a1a;
  --fg: #00ff00;
  --fg-dim: #00aa00;
  --fg-bright: #33ff33;
  --accent: #00ff00;
  --accent-dim: #008800;
  --border: #00aa0044;
  --selection-bg: #00ff0030;
  --glow: 0 0 5px #00ff0040;
  --tag-bg: #00ff0018;
  --tag-border: #00ff0033;
  --scrollbar-thumb: #00aa00;
  --scrollbar-track: #0a0a0a;
}

[data-color-theme="amber"] {
  --bg: #0d0905;
  --bg-surface: #140e08;
  --bg-hover: #1c1408;
  --fg: #ffb000;
  --fg-dim: #aa7500;
  --fg-bright: #ffc940;
  --accent: #ffb000;
  --accent-dim: #886000;
  --border: #ffb00044;
  --selection-bg: #ffb00030;
  --glow: 0 0 5px #ffb00040;
  --tag-bg: #ffb00018;
  --tag-border: #ffb00033;
  --scrollbar-thumb: #aa7500;
  --scrollbar-track: #0d0905;
}

[data-color-theme="solarized"] {
  --bg: #002b36;
  --bg-surface: #073642;
  --bg-hover: #0a4050;
  --fg: #839496;
  --fg-dim: #586e75;
  --fg-bright: #93a1a1;
  --accent: #859900;
  --accent-dim: #657b00;
  --border: #586e7544;
  --selection-bg: #85990030;
  --glow: 0 0 5px #85990040;
  --tag-bg: #85990018;
  --tag-border: #85990033;
  --scrollbar-thumb: #586e75;
  --scrollbar-track: #002b36;
}

[data-color-theme="dracula"] {
  --bg: #282a36;
  --bg-surface: #2d303e;
  --bg-hover: #343746;
  --fg: #f8f8f2;
  --fg-dim: #6272a4;
  --fg-bright: #ffffff;
  --accent: #bd93f9;
  --accent-dim: #8b6fc0;
  --border: #6272a444;
  --selection-bg: #bd93f930;
  --glow: 0 0 5px #bd93f940;
  --tag-bg: #bd93f918;
  --tag-border: #bd93f933;
  --scrollbar-thumb: #6272a4;
  --scrollbar-track: #282a36;
}

[data-color-theme="monokai"] {
  --bg: #272822;
  --bg-surface: #2e2f28;
  --bg-hover: #3e3d32;
  --fg: #f8f8f2;
  --fg-dim: #75715e;
  --fg-bright: #ffffff;
  --accent: #f92672;
  --accent-dim: #c4205b;
  --border: #75715e44;
  --selection-bg: #f9267230;
  --glow: 0 0 5px #f9267240;
  --tag-bg: #f9267218;
  --tag-border: #f9267233;
  --scrollbar-thumb: #75715e;
  --scrollbar-track: #272822;
}

[data-color-theme="gruvbox"] {
  --bg: #282828;
  --bg-surface: #3c3836;
  --bg-hover: #504945;
  --fg: #ebdbb2;
  --fg-dim: #a89984;
  --fg-bright: #fbf1c7;
  --accent: #fabd2f;
  --accent-dim: #d79921;
  --border: #a8998444;
  --selection-bg: #fabd2f30;
  --glow: 0 0 5px #fabd2f40;
  --tag-bg: #fabd2f18;
  --tag-border: #fabd2f33;
  --scrollbar-thumb: #a89984;
  --scrollbar-track: #282828;
}

[data-color-theme="nord"] {
  --bg: #2e3440;
  --bg-surface: #3b4252;
  --bg-hover: #434c5e;
  --fg: #d8dee9;
  --fg-dim: #81a1c1;
  --fg-bright: #eceff4;
  --accent: #88c0d0;
  --accent-dim: #5e81ac;
  --border: #81a1c144;
  --selection-bg: #88c0d030;
  --glow: 0 0 5px #88c0d040;
  --tag-bg: #88c0d018;
  --tag-border: #88c0d033;
  --scrollbar-thumb: #81a1c1;
  --scrollbar-track: #2e3440;
}

[data-color-theme="catppuccin"] {
  --bg: #1e1e2e;
  --bg-surface: #26263a;
  --bg-hover: #313244;
  --fg: #cdd6f4;
  --fg-dim: #7f849c;
  --fg-bright: #ffffff;
  --accent: #cba6f7;
  --accent-dim: #9674c4;
  --border: #7f849c44;
  --selection-bg: #cba6f730;
  --glow: 0 0 5px #cba6f740;
  --tag-bg: #cba6f718;
  --tag-border: #cba6f733;
  --scrollbar-thumb: #7f849c;
  --scrollbar-track: #1e1e2e;
}

/* === BASE === */
html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  font-size: 14px;
  line-height: 1.65;
  color: var(--fg);
  background-color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

::selection {
  background: var(--selection-bg);
  color: var(--fg-bright);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 180ms ease;
}
a:hover {
  color: var(--fg-bright);
  text-decoration: underline;
}

/* === SCROLLBAR === */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 3px;
}

/* === TERMINAL CONTAINER === */
.terminal {
  width: 100%;
  max-width: 860px;
  min-height: 80dvh;
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--glow), 0 20px 60px rgba(0,0,0,0.5);
}

/* === TOP BAR === */
.terminal-bar {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 12px;
}

.terminal-dots {
  display: flex;
  gap: 7px;
  flex-shrink: 0;
}

.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); }

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

.terminal-bar-spacer {
  width: 55px;
  flex-shrink: 0;
}

/* === NAVIGATION === */
.terminal-nav {
  display: flex;
  padding: 0;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow-x: auto;
}

.nav-btn {
  flex: 1;
  padding: 10px 16px;
  background: transparent;
  border: none;
  color: var(--fg-dim);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: all 180ms ease;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.nav-btn:hover {
  background: var(--bg-hover);
  color: var(--fg);
}

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

.nav-prefix {
  color: var(--fg-dim);
  margin-right: 6px;
  font-size: 11px;
  opacity: 0.6;
}

.nav-btn.active .nav-prefix {
  color: var(--accent-dim);
  opacity: 1;
}

/* === CONTENT AREA === */
.terminal-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

.section {
  display: none;
}
.section.active {
  display: block;
  animation: fadeIn 200ms ease;
}

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

/* === TYPED HEADER === */
.typed-header {
  font-size: 14px;
  margin-bottom: 20px;
  color: var(--fg);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.typed-header.small {
  font-size: 13px;
  margin-bottom: 12px;
  border-bottom: none;
  padding-bottom: 4px;
  margin-top: 28px;
}

.prompt {
  color: var(--accent);
  font-weight: 600;
}

.prompt-small {
  color: var(--accent);
  font-size: 12px;
  font-weight: 500;
}

/* === CURSOR === */
.cursor {
  animation: blink 1s step-start infinite;
  color: var(--accent);
}

@keyframes blink {
  50% { opacity: 0; }
}

/* === BIO === */
.bio-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--fg-bright);
  letter-spacing: -0.01em;
}

.bio-role {
  font-size: 14px;
  color: var(--accent);
  margin-top: 4px;
  font-weight: 400;
}

.bio-divider {
  color: var(--border);
  margin: 16px 0;
  font-size: 12px;
  overflow: hidden;
  white-space: nowrap;
  letter-spacing: 0;
}

.bio-text {
  color: var(--fg);
  max-width: 65ch;
  margin-bottom: 20px;
  font-size: 13px;
  line-height: 1.7;
}

.bio-stats {
  margin-bottom: 8px;
}

.stat-row {
  display: flex;
  gap: 8px;
  padding: 3px 0;
  font-size: 13px;
  flex-wrap: wrap;
}

.stat-key {
  color: var(--accent);
  min-width: 110px;
  font-weight: 500;
  flex-shrink: 0;
}

.stat-sep {
  color: var(--fg-dim);
  flex-shrink: 0;
}

.stat-val {
  color: var(--fg);
}

.stat-val a {
  color: var(--fg);
}
.stat-val a:hover {
  color: var(--accent);
}

/* === SKILLS === */
.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.skill-tag {
  display: inline-block;
  padding: 3px 10px;
  font-size: 12px;
  color: var(--accent);
  background: var(--tag-bg);
  border: 1px solid var(--tag-border);
  border-radius: 3px;
  letter-spacing: 0.01em;
}

/* === RESUME === */
.resume-hint {
  font-size: 12px;
  color: var(--fg-dim);
  margin-bottom: 20px;
  font-style: italic;
}

.resume-timeline {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.job-entry {
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  transition: all 180ms ease;
  cursor: pointer;
  outline: none;
}

.job-entry:hover,
.job-entry:focus-visible {
  border-color: var(--accent-dim);
  background: var(--bg-hover);
}

.job-entry.expanded {
  border-color: var(--accent);
  background: var(--bg-surface);
}

.job-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
}

.job-date {
  font-size: 11px;
  color: var(--fg-dim);
  letter-spacing: 0.03em;
  font-weight: 400;
}

.job-indicator {
  font-size: 10px;
  color: var(--fg-dim);
  transition: transform 200ms ease;
}

.job-entry.expanded .job-indicator {
  transform: rotate(90deg);
  color: var(--accent);
}

.job-title {
  padding: 0 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--fg-bright);
}

.job-company {
  padding: 2px 14px 10px;
  font-size: 12px;
  color: var(--accent);
}

.job-details {
  max-height: 0;
  overflow: hidden;
  transition: max-height 300ms ease, padding 200ms ease;
  padding: 0 14px;
}

.job-entry.expanded .job-details {
  max-height: 500px;
  padding: 8px 14px 16px;
  border-top: 1px solid var(--border);
}

.job-details ul {
  list-style: none;
  padding: 0;
}

.job-details li {
  position: relative;
  padding-left: 18px;
  font-size: 12px;
  color: var(--fg);
  line-height: 1.7;
  margin-bottom: 4px;
  max-width: none;
}

.job-details li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--accent-dim);
}

.job-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}

.job-tags span {
  padding: 2px 8px;
  font-size: 10px;
  color: var(--accent);
  background: var(--tag-bg);
  border: 1px solid var(--tag-border);
  border-radius: 2px;
  letter-spacing: 0.02em;
}

/* === EDUCATION === */
.resume-education {
  margin-top: 8px;
}

.edu-entry {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-top: 2px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.edu-date {
  font-size: 11px;
  color: var(--fg-dim);
  letter-spacing: 0.03em;
}

.edu-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-bright);
}

.edu-detail {
  font-size: 12px;
  color: var(--fg);
}

/* === BLOG === */
.blog-post {
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.blog-post-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  transition: background 180ms ease;
  outline: none;
}

.blog-post-header:hover,
.blog-post-header:focus-visible {
  background: var(--bg-hover);
}

.blog-date {
  font-size: 11px;
  color: var(--fg-dim);
  letter-spacing: 0.03em;
  flex-shrink: 0;
}

.blog-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg-bright);
  flex: 1;
}

.blog-indicator {
  font-size: 10px;
  color: var(--fg-dim);
  transition: transform 200ms ease;
  flex-shrink: 0;
}

.blog-post-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 400ms ease, padding 200ms ease;
  padding: 0 14px;
}

.blog-post-body.open {
  max-height: 2000px;
  padding: 8px 14px 20px;
  border-top: 1px solid var(--border);
}

.blog-post-body p {
  font-size: 13px;
  color: var(--fg);
  line-height: 1.75;
  margin-bottom: 12px;
  max-width: 65ch;
}

.blog-signature {
  margin-top: 20px;
  font-size: 13px;
  color: var(--fg);
  line-height: 1.8;
}

/* === LINKS === */
.links-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.link-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 4px;
  transition: all 180ms ease;
  text-decoration: none;
}

.link-row:hover {
  background: var(--bg-hover);
  border-color: var(--accent-dim);
  text-decoration: none;
}

.link-icon {
  color: var(--accent);
  font-size: 14px;
  flex-shrink: 0;
}

.link-name {
  color: var(--fg-bright);
  font-weight: 600;
  font-size: 14px;
  min-width: 90px;
  flex-shrink: 0;
}

.link-url {
  color: var(--fg-dim);
  font-size: 12px;
}

/* === FOOTER (lang + theme) === */
.terminal-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.footer-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 16px;
  overflow-x: auto;
}

.footer-row:first-child {
  padding-top: 10px;
}

.footer-row:last-child {
  padding-bottom: 10px;
}

.footer-label {
  flex-shrink: 0;
}

/* === LANGUAGE SWITCHER === */
.lang-buttons {
  display: flex;
  gap: 4px;
}

.lang-btn {
  padding: 3px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--fg-dim);
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 180ms ease;
  letter-spacing: 0.04em;
}

.lang-btn:hover {
  background: var(--bg-hover);
  color: var(--fg);
  border-color: var(--fg-dim);
}

.lang-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--tag-bg);
}

.theme-buttons {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.theme-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--fg-dim);
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
  transition: all 180ms ease;
  white-space: nowrap;
}

.theme-btn:hover {
  background: var(--bg-hover);
  color: var(--fg);
  border-color: var(--fg-dim);
}

.theme-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--tag-bg);
}

.theme-preview {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.theme-name {
  letter-spacing: 0.02em;
}

/* === MOBILE === */
@media (max-width: 600px) {
  body {
    padding: 0;
    align-items: stretch;
  }

  .terminal {
    max-width: none;
    min-height: 100dvh;
    max-height: none;
    border-radius: 0;
    border: none;
  }

  .terminal-content {
    padding: 16px;
  }

  .nav-btn {
    padding: 8px 10px;
    font-size: 12px;
  }

  .nav-prefix {
    display: none;
  }

  .stat-row {
    flex-direction: column;
    gap: 0;
    padding: 4px 0;
  }

  .stat-key {
    min-width: auto;
  }

  .stat-sep {
    display: none;
  }

  .stat-val {
    padding-left: 12px;
    font-size: 12px;
  }

  .job-header {
    padding: 8px 10px;
  }

  .job-title {
    padding: 0 10px;
    font-size: 13px;
  }

  .job-company {
    padding: 2px 10px 8px;
    font-size: 11px;
  }

  .job-entry.expanded .job-details {
    padding: 6px 10px 14px;
  }

  .link-row {
    gap: 8px;
    padding: 10px 12px;
  }

  .link-name {
    min-width: auto;
    font-size: 13px;
  }

  .link-url {
    font-size: 11px;
  }

  .footer-row {
    padding: 4px 12px;
    gap: 8px;
    flex-wrap: wrap;
  }

  .footer-row:first-child {
    padding-top: 8px;
  }

  .footer-row:last-child {
    padding-bottom: 8px;
  }

  .theme-buttons {
    flex-wrap: wrap;
  }

  .theme-btn {
    padding: 3px 8px;
    font-size: 10px;
  }

  .lang-btn {
    padding: 2px 10px;
    font-size: 10px;
  }

  .bio-name {
    font-size: 18px;
  }

  .blog-post-header {
    flex-wrap: wrap;
    gap: 6px;
  }

  .blog-title {
    font-size: 13px;
  }
}

/* Focus ring */
:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}
