/* ============================================================
   main.css — PCB mode (terminal overlays, boot, nav)
   + plain CV page styles.
   ============================================================ */

:root {
  --bg: #05070c;
  --ink: #d8f3ec;
  --dim: #5d7a7a;
  --cyan: #3fe0c5;
  --cyan-soft: rgba(63, 224, 197, 0.18);
  --amber: #ffb454;
  --red: #ff5566;
  --panel-bg: rgba(7, 13, 18, 0.93);
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

/* ---------------- PCB mode ---------------- */
body.pcb-mode {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--mono);
  overflow: hidden;
  height: 100dvh;
  overscroll-behavior: none;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100dvh;
  display: block;
  touch-action: none;
}

.skip-link {
  position: fixed;
  top: -3em;
  left: 1rem;
  z-index: 100;
  background: var(--cyan);
  color: #04221d;
  padding: 0.5em 1em;
  font-family: var(--mono);
  text-decoration: none;
  transition: top 0.15s;
}
.skip-link:focus { top: 0.5rem; }

/* ---- boot overlay ---- */
#boot {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.8s ease;
}
#boot.gone { opacity: 0; pointer-events: none; }
#boot-log {
  font-family: var(--mono);
  font-size: clamp(0.72rem, 2.4vw, 0.95rem);
  line-height: 1.7;
  color: var(--ink);
  white-space: pre-wrap;
  margin: 0;
  padding: 1.5rem;
  max-width: 34rem;
  text-shadow: 0 0 12px var(--cyan-soft);
}

/* ---- scroll hint ---- */
#scroll-hint {
  position: fixed;
  bottom: 4.2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  color: var(--cyan);
  font-size: 0.8rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  opacity: 0.85;
  transition: opacity 0.6s;
  pointer-events: none;
}
#scroll-hint .chev { animation: bob 1.6s ease-in-out infinite; }
#scroll-hint.gone { opacity: 0; }
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(7px); }
}

/* ---- halt screen ---- */
#halt {
  position: fixed;
  inset: 0;
  z-index: 18;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s;
}
#halt.visible { opacity: 1; pointer-events: auto; }
#halt pre {
  margin: 0;
  font-family: var(--mono);
  font-size: 1.1rem;
  color: var(--dim);
  letter-spacing: 0.2em;
}

/* ---- silkscreen progress nav ---- */
#rail-nav {
  position: fixed;
  /* left side — the terminal panel lives on the right and must never block it */
  left: 1.1rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.rail-nav-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: none;
  border: none;
  padding: 0.2rem;
  cursor: pointer;
  font-family: var(--mono);
  color: var(--dim);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
}
.rail-dot {
  width: 9px;
  height: 9px;
  border: 1px solid var(--dim);
  background: transparent;
  flex: 0 0 auto;
  transition: all 0.25s;
}
.rail-label {
  opacity: 0;
  transform: translateX(-6px);
  transition: all 0.25s;
  white-space: nowrap;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.9);
}
.rail-nav-item:hover .rail-label,
.rail-nav-item:focus-visible .rail-label,
.rail-nav-item.active .rail-label { opacity: 1; transform: none; }
.rail-nav-item.active { color: var(--cyan); }
.rail-nav-item.active .rail-dot {
  background: var(--cyan);
  border-color: var(--cyan);
  box-shadow: 0 0 10px var(--cyan-soft);
}
.rail-nav-item:focus-visible { outline: 1px solid var(--cyan); outline-offset: 2px; }

/* ---- corner links + attribution (silkscreen style) ---- */
#corner-links {
  position: fixed;
  top: 0.9rem;
  right: 1.1rem;
  z-index: 20;
}
#corner-links a {
  color: var(--dim);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-decoration: none;
  border-bottom: 1px dotted var(--dim);
}
#corner-links a:hover, #corner-links a:focus-visible { color: var(--cyan); border-color: var(--cyan); }

#attribution {
  position: fixed;
  bottom: 0.7rem;
  left: 1.1rem;
  z-index: 20;
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  color: var(--dim);
  opacity: 0.8;
  pointer-events: none;
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.8);
}

/* ---- terminal panel ---- */
.panel {
  position: fixed;
  z-index: 30;
  right: 4.5rem;
  top: 50%;
  transform: translateY(-50%) translateX(2.5rem);
  width: min(44rem, 46vw);
  max-height: 76dvh;
  display: flex;
  flex-direction: column;
  background: var(--panel-bg);
  border: 1px solid rgba(63, 224, 197, 0.35);
  box-shadow: 0 0 40px rgba(63, 224, 197, 0.08), 0 18px 50px rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.35s ease;
}
.panel::after {
  /* scanlines */
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.018) 0 1px,
    transparent 1px 3px
  );
}
.panel--open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-50%) translateX(0);
}
.panel-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 0.9rem;
  border-bottom: 1px solid rgba(63, 224, 197, 0.25);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: var(--dim);
}
.panel-title { color: var(--cyan); }
.panel-hint { opacity: 0.7; }
.panel-body {
  padding: 1rem 1.1rem 1.2rem;
  overflow-y: auto;
  font-size: 0.86rem;
  line-height: 1.65;
  scrollbar-width: thin;
  scrollbar-color: var(--dim) transparent;
}
.panel-body:focus-visible { outline: 1px solid var(--cyan); outline-offset: -1px; }

.t-line { min-height: 1.2em; overflow-wrap: anywhere; }
.t-user { color: var(--cyan); }
.t-root { color: var(--red); }
.t-host { color: var(--ink); }
.t-dim { color: var(--dim); }
.t-cmd { color: var(--ink); }
.t-head { color: var(--cyan); font-weight: 700; }
.t-sub { color: var(--ink); opacity: 0.9; }
.t-key { color: var(--amber); }
.t-accent { color: var(--amber); }
.t-warn { color: var(--red); }
.t-flag {
  color: var(--amber);
  background: rgba(255, 180, 84, 0.08);
  border: 1px dashed rgba(255, 180, 84, 0.5);
  padding: 0.1em 0.5em;
  display: inline-block;
  user-select: all;
}
.panel a { color: var(--cyan); text-decoration: underline dotted; text-underline-offset: 3px; }
.panel a:hover { color: #8ff2e2; }

.cursor {
  display: inline-block;
  width: 0.55em;
  height: 1.05em;
  vertical-align: text-bottom;
  background: var(--cyan);
  animation: blink 1.05s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* root shell (easter egg) flavor */
.panel--root { border-color: rgba(255, 85, 102, 0.5); }
.panel--root .panel-bar { border-color: rgba(255, 85, 102, 0.4); }
.panel--root .panel-title { color: var(--red); }
.panel--root { animation: glitch-in 0.35s steps(3); }
@keyframes glitch-in {
  0% { transform: translateY(-50%) translateX(4px) skewX(2deg); filter: hue-rotate(40deg); }
  60% { transform: translateY(-50%) translateX(-3px) skewX(-1deg); }
  100% { transform: translateY(-50%); filter: none; }
}
@keyframes glitch-in-mobile {
  0% { transform: translateY(4px) skewX(2deg); filter: hue-rotate(40deg); }
  60% { transform: translateY(-3px) skewX(-1deg); }
  100% { transform: translateY(0); filter: none; }
}

.t-btn {
  font-family: var(--mono);
  font-size: 0.84rem;
  background: transparent;
  border: 1px solid var(--cyan);
  color: var(--cyan);
  padding: 0.45em 1.1em;
  cursor: pointer;
  letter-spacing: 0.08em;
}
.t-btn:hover, .t-btn:focus-visible { background: var(--cyan-soft); }

/* reduced motion: kill the decorative animation */
@media (prefers-reduced-motion: reduce) {
  #scroll-hint .chev { animation: none; }
  .cursor { animation: none; }
  .panel--root { animation: none; }
  .panel { transition: opacity 0.15s linear; }
}

/* ---------------- mobile ---------------- */
@media (max-width: 720px) {
  .panel {
    right: 0;
    left: 0;
    top: auto;
    bottom: 0;
    transform: translateY(1.5rem);
    width: 100%;
    max-height: 68dvh;
    border-left: none;
    border-right: none;
  }
  .panel--open { transform: translateY(0); }
  .panel--root { animation-name: glitch-in-mobile; }
  .panel-body { font-size: 0.92rem; padding: 0.9rem; }
  .panel-hint { display: none; }

  #rail-nav { left: 0.55rem; gap: 0.75rem; }
  .rail-label { display: none; }

  #corner-links { top: 0.6rem; right: 0.7rem; }
  #attribution { font-size: 0.55rem; left: 0.7rem; bottom: 0.5rem; max-width: 60vw; }
  #scroll-hint { bottom: 5.5rem; }
}

/* ============================================================
   plain CV page
   ============================================================ */
body.plain-mode {
  background: #f7f6f2;
  color: #1c2228;
  font-family: var(--sans);
  line-height: 1.55;
  padding: 2rem 1.2rem 3rem;
}
.cv { max-width: 46rem; margin: 0 auto; }

.cv-actions {
  max-width: 46rem;
  margin: 0 auto 1.6rem;
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}
.cv-btn {
  font-family: var(--mono);
  font-size: 0.85rem;
  border: 1px solid #1c2228;
  background: #1c2228;
  color: #f7f6f2;
  padding: 0.55em 1.2em;
  cursor: pointer;
  text-decoration: none;
}
.cv-btn--ghost { background: transparent; color: #1c2228; }
.cv-btn:hover { opacity: 0.85; }

.cv-header {
  display: flex;
  gap: 1.4rem;
  align-items: center;
  border-bottom: 2px solid #1c2228;
  padding-bottom: 1.2rem;
  margin-bottom: 1.4rem;
}
.cv-photo { border-radius: 4px; object-fit: cover; }
.cv-header h1 { margin: 0 0 0.2rem; font-size: 1.7rem; }
.cv-title { margin: 0 0 0.3rem; font-family: var(--mono); font-size: 0.9rem; color: #3a4754; }
.cv-meta { margin: 0; font-size: 0.85rem; color: #5a6672; }
.cv-meta a { color: #0e7c6b; }

.cv h2 {
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #0e7c6b;
  border-bottom: 1px solid #d8d5cc;
  padding-bottom: 0.3rem;
  margin: 1.8rem 0 0.8rem;
}
.cv-entry { margin-bottom: 1rem; }
.cv-entry-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
  flex-wrap: wrap;
}
.cv-entry h3 { margin: 0; font-size: 1rem; }
.cv-period { font-family: var(--mono); font-size: 0.78rem; color: #5a6672; white-space: nowrap; }
.cv-entry ul { margin: 0.3rem 0 0; padding-left: 1.2rem; }
.cv-entry li { margin: 0.15rem 0; font-size: 0.92rem; }
.cv-entry p { margin: 0.2rem 0; font-size: 0.92rem; }
.cv a { color: #0e7c6b; }

.cv-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; }
@media (max-width: 540px) { .cv-two-col { grid-template-columns: 1fr; } }

.cv-footer {
  max-width: 46rem;
  margin: 2.5rem auto 0;
  border-top: 1px solid #d8d5cc;
  padding-top: 1rem;
  font-size: 0.78rem;
  color: #7a8590;
}
