:root {
  --bg: #0b1020;
  --surface: #131a2e;
  --surface-2: #1b2440;
  --border: #26304d;
  --text: #e6ebf5;
  --muted: #9aa6c2;
  --blue: #3b82f6;
  --blue-light: #60a5fa;
  --cyan: #22d3ee;
  --amber: #fbbf24;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);

  --font-head: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;

  --header-h: 72px;
  color-scheme: dark;
}

/* ==========================================================================
   Base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(59, 130, 246, 0.18), transparent 60%),
    radial-gradient(700px 400px at -10% 30%, rgba(34, 211, 238, 0.08), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

h1, h2, h3 {
  font-family: var(--font-head);
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0 0 0.5em;
}

h1 { font-size: clamp(2rem, 4vw, 2.75rem); }
h2 { font-size: clamp(1.5rem, 3vw, 1.875rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1.1em; }

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

a:hover { color: var(--cyan); }

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
  border-radius: 6px;
}

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

.container--narrow { max-width: 808px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn:hover { transform: none; }
}

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 16, 32, 0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--header-h);
}

.brand {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-name {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.25rem;
  background: linear-gradient(90deg, var(--blue-light), var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-tag {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

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

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  display: block;
  padding: 8px 14px;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.2s, background-color 0.2s;
}

.site-nav a:hover {
  color: var(--text);
  background: var(--surface-2);
}

.site-nav a[aria-current="page"] {
  color: #fff;
  background: var(--blue);
}

.nav-hamburger {
  display: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.nav-hamburger-line {
  display: block;
  width: 20px;
  height: 2px;
  margin: 4px auto;
  background: currentColor;
  border-radius: 2px;
}

/* Hamburger only when JS is running; otherwise the links just wrap. */
@media (max-width: 720px) {
  .js .nav-hamburger { display: block; }

  .js .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    padding: 12px 16px 16px;
    background: rgba(11, 16, 32, 0.97);
    border-bottom: 1px solid var(--border);
  }

  .js .site-nav.is-open { display: block; }

  .js .site-nav ul { flex-direction: column; }

  .js .site-nav a {
    border-radius: var(--radius-sm);
    padding: 12px 14px;
  }

  .header-inner { flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }

  .js .header-inner { flex-wrap: nowrap; }
}

/* ==========================================================================
   Shared Components
   ========================================================================== */
main { padding: 56px 0 96px; }

#projects-heading {
  margin-bottom: 40px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border: 1px solid transparent;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.2;
  transition: transform 0.2s, box-shadow 0.2s, background-color 0.2s, color 0.2s;
}

.btn-primary {
  background: var(--blue);
  color: #fff;
}

.btn-primary:hover {
  color: #fff;
  background: #2f74e6;
  transform: translateY(-2px);
}

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

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--blue);
  transform: translateY(-2px);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
}

.chip {
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
}

/* Currently Unused */
.chip--accent {
  border-color: rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.1);
  color: var(--amber);
}

.media-frame {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--surface);
}

/* ==========================================================================
   Home Page
   ========================================================================== */
.project-list {
  display: grid;
  gap: 72px;
}

.project-row {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  align-items: center;
  gap: 48px;
}

.project-row .media-frame {
  display: block;
  aspect-ratio: 16 / 9;
}

.project-row:nth-child(even) { grid-template-columns: 1fr 1.15fr; }
.project-row:nth-child(even) .project-media { order: 2; }

.project-body h2 {
  font-size: clamp(1.6rem, 3vw, 2rem);
  margin-bottom: 12px;
}

.project-body p { color: var(--muted); }

@media (max-width: 800px) {
  .project-list { gap: 56px; }

  .project-row, .project-row:nth-child(even) {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .project-row:nth-child(even) .project-media { order: 0; }
}

/* ==========================================================================
   About
   ========================================================================== */
.about-intro {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 48px;
  align-items: start;
  padding: 40px;
}

.about-photo {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 50%;
  border: 4px solid var(--blue);
}

.about-intro h1 { margin-bottom: 16px; }

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 24px;
}

.about-grid .card { padding: 28px 32px; }

.about-grid h2 {
  font-size: 1.25rem;
  margin-bottom: 16px;
}

.about-grid .chips { margin: 0; }

.about-grid .chip {
  font-size: 0.95rem;
  padding: 6px 14px;
  color: var(--text);
}

@media (max-width: 800px) {
  .about-intro {
    grid-template-columns: 1fr;
    gap: 28px;
    padding: 28px 24px;
  }

  .about-photo { max-width: 220px; margin: 0 auto; }
  .about-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Project Pages
   ========================================================================== */
.project-hero { margin: 0 auto 40px; }
.project-hero h1 { text-align: center; margin-bottom: 24px; }

.project-hero-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  align-items: center;
  gap: 32px;
}

.project-hero-row .details { margin-bottom: 0; }

.project-hero-row .details dl {
  grid-template-columns: 1fr 1fr;
  gap: 16px 24px;
}

@media (max-width: 800px) {
  .project-hero-row {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

.details {
  padding: 28px 32px;
  margin-bottom: 48px;
}

.details dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px 28px;
  margin: 0 0 24px;
}

.details dt {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--amber);
}

.details dd {
  margin: 4px 0 0;
  color: var(--text);
}

.prose h2 {
  margin-top: 56px;
  padding-left: 16px;
  border-left: 4px solid var(--blue);
}

.prose p { color: #cdd5e6; }
.prose figure { margin: 40px 0; }

.figure-row {
  display: flex;
  gap: 24px;
  margin: 40px 0;
}

.figure-row figure {
  flex: 1 1 0;
  min-width: 0;
  margin: 0;
}

.figure-row .figure--square { flex-grow: 1; }
.figure-row .figure--wide { flex-grow: 1.58; }
.figure-row .figure--code { flex-grow: 1.45; }
.figure-row .figure--test { flex-grow: 1.54; }

.figure-row .media-frame {
  width: fit-content;
  margin: 0 auto;
}

.prose figcaption {
  position: relative;
  margin-top: 14px;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

.prose figcaption::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--amber);
}

@media (max-width: 600px) {
  main { padding: 36px 0 72px; }
  .container { padding: 0 16px; }
  .details { padding: 24px 20px; }
  .figure-row { flex-direction: column; }
}
