:root {
  --bg: #0c0f14;
  --bg-elev: #111723;
  --card: #141b2a;
  --text: #e6edf6;
  --muted: #9aa7b6;
  --accent: #4f9cff;
  --border: #1f2a3a;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

html[data-theme="light"] {
  --bg: #f5f7fb;
  --bg-elev: #ffffff;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #5b6779;
  --accent: #2b6ff6;
  --border: #e2e8f0;
  --shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  width: min(1100px, 92%);
  margin: 0 auto;
}

.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(12, 15, 20, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

html[data-theme="light"] .navbar {
  background: rgba(245, 247, 251, 0.9);
}

.nav-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  gap: 16px;
}

.logo {
  font-weight: 600;
  letter-spacing: 0.3px;
}

.nav-links {
  display: flex;
  gap: 20px;
  font-size: 0.95rem;
  color: var(--muted);
}

.nav-links a {
  padding: 6px 2px;
  transition: color 0.2s ease;
}

.nav-links a:hover,
.nav-links a:focus {
  color: var(--accent);
}

.theme-toggle {
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.theme-toggle:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: transparent;
  border: none;
  cursor: pointer;
}

.menu-toggle span {
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}

.mobile-menu {
  display: none;
  flex-direction: column;
  gap: 14px;
  padding: 12px 0 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev);
}

.mobile-menu a {
  color: var(--muted);
  padding: 4px 0;
}

.hero {
  padding: 110px 0 80px;
}

.hero-content {
  display: grid;
  gap: 18px;
}

.hero-media {
  width: 120px;
  height: 120px;
}

.avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 1px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.eyebrow {
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  font-size: 0.8rem;
}

.hero h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 700;
}

.hero-intro {
  color: var(--muted);
  max-width: 680px;
}

.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-weight: 500;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.btn.primary {
  background: var(--accent);
  color: #ffffff;
}

.btn.primary:hover {
  transform: translateY(-2px);
  background: #3b87ef;
}

.btn.ghost {
  border-color: var(--border);
  color: var(--text);
}

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

.section {
  padding: 70px 0;
}

.section-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 28px;
}

.section-header h2 {
  margin: 0;
}

.section-header p {
  color: var(--muted);
  margin: 0;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  padding: 22px;
  border-radius: 14px;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.card:hover {
  transform: translateY(-4px);
  border-color: rgba(79, 156, 255, 0.5);
}

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

.card-divider {
  height: 1px;
  width: 100%;
  margin: 12px 0 14px;
  background: linear-gradient(90deg, rgba(79, 156, 255, 0.5), rgba(79, 156, 255, 0));
  border-radius: 999px;
}

.grid {
  display: grid;
  gap: 20px;
}

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

.muted {
  color: var(--muted);
  margin: 6px 0 12px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;
}

.tag i {
  width: 18px;
  height: 18px;
  color: var(--accent);
  stroke-width: 2;
}

.ai-tag i {
  color: var(--accent);
}

.stack {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.project-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 500;
  transition: gap 0.2s ease;
}

.project-link:hover {
  gap: 10px;
}

.project-link i {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}

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

.contact-link {
  color: var(--accent);
  transition: opacity 0.2s ease;
}

.contact-link:hover {
  opacity: 0.8;
  text-decoration: underline;
}

.footer {
  padding: 32px 0 50px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  text-align: center;
}

@media (max-width: 900px) {
  .nav-links {
    display: none;
  }

  .menu-toggle {
    display: flex;
  }

  .hero {
    padding-top: 90px;
  }
}

@media (max-width: 600px) {
  .hero-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .card {
    padding: 18px;
  }
}
/* ============================================================
   Project index — a technical catalogue, not a card grid.
   ============================================================ */

.mobile-menu.open { display: flex; }

.section-projects { padding-bottom: 40px; }

.project-index {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border);
}

.load-error {
  color: var(--muted);
  padding: 28px 0;
  font-size: 0.9rem;
}
.load-error a { color: var(--accent); text-decoration: underline; }

.entry {
  display: grid;
  grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
  gap: 40px;
  padding: 44px 0;
  border-bottom: 1px solid var(--border);
  align-items: start;
}

.entry-media { display: block; }

/* --- media well: one consistent rectangle, varying content inside --- */

.well {
  position: relative;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elev);
  overflow: hidden;
  display: grid;
  place-items: center;
  transition: border-color 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.entry:hover .well,
.entry:focus-within .well { border-color: rgba(79, 156, 255, 0.55); }

.well-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.well[data-aspect="phone"] .well-img {
  height: 100%;
  width: auto;
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
}

/* Honest empty state — reads as "not captured yet", never as broken. */
.well.is-empty {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  background-image: repeating-linear-gradient(
    -45deg,
    transparent 0 9px,
    var(--border) 9px 10px
  );
}

.well-empty-label,
.well-empty-meta {
  position: relative;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  background: var(--bg-elev);
  padding: 3px 10px;
  border-radius: 6px;
}
.well-empty-label { color: var(--text); }
.well-empty-meta { color: var(--muted); font-size: 0.7rem; }

/* --- entry body --- */

.entry-body { display: flex; flex-direction: column; align-items: flex-start; }

.entry-id {
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 10px;
}

.entry-role {
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 9px;
  font-size: 0.68rem;
}

.entry-title {
  font-size: clamp(1.5rem, 2.6vw, 2.1rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-top: 14px;
  text-wrap: balance;
}
.entry-title a { transition: color 0.2s ease; }
.entry-title a:hover, .entry-title a:focus-visible { color: var(--accent); }

.entry-line {
  margin-top: 10px;
  font-size: 1.02rem;
  max-width: 62ch;
}

.entry-note {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.92rem;
  max-width: 68ch;
}

/* Spec line: real measurements, which is what mono is actually for. */
.spec {
  margin-top: 20px;
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.01em;
}
.spec span { color: var(--accent); opacity: 0.55; padding: 0 4px; }

.stack-row { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 16px; }

.chip {
  font-size: 0.72rem;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 9px;
}

.entry-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 22px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.8rem;
  padding: 7px 13px;
  border-radius: 8px;
  border: 1px solid var(--border);
  color: var(--text);
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}
.badge i { width: 15px; height: 15px; stroke-width: 2; }

.badge-live { color: #55d18b; border-color: rgba(85, 209, 139, 0.4); }
.badge-live:hover { background: rgba(85, 209, 139, 0.1); }

.badge-source:hover { border-color: var(--accent); color: var(--accent); }

.badge-closed { color: var(--muted); border-style: dashed; cursor: default; }

.badge-read {
  color: var(--accent);
  border-color: rgba(79, 156, 255, 0.4);
  margin-left: auto;
}
.badge-read:hover { background: rgba(79, 156, 255, 0.1); gap: 11px; }

/* --- the one authored moment: the entry wakes as you reach it --- */

@media (prefers-reduced-motion: no-preference) {
  .entry-body {
    opacity: 0.78;
    transform: translateY(6px);
    transition:
      opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
      transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .entry.awake .entry-body { opacity: 1; transform: none; }
  .entry .well {
    clip-path: inset(0 0 0 0 round 12px);
    transform: translateY(10px) scale(0.985);
    filter: saturate(0.5);
    transition:
      transform 0.8s cubic-bezier(0.16, 1, 0.3, 1),
      filter 0.8s cubic-bezier(0.16, 1, 0.3, 1),
      border-color 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .entry.awake .well { transform: none; filter: none; }
}

/* ============================================================
   Case study page
   ============================================================ */

.study-main { padding: 56px 0 40px; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.85rem;
  transition: color 0.2s ease, gap 0.2s ease;
}
.back-link:hover { color: var(--accent); gap: 12px; }
.back-link i { width: 15px; height: 15px; }

.study { margin-top: 34px; }

.study-title {
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.05;
  margin-top: 14px;
  text-wrap: balance;
}

.study-line {
  margin-top: 14px;
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 60ch;
}

.study-cols {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 56px;
  margin-top: 52px;
  padding-top: 40px;
  border-top: 1px solid var(--border);
}

.study-rail { position: sticky; top: 96px; align-self: start; }
.study-rail .entry-links { margin-top: 20px; }
.study-rail .badge-read { margin-left: 0; }

.rail-meta { margin-top: 24px; font-size: 0.82rem; }
.rail-meta dt {
  color: var(--accent);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 20px;
}
.rail-meta dt:first-child { margin-top: 0; }
.rail-meta dd { color: var(--muted); margin-top: 7px; line-height: 1.85; }

/* --- prose: this page is for reading --- */

.prose { max-width: 72ch; }

.prose h2 {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-top: 56px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.prose > h2:first-child { margin-top: 0; }

.prose p { margin-top: 20px; line-height: 1.78; }
.prose p + p { margin-top: 18px; }

.prose ul, .prose ol { margin-top: 20px; padding-left: 1.15rem; }
.prose li { margin-top: 11px; line-height: 1.72; }
.prose li::marker { color: var(--accent); font-size: 0.8em; }

.prose strong { color: var(--text); font-weight: 600; }

.prose code {
  font-size: 0.86em;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
  color: var(--accent);
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 1000px) {
  .study-cols { grid-template-columns: 1fr; gap: 40px; }
  .study-rail { position: static; max-width: 420px; }
}

@media (max-width: 760px) {
  .entry { grid-template-columns: 1fr; gap: 24px; padding: 34px 0; }
  .entry-media { max-width: 420px; }
  .badge-read { margin-left: 0; }
  .study-main { padding-top: 40px; }
  .prose h2 { margin-top: 42px; }
}

/* desktop screenshots fill a 16:10 well; caption sits under it */
.well[data-aspect="desktop"] { aspect-ratio: 16 / 10; }
.well[data-aspect="desktop"] .well-img { width: 100%; height: 100%; object-fit: cover; object-position: left top; }
.well-cap { margin: 6px 2px 0; font-size: 0.72rem; color: var(--muted); }

.terminal-line { margin-top: 1.1rem; font-size: 0.85rem; }
.terminal-line code, .contact-grid code { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 6px; padding: 2px 8px; }
