/* Colour scheme: graphite background, one amber accent (trading-terminal style), and
   green/red reserved for bid/ask style data (the hero depth chart, CI status). */
:root {
  --bg: #0b0c0e;
  --bg-soft: #101216;
  --surface: #14161b;
  --surface-2: #1a1d23;
  --border: #23262d;
  --border-strong: #3a3e47;
  --text: #ecebe8;
  --muted: #9a9ca3;
  --faint: #6b6e76;
  --accent: #ffb224;
  --accent-strong: #ffc457;
  --accent-soft: rgba(255, 178, 36, 0.1);
  --accent-line: rgba(255, 178, 36, 0.35);
  --on-accent: #17120a;
  --bid: #3ecf8e;
  --ask: #ff6b5b;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  --radius: 14px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --header-h: 68px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Inter", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body.locked {
  overflow: hidden;
}

::selection {
  background: var(--accent);
  color: var(--on-accent);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

img {
  max-width: 100%;
}

code,
kbd,
.mono {
  font-family: var(--mono);
}

code {
  font-size: 0.9em;
  padding: 0.1em 0.35em;
  border-radius: 5px;
  background: var(--surface-2);
}

kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 0.05em 0.4em;
  font-size: 0.78em;
  line-height: 1.5;
  text-align: center;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
}

.container {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 100;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
}

.skip-link:focus {
  top: 1rem;
}

/* Keyboard hints for mouse users, swipe hints for touch users */
.hint-touch {
  display: none;
}

@media (hover: none), (pointer: coarse) {
  .hint-keys {
    display: none;
  }

  .hint-touch {
    display: inline;
  }
}

/* ---------- Header / nav ---------- */

.header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px);
  background: rgba(11, 12, 14, 0.8);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-h);
  gap: 1rem;
}

.logo {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--text);
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
}

.logo:hover {
  text-decoration: none;
}

.logo-prompt {
  color: var(--accent);
}

.logo-cursor {
  display: inline-block;
  width: 0.55em;
  height: 1.1em;
  margin-left: 0.2em;
  background: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.nav-links {
  display: flex;
  gap: 1.4rem;
  align-items: center;
}

.nav-links a:not(.btn) {
  color: var(--muted);
  font-weight: 500;
  transition: color 0.2s ease;
}

.nav-links a:not(.btn):hover {
  color: var(--text);
  text-decoration: none;
}

.palette-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.5rem 0.4rem 0.75rem;
  color: var(--muted);
  font-size: 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.palette-trigger:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  padding: 0 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  padding: 6.5rem 0 5rem;
  border-bottom: 1px solid var(--border);
  background:
    linear-gradient(var(--border) 1px, transparent 1px) 0 0 / 100% 48px,
    linear-gradient(90deg, var(--border) 1px, transparent 1px) 0 0 / 48px 100%,
    var(--bg);
  background-blend-mode: normal;
}

.hero::before {
  /* fades the grid out towards the edges */
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 30% 30%, transparent 0%, var(--bg) 70%);
  pointer-events: none;
}

.hero-depth {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 55%;
  opacity: 0.55;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to top, #000 10%, transparent 100%);
  mask-image: linear-gradient(to top, #000 10%, transparent 100%);
}

.hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 3rem;
  align-items: center;
}

.eyebrow {
  font-family: var(--mono);
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  margin: 0 0 0.75rem;
}

.eyebrow::before {
  content: "// ";
  color: var(--faint);
}

h1 {
  font-size: clamp(2.6rem, 6.5vw, 4.4rem);
  line-height: 1.04;
  letter-spacing: -0.03em;
  margin: 0 0 1.1rem;
}

h2 {
  font-size: 2rem;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
}

.lead {
  font-size: 1.12rem;
  color: var(--muted);
  max-width: 600px;
  margin: 0;
}

.quick-info {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  padding: 0;
  margin: 1.5rem 0 0;
  list-style: none;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.85rem;
}

.quick-info a {
  color: var(--muted);
}

.quick-info a:hover {
  color: var(--text);
}

/* Terminal */

.terminal {
  background: rgba(16, 18, 22, 0.92);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  min-width: 0;
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.terminal-bar .dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--border-strong);
}

.terminal-title {
  margin-left: 0.6rem;
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.terminal-body {
  margin: 0;
  padding: 1.1rem 1.15rem 1.25rem;
  min-height: 17.5rem;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.75;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.terminal-body .t-prompt {
  color: var(--accent);
}

.terminal-body .t-out {
  color: var(--muted);
}

.terminal-body .t-ok {
  color: var(--bid);
}

.terminal-body a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 3px;
}

.terminal-body a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

.t-cursor {
  display: inline-block;
  width: 0.6em;
  height: 1.15em;
  vertical-align: text-bottom;
  background: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}

/* ---------- Sections ---------- */

.section {
  padding: 4.5rem 0 1rem;
  scroll-margin-top: var(--header-h);
}

.section-index {
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent);
}

.section-intro {
  color: var(--muted);
  margin: -0.4rem 0 1.75rem;
}

.section-intro .hint-keys,
.section-intro .hint-touch {
  color: var(--faint);
}

.subheading {
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 2.75rem 0 1rem;
  color: var(--faint);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.grid {
  display: grid;
  gap: 1rem;
}

.skills-grid {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.project-grid {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}

.two-col {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.timeline {
  display: grid;
  gap: 1rem;
}

.muted {
  color: var(--muted);
  margin-top: 0;
}

p.mono {
  font-size: 0.82rem;
}

/* ---------- Project cards ---------- */

.project-card {
  position: relative;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.project-card:hover,
.project-card:focus-within {
  border-color: var(--accent-line);
  box-shadow: var(--shadow);
}

.project-card p {
  margin: 0 0 0.85rem;
  color: var(--muted);
}

.project-card h3 {
  font-size: 1.15rem;
}

/* The title link covers the whole card, so the card is one big click target */
.project-open {
  color: var(--text);
}

.project-open::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  z-index: 1;
}

.project-open:hover {
  text-decoration: none;
}

.project-open:focus-visible {
  outline: none;
}

.project-card:has(.project-open:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.project-media {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid var(--border);
  margin-bottom: 1.1rem;
  aspect-ratio: 16 / 9;
  background: var(--bg-soft);
}

.project-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  display: block;
  transition: transform 0.4s ease;
}

.project-image.fit-contain {
  object-fit: contain;
  object-position: center;
  padding: 4%;
}

.project-card:hover .project-image {
  transform: scale(1.03);
}

.project-cover {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 1rem;
  color: var(--accent);
  background:
    linear-gradient(var(--border) 1px, transparent 1px) 0 0 / 100% 22px,
    radial-gradient(circle at 75% 25%, var(--accent-soft), transparent 60%),
    var(--bg-soft);
}

.project-cover span {
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  background: rgba(11, 12, 14, 0.85);
  border: 1px solid var(--border-strong);
}

.project-label {
  font-family: var(--mono);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  margin: 0 0 0.4rem;
}

.card-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--faint);
}

.card-metrics strong {
  color: var(--text);
  font-weight: 700;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
  padding: 0;
  margin: 0.25rem 0 1rem;
}

.tags li {
  font-family: var(--mono);
  font-size: 0.74rem;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.card-links {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: auto;
}

.card-open-hint {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--faint);
  transition: color 0.2s ease;
}

.project-card:hover .card-open-hint {
  color: var(--accent);
}

/* Sits above the stretched title link */
.card-links .btn {
  position: relative;
  z-index: 2;
}

.skill-card .tags {
  margin-bottom: 0;
}

.featured-list {
  display: grid;
  gap: 1.25rem;
}

.project-card.featured {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 1.75rem;
  align-items: center;
  padding: 1.5rem;
}

.project-card.featured .project-media {
  margin-bottom: 0;
}

.project-card.featured h3 {
  font-size: 1.5rem;
  line-height: 1.25;
}

.project-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.project-card:not(.featured) .project-body {
  flex: 1;
}

/* ---------- Buttons ---------- */

.hero-actions,
.contact-links {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: var(--on-accent);
  padding: 0.8rem 1.15rem;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.98rem;
  line-height: 1.2;
  border: 1px solid transparent;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
  background: var(--accent-strong);
  text-decoration: none;
}

.btn-secondary {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--surface-2);
  border-color: var(--accent-line);
}

.btn-small {
  padding: 0.5rem 0.85rem;
  font-size: 0.88rem;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: var(--text);
  font-size: 1rem;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

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

.section#contact {
  padding-bottom: 3rem;
}

.contact-card {
  text-align: center;
  padding: 3rem 1.5rem;
  background:
    radial-gradient(circle at 50% 0%, var(--accent-soft), transparent 60%),
    var(--surface);
}

.contact-card h2 {
  justify-content: center;
}

.contact-card p {
  color: var(--muted);
  max-width: 520px;
  margin: 0 auto;
}

.contact-card .contact-links {
  justify-content: center;
}

.footer {
  padding: 1.5rem 0 2.5rem;
  color: var(--faint);
  border-top: 1px solid var(--border);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
}

.footer p {
  margin: 0;
  font-size: 0.85rem;
}

/* ---------- Project viewer (full-screen dialog) ---------- */

.viewer {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
}

.viewer[open] {
  display: flex;
  flex-direction: column;
}

.viewer::backdrop {
  background: var(--bg);
}

.viewer.fade-in {
  animation: viewer-in 0.28s ease;
}

@keyframes viewer-in {
  from {
    opacity: 0;
    transform: scale(0.985);
  }
}

.viewer-bar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem max(1rem, calc((100% - 1120px) / 2));
  border-bottom: 1px solid var(--border);
  background: rgba(11, 12, 14, 0.9);
}

.viewer-count {
  font-size: 0.85rem;
  color: var(--faint);
}

.viewer-count strong {
  color: var(--accent);
  font-weight: 500;
}

.viewer-controls {
  display: flex;
  gap: 0.5rem;
}

.viewer-scroll {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.viewer-content {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2.5rem 0 4rem;
}

.viewer-content.slide-next {
  animation: slide-next 0.32s ease;
}

.viewer-content.slide-prev {
  animation: slide-prev 0.32s ease;
}

@keyframes slide-next {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
}

@keyframes slide-prev {
  from {
    opacity: 0;
    transform: translateX(-40px);
  }
}

.viewer-hint {
  flex: none;
  margin: 0;
  padding: 0.55rem 1rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--faint);
  border-top: 1px solid var(--border);
}

.detail-head {
  margin-bottom: 1.75rem;
}

.detail-head h2 {
  display: block;
  outline: none;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.08;
  margin: 0.2rem 0 0.75rem;
}

.detail-head .lead {
  max-width: 760px;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 2.5rem;
  align-items: start;
}

.detail-main > * + * {
  margin-top: 2rem;
}

.detail-side {
  position: sticky;
  top: 1.5rem;
  display: grid;
  gap: 1rem;
}

/* Gallery */

.gallery-main {
  margin: 0;
}

.gallery-frame {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-soft);
}

.gallery-frame img {
  display: block;
  width: 100%;
  max-height: 62vh;
  object-fit: contain;
}

.gallery-frame.has-bg img {
  padding: 2%;
}

.gallery-main figcaption {
  margin-top: 0.6rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.gallery-thumbs {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.85rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.gallery-thumb {
  flex: none;
  width: 108px;
  aspect-ratio: 16 / 9;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-soft);
  opacity: 0.6;
  transition: opacity 0.2s ease, border-color 0.2s ease;
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-thumb:hover,
.gallery-thumb[aria-current="true"] {
  opacity: 1;
  border-color: var(--accent);
}

.detail-cover {
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 1.3rem;
}

/* Metrics strip */

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--border);
}

.detail-main > .metrics {
  margin-top: 2rem;
}

.detail-wide {
  margin-top: 2.5rem;
}

.metrics li {
  padding: 0.9rem 1rem;
  background: var(--surface);
}

.metric-value {
  display: block;
  font-family: var(--mono);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
}

.metric-label {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.35;
}

/* Write-up */

.detail-section h3 {
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 0.6rem;
}

.detail-section p,
.detail-section li {
  color: #c9c8c4;
  font-size: 1.02rem;
}

.detail-section p {
  margin: 0 0 0.9rem;
}

.detail-section strong {
  color: var(--text);
}

.detail-section ul {
  margin: 0;
  padding-left: 1.2rem;
}

/* Architecture diagram */

.arch {
  display: flex;
  align-items: stretch;
  gap: 0;
  overflow-x: auto;
  padding: 1.1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background:
    radial-gradient(var(--border) 1px, transparent 1px) 0 0 / 16px 16px,
    var(--bg-soft);
}

.arch-stage {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.5rem;
  flex: none;
}

.arch-arrow {
  flex: none;
  display: grid;
  place-items: center;
  width: 2rem;
  color: var(--faint);
  font-family: var(--mono);
}

.arch-arrow::before {
  content: "→";
}

.arch-node {
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.35;
  white-space: nowrap;
}

.arch-node small {
  display: block;
  color: var(--faint);
  font-size: 0.68rem;
}

.arch-node.kind-cpp {
  border-color: rgba(255, 178, 36, 0.5);
}

.arch-node.kind-py {
  border-color: rgba(62, 207, 142, 0.5);
}

.arch-legend {
  display: flex;
  gap: 1.25rem;
  margin-top: 0.6rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--faint);
}

.arch-legend span::before {
  content: "";
  display: inline-block;
  width: 0.7em;
  height: 0.7em;
  margin-right: 0.4em;
  border-radius: 2px;
  border: 1px solid;
  vertical-align: -0.05em;
}

.arch-legend .kind-cpp::before {
  border-color: var(--accent);
}

.arch-legend .kind-py::before {
  border-color: var(--bid);
}

/* Side panels */

.panel {
  padding: 1.1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.panel-title {
  margin: 0 0 0.85rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--faint);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.panel .tags {
  margin-bottom: 0;
}

.panel-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.repo-name {
  display: block;
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--text);
  margin-bottom: 0.25rem;
  word-break: break-all;
}

.repo-desc {
  margin: 0 0 0.9rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.lang-bar {
  display: flex;
  height: 8px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--surface-2);
}

.lang-bar span {
  display: block;
  height: 100%;
}

.lang-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.9rem;
  margin: 0.6rem 0 0.9rem;
  padding: 0;
  list-style: none;
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--muted);
}

.lang-list i {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 0.35em;
  border-radius: 50%;
}

.repo-stats {
  display: grid;
  gap: 0.35rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
}

.repo-stats strong {
  color: var(--text);
  font-weight: 500;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
}

.status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--faint);
}

.status.ok::before {
  background: var(--bid);
  box-shadow: 0 0 0 3px rgba(62, 207, 142, 0.18);
}

.status.fail::before {
  background: var(--ask);
}

.live-dot {
  font-size: 0.7rem;
  color: var(--bid);
  text-transform: none;
  letter-spacing: 0;
}

.skeleton {
  height: 0.8rem;
  margin-bottom: 0.55rem;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--surface-2), var(--border), var(--surface-2));
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

.detail-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.detail-nav button {
  padding: 1rem 1.1rem;
  text-align: left;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: border-color 0.2s ease;
}

.detail-nav button:last-child {
  text-align: right;
}

.detail-nav button:hover {
  border-color: var(--accent-line);
}

.detail-nav small {
  display: block;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--faint);
  margin-bottom: 0.2rem;
}

/* Card image grows into the project page */
::view-transition-group(project-media) {
  animation-duration: 0.4s;
  animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.3s;
}

/* ---------- Command palette ---------- */

.palette {
  width: min(600px, calc(100% - 2rem));
  max-height: min(520px, calc(100% - 6rem));
  margin: 12vh auto auto;
  padding: 0;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.palette[open] {
  animation: palette-in 0.16s ease;
}

@keyframes palette-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
}

.palette::backdrop {
  background: rgba(5, 6, 8, 0.6);
  backdrop-filter: blur(3px);
}

.palette-box {
  display: flex;
  flex-direction: column;
  max-height: inherit;
}

.palette-input-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 1rem;
  border-bottom: 1px solid var(--border);
}

.palette-prompt {
  color: var(--accent);
}

.palette-input {
  flex: 1;
  min-width: 0;
  padding: 1rem 0;
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: none;
}

.palette-input::placeholder {
  color: var(--faint);
}

.palette-list {
  flex: 1;
  overflow-y: auto;
  margin: 0;
  padding: 0.4rem;
  list-style: none;
}

.palette-group {
  padding: 0.6rem 0.65rem 0.3rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--faint);
}

.palette-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 0.65rem;
  border-radius: 8px;
  cursor: pointer;
}

.palette-item small {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--faint);
  white-space: nowrap;
}

.palette-item[aria-selected="true"] {
  background: var(--accent-soft);
  box-shadow: inset 2px 0 0 var(--accent);
}

.palette-empty {
  padding: 1.25rem 0.65rem;
  color: var(--faint);
}

.palette-foot {
  margin: 0;
  padding: 0.55rem 1rem;
  font-size: 0.72rem;
  color: var(--faint);
  border-top: 1px solid var(--border);
}

/* ---------- Scroll reveal (only when JS is running) ---------- */

.js .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.js .reveal.visible {
  opacity: 1;
  transform: none;
}

.js .project-card.reveal.visible:hover {
  transform: translateY(-3px);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .js .reveal {
    opacity: 1;
    transform: none;
  }

  .project-card:hover,
  .js .project-card.reveal.visible:hover,
  .project-card:hover .project-image {
    transform: none;
  }
}

/* ---------- Responsive ---------- */

@media (max-width: 960px) {
  .hero-inner {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .detail-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .detail-side {
    position: static;
  }
}

@media (max-width: 820px) {
  .project-card.featured {
    grid-template-columns: 1fr;
    gap: 1.1rem;
  }
}

@media (max-width: 760px) {
  .nav-toggle {
    display: flex;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
    padding: 0.75rem 1rem 1rem;
    background: rgba(11, 12, 14, 0.98);
    border-bottom: 1px solid var(--border);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a:not(.btn) {
    padding: 0.6rem 0.25rem;
  }

  .palette-trigger {
    justify-content: space-between;
    padding: 0.6rem 0.75rem;
  }

  .nav-links .btn {
    margin-top: 0.5rem;
  }

  .hero {
    padding: 4rem 0 3rem;
  }

  .terminal-body {
    font-size: 0.74rem;
    min-height: 15rem;
  }

  h2 {
    font-size: 1.6rem;
  }

  .section {
    padding: 3rem 0 0.5rem;
  }

  .project-grid {
    grid-template-columns: 1fr;
  }

  .viewer-content {
    padding-top: 1.5rem;
  }

  .count-title {
    display: none;
  }

  /* Diagram stacks vertically on phones */
  .arch {
    flex-direction: column;
    align-items: flex-start;
  }

  .arch-stage {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .arch-arrow {
    width: auto;
    height: 1.6rem;
    padding-left: 1rem;
  }

  .arch-arrow::before {
    content: "↓";
  }

  .arch-node {
    white-space: normal;
  }

  .detail-nav {
    grid-template-columns: 1fr;
  }

  .detail-nav button:last-child {
    text-align: left;
  }
}
