:root{
  --bg: #0b1020;
  --panel: rgba(255,255,255,0.04);
  --border: rgba(255,255,255,0.08);
  --text: rgba(255,255,255,0.92);
  --muted: rgba(255,255,255,0.62);
  --accent: #79f2ff;
  --accent2: #9aff79;
  --danger: #ff6b6b;
  --warn: #ffd166;
}

.bg-dev { background: radial-gradient(1200px 600px at 20% 10%, rgba(121,242,255,0.12), transparent 60%),
                    radial-gradient(900px 500px at 90% 40%, rgba(154,255,121,0.10), transparent 55%),
                    var(--bg); }

body { color: var(--text); }
body{
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Nothing should push the page wider than the viewport on a phone. */
html, body{
  max-width: 100%;
  overflow-x: hidden;
}

body.matrixmode-active.bg-dev{
  background:
    linear-gradient(rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0.72)),
    url('https://i.gifer.com/3HeL.gif') center center / cover fixed no-repeat,
    var(--bg);
}

.brand { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }

.dot { display:inline-block; width:10px; height:10px; border-radius:50%; margin-right:6px; opacity:0.9; }
.dot-red{ background: var(--danger); }
.dot-yellow{ background: var(--warn); }
.dot-green{ background: var(--accent2); }

.btn-dev{
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  font-family: ui-monospace, monospace;
}
.btn-dev:hover{ border-color: rgba(255,255,255,0.2); background: rgba(255,255,255,0.05); }

.btn-dev-primary{
  border: 1px solid rgba(121,242,255,0.35);
  background: rgba(121,242,255,0.10);
  color: var(--text);
  font-family: ui-monospace, monospace;
}
.btn-dev-primary:hover{ background: rgba(121,242,255,0.16); }

.terminal{
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.35);
  border-radius: 14px;
  overflow: hidden;
}
.terminal-bar{
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-family: ui-monospace, monospace;
  background: rgba(255,255,255,0.03);
}
.terminal-body{
  padding: 16px;
  font-family: ui-monospace, monospace;
  font-size: 0.95rem;
  line-height: 1.55;
}
.prompt{ color: var(--accent2); }
.path{ color: var(--accent); }
.cmd{ color: rgba(255,255,255,0.9); }
.output{ color: var(--muted); }

.cursor{
  display:inline-block;
  width: 10px;
  height: 1.1em;
  background: rgba(255,255,255,0.75);
  animation: blink 1s steps(2, start) infinite;
  transform: translateY(2px);
}
@keyframes blink { to { visibility: hidden; } }

.chip{
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.85rem;
}
.chip:hover{ border-color: rgba(255,255,255,0.25); }

.panel{
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 14px;
  overflow: hidden;
}
.panel-title{
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-family: ui-monospace, monospace;
  color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.02);
}
.panel-body{ padding: 14px; }

@media (min-width: 992px){
  #about.panel,
  #projects.panel{
    height: 100%;
    display: flex;
    flex-direction: column;
  }

  #projects .panel-body{
    flex: 1;
  }

  /* Let about size to its content; stretching it left a large empty gap. */
  #about .panel-body{
    flex: 0 0 auto;
  }
  #about.panel{
    height: auto;
  }

  #projects .panel-body{
    max-height: clamp(380px, 55vh, 620px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(121,242,255,0.45) rgba(255,255,255,0.06);
  }

  #projects .panel-body::-webkit-scrollbar{
    width: 10px;
  }

  #projects .panel-body::-webkit-scrollbar-track{
    background: rgba(255,255,255,0.06);
    border-radius: 999px;
  }

  #projects .panel-body::-webkit-scrollbar-thumb{
    background: linear-gradient(
      180deg,
      rgba(121,242,255,0.5),
      rgba(154,255,121,0.4)
    );
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 999px;
  }

  #projects .panel-body::-webkit-scrollbar-thumb:hover{
    background: linear-gradient(
      180deg,
      rgba(121,242,255,0.7),
      rgba(154,255,121,0.58)
    );
  }

  #skills.panel,
  #repos.panel{
    height: 100%;
    display: flex;
    flex-direction: column;
  }

  #skills .panel-body,
  #repos .panel-body{
    flex: 0 0 auto;
  }

  /* Push the private-source note to the bottom instead of leaving a gap
     between it and the repo cards. */
  #repos > p:last-child{
    margin-top: auto !important;
  }
}

.tag{
  display:inline-block;
  border: 1px solid rgba(154,255,121,0.25);
  background: rgba(154,255,121,0.08);
  border-radius: 999px;
  padding: 4px 10px;
  margin-right: 6px;
  margin-bottom: 8px;
  font-size: 0.8rem;
  font-family: ui-monospace, monospace;
}

.divider{ border-color: rgba(255,255,255,0.10); }

.link-dev{
  color: var(--accent);
  text-decoration: none;
  font-family: ui-monospace, monospace;
}
.link-dev:hover{ text-decoration: underline; }

.repo-grid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 12px;
}
@media (max-width: 992px){
  .repo-grid{ grid-template-columns: 1fr; }
}
.repo-card{
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: rgba(0,0,0,0.20);
  text-decoration: none;
  color: var(--text);
}
.repo-card:hover{
  border-color: rgba(121,242,255,0.30);
  background: rgba(0,0,0,0.28);
}

.hint{
  color: rgba(255,255,255,0.65);
}
/* Readable secondary text — Bootstrap's .text-secondary is too dim on this bg. */
.note-muted{
  color: rgba(255,255,255,0.60);
}
.text-success{
  color: var(--accent2);
}
.text-muted{
  color: var(--muted);
}
.error{
  color: var(--danger);
}
.terminal-body{
  height: 320px;
  max-height: 60vh;
  overflow-y: auto;
  overflow-x: hidden;
  cursor: text;
  overflow-wrap: anywhere;
  -webkit-overflow-scrolling: touch;
}

/* Long output (tree listings, help) must never widen the terminal on a phone. */
.terminal-body pre{
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 575.98px){
  .terminal-body{
    height: 260px;
    padding: 12px;
    font-size: 0.82rem;
  }
  .terminal-body .chip{
    padding: 8px 14px;
    font-size: 0.82rem;
  }

  .hero .lead{ font-size: 1.05rem; }
  .hero h2{ font-size: 1.75rem; }

  /* Project header: title and status badge stack instead of overflowing. */
  .project > .d-flex{
    flex-wrap: wrap;
    gap: 8px;
  }
  .project .fs-4{ font-size: 1.15rem !important; }
}

.back-to-top{
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1100;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  border: 1px solid rgba(121,242,255,0.55);
  background: #153347;
  color: var(--accent);
  font-size: 1.3rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

.back-to-top.is-visible{
  opacity: 0.45;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover{
  opacity: 1;
  border-color: rgba(154,255,121,0.75);
  color: var(--accent2);
}

.back-to-top:focus-visible{
  outline: 2px solid var(--accent2);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce){
  .back-to-top{
    transition: none;
  }
}

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

.timeline-item {
  position: relative;
  padding-left: 20px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 5px;
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
}

/* Marks a project whose source is private, in place of a dead GitHub link. */
.badge-private{
  flex: none;
  align-self: flex-start;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
  font-family: ui-monospace, monospace;
  font-size: 0.75rem;
  color: var(--muted);
  background: rgba(255,255,255,0.03);
  white-space: nowrap;
}
