/* ==========================================================
   Avi Balsam — personal site
   Amber phosphor on deep charcoal. All mono, no chrome.
   Boot sequence: commands type, output prints instantly.
   ========================================================== */

:root {
  --bg: #0C0F14;
  --text: #C9D1D9;
  --bright: #EDF2F7;
  --muted: #6E7A87;
  --rule: #1E242E;
  --amber: #FFB000;
  --amber-dim: #B37C02;
}

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

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

body {
  font-family: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  background: var(--bg);
  color: var(--text);
  font-size: 0.9375rem;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--amber); color: #14100A; }

.page {
  position: relative;
  max-width: 46rem;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 5vw, 2rem);
}

a { color: var(--text); }
a:hover { color: var(--amber); }
a:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
}

em { color: var(--bright); }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- boot-sequence gating ----------
   .anim hides everything the script reveals step by step.
   Without JS, .cmd lines and the idle prompt stay hidden
   and the full content shows immediately. */

html:not(.js) .cmd { display: none; }

/* Hidden content keeps its layout space, so the page always has its
   final height and you can scroll ahead — but never past the real end. */
.anim .term-block,
.anim .out,
.anim .site-footer,
.anim #idle-prompt { visibility: hidden; }

.anim .term-block.on,
.anim .out.on,
.anim .site-footer.on,
.anim #idle-prompt.on { visibility: visible; }

/* ---------- cursor ---------- */

.cursor {
  display: inline-block;
  width: 0.55em;
  height: 0.95em;
  margin-left: 0.1em;
  background: var(--amber);
  vertical-align: baseline;
  transform: translateY(0.12em);
}
.cursor.blink { animation: blink 1.05s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- command lines ---------- */

.cmd {
  font-size: 0.9rem;
  color: var(--bright);
  font-weight: 500;
  margin-bottom: 2.25rem;
}

.prompt { color: var(--amber); font-weight: 600; }

#idle-prompt { padding: 2.5rem 0 3.5rem; margin: 0; }

/* ---------- header ---------- */

/* Nav sits level with the `$ whoami` line. */
.site-header {
  position: absolute;
  top: clamp(4rem, 13vh, 7rem);
  right: clamp(1.25rem, 5vw, 2rem);
  line-height: 1.75;
}

.site-header nav {
  display: flex;
  gap: 1.5rem;
  font-size: 0.85rem;
}
.site-header nav a {
  text-decoration: none;
  color: var(--muted);
}
.site-header nav a:hover { color: var(--amber); }

/* ---------- intro ---------- */

.intro {
  padding: clamp(4rem, 13vh, 7rem) 0 clamp(2.5rem, 7vh, 4rem);
}

.intro h1 {
  font-size: clamp(2.2rem, 7.5vw, 3.6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--bright);
  margin-bottom: 1.25rem;
}

.intro-role {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.intro-line {
  font-size: 1.02rem;
  max-width: 44ch;
  margin-bottom: 1rem;
}

.intro-meta {
  font-size: 0.8125rem;
  color: var(--muted);
}

/* ---------- sections ---------- */

.section {
  border-top: 1px solid var(--rule);
  padding: 2.5rem 0 3rem;
}

/* ---------- entries (work + projects) ---------- */

.entry {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 1.5rem;
}
.entry + .entry { margin-top: 2.25rem; }

.entry-meta {
  font-size: 0.8125rem;
  color: var(--muted);
  padding-top: 0.2rem;
  white-space: nowrap;
}

.entry-body h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--bright);
  line-height: 1.5;
  margin-bottom: 0.4rem;
}

.entry-role {
  display: block;
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--muted);
}

.entry-body p {
  font-size: 0.9rem;
  max-width: 62ch;
}

.metric {
  color: var(--amber);
  font-weight: 600;
}

/* ---------- projects ---------- */

.project-list {
  list-style: none;
  display: grid;
  gap: 2.25rem;
}
.project-list .entry + .entry { margin-top: 0; }

.project-list h3 a {
  color: var(--bright);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  text-decoration-color: var(--rule);
}
.project-list h3 a:hover {
  color: var(--amber);
  text-decoration-color: var(--amber);
}

.ext { color: var(--amber-dim); font-weight: 400; }
.project-list h3 a:hover .ext { color: var(--amber); }

/* ---------- contact ---------- */

.contact-list {
  list-style: none;
  display: grid;
  gap: 0.8rem;
}

.contact-list li {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 1.5rem;
  align-items: baseline;
}

.contact-label {
  font-size: 0.8125rem;
  color: var(--muted);
}

.contact-list a {
  color: var(--bright);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  text-decoration-color: var(--rule);
  width: fit-content;
}
.contact-list a:hover {
  color: var(--amber);
  text-decoration-color: var(--amber);
}

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--rule);
  padding: 1.5rem 0 2.5rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.8125rem;
  color: var(--muted);
}

/* ---------- idle prompt / chat input ---------- */

.idle-slot { display: inline-flex; align-items: baseline; }

.idle-input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--bright);
  font: inherit;
  font-weight: 500;
  min-width: 12ch;
  caret-color: var(--amber);
}
.idle-input::placeholder { color: var(--muted); opacity: 0.7; }

/* ---------- chat messages ---------- */

.chat-log {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.chat-msg {
  display: flex;
  gap: 0.5rem;
  line-height: 1.6;
}
.chat-msg.user .prompt { color: var(--amber); }
.chat-msg.ai .prompt { color: var(--muted); }
.chat-msg .msg-text { color: var(--text); }
.chat-msg.user .msg-text { color: var(--bright); }

/* ---------- thinking indicator ---------- */

.thinking .cursor { animation: blink 0.7s steps(1) infinite; }

/* ---------- responsive ---------- */

@media (max-width: 560px) {
  .site-header {
    position: static;
    padding: 1.5rem 0 0;
  }
  .intro { padding-top: 2.5rem; }

  .entry,
  .contact-list li {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
  .entry + .entry { margin-top: 2rem; }
  .project-list .entry + .entry { margin-top: 0; }
  .entry-meta { padding-top: 0; }
}
