/* ==========================================================================
   Danila Chernoklinov — Portfolio Stylesheet
   Modern Terminal & Minimalist Engineering Aesthetic
   ========================================================================== */

:root {
  --bg: #0b0f0e;
  --surface: #121715;
  --surface-2: #18201c;
  --surface-hover: #1f2824;
  --border: #232d28;
  --border-focus: #3d5045;
  --text: #e7ece8;
  --text-dim: #c5d2c9;
  --muted: #8fa095;
  --accent: #8fd19e;
  --accent-dim: #273e31;
  --accent-glow: rgba(143, 209, 158, 0.18);
  --copper: #c68958;
  --copper-dim: rgba(198, 137, 88, 0.16);
  --danger: #e06c75;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  box-sizing: border-box;
}

html[data-theme="light"] {
  --bg: #f4f6f4;
  --surface: #ffffff;
  --surface-2: #ebf0ec;
  --surface-hover: #e2e8e3;
  --border: #d4dcd5;
  --border-focus: #9eb1a2;
  --text: #121714;
  --text-dim: #2d3730;
  --muted: #5e6d63;
  --accent: #1e7552;
  --accent-dim: #d8ece0;
  --accent-glow: rgba(30, 117, 82, 0.14);
  --copper: #9b5a2b;
  --copper-dim: rgba(155, 90, 43, 0.12);
  --danger: #cf3d3d;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.6;
  font-size: 15px;
  overflow-x: hidden;
  transition: background-color 0.25s ease, color 0.25s ease;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

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

.wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ==========================================================================
   Navigation
   ========================================================================== */
header.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  transition: border-color 0.2s, background-color 0.2s;
}

.nav-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.logo {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-prompt {
  color: var(--muted);
}

.navlinks {
  display: flex;
  gap: 20px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--muted);
  flex-wrap: wrap;
  align-items: center;
}

.navlinks a {
  transition: color 0.2s ease;
  position: relative;
}

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

.tools {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-left: 8px;
}

.tool-btn {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

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

/* ==========================================================================
   Sections & Section Headers
   ========================================================================== */
section {
  padding: 68px 0;
  border-bottom: 1px solid var(--border);
}

.sec-head {
  display: flex;
  gap: 14px;
  align-items: baseline;
  margin-bottom: 28px;
}

.sec-num {
  font-family: var(--mono);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  opacity: 0.8;
}

html[data-theme="light"] .sec-num {
  color: var(--accent);
}

.sec-title {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.05em;
  color: var(--muted);
  text-transform: uppercase;
}

/* ==========================================================================
   Hero Section & Interactive Terminal
   ========================================================================== */
.hero {
  padding-top: 48px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 22px;
}

.status-badge span {
  color: var(--text);
}

/* Terminal Component */
.term-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  overflow: hidden;
  max-width: 680px;
  margin-bottom: 30px;
}

.term-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.term-dots {
  display: flex;
  gap: 7px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.dot-red { background: #ff5f56; }
.dot-yellow { background: #ffbd2e; }
.dot-green { background: #27c93f; }

.term-title {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

.term-hint {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  opacity: 0.7;
}

.term-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 11px;
}

.term-chips-label {
  color: var(--muted);
  align-self: center;
  margin-right: 4px;
}

.chip-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px 7px;
  color: var(--text-dim);
  transition: all 0.15s ease;
}

.chip-btn:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.term-body {
  padding: 16px 18px;
  font-family: var(--mono);
  font-size: 13.5px;
  max-height: 240px;
  overflow-y: auto;
  line-height: 1.55;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.term-history {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.term-output {
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-dim);
}

.term-output .accent { color: var(--accent); }
.term-output .copper { color: var(--copper); }
.term-output .muted { color: var(--muted); }
.term-output .danger { color: var(--danger); }

.term-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 13px;
}

.term-prompt {
  color: var(--accent);
  white-space: nowrap;
  font-weight: 500;
}

.term-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
}

/* Hero Titles & Content */
h1.role {
  font-family: var(--mono);
  font-size: clamp(25px, 4vw, 36px);
  font-weight: 700;
  margin: 10px 0 14px;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

h1.role span {
  color: var(--accent);
}

.lede {
  color: var(--muted);
  max-width: 58ch;
  font-size: 16px;
  line-height: 1.65;
}

.contacts-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  margin-top: 28px;
  font-family: var(--mono);
  font-size: 13px;
  align-items: center;
}

.contact-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  padding-bottom: 2px;
  transition: all 0.2s ease;
}

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

.copy-btn {
  opacity: 0.6;
  font-size: 11px;
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: all 0.2s ease;
  line-height: 1;
}

.contact-item:hover .copy-btn {
  opacity: 1;
  border-color: var(--accent);
  color: var(--accent);
}

/* ==========================================================================
   About Section
   ========================================================================== */
.about-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 48px;
  align-items: start;
}

.about-text {
  color: var(--muted);
  font-size: 15.5px;
  line-height: 1.7;
}

.facts {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.fact {
  border-left: 2px solid var(--accent);
  padding-left: 16px;
}

.fact b {
  display: block;
  font-family: var(--mono);
  font-size: 24px;
  color: var(--accent);
  font-weight: 700;
  line-height: 1.2;
}

.fact span {
  font-size: 13px;
  color: var(--muted);
}

/* ==========================================================================
   Photo Carousel & Gallery
   ========================================================================== */
.train-sec {
  padding: 60px 0;
  border-bottom: 1px solid var(--border);
}

.train-head {
  max-width: 860px;
  margin: 0 auto 20px;
  padding: 0 24px;
}

.train-viewport {
  width: 100%;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
  padding: 10px 0;
}

.frame {
  position: relative;
  width: 220px;
  height: 280px;
  flex: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.frame:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 8px 24px var(--accent-glow);
}

.frame:hover img {
  transform: scale(1.04);
}

.frame-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 60%);
  display: flex;
  align-items: flex-end;
  padding: 12px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.frame:hover .frame-overlay {
  opacity: 1;
}

.frame-hint {
  font-family: var(--mono);
  font-size: 11px;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.6);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
}

/* ==========================================================================
   Technical Skills
   ========================================================================== */
.skills-list {
  display: flex;
  flex-direction: column;
}

.skill-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 8px 24px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  align-items: baseline;
}

.skill-row:last-child {
  border-bottom: none;
}

.skill-key {
  font-family: var(--mono);
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
}

.skill-val {
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.5;
}

/* ==========================================================================
   Experience
   ========================================================================== */
.job-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
}

.job-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.job-role {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}

.job-meta {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

ul.bl {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

ul.bl li {
  position: relative;
  padding-left: 20px;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.55;
}

ul.bl li::before {
  content: '›';
  position: absolute;
  left: 2px;
  color: var(--accent);
  font-weight: bold;
}

/* ==========================================================================
   Projects & Research
   ========================================================================== */
.projects-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.proj-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.proj-card:hover {
  border-color: var(--border-focus);
}

.proj-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}

.proj-name {
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
}

.proj-tag {
  font-family: var(--mono);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.proj-tag.prod {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid var(--accent);
}

.proj-tag.infra {
  background: var(--copper-dim);
  color: var(--copper);
  border: 1px solid var(--copper);
}

.proj-tag.wip {
  background: rgba(224, 108, 117, 0.12);
  color: var(--danger);
  border: 1px solid rgba(224, 108, 117, 0.4);
}

.proj-desc {
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.6;
}

.stack-line {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.stack-line b {
  color: var(--text);
  font-weight: 500;
}

.note {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
  background: var(--surface-2);
}

/* ==========================================================================
   Hardware & Additional Box (Oscilloscope)
   ========================================================================== */
.hw-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--copper);
  border-radius: var(--radius-md);
  padding: 24px;
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 28px;
  align-items: center;
}

.hw-box p {
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.6;
}

.scope {
  background: #080c0a;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  position: relative;
  overflow: hidden;
  height: 140px;
}

.scope svg {
  width: 100%;
  height: 100%;
  display: block;
}

.scope-grid line {
  stroke: rgba(198, 137, 88, 0.15);
  stroke-width: 1;
}

.scope-label {
  position: absolute;
  top: 8px;
  left: 10px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--copper);
  opacity: 0.85;
  letter-spacing: 0.04em;
}

/* ==========================================================================
   Education & Achievements
   ========================================================================== */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
}

.mini-title {
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 16px;
  letter-spacing: 0.05em;
}

/* ==========================================================================
   Footer
   ========================================================================== */
footer {
  padding: 68px 0 44px;
}

.cta {
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 24px;
}

.cta span {
  color: var(--accent);
}

.foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.foot-btn {
  font-family: var(--mono);
  font-size: 13px;
  padding: 9px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  text-decoration: none;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

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

.foot-bottom {
  margin-top: 50px;
  color: var(--muted);
  font-size: 12px;
  font-family: var(--mono);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

/* ==========================================================================
   Lightbox Modal Component
   ========================================================================== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.lightbox.active {
  display: flex;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 11, 10, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.lightbox-content {
  position: relative;
  z-index: 10;
  max-width: 90vw;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-img {
  max-width: 100%;
  max-height: 78vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
}

.lightbox-info {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
}

.lightbox-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.2s ease;
  z-index: 20;
}

.lightbox-nav-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.lightbox-prev { left: -60px; }
.lightbox-next { right: -60px; }

.lightbox-close {
  position: absolute;
  top: -46px;
  right: 0;
  font-family: var(--mono);
  font-size: 20px;
  color: var(--muted);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: all 0.2s ease;
}

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

/* ==========================================================================
   Toast Notification Component
   ========================================================================== */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-2);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12.5px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px var(--accent-glow);
  z-index: 9999;
  pointer-events: none;
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 768px) {
  .about-grid,
  .two-col,
  .hw-box {
    grid-template-columns: 1fr;
  }
  
  .scope {
    order: -1;
  }
  
  .lightbox-prev { left: 10px; }
  .lightbox-next { right: 10px; }
  .lightbox-close { top: -42px; right: 6px; }
}

@media (max-width: 640px) {
  .navlinks a {
    display: none;
  }
  
  section {
    padding: 50px 0;
  }
  
  .frame {
    width: 165px;
    height: 215px;
  }
  
  .skill-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  
  .contacts-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}
