/* ---------------------------------------------------------------
   Token system
   A syntax-highlighting palette, used semantically:
   amber = identity & emphasis (strings), teal = interactive (functions),
   violet = structure (keywords). Contained, not sprayed everywhere.
---------------------------------------------------------------- */
:root {
  --bg: #131720; /* deep indigo-slate, not neutral near-black */
  --surface: #1a2030;
  --surface-2: #202741;
  --line: #2a3147;
  --text: #e8eaf2;
  --muted: #9aa3b8;
  /* --faint is the quietest tier, but it still has to clear WCAG AA (4.5:1)
     on both --bg and --surface: 5.36:1 and 4.85:1 respectively. The old
     #6b7590 managed only 3.90 and 3.54. */
  --faint: #808cad;
  --amber: #e8b25c;
  --teal: #62d3bd;
  --violet: #a78bfa;
  --comment: #7d8aa8;

  --font-sans: "IBM Plex Sans", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-mono:
    "IBM Plex Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;

  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
/* The design is dark by intent; hold the same tokens in every viewer theme. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131720;
    --text: #e8eaf2;
  }
}
:root[data-theme="dark"] {
  --bg: #131720;
  --text: #e8eaf2;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(72px + env(safe-area-inset-top, 0px));
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
html,
body {
  height: 100%;
}
*,
*::before,
*::after {
  box-sizing: inherit;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
::selection {
  background: var(--amber);
  color: #1a1408;
}

img,
svg {
  max-width: 100%;
}

a {
  color: var(--teal);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
  border-radius: 2px;
}

.wrap {
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------------- Skip link ----------------
   Off-screen rather than display:none, which would drop it out of the tab
   order entirely and defeat the point. First focusable thing on the page. */
.skip-link {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 20;
  transform: translateY(-120%);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: #16120a;
  background: var(--amber);
  padding: calc(10px + env(safe-area-inset-top, 0px)) 18px 10px;
  border-radius: 0 0 6px 0;
}
.skip-link:focus {
  transform: translateY(0);
}

/* The skip target. Focus moves here programmatically, which does not match
   :focus-visible, so no ring is drawn around the whole page body. */
main:focus {
  outline: none;
}

/* ---------------- Top bar ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(19, 23, 32, 0.88);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0px);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 56px;
}
.brand {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text);
}
.brand .tilde {
  color: var(--amber);
}
.nav {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}
.nav a {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--muted);
}
.nav a:hover {
  color: var(--text);
  text-decoration: none;
}

/* ---------------- Hero ---------------- */
.hero {
  padding: 84px 0 72px;
  background-image: radial-gradient(var(--line) 1px, transparent 1px);
  background-size: 26px 26px;
  border-bottom: 1px solid var(--line);
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 56px;
  align-items: center;
}
.kicker {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--comment);
  margin: 0 0 14px;
}
h1 {
  font-size: clamp(2.2rem, 5.5vw, 3.4rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.06;
  margin: 0 0 14px;
}
h1 .underscore {
  color: var(--amber);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink {
  50% {
    opacity: 0;
  }
}
.role {
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--text);
  margin: 0 0 12px;
}
.hero p.lede {
  color: var(--muted);
  max-width: 46ch;
  margin: 0 0 30px;
}
.hero-actions {
  display: flex;
  gap: 22px;
  align-items: center;
  flex-wrap: wrap;
}
.btn {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: #16120a;
  background: var(--amber);
  padding: 11px 20px;
  border-radius: 6px;
  font-weight: 500;
}
.btn:hover {
  background: #f0c078;
  text-decoration: none;
}
.link-quiet {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 2px;
}
.link-quiet:hover {
  text-decoration: none;
  border-color: var(--teal);
}

/* Editor card */
.editor {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 18px 44px -22px rgba(0, 0, 0, 0.6);
}
.editor-tabbar {
  display: flex;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.editor-tab {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text);
  padding: 9px 16px;
  border-right: 1px solid var(--line);
  background: var(--surface);
  position: relative;
}
.editor-tab::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--amber);
}
.editor-body {
  padding: 18px 8px 20px 0;
  overflow-x: auto;
}
.editor-body pre {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  line-height: 1.85;
}
.codeline {
  display: flex;
  white-space: pre;
}
.lineno {
  width: 44px;
  flex: 0 0 44px;
  text-align: right;
  padding-right: 16px;
  color: var(--faint);
  user-select: none;
}
.tok-key {
  color: var(--violet);
}
.tok-str {
  color: var(--amber);
}
.tok-val {
  color: var(--teal);
}
.tok-punc {
  color: var(--muted);
}
.tok-comment {
  color: var(--comment);
  font-style: italic;
}

/* One orchestrated load moment: hero elements + code lines rise in once.
   The animation is pure CSS, so it still completes with JS disabled –
   main.js only stages the delays that turn it into a sequence. */
[data-reveal] {
  opacity: 0;
  transform: translateY(10px);
  animation: rise 0.55s ease-out forwards;
}
[data-reveal="code"] {
  animation-duration: 0.4s;
}
@keyframes rise {
  to {
    opacity: 1;
    transform: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  [data-reveal] {
    opacity: 1;
    transform: none;
  }
}

/* ---------------- Sections ---------------- */
section {
  padding: 76px 0;
  border-bottom: 1px solid var(--line);
}
section:last-of-type {
  border-bottom: none;
}
h2 {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--comment);
  margin: 0 0 40px;
}
h2 .slashes {
  color: var(--faint);
}
h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}

/* About & skills */
.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 56px;
}
.about-grid p {
  color: var(--muted);
  max-width: 62ch;
  margin: 0 0 1.1em;
}
.about-grid p strong {
  color: var(--text);
  font-weight: 600;
}
.now {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 22px 24px;
  align-self: start;
}
.now h3 {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--comment);
  margin-bottom: 14px;
}
.now ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.now li {
  padding: 7px 0;
  color: var(--muted);
  font-size: 0.95rem;
  border-bottom: 1px dashed var(--line);
}
.now li:last-child {
  border-bottom: none;
}
.now li strong {
  color: var(--text);
  font-weight: 600;
}

.skills {
  margin-top: 48px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px 48px;
}
.skill-group h3 {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 12px;
}
.skill-group ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.skill-group li {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  padding: 5px 11px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: var(--surface);
}
/* token colour = category, like syntax colour = token type.
   `accent:` in cv.yaml picks one of these. */
.acc-amber h3,
.acc-amber li {
  color: var(--amber);
}
.acc-teal h3,
.acc-teal li {
  color: var(--teal);
}
.acc-violet h3,
.acc-violet li {
  color: var(--violet);
}
.acc-muted h3,
.acc-muted li {
  color: var(--muted);
}

/* Credentials */
.creds {
  margin-top: 52px;
}
.creds h3 {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--comment);
  margin: 0 0 14px;
}
.creds ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 48px;
}
.creds li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 0.95rem;
}
.creds li b {
  font-weight: 500;
  color: var(--text);
}
.creds li span {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--faint);
  white-space: nowrap;
}
.creds-more {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--comment);
  margin: 16px 0 0;
}

/* Experience: career history as commit history */
.timeline {
  position: relative;
  padding-left: 34px;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--line);
}
.entry {
  position: relative;
  padding-bottom: 52px;
}
.entry:last-child {
  padding-bottom: 0;
}
.entry::before {
  content: "";
  position: absolute;
  left: -32px;
  top: 7px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--teal);
}
.entry.head::before {
  background: var(--teal);
  box-shadow: 0 0 0 4px rgba(98, 211, 189, 0.15);
}
.entry .tag {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--amber);
  margin: 0 0 6px;
}
.entry .org {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0 0 12px;
}
.entry ul {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}
.entry li {
  margin-bottom: 7px;
}
.entry li::marker {
  color: var(--faint);
}

/* Projects: varied rows, not a card grid */
.project {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 32px;
  padding: 34px 0;
  border-top: 1px solid var(--line);
}
.project:last-of-type {
  border-bottom: 1px solid var(--line);
}
.project .meta {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--faint);
  line-height: 2;
}
.project .meta .yr {
  color: var(--text);
}
.project p {
  color: var(--muted);
  margin: 8px 0 0;
  max-width: 62ch;
}
.project .outcome {
  margin-top: 14px;
  font-size: 0.95rem;
  color: var(--text);
  border-left: 3px solid var(--amber);
  padding-left: 14px;
}
.project.featured {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 34px 30px;
  margin-bottom: 10px;
}
.project.featured .meta .badge {
  display: inline-block;
  color: var(--amber);
  border: 1px solid var(--amber);
  border-radius: 4px;
  padding: 1px 8px;
  margin-bottom: 8px;
}
.confidential-note {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--comment);
  margin-top: 26px;
}

/* Contact */
.contact p {
  color: var(--muted);
  max-width: 56ch;
  margin: 0 0 26px;
}
.contact-links {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
}
.contact-links a {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 3px;
}
.contact-links a:hover {
  text-decoration: none;
  border-color: var(--teal);
}

footer {
  border-top: 1px solid var(--line);
  padding: 26px 0 34px;
}
footer .wrap {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--faint);
}

/* ---------------- Responsive ---------------- */
@media (max-width: 860px) {
  .hero {
    padding: 56px 0;
  }
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  .about-grid {
    grid-template-columns: 1fr;
    gap: 36px;
  }
  .skills {
    grid-template-columns: 1fr;
  }
  .creds ul {
    grid-template-columns: 1fr;
  }
  .project {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .project .meta {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    line-height: 1.6;
  }
  section {
    padding: 56px 0;
  }
}
@media (max-width: 480px) {
  body {
    font-size: 16px;
  }
  .topbar-inner {
    height: auto;
    padding: 10px 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .nav {
    gap: 14px;
  }
  html {
    scroll-padding-top: calc(96px + env(safe-area-inset-top, 0px));
  }
}
