/* Section and component styles — written mobile first, widened with min-width queries */

/* ---------- Shared pieces ---------- */

.text-accent {
  color: var(--color-accent);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
}

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

.section {
  padding-block: var(--space-7);
  border-top: 1px solid var(--color-border);
}

.section-title {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  font-size: var(--text-2xl);
  margin-bottom: var(--space-3);
}

.section-title__index {
  font-size: var(--text-sm);
  color: var(--color-accent);
  /* Small raised index breaks the flat line of the heading */
  transform: translateY(-0.9em);
}

.section-lead {
  max-width: 60ch;
  color: var(--color-text-muted);
  margin-bottom: var(--space-5);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 48px;
  padding: var(--space-2) var(--space-4);
  font-weight: 600;
  text-decoration: none;
  border: 2px solid var(--color-accent);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition:
    transform var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out),
    background-color var(--duration-fast) var(--ease-out);
}

.button--primary {
  background: var(--color-accent);
  color: var(--color-on-accent);
  box-shadow: 4px 4px 0 var(--color-accent-soft);
}

.button--primary:hover {
  color: var(--color-on-accent);
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--color-accent-soft);
}

.button--ghost {
  background: transparent;
  color: var(--color-accent);
}

.button--ghost:hover {
  background: var(--color-accent-soft);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: 0;
  list-style: none;
}

.tag {
  padding: var(--space-1) var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: 999px;
}

.tag-list--small .tag {
  padding: 2px var(--space-2);
  font-size: 0.75rem;
}

.chip {
  padding: var(--space-1) var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  white-space: nowrap; /* a chip that breaks onto two lines grows into the terminal prompt */
  background: var(--color-surface);
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-sm);
}

@media (max-width: 379px) {
  .chip {
    padding-inline: var(--space-2);
    font-size: 0.75rem;
  }
}

/* Scroll reveal — .reveal-ready is added by js/reveal.js, never when motion is reduced */
.reveal-ready :is(.section-title, .section-lead, .about__photo, .about__text, .project-grid > li, .service-card, .services__cta, .contact__intro, .contact-form) {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 0.4s var(--ease-out) var(--reveal-delay, 0ms),
    transform 0.4s var(--ease-out) var(--reveal-delay, 0ms);
}

/* Same selector list plus .is-visible, so this always outranks the hidden state above */
.reveal-ready :is(.section-title, .section-lead, .about__photo, .about__text, .project-grid > li, .service-card, .services__cta, .contact__intro, .contact-form).is-visible {
  opacity: 1;
  transform: none;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--color-bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-border);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-height);
}

.brand {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--color-text);
  text-decoration: none;
}

.brand:hover {
  color: var(--color-text);
}

.brand__prompt {
  color: var(--color-accent);
}

.brand__cursor {
  color: var(--color-accent);
  animation: blink 1.1s steps(1) infinite;
}

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

.site-nav__list {
  display: flex;
  gap: var(--space-2);
  padding: 0;
  list-style: none;
}

.site-nav__list a {
  display: block;
  padding: var(--space-2) var(--space-1);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  text-decoration: none;
}

/* Phones (under 480px): brand and the two toggles share the top row, the menu gets its own row below */
@media (max-width: 479px) {
  :root {
    --header-height: 96px; /* keeps anchor jumps clear of the taller two-row header */
  }

  .site-header__inner {
    flex-wrap: wrap;
    padding-top: var(--space-2);
  }

  .site-nav {
    order: 3;
    width: 100%;
  }

  .site-nav__list {
    justify-content: space-between;
  }

  /* Auto margin pushes the theme + language pair to the right edge of the top row.
     Extra class in the selector: the base .theme-toggle rule comes later in this file and would win otherwise. */
  .site-header__inner .theme-toggle {
    margin-left: auto;
  }
}

.site-nav__list a:hover {
  color: var(--color-text);
}

/* The section you're reading (js/navigation.js): accent text with a short bar underneath */
.site-nav__list a[aria-current="true"] {
  position: relative;
  color: var(--color-accent);
}

.site-nav__list a[aria-current="true"]::after {
  content: "";
  position: absolute;
  left: var(--space-1);
  right: var(--space-1);
  bottom: 2px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
}

/* ---------- Back to top (js/navigation.js) ---------- */

.back-to-top {
  position: fixed;
  z-index: 40;
  right: var(--space-3);
  bottom: var(--space-3);
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: var(--color-accent);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: 3px 3px 0 var(--color-accent-soft);
  cursor: pointer;
  animation: back-to-top-in var(--duration-base) var(--ease-out);
  transition:
    border-color var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out);
}

.back-to-top[hidden] {
  display: none;
}

.back-to-top:hover {
  border-color: var(--color-accent);
  transform: translate(-1px, -1px);
}

.back-to-top svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

@media (min-width: 960px) {
  .back-to-top {
    right: var(--space-5);
    bottom: var(--space-5);
  }
}

.site-nav {
  margin-left: auto;
}

/* Language button reuses the theme button's square shape */
.lang-toggle {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-left: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-accent);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: 3px 3px 0 var(--color-accent-soft);
  cursor: pointer;
  transition:
    border-color var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out);
}

.lang-toggle[hidden] {
  display: none;
}

.lang-toggle:hover {
  border-color: var(--color-accent);
  transform: translate(-1px, -1px);
}

.theme-toggle {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-left: var(--space-2);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  /* Offset accent corner keeps the button from reading as a plain square */
  box-shadow: 3px 3px 0 var(--color-accent-soft);
  cursor: pointer;
  transition:
    border-color var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out);
}

.theme-toggle:hover {
  border-color: var(--color-accent);
  transform: translate(-1px, -1px);
}

.theme-toggle__icon {
  grid-area: 1 / 1;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--color-accent);
  stroke-width: 2;
  stroke-linecap: round;
  transition:
    opacity var(--duration-base) var(--ease-out),
    transform var(--duration-base) var(--ease-out);
}

/* Dark theme shows the sun (what you switch to), light theme shows the moon */
.theme-toggle__icon--moon,
[data-theme="light"] .theme-toggle__icon--sun {
  opacity: 0;
  transform: rotate(-90deg) scale(0.6);
}

[data-theme="light"] .theme-toggle__icon--moon {
  opacity: 1;
  transform: none;
}

.theme-toggle__icon--moon {
  fill: var(--color-accent);
  stroke: none;
}

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

.hero {
  padding-block: var(--space-6) var(--space-7);
  overflow-x: clip; /* the 3D model box may reach past the screen edge */
}

.hero__inner {
  display: grid;
  gap: var(--space-6);
}

.hero__title {
  font-size: var(--text-3xl);
  margin-bottom: var(--space-4);
}

.hero__lead {
  max-width: 52ch;
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  margin-bottom: var(--space-5);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

/* Terminal: a window stacked on an offset back panel, with chips hanging off the edge
   and the 3D barbell peeking out from behind its top-right corner.
   Layers: model (0) < dashed back panel (1) < window (2) < chips (3) */
.terminal {
  position: relative;
  margin-top: var(--space-8); /* room for the model above the window */
  margin-right: var(--space-3);
  margin-bottom: var(--space-4);
}

/* Wider than the terminal on phones so the barbell isn't tiny; .hero clips what spills past the screen edge */
.hero-model {
  position: absolute;
  z-index: 0;
  top: -132px;
  right: -20%;
  width: 128%;
  aspect-ratio: 640 / 288;
  pointer-events: none;
}

.hero-model.is-ready {
  pointer-events: auto;
}

.hero-model__fallback,
.hero-model__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero-model__fallback {
  object-fit: contain;
  transition: opacity var(--duration-base) var(--ease-out);
}

.hero-model__canvas {
  opacity: 0;
  cursor: grab;
  touch-action: pan-y; /* vertical swipes still scroll the page */
  transition: opacity 0.6s var(--ease-out);
}

.hero-model__canvas:active {
  cursor: grabbing;
}

.hero-model.is-ready .hero-model__canvas {
  opacity: 1;
}

.hero-model.is-ready .hero-model__fallback {
  opacity: 0;
}

/* Small "drag me" tab on the model's top edge, only once the live model is there */
/* Positioned over the model's top-right shoulder (the model fills roughly the middle 55% of the box) */
.hero-model__hint {
  position: absolute;
  top: 8%;
  right: 22%;
  padding: 2px var(--space-2);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-accent);
  background: var(--color-bg);
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-sm);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-base) var(--ease-out);
}

.hero-model.is-ready .hero-model__hint {
  opacity: 1;
}

.terminal__back {
  position: absolute;
  z-index: 1;
  inset: 0;
  transform: translate(var(--space-3), var(--space-3));
  border: 1px dashed var(--color-accent);
  border-radius: var(--radius-md);
  pointer-events: none;
}

.terminal__window {
  position: relative;
  z-index: 2;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.terminal__bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface-raised);
  border-bottom: 1px solid var(--color-border);
}

.terminal__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-border);
}

.terminal__dot:first-child {
  background: var(--color-danger);
}

.terminal__dot:nth-child(3) {
  background: var(--color-accent);
}

.terminal__title {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.terminal__body {
  padding: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-x: auto;
}

.terminal__prompt {
  color: var(--color-accent);
}

.terminal__body {
  cursor: default;
}

.terminal__cursor {
  display: inline-block;
  width: 0.6em;
  height: 1em;
  vertical-align: middle;
  background: var(--color-accent);
  animation: blink 1.1s steps(1) infinite;
}

/* ---------- Interactive prompt (js/terminal.js) ---------- */

/* Once commands can be typed, the output scrolls inside the window instead of stretching the page */
.terminal__window.is-interactive .terminal__body {
  max-height: 340px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}

.terminal__body a {
  color: var(--color-accent);
}

.terminal__muted {
  color: var(--color-text-muted);
}

.terminal__error {
  color: var(--color-danger);
}

.terminal__form {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  /* Extra room at the bottom: the highlight chips hang over the window's lower edge */
  padding: var(--space-2) var(--space-3) var(--space-5);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  border-top: 1px dashed var(--color-border);
}

.terminal__input {
  flex: 1;
  min-width: 0;
  min-height: 32px;
  padding: 0;
  font-family: var(--font-mono);
  /* 16px on phones stops iOS from zooming in when the field is focused */
  font-size: max(16px, var(--text-sm));
  color: var(--color-text);
  caret-color: var(--color-accent);
  background: transparent;
  border: 0;
}

.terminal__input::placeholder {
  color: var(--color-text-muted);
  opacity: 0.7;
}

.terminal__input:focus {
  outline: none;
}

/* The focus ring goes on the whole prompt row instead of the bare input */
.terminal__form:focus-within {
  box-shadow: inset 0 0 0 2px var(--color-accent-soft);
}

/* `matrix`: falling characters drawn over the window, fading out at the end */
.terminal__matrix {
  position: absolute;
  inset: 0;
  z-index: 5;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-md);
  pointer-events: none;
  transition: opacity 0.6s var(--ease-out);
}

.terminal__matrix.is-fading {
  opacity: 0;
}

.terminal__chips {
  position: absolute;
  z-index: 3;
  right: calc(-1 * var(--space-2));
  bottom: calc(-1 * var(--space-4));
  display: flex;
  gap: var(--space-2);
  padding: 0;
  list-style: none;
}

.chip--offset {
  transform: translateY(var(--space-2));
}

/* ---------- About ---------- */

.about__inner {
  display: grid;
  gap: var(--space-6);
}

.about__photo {
  position: relative;
  width: min(100%, 280px);
  justify-self: center;
}

.about__photo-frame {
  position: absolute;
  inset: 0;
  transform: translate(var(--space-3), var(--space-3));
  border: 2px solid var(--color-accent);
  border-radius: var(--radius-lg);
}

.about__photo img {
  position: relative;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

.about__text p {
  max-width: 62ch;
  margin-bottom: var(--space-3);
}

.about__subtitle {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  margin-block: var(--space-4) var(--space-3);
}

/* ---------- Projects ---------- */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.filter-bar[hidden] {
  display: none;
}

.filter-button {
  min-height: 40px;
  padding: var(--space-1) var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  cursor: pointer;
  transition:
    border-color var(--duration-fast) var(--ease-out),
    background-color var(--duration-fast) var(--ease-out);
}

.filter-button:hover {
  border-color: var(--color-accent);
}

.filter-button[aria-pressed="true"] {
  background: var(--color-accent);
  color: var(--color-on-accent);
  border-color: var(--color-accent);
}

.filter-button[aria-pressed="true"]::before {
  content: "> ";
}

.project-grid > li.is-filtered-in {
  animation: filter-in var(--duration-base) var(--ease-out);
}

@keyframes filter-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
}

.project-grid {
  display: grid;
  gap: var(--space-5);
  padding: 0;
  list-style: none;
}

.project-card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-offset);
  transition:
    transform var(--duration-base) var(--ease-out),
    box-shadow var(--duration-base) var(--ease-out),
    border-color var(--duration-base) var(--ease-out);
}

.project-card:hover {
  transform: translate(-3px, -3px);
  border-color: var(--color-accent);
  box-shadow: 10px 10px 0 var(--color-accent-soft);
}

/* Number tab sticks out above the card's top edge */
.project-card__number {
  position: absolute;
  top: calc(-1 * var(--space-3));
  left: var(--space-3);
  z-index: 2;
  padding: 2px var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 700;
  background: var(--color-accent);
  color: var(--color-on-accent);
  border-radius: var(--radius-sm);
}

.project-card__media {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-raised);
}

.project-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--duration-base) var(--ease-out);
}

.project-card:hover .project-card__media img {
  transform: scale(1.04);
}

/* Gameplay clip sits on top of the cover image and fades in once it actually plays */
.project-card__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity var(--duration-base) var(--ease-out);
}

.project-card__video.is-playing {
  opacity: 1;
}

/* "Video" hint tab, shown only where hover previews are enabled */
.project-card__media.has-preview::after {
  content: "▶ video";
  position: absolute;
  right: var(--space-2);
  bottom: var(--space-2);
  padding: 2px var(--space-2);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-accent);
  background: var(--color-bg);
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-sm);
  transition: opacity var(--duration-fast) var(--ease-out);
}

.project-card:hover .project-card__media.has-preview::after,
.project-card:focus-within .project-card__media.has-preview::after {
  opacity: 0;
}

.project-card__media--code {
  display: flex;
  align-items: center;
  padding: var(--space-3) var(--space-4);
  background:
    linear-gradient(90deg, var(--color-accent-soft) 3px, transparent 3px) left / 100% 100% no-repeat,
    var(--color-surface-raised);
}

.code-cover {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--color-text-muted);
  overflow: hidden;
}

.code-cover__kw {
  color: var(--color-accent);
}

.badge {
  position: absolute;
  right: var(--space-2);
  bottom: var(--space-2);
  padding: 2px var(--space-2);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
}

.badge--status {
  background: var(--color-bg);
  color: var(--color-accent);
  border: 1px solid var(--color-accent);
}

.project-card__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: var(--space-3);
  padding: var(--space-4);
}

.project-card__kind {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-accent);
}

.project-card__title {
  font-size: var(--text-xl);
  margin-top: calc(-1 * var(--space-2));
}

.project-card__body > p:not(.project-card__kind) {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.project-card__links {
  display: flex;
  gap: var(--space-4);
  /* Pushes links to the bottom so cards in a row line up */
  margin-top: auto;
  padding-top: var(--space-2);
}

.project-card__links a {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 700;
}

.project-card__links a::after {
  content: " ↗";
}

/* ---------- Services ---------- */

.service-grid {
  display: grid;
  gap: var(--space-4);
  padding: 0;
  list-style: none;
}

.service-card {
  position: relative;
  padding: var(--space-5) var(--space-4) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-accent);
  border-radius: var(--radius-md);
}

.service-card__icon {
  position: absolute;
  top: calc(-1 * var(--space-3));
  right: var(--space-4);
  padding: var(--space-1) var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-accent);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

.service-card__title {
  font-size: var(--text-lg);
  margin-bottom: var(--space-2);
}

.service-card p {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.services__cta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-3);
  margin-top: var(--space-5);
  padding: var(--space-4);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
}

/* ---------- GitHub ---------- */

/* Without JavaScript only the profile link is shown */
html:not(.js) .repo-list,
html:not(.js) .github__languages {
  display: none;
}

.github__languages {
  min-height: 56px; /* reserved so the bar arriving later doesn't push the cards down */
  margin-bottom: var(--space-5);
}

.lang-bar {
  display: flex;
  gap: 3px;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--color-surface-raised);
}

.lang-bar__segment {
  flex-basis: 0;
  min-width: 8px;
  background: var(--dot-color);
}

.lang-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
  margin-top: var(--space-2);
  padding: 0;
  list-style: none;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

.lang-legend li {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.lang-legend__percent {
  color: var(--color-text-muted);
}

.lang-dot {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--dot-color);
  box-shadow: 0 0 0 2px var(--color-surface);
}

.repo-list {
  display: grid;
  gap: var(--space-4);
  padding: 0;
  list-style: none;
}

.repo {
  position: relative;
  display: grid;
  align-content: start;
  gap: var(--space-2);
  min-height: 148px;
  padding: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-accent);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-offset);
  transition:
    transform var(--duration-base) var(--ease-out),
    border-color var(--duration-base) var(--ease-out);
}

.repo:hover {
  transform: translate(-2px, -2px);
  border-color: var(--color-accent);
}

/* Shimmering placeholder while the API is answering */
.repo--skeleton {
  background: linear-gradient(
      100deg,
      transparent 20%,
      color-mix(in srgb, var(--color-text) 6%, transparent) 50%,
      transparent 80%
    )
    var(--color-surface);
  background-size: 200% 100%;
  border-left-color: var(--color-border);
  animation: shimmer 1.4s linear infinite;
}

@keyframes shimmer {
  from {
    background-position: 150% 0;
  }
  to {
    background-position: -50% 0;
  }
}

.repo__name {
  font-size: var(--text-lg);
  word-break: break-word;
}

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

.repo__name a:hover {
  color: var(--color-accent);
}

/* Whole card is clickable through the title link */
.repo__name a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius-md);
}

.repo__desc {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.repo__desc--empty {
  font-style: italic;
}

.repo__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-3);
  margin-top: auto;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.repo__lang {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text);
}

.github__status:empty {
  display: none;
}

.github__status[data-state="error"] {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
}

.github.has-error .github__languages {
  display: none;
}

.github__profile {
  display: inline-block;
  margin-top: var(--space-5);
  font-family: var(--font-mono);
  font-weight: 700;
}

.github__profile::after {
  content: " ↗";
}

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

.contact__inner {
  display: grid;
  gap: var(--space-5);
}

.contact__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  padding: 0;
  list-style: none;
}

.contact__links a {
  font-family: var(--font-mono);
  font-weight: 700;
}

.contact-form {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-offset);
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.form-field label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  min-height: 48px;
  padding: var(--space-2) var(--space-3);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  transition: border-color var(--duration-fast) var(--ease-out);
}

.form-field textarea {
  resize: vertical;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: var(--color-accent);
  outline: none;
}

/* ---------- 404 page ---------- */

.not-found__inner {
  display: grid;
  justify-items: start;
  gap: var(--space-4);
  min-height: 100vh;
  align-content: center;
  padding-block: var(--space-7);
}

/* Huge outlined "404" sitting behind the terminal's top edge */
.not-found__code {
  /* Overlap scales with the text, so the digits stay readable on small phones too */
  margin-bottom: -0.32em;
  font-family: var(--font-mono);
  font-size: clamp(5rem, 3rem + 12vw, 11rem);
  font-weight: 700;
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 2px var(--color-accent);
  opacity: 0.6;
}

.not-found__terminal {
  width: min(100%, 560px);
  margin-top: 0;
}

.not-found__title {
  font-size: var(--text-2xl);
}

.not-found__lead {
  color: var(--color-text-muted);
}

.not-found__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

/* ---------- Footer ---------- */

.site-footer {
  padding-block: var(--space-5);
  border-top: 1px solid var(--color-border);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-3);
}

.site-footer__links {
  display: flex;
  gap: var(--space-3);
  padding: 0;
  list-style: none;
}

/* ---------- Tablet and up ---------- */

@media (min-width: 640px) {
  .project-grid {
    grid-template-columns: repeat(2, 1fr);
    row-gap: var(--space-6);
  }

  .repo-list {
    grid-template-columns: repeat(2, 1fr);
  }

  .service-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .services__cta {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .contact-form {
    grid-template-columns: 1fr 1fr;
  }

  .form-field--full {
    grid-column: 1 / -1;
  }
}

/* ---------- Desktop ---------- */

@media (min-width: 960px) {
  .site-nav__list {
    gap: var(--space-4);
  }

  .theme-toggle {
    margin-left: var(--space-4);
  }

  .hero {
    padding-block: var(--space-8);
  }

  .hero__inner {
    grid-template-columns: 1.15fr 1fr;
    align-items: center;
  }

  /* Desktop: a bigger, draggable model that spills over the terminal's top-right corner */
  .terminal {
    margin-top: var(--space-8);
  }

  .hero-model {
    top: -190px;
    right: -150px;
    width: 680px;
  }

  .about__inner {
    grid-template-columns: 300px 1fr;
    align-items: start;
  }

  .about__photo {
    justify-self: start;
  }

  .project-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  /* The flagship project spans two columns so the grid is not a flat row of equal boxes */
  .project-grid > li:first-child {
    grid-column: span 2;
  }

  .contact__inner {
    grid-template-columns: 1fr 1.4fr;
    align-items: start;
  }
}
