/* ============================================
   Mihails Velikijs — portfolio
   Terminal / code-inspired theme
   ============================================ */

:root{
  --bg:        #0a0e14;
  --bg-alt:    #10151f;
  --bg-panel:  #0d1219;
  --border:    #1f2733;
  --text:      #c9d1d9;
  --text-dim:  #7a8494; /* was #6b7686 — 4.08:1 on panel, below the 4.5:1 floor; now 4.97:1 */
  --text-dimmer:#727d92; /* was #4a5566 — 2.49:1 on panel, now 4.53:1 */

  --accent:    #7ee787; /* green   */
  --accent2:   #56d4dd; /* cyan    */
  --accent3:   #f0883e; /* orange — terminal error color, see .out-err */
  --accent4:   #bd93f9; /* purple  */

  --red:    #ff5f56;
  --yellow: #ffbd2e;
  --green:  #27c93f;

  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --radius: 10px;
  --maxw: 880px;
}

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

html{ scroll-behavior: smooth; }

body{
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

::selection{ background: var(--accent); color: #05130a; }

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

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

/* subtle scanline overlay for terminal flavor */
.scanline{
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 200;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255,255,255,0.012) 0px,
    rgba(255,255,255,0.012) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: overlay;
}

/* ---------- layout helpers ---------- */
main{
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

.section{
  padding: 70px 0 10px;
}

.section-heading{
  font-size: 14px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text);
  font-weight: 600;
  margin: 0 0 20px;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.section-heading .hash{
  color: var(--accent2);
  font-weight: 500;
}

/* ---------- nav ---------- */
#navbar{
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10,14,20,0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.nav-inner{
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-brand{
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-dim);
  white-space: nowrap;
}
.nav-brand .brand-path{
  margin-left: 6px;
  color: var(--text);
}
.prompt-sep{ color: var(--accent2); }

.dot{
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.dot.red{ background: var(--red); }
.dot.yellow{ background: var(--yellow); }
.dot.green{ background: var(--green); }

.nav-links{
  display: flex;
  gap: 22px;
  font-size: 14px;
}
.nav-links a{
  padding: 4px 2px;
  color: var(--text-dim);
  position: relative;
  transition: color .15s ease;
}
.nav-links a::before{ content: "./"; color: var(--text-dimmer); }
.nav-links a:hover{ color: var(--accent); }

.nav-toggle{
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.nav-toggle span{
  width: 20px; height: 2px;
  background: var(--text);
  border-radius: 2px;
}

/* ---------- terminal window (shared) ---------- */
.term-window{
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 20px 50px -20px rgba(0,0,0,0.6);
}
.term-titlebar{
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}
.term-title{
  margin-left: 10px;
  font-size: 12px;
  color: var(--text-dim);
}
.term-body{
  padding: 22px 24px 26px;
}

.term-line{
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--text-dim);
}
.term-line.muted{ color: var(--text-dimmer); }

.prompt{ color: var(--accent); }
.colon{ color: var(--text-dim); }
.path{ color: var(--accent2); }
.dollar{ color: var(--text-dim); margin-right: 6px; }

.cursor{
  display: inline-block;
  color: var(--accent);
  animation: blink 1s step-end infinite;
}
@keyframes blink{
  0%, 49%{ opacity: 1; }
  50%, 100%{ opacity: 0; }
}

/* ---------- hero ---------- */
.hero{
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 60px 24px 40px;
  min-height: calc(100vh - 54px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 24px;
}
.hero-term .term-body{ padding: 28px 28px 32px; }

.hero-name{
  margin: 0 0 18px;
  font-size: clamp(28px, 6vw, 44px);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.hero-role{
  font-size: clamp(18px, 3.4vw, 24px);
  color: var(--accent2);
  font-weight: 600;
  margin: 0 0 16px;
  min-height: 1.4em;
}

.hero-actions{
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.btn{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  transition: transform .15s ease, border-color .15s ease, background .15s ease, color .15s ease;
}
.btn-primary{
  background: var(--accent);
  color: #05130a;
  border-color: var(--accent);
}
.btn-primary:hover{ transform: translateY(-2px); filter: brightness(1.08); }

.btn-ghost{
  color: var(--text);
  background: transparent;
}
.btn-ghost:hover{
  border-color: var(--accent2);
  color: var(--accent2);
  transform: translateY(-2px);
}

.scroll-hint{
  align-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text-dimmer);
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  animation: floaty 2.4s ease-in-out infinite;
}
@keyframes floaty{
  0%, 100%{ transform: translateY(0); }
  50%{ transform: translateY(6px); }
}

/* ---------- about ---------- */
.about-text{
  max-width: 62ch;
  margin: 0 0 14px;
  font-size: 15px;
  color: var(--text);
}
.about-text.muted{ color: var(--text-dim); font-size: 14px; }

/* ---------- skills ---------- */
.skills-grid{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.skills-grid .term-body{ padding: 20px 20px 24px; }

.tag-list{
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.tag{
  --tag-c: #7ee787;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--tag-c);
  background: color-mix(in srgb, var(--tag-c) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--tag-c) 40%, transparent);
}
.tag-pulse{
  animation: tagpulse 2.2s ease-in-out infinite;
}
@keyframes tagpulse{
  0%, 100%{ box-shadow: 0 0 0 0 color-mix(in srgb, var(--tag-c) 45%, transparent); }
  50%{ box-shadow: 0 0 0 6px color-mix(in srgb, var(--tag-c) 0%, transparent); }
}

/* ---------- projects (empty state) ---------- */
.empty-state{
  margin-top: 14px;
  padding: 16px 18px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--bg-alt);
}
.empty-line{
  margin: 0 0 4px;
  color: var(--text-dim);
  font-size: 14px;
  font-style: italic;
}
.empty-line:last-child{ margin-bottom: 0; }

/* ---------- contact ---------- */
.contact-list{
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.contact-list li{
  font-size: 14px;
  display: grid;
  grid-template-columns: 84px 10px 1fr;
  align-items: baseline;
  column-gap: 4px;
}
.key{ color: var(--accent4); }
.sep{ color: var(--text-dimmer); }
.val{
  display: inline-block;
  padding: 6px 0;
  color: var(--text);
  border-bottom: 1px solid transparent;
  transition: color .15s ease, border-color .15s ease;
  word-break: break-word;
}
.val:hover{
  color: var(--accent2);
  border-bottom-color: var(--accent2);
}

/* ---------- interactive terminal ---------- */
#try-term{ padding-bottom: 40px; }
.live-input-line{
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}
.live-input{
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 14px;
  caret-color: var(--accent);
}
#liveTermOutput .term-line{ margin-bottom: 6px; }
#liveTermOutput .out-accent{ color: var(--accent); }
#liveTermOutput .out-cyan{ color: var(--accent2); }
#liveTermOutput .out-err{ color: var(--accent3); }

/* ---------- footer ---------- */
footer{
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 30px 24px 60px;
  color: var(--text-dimmer);
  font-size: 12px;
  text-align: center;
}
footer .cursor{ color: var(--text-dimmer); }

/* ---------- responsive ---------- */
@media (max-width: 760px){
  .skills-grid{ grid-template-columns: 1fr; }
}

@media (max-width: 620px){
  .nav-brand .brand-path{ display: none; }
  .nav-toggle{ display: flex; }
  .nav-links{
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    gap: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height .25s ease;
  }
  .nav-links.open{ max-height: 260px; }
  .nav-links a{
    padding: 14px 24px;
    border-top: 1px solid var(--border);
  }
  .hero{ min-height: auto; padding-top: 40px; }
  .hero-term .term-body{ padding: 20px; }
  .contact-list li{ grid-template-columns: 74px 10px 1fr; }
}

@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior: auto; }
  .cursor, .tag-pulse, .scroll-hint{ animation: none; }
}

@media (prefers-contrast: more){
  :root{
    --text-dim: #9aa4b3;
    --text-dimmer: #8994a8;
    --border: #3a4453;
  }
}
