:root {
  color-scheme: dark;
  --bg: #0b0e14;
  --panel: #11151f;
  --fg: #c9d1d9;
  --muted: #9aa4b2; /* bumped from #7d8590 for AA contrast on the panel bg */
  --accent: #39b0ff;       /* blue — links, primary actions, focus */
  --accent2: #ffb454;      /* amber — section headings, highlights, the agent */
  --green: #3fb950;        /* green — "open to work" / available */
  --border: #222938;
  --radius: 10px;
  --maxw: 820px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 2rem 1rem;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

.window {
  max-width: var(--maxw);
  margin: 0 auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .45);
}

.titlebar {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .6rem .9rem;
  background: #0d1118;
  border-bottom: 1px solid var(--border);
}
.dot { width: 12px; height: 12px; border-radius: 50%; }
.dot.red { background: #ff5f56; }
.dot.amber { background: #ffbd2e; }
.dot.green { background: #27c93f; }
.titlebar .tt { margin-left: .5rem; color: var(--muted); font-size: .8rem; }
.titlebar .wip { margin-left: auto; color: var(--accent2); border: 1px solid var(--accent2); border-radius: 4px; padding: 0 .4rem; font-size: .68rem; letter-spacing: .03em; }

.screen { padding: 1.6rem clamp(1rem, 4vw, 2.4rem); }

h1 { margin: .2rem 0; font-size: clamp(1.6rem, 5vw, 2.2rem); color: #fff; }
h2 {
  margin: 2.2rem 0 .6rem;
  font-size: 1.1rem;
  color: var(--accent2);
  border-bottom: 1px dashed var(--border);
  padding-bottom: .3rem;
}
h3 { margin: .9rem 0 .2rem; font-size: 1rem; color: var(--accent); }

.tagline { color: var(--muted); margin: .2rem 0 0; }
.meta { color: var(--muted); font-size: .9rem; margin: .4rem 0 1rem; }

.cmd {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  background: #0d1118;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .7rem .9rem;
  margin: 1rem 0 .4rem;
}
.cmd .prompt { color: var(--green); }
.cmd code { color: #fff; font-size: 1.05rem; }
.copy {
  margin-left: auto;
  background: var(--accent);
  color: #021018;
  border: 0;
  border-radius: 6px;
  padding: .35rem .7rem;
  font: inherit;
  font-size: .8rem;
  cursor: pointer;
}
.copy:hover { filter: brightness(1.1); }
.copy.copied { background: var(--green); }

.hint { color: var(--muted); font-size: .85rem; margin: .2rem 0 1rem; }

.links { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: .6rem; }
a { color: var(--accent); text-decoration: none; }
a:hover, a:focus { text-decoration: underline; }

ul { margin: .3rem 0 .6rem; padding-left: 1.2rem; }
li { margin: .15rem 0; }
.job-meta { color: var(--muted); font-size: .88rem; margin: .1rem 0 .3rem; }

.skills { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .4rem 1.4rem; }
.tags { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.tags li {
  background: #0d1118;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .15rem .6rem;
  font-size: .82rem;
}

footer {
  margin-top: 2.4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: .82rem;
}
footer code { color: var(--accent); }

.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;
}

/* --- chat: floating terminal-style popup ---------------------------------- */
/* Honor the `hidden` attribute — class display rules below would otherwise win. */
.chat-launch[hidden], .chat-panel[hidden] { display: none; }
.chat-launch {
  position: fixed; right: 1.1rem; bottom: 1.1rem; z-index: 40;
  display: inline-flex; align-items: center; gap: .5rem;
  background: var(--panel); color: var(--fg);
  border: 1px solid var(--accent); border-radius: 999px;
  padding: .6rem 1rem; font: inherit; font-size: .9rem;
  cursor: pointer; box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
}
.chat-launch:hover, .chat-launch:focus { border-color: var(--accent2); color: #fff; }
.chat-launch .pulse {
  width: .55rem; height: .55rem; border-radius: 50%;
  background: var(--green); animation: pulse 2.4s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(63, 185, 80, .55); }
  70% { box-shadow: 0 0 0 .5rem rgba(63, 185, 80, 0); }
  100% { box-shadow: 0 0 0 0 rgba(63, 185, 80, 0); }
}

.chat-panel {
  position: fixed; right: 1.1rem; bottom: 1.1rem; z-index: 45;
  display: flex; flex-direction: column;
  width: min(380px, calc(100vw - 2rem));
  height: min(560px, calc(100dvh - 2rem));
  background: var(--panel);
  border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden; box-shadow: 0 16px 50px rgba(0, 0, 0, .55);
}
.chat-head {
  display: flex; align-items: center; gap: .45rem;
  padding: .55rem .8rem;
  background: #0d1118; border-bottom: 1px solid var(--border);
}
.chat-head .chat-title { margin-left: .4rem; flex: 1 1 auto; color: var(--muted); font-size: .8rem; }
.chat-close { background: none; border: 0; color: var(--muted); font: inherit; font-size: 1rem; cursor: pointer; padding: 0 .2rem; }
.chat-close:hover { color: #fff; }
/* Outline variant — specificity must beat .cta-button (defined later). */
.cta-button.cta-ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); cursor: pointer; }
.cta-button.cta-ghost:hover, .cta-button.cta-ghost:focus { background: var(--panel); color: var(--accent); filter: none; }

@media (max-width: 480px) {
  .chat-panel { right: 0; bottom: 0; width: 100vw; height: 100dvh; border-radius: 0; }
  .chat-launch { right: .8rem; bottom: .8rem; }
}

.chat-log {
  display: flex;
  flex-direction: column;
  gap: .7rem;
  padding: 1rem;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}
.msg { display: flex; gap: .5rem; max-width: 90%; }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg.assistant { align-self: flex-start; }
.msg .who {
  flex: 0 0 auto;
  width: 1.7rem; height: 1.7rem;
  display: grid; place-items: center;
  border-radius: 6px;
  background: #161b26;
  border: 1px solid var(--border);
  color: var(--accent2);
  font-size: .6rem; font-weight: bold;
  margin-top: .15rem;
}
.bubble {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding: .55rem .8rem;
  border-radius: 12px;
  line-height: 1.5;
}
.msg.assistant .bubble { background: #161b26; border: 1px solid var(--border); border-top-left-radius: 3px; }
.msg.user .bubble { background: var(--accent); color: #021018; border-top-right-radius: 3px; }
.bubble.error { background: #2a1416; border: 1px solid #6b2b33; color: #ff8a8a; }
.bubble.thinking { display: inline-flex; gap: .28rem; }
.bubble.thinking .dot {
  width: .4rem; height: .4rem; border-radius: 50%;
  background: var(--muted);
  animation: blink 1.2s infinite ease-in-out both;
}
.bubble.thinking .dot:nth-child(2) { animation-delay: .2s; }
.bubble.thinking .dot:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.chat-suggestions { display: flex; flex-wrap: wrap; gap: .4rem; padding: 0 1rem .7rem; }
.chip {
  background: #161b26;
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .3rem .75rem;
  font: inherit; font-size: .82rem;
  cursor: pointer;
}
.chip:hover, .chip:focus { border-color: var(--accent); color: var(--accent); }

.chat-form {
  display: flex; gap: .5rem; align-items: flex-end;
  padding: .6rem;
  border-top: 1px solid var(--border);
  background: #0b0e14;
}
.chat-form textarea {
  flex: 1 1 auto;
  resize: none;
  background: #0d1118;
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .55rem .7rem;
  font: inherit;
  line-height: 1.4;
  max-height: 160px;
  overflow-y: auto;
}
#chat-send {
  flex: 0 0 auto;
  width: 2.4rem; height: 2.4rem;
  background: var(--accent2);
  color: #1a0413;
  border: 0; border-radius: 8px;
  font: inherit; font-size: 1.1rem; font-weight: bold;
  cursor: pointer;
}
#chat-send:hover { filter: brightness(1.08); }
#chat-send[disabled] { opacity: .6; cursor: progress; }

/* Above-the-fold call to action: lead with contact, not the SSH gimmick. */
.cta { display: flex; gap: .8rem; flex-wrap: wrap; align-items: center; margin: 1rem 0 .4rem; }
.cta-button {
  background: var(--green);
  color: #04140a;
  font-weight: bold;
  border-radius: 8px;
  padding: .6rem 1.1rem;
}
.cta-button:hover, .cta-button:focus { filter: brightness(1.08); text-decoration: none; }
.cta-link { color: var(--accent); align-self: center; }

/* The SSH command is a flourish for engineers, not the front door. */
.ssh-flourish { margin: .8rem 0 .4rem; }
.ssh-flourish > summary {
  cursor: pointer;
  color: var(--muted);
  font-size: .9rem;
  list-style: none;
}
.ssh-flourish > summary::-webkit-details-marker { display: none; }
.ssh-flourish > summary::before { content: "▸ "; }
.ssh-flourish[open] > summary::before { content: "▾ "; }
.ssh-flourish .muted { color: var(--muted); }

/* Availability: a compact definition list. */
.availability { display: grid; grid-template-columns: max-content 1fr; gap: .2rem 1rem; margin: .4rem 0; }
.availability dt { color: var(--muted); }
.availability dd { margin: 0; }

.how ul { margin-top: .4rem; }
.how li { margin: .3rem 0; }

/* --- section-heading marker (terminal/markdown vibe) --- */
h2::before { content: "# "; color: var(--accent); }

/* --- command bar: top nav, terminal-app skin (still clickable/scrollable) --- */
.cmdbar {
  display: flex; flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  background: #0d1118;
  font-size: .85rem;
}
.cmdbar a {
  padding: .5rem .9rem;
  color: var(--muted);
  border-right: 1px solid var(--border);
  white-space: nowrap;
}
.cmdbar a:hover, .cmdbar a:focus { color: var(--accent); background: var(--panel); text-decoration: none; }
.cmdbar a .k { color: var(--accent2); font-weight: bold; }   /* key hint */
.cmdbar .brand { color: #fff; font-weight: bold; }

/* --- boot intro overlay (shown by app.js; no-JS never sees it) --- */
.boot {
  position: fixed; inset: 0; z-index: 50;
  display: none;
  align-items: center; justify-content: center;
  background: var(--bg);
  cursor: pointer;
}
.boot.show { display: flex; }
.boot.fade { opacity: 0; transition: opacity .35s ease; }
.boot pre {
  margin: 0; padding: 1rem;
  color: var(--fg); font: inherit; font-size: 1rem; line-height: 1.7;
  white-space: pre-wrap;
}
.boot pre b { color: #fff; }
.boot pre .ok { color: var(--green); }
.boot .cursor { color: var(--accent2); animation: caret 1s step-end infinite; }
@keyframes caret { 50% { opacity: 0; } }

/* --- footer key-hints --- */
.keyhints { display: flex; flex-wrap: wrap; gap: 1.2rem; }
.keyhints .k { color: var(--accent2); font-weight: bold; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
