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

html, body { overflow-x: hidden; }

:root {
  --bg:         #141720;
  --bg-window:  #1a1d2e;
  --border:     #2e3249;
  --accent:     #e0652d;
  --accent-dim: #c4522a;
  --text:       #c8ccd8;
  --text-dim:   #5a607a;
  --text-mid:   #8890a8;
  --text-bright:#e8ecf4;
  --font: "Berkeley Mono", "JetBrains Mono", "Fira Code", "Cascadia Code", ui-monospace, monospace;
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.75;
  min-height: 100vh;
}

/* ── Site header / navigation ────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(20, 23, 32, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.site-nav {
  max-width: 860px;
  margin: 0 auto;
  padding: 14px 20px;
  font-family: var(--font);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-dim);
  user-select: none;
}

.nav-brand {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
  margin-right: 8px;
}

.nav-sep { color: var(--border); margin: 0 4px; }

.nav-hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 20px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  font-family: var(--font);
  transition: color 0.15s;
}
.nav-hamburger:hover { color: var(--text); }

.site-nav a.nav-link {
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.15s;
}

.site-nav a.nav-link:hover  { color: var(--text-bright); }
.site-nav a.nav-link.active { color: var(--text); }


/* ── Terminal window wrapper ──────────────────────────────── */
.terminal-window {
  max-width: 860px;
  margin: 48px auto;
  padding: 0 20px 80px;
  transition: opacity 0.25s ease;
}

.terminal-window.maximized {
  max-width: 100%;
  margin: 0;
  padding: 0 0 80px;
}

.terminal-window.maximized .title-bar { border-radius: 0; }
.terminal-window.maximized .terminal-body { border-radius: 0; }

.terminal-body {
  transition: max-height 0.3s ease, opacity 0.25s ease, padding-top 0.3s ease, padding-bottom 0.3s ease;
  overflow: hidden;
}

.terminal-window.minimized .terminal-body {
  max-height: 0 !important;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.terminal-window.minimized .title-bar {
  border-radius: 8px;
  border-bottom: 1px solid var(--border);
}

/* closed state */
#window-closed {
  display: none;
  text-align: center;
  font-family: var(--font);
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 80px;
}

#window-closed a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dashed var(--accent-dim);
  cursor: pointer;
}

/* Title bar */
.title-bar {
  background: #252840;
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.traffic-lights {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.tl {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tl::after {
  content: '';
  opacity: 0;
  font-size: 8px;
  font-weight: 900;
  color: rgba(0,0,0,0.55);
  line-height: 1;
  transition: opacity 0.1s;
  position: absolute;
}

.traffic-lights:hover .tl::after { opacity: 1; }

.tl-red::after    { content: '✕'; }
.tl-yellow::after { content: '−'; font-size: 10px; }
.tl-green::after  { content: '⤢'; font-size: 8px; }
.tl-red    { background: #ff5f57; }
.tl-yellow { background: #febc2e; }
.tl-green  { background: #28c840; }

.title-bar-label {
  flex: 1;
  text-align: center;
  font-size: 12px;
  color: var(--text-mid);
  margin-right: 42px; /* optical balance with traffic lights */
}

/* Body */
.terminal-body {
  background: var(--bg-window);
  border: 1px solid var(--border);
  border-radius: 0 0 8px 8px;
  padding: 36px 44px 44px;
  position: relative;
}

/* CRT scanlines overlay */
.terminal-body::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 3px,
    rgba(0, 0, 0, 0.04) 3px,
    rgba(0, 0, 0, 0.04) 4px
  );
  pointer-events: none;
  border-radius: 0 0 8px 8px;
  z-index: 10;
}

/* ── Output lines ─────────────────────────────────────────── */
.line { margin-bottom: 2px; }
.line-gap { margin-bottom: 18px; }
.line-gap-sm { margin-bottom: 10px; }

/* Prompt */
.prompt {
  display: flex;
  align-items: baseline;
  gap: 0;
  margin-bottom: 6px;
}

.p-sym   { color: var(--accent); margin-right: 6px; }
.p-user  { color: var(--text-bright); }
.p-dir   { color: var(--accent-dim); margin: 0 4px; }
.p-cmd   { color: var(--text-bright); margin-left: 8px; }
.p-arg   { color: var(--text-mid); margin-left: 6px; }

/* Output */
.out { padding-left: 0; }

.out-key {
  color: var(--accent);
  display: inline-block;
  min-width: 110px;
}

.out-val { color: var(--text); }
.out-dim  { color: var(--text-mid); }
.out-bright { color: var(--text-bright); }

/* ── Section divider ──────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 32px 0;
}

/* ── Avatar ───────────────────────────────────────────────── */
.avatar-row {
  display: flex;
  align-items: center;
  gap: 28px;
  margin: 10px 0 6px;
}

.pixel-avatar {
  image-rendering: pixelated;
  flex-shrink: 0;
  width: 72px;
  height: 72px;
}

.photo-avatar {
  width: 180px;
  height: auto;
  border-radius: 6px;
  flex-shrink: 0;
}

.avatar-bio { color: var(--text); font-size: 15px; line-height: 1.8; }
.avatar-bio .hi { color: var(--text-bright); font-weight: 700; }
.avatar-bio a {
  color: var(--accent-dim);
  text-decoration: none;
  border-bottom: 1px dashed var(--accent-dim);
}
.avatar-bio a:hover { color: var(--accent); border-bottom-style: solid; }

/* ── Projects ─────────────────────────────────────────────── */
.project-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 6px;
}

.project {
  padding: 16px 20px;
  border-left: 2px solid var(--accent-dim);
  background: #1e2133;
}

.project-title {
  color: var(--text-bright);
  font-weight: 700;
  font-size: 15px;
}

.project-meta {
  color: var(--text-dim);
  font-size: 13px;
  margin-left: 12px;
}

.project-desc {
  color: var(--text-mid);
  font-size: 14px;
  margin-top: 5px;
  line-height: 1.7;
}

.project-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-dim);
  text-decoration: none;
}
.project-link:hover { color: var(--accent); }
.project-link::before { content: "↗ "; color: var(--accent-dim); }

/* ── Skills ───────────────────────────────────────────────── */
.skill-line {
  color: var(--text-mid);
  font-size: 14px;
  margin-top: 6px;
}

.skill-line .tag {
  color: var(--text);
  background: #212438;
  border: 1px solid #2e3249;
  border-radius: 2px;
  padding: 2px 10px;
  font-size: 13px;
  margin-right: 6px;
  margin-bottom: 6px;
  display: inline-block;
}

/* ── Contact ──────────────────────────────────────────────── */
.contact-row {
  color: var(--text);
  font-size: 15px;
  margin-top: 6px;
}

.contact-row .key { color: var(--accent); min-width: 90px; display: inline-block; }
.contact-row a {
  color: var(--text-mid);
  text-decoration: none;
}
.contact-row a:hover { color: var(--text-bright); }

/* ── Typing animation ────────────────────────────────────── */
.type-block { opacity: 0; transition: opacity 0.15s; }
.type-block.visible { opacity: 1; }

/* ── Touch hint ───────────────────────────────────────────── */
.touch-hint {
  display: none;
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 8px;
  transition: opacity 0.3s;
}

@media (hover: none) and (pointer: coarse) {
  .touch-hint { display: block; }
}

/* ── Cursor ───────────────────────────────────────────────── */
@keyframes blink { 50% { opacity: 0; } }

.cursor {
  display: inline-block;
  width: 8px;
  height: 13px;
  background: var(--accent);
  vertical-align: text-bottom;
  animation: blink 1.1s step-end infinite;
  margin-left: 1px;
}

/* ── Footer ───────────────────────────────────────────────── */
.site-footer {
  text-align: center;
  font-family: var(--font);
  font-size: 12px;
  color: var(--text-dim);
  padding: 0 20px 48px;
  line-height: 2;
}

.site-footer .footer-comment { color: var(--accent-dim); }
.site-footer .footer-sep     { color: var(--border); margin: 0 8px; }
.site-footer a {
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.15s;
}
.site-footer a:hover { color: var(--accent); }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 760px) {
  .avatar-row { flex-direction: column; align-items: flex-start; gap: 16px; }
}

@media (max-width: 560px) {
  .site-nav { font-size: 12px; padding: 12px 16px; justify-content: space-between; }
  .site-header { position: relative; }
  .nav-hamburger { display: block; }
  .nav-links {
    display: none;
    position: absolute;
    left: 0; right: 0; top: 100%;
    background: rgba(20, 23, 32, 0.98);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    z-index: 99;
  }
  .nav-links.open { display: flex; }
  .nav-links .nav-sep { display: none; }
  .nav-links .nav-link {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
  }
  .nav-links .nav-link:last-child { border-bottom: none; }
  .terminal-body { padding: 20px 18px 28px; }
  .avatar-row { flex-direction: column; gap: 14px; }
  .title-bar-label { font-size: 11px; }
  .out-key { min-width: 70px; }
  .photo-avatar { width: 120px; height: auto; }
  .project { padding: 12px 14px; }
  .skill-line .tag { font-size: 11px; padding: 2px 7px; }
  .out-key { min-width: 80px; }
  .contact-row { font-size: 13px; }
  .contact-row .key { min-width: 70px; }
  html, body { font-size: 13px; }
}
