/* ============================================================
   FORGE — Theme Stylesheet
   Colour: deep navy-black × signal red × off-white
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Ubuntu+Mono:wght@400;700&family=JetBrains+Mono:wght@300;400;500&family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,600;1,9..144,300&display=swap');

/* ── Tokens ─────────────────────────────────────────────────── */
:root {
  /* Core palette */
  --black:        #07080d;
  --navy-deep:    #0b0e1a;
  --navy:         #0f1422;
  --navy-mid:     #141929;
  --navy-light:   #1c2338;
  --navy-border:  #232b42;
  --navy-muted:   #2d3655;

  --red:          #a81824;
  --red-deep:     #7d121b;
  --red-glow:     rgba(168, 24, 36, 0.15);
  --red-subtle:   rgba(168, 24, 36, 0.06);

  --white:        #f0f2f7;
  --grey-light:   #c8ccd8;
  --grey:         #8891aa;
  --grey-dark:    #3e4860;

  /* Typography */
  --font-display: 'Ubuntu Mono', 'JetBrains Mono', monospace;
  --font-body:    'Fraunces', Georgia, serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', monospace;

  /* Sizing */
  --max-w:        1180px;
  --max-w-narrow: 760px;
  --nav-h:        68px;
  --scale:        1;

  /* Easing */
  --ease-out:     cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out:  cubic-bezier(0.45, 0, 0.55, 1);
}

/* ── Reset ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: calc(16px * var(--scale));
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 1rem);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  background-color: var(--navy-deep);
  color: var(--white);
  font-family: var(--font-body);
  font-weight: 300;
  line-height: 1.72;
  min-height: 100vh;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar              { width: 6px; }
::-webkit-scrollbar-track        { background: var(--navy-deep); }
::-webkit-scrollbar-thumb        { background: var(--navy-muted); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover  { background: var(--red); }

/* ── Grain overlay ───────────────────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  background-size: 180px;
  opacity: 0.028;
  pointer-events: none;
  z-index: 1000;
}

/* ── Typography scale ────────────────────────────────────────── */
h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

h1 { font-size: clamp(2.6rem, 6vw, 5rem);   font-weight: 800; }
h2 { font-size: clamp(1.8rem, 4vw, 3rem);   font-weight: 700; }
h3 { font-size: clamp(1.3rem, 2.5vw, 1.9rem); font-weight: 600; }
h4 { font-size: 1.15rem; font-weight: 600; }

p { font-size: 1.05rem; color: var(--grey-light); }
small { font-size: 0.82rem; font-family: var(--font-mono); color: var(--grey); }

code, pre {
  font-family: var(--font-mono);
  font-size: 0.88rem;
}

code {
  background: var(--navy-light);
  border: 1px solid var(--navy-border);
  padding: 0.15em 0.45em;
  border-radius: 4px;
  color: var(--red);
}

pre {
  background: var(--navy-light);
  border: 1px solid var(--navy-border);
  border-left: 3px solid var(--red);
  padding: 1.4rem 1.6rem;
  overflow-x: auto;
  border-radius: 0 8px 8px 0;
  margin: 2rem 0;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--grey-light);
}

/* ── Layout utilities ────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 2rem;
}

.container--narrow {
  max-width: var(--max-w-narrow);
  margin: 0 auto;
  padding: 0 2rem;
}

.section { padding: 6rem 0; }
.section--sm { padding: 3.5rem 0; }

/* ── Nav ─────────────────────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  z-index: 900;
  display: flex;
  align-items: center;
  background: rgba(11, 14, 26, 0.7);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px solid var(--navy-border);
  transition: border-color 0.3s;
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 2rem;
}

.nav__logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.04em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav__logo span { color: var(--red); }

.nav__logo-mark {
  width: 28px; height: 28px;
  background: var(--red);
  clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
  display: inline-block;
}

.nav__links {
  display: flex;
  gap: 2.4rem;
  align-items: center;
}

.nav__link {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--grey);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: color 0.2s;
  position: relative;
}

.nav__link::after {
  content: '';
  position: absolute;
  bottom: -4px; left: -6px;
  width: 0; height: 2px;
  background: var(--red);
  transition: width 0.3s var(--ease-out);
}

.nav__link:hover, .nav__link--active {
  color: var(--white);
}

.nav__link:hover::after, .nav__link--active::after {
  width: 100%;
}

/* ── Mobile nav toggle ─────────────────────────────────────────── */
.nav__toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 1000;
}

.nav__toggle-bar {
  width: 22px;
  height: 2px;
  background: var(--white);
  transition: all 0.3s var(--ease-out);
}

.nav__toggle[aria-expanded="true"] .nav__toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav__toggle[aria-expanded="true"] .nav__toggle-bar:nth-child(2) {
  opacity: 0;
}
.nav__toggle[aria-expanded="true"] .nav__toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ── Hero ────────────────────────────────────────────────────── */
.hero {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  padding-top: var(--nav-h);
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: '';
  position: absolute;
  right: -120px; top: 50%;
  transform: translateY(-50%);
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(232,25,44,0.12) 0%, transparent 70%);
  pointer-events: none;
}

.hero__bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--navy-border) 1px, transparent 1px),
    linear-gradient(90deg, var(--navy-border) 1px, transparent 1px);
  background-size: 60px 60px;
  opacity: 0.25;
  mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 30%, transparent 100%);
}

.hero__content { padding: 0 2rem 0 max(2rem, calc((100vw - var(--max-w)) / 2 + 2rem)); }

.hero__eyebrow {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 1.4rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.hero__eyebrow::before {
  content: '';
  display: inline-block;
  width: 32px; height: 1px;
  background: var(--red);
}

.hero__title {
  margin-bottom: 1.4rem;
}

.hero__title em {
  font-style: normal;
  color: transparent;
  -webkit-text-stroke: 1.5px var(--red);
}

.hero__subtitle {
  font-size: 1.15rem;
  color: var(--grey);
  max-width: 440px;
  margin-bottom: 2.6rem;
  line-height: 1.7;
}

.hero__cta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.hero__visual {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-right: max(2rem, calc((100vw - var(--max-w)) / 2 + 2rem));
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.6rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.25s var(--ease-out);
  border: 1px solid transparent;
}

.btn--primary {
  background: var(--red);
  color: var(--white);
  border-color: var(--red);
}

.btn--primary:hover {
  background: var(--red-deep);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px var(--red-glow);
}

.btn--ghost {
  background: transparent;
  color: var(--grey-light);
  border-color: var(--navy-border);
}

.btn--ghost:hover {
  border-color: var(--grey-dark);
  color: var(--white);
  transform: translateY(-2px);
}

/* ── Section heading ─────────────────────────────────────────── */
.section-head {
  margin-bottom: 3.5rem;
}

.section-head__label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.section-head__label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--red), transparent);
  max-width: 80px;
}

/* ── Project cards ───────────────────────────────────────────── */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.5px;
  border: 1.5px solid var(--navy-border);
  border-radius: 8px;
  overflow: hidden;
}

.project-card {
  background: var(--navy);
  padding: 2.2rem;
  transition: background 0.3s;
  position: relative;
  overflow: hidden;
}

.project-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 2px;
  background: var(--red);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s var(--ease-out);
}

.project-card:hover { background: var(--navy-mid); }
.project-card:hover::before { transform: scaleX(1); }

.project-card__lang {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.project-card__lang::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 8px var(--red-glow);
}

.project-card__title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.8rem;
  color: var(--white);
  transition: color 0.2s;
}

.project-card:hover .project-card__title { color: var(--red); }

.project-card__desc {
  font-size: 0.95rem;
  color: var(--grey);
  line-height: 1.65;
  margin-bottom: 1.6rem;
}

.project-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.6rem;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0.25em 0.7em;
  border-radius: 3px;
  background: var(--navy-light);
  border: 1px solid var(--navy-border);
  color: var(--grey);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.project-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.project-card__link {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--grey);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: color 0.2s, gap 0.2s;
}

.project-card__link:hover { color: var(--red); gap: 0.7rem; }

/* ── Single project page ─────────────────────────────────────── */
.project-hero {
  padding-top: calc(var(--nav-h) + 4rem);
  padding-bottom: 4rem;
  border-bottom: 1px solid var(--navy-border);
  position: relative;
}

.project-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--red-subtle) 0%, transparent 60%);
  pointer-events: none;
}

.project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  margin-top: 2rem;
}

.project-meta__item {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.project-meta__label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--grey-dark);
}

.project-meta__value {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--grey-light);
}

.project-body {
  padding: 4rem 0;
}

.project-body__content {
  /* Prose styles */
}

.project-body__content h2 {
  font-size: 1.7rem;
  margin: 2.8rem 0 1rem;
  color: var(--white);
}

.project-body__content h3 {
  font-size: 1.25rem;
  margin: 2rem 0 0.8rem;
  color: var(--grey-light);
}

.project-body__content p {
  margin-bottom: 1.4rem;
}

.project-body__content ul, .project-body__content ol {
  margin: 1.2rem 0 1.4rem 1.5rem;
  list-style: disc;
}

.project-body__content ol { list-style: decimal; }

.project-body__content li {
  color: var(--grey-light);
  margin-bottom: 0.4rem;
}

.project-body__content a {
  color: var(--red);
  border-bottom: 1px solid var(--red-glow);
  transition: border-color 0.2s;
}

.project-body__content a:hover { border-color: var(--red); }

/* Source panel */
.source-panel {
  background: var(--navy);
  border: 1px solid var(--navy-border);
  border-radius: 8px;
  overflow: hidden;
  margin-top: 2rem;
}

.source-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.4rem;
  background: var(--navy-mid);
  border-bottom: 1px solid var(--navy-border);
}

.source-panel__title {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--grey);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.source-panel__title svg { color: var(--red); }

.source-panel__body {
  padding: 1.4rem;
}

.source-panel__loading {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--grey-dark);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1rem;
}

.gitea-tree { width: 100%; }

.gitea-file {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.5rem 0.6rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--grey);
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
}

.gitea-file:hover { background: var(--navy-light); color: var(--white); }
.gitea-file--dir { color: var(--grey-light); }
.gitea-file--dir::before { content: '📁'; font-size: 0.75rem; }
.gitea-file--file::before { content: '📄'; font-size: 0.75rem; }
.gitea-file--rust::before { content: '🦀'; font-size: 0.75rem; }

/* ── WASM demo container ──────────────────────────────────────── */
.wasm-demo {
  background: var(--black);
  border: 1px solid var(--navy-border);
  border-top: 2px solid var(--red);
  border-radius: 0 0 8px 8px;
  padding: 2rem;
  margin: 2.5rem 0;
}

.wasm-demo__label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ── Skills / tech section ───────────────────────────────────── */
.tech-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1px;
  border: 1px solid var(--navy-border);
  border-radius: 6px;
  overflow: hidden;
}

.tech-item {
  background: var(--navy);
  padding: 1.4rem 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: background 0.2s;
}

.tech-item:hover { background: var(--navy-mid); }

.tech-item__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  color: var(--white);
}

.tech-item__type {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--grey-dark);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ── Footer ──────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--navy-border);
  padding: 3rem 0;
  margin-top: 6rem;
}

.footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.footer__copy {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--grey-dark);
}

.footer__copy span { color: var(--red); }

.footer__links {
  display: flex;
  gap: 1.8rem;
}

.footer__link {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--grey-dark);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: color 0.2s;
}

.footer__link:hover { color: var(--red); }

/* ── Terminal / typewriter block ─────────────────────────────── */
.terminal {
  background: var(--black);
  border: 1px solid var(--navy-border);
  border-radius: 8px;
  overflow: hidden;
  width: 100%;
  max-width: 520px;
}

.terminal__bar {
  background: var(--navy-mid);
  border-bottom: 1px solid var(--navy-border);
  padding: 0.65rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.terminal__dot {
  width: 10px; height: 10px;
  border-radius: 50%;
}

.terminal__dot--red   { background: var(--red); }
.terminal__dot--amber { background: #f0a500; }
.terminal__dot--green { background: #2ecc71; }

.terminal__body {
  padding: 1.4rem 1.6rem;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  line-height: 1.8;
  color: var(--grey-light);
}

.terminal__prompt { color: var(--red); }
.terminal__cmd    { color: var(--white); }
.terminal__out    { color: var(--grey); }
.terminal__cursor {
  display: inline-block;
  width: 8px; height: 1.1em;
  background: var(--red);
  vertical-align: text-bottom;
  animation: blink 1.1s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ── Posts ───────────────────────────────────────────────────── */
.post-list { display: flex; flex-direction: column; gap: 0; }

.post-item {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 2rem;
  padding: 2rem 0;
  border-bottom: 1px solid var(--navy-border);
  align-items: start;
  transition: background 0.2s;
}

.post-item:last-child { border-bottom: none; }

.post-item__date {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--grey-dark);
  padding-top: 0.3rem;
}

.post-item__title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 0.4rem;
  transition: color 0.2s;
}

.post-item:hover .post-item__title { color: var(--red); }

.post-item__excerpt {
  font-size: 0.9rem;
  color: var(--grey);
}

/* ── Breadcrumb ──────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--grey-dark);
  margin-bottom: 2rem;
}

.breadcrumb a { color: var(--grey); transition: color 0.2s; }
.breadcrumb a:hover { color: var(--red); }
.breadcrumb span { color: var(--grey-dark); }

/* ── About page ──────────────────────────────────────────────── */
.about-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 5rem;
  align-items: start;
}

.avatar-card {
  position: sticky;
  top: calc(var(--nav-h) + 2rem);
  background: var(--navy);
  border: 1px solid var(--navy-border);
  border-radius: 8px;
  overflow: hidden;
}

.avatar-card__img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  filter: grayscale(40%) contrast(1.1);
}

.avatar-card__info {
  padding: 1.4rem;
}

.avatar-card__name {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}

.avatar-card__role {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--red);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 1.2rem;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    padding: calc(var(--nav-h) + 3rem) 0 3rem;
  }
  .hero__visual { display: none; }
  .hero__content {
    padding: 0 1.5rem;
    text-align: center;
  }
  .hero__eyebrow { justify-content: center; }
  .hero__cta { justify-content: center; }
  .hero__subtitle { margin: 0 auto 2.6rem; }

  .about-layout { grid-template-columns: 1fr; }
  .avatar-card { position: static; max-width: 280px; }

  .post-item { grid-template-columns: 1fr; gap: 0.4rem; }
  .post-item__date { padding-top: 0; }
}

@media (max-width: 768px) {
  .nav__toggle { display: flex; }

  .nav__links {
    position: fixed;
    top: 0; right: 0;
    width: min(280px, 80vw);
    height: 100vh;
    background: var(--navy-deep);
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: calc(var(--nav-h) + 2rem) 2rem;
    transform: translateX(100%);
    transition: transform 0.35s var(--ease-out);
    border-left: 1px solid var(--navy-border);
  }

  .nav__links.is-open {
    transform: translateX(0);
  }

  .nav__links li { width: 100%; }

  .nav__link {
    display: block;
    padding: 1rem 0;
    border-bottom: 1px solid var(--navy-border);
    font-size: 1.1rem;
  }

  .nav__link::after { display: none; }

  .container { padding: 0 1.25rem; }
  .container--narrow { padding: 0 1.25rem; }
  .section { padding: 4rem 0; }
}

@media (max-width: 640px) {
  :root {
    --nav-h: 56px;
  }
  h1 { font-size: clamp(2rem, 5vw, 3rem); }
  h2 { font-size: clamp(1.5rem, 3.5vw, 2rem); }
  .projects-grid { grid-template-columns: 1fr; gap: 0; }

  .terminal { max-width: 100%; }
  .terminal__body { font-size: 0.78rem; }

  .footer__inner { flex-direction: column; text-align: center; gap: 1rem; }
}

/* ── Large screens (1400px+) ───────────────────────────────────── */
@media (min-width: 1400px) {
  :root {
    --max-w: 1400px;
    --max-w-narrow: 900px;
    --nav-h: 80px;
    --scale: 1.15;
  }

  html { font-size: 18px; }

  h1 { font-size: clamp(3rem, 5vw, 5.5rem); }
  h2 { font-size: clamp(2rem, 3vw, 3.2rem); }

  .section { padding: 8rem 0; }
  .section--sm { padding: 5rem 0; }

  .project-card { padding: 2.8rem; }
  .project-card__title { font-size: 1.5rem; }

  .nav__logo { font-size: 1.5rem; }
  .nav__links { gap: 3rem; }
  .nav__link { font-size: 0.9rem; }
}

/* ── 4K monitors (2000px+) ─────────────────────────────────── */
@media (min-width: 2000px) {
  :root {
    --max-w: 1600px;
    --max-w-narrow: 1000px;
    --nav-h: 90px;
    --scale: 1.25;
  }

  html { font-size: 20px; }

  h1 { font-size: clamp(3.5rem, 4vw, 6rem); }
  h2 { font-size: clamp(2.2rem, 2.5vw, 3.5rem); }
  p { font-size: 1.15rem; }

  .section { padding: 10rem 0; }

  .nav__logo { font-size: 1.7rem; }
  .nav__link { font-size: 1rem; }

  .project-card { padding: 3.2rem; }
  .project-card__title { font-size: 1.7rem; }
  .project-card__desc { font-size: 1.05rem; }
}

/* ── Animated entrance ───────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-up {
  animation: fadeUp 0.7s var(--ease-out) both;
}

.fade-up--d1 { animation-delay: 0.1s; }
.fade-up--d2 { animation-delay: 0.2s; }
.fade-up--d3 { animation-delay: 0.35s; }
.fade-up--d4 { animation-delay: 0.5s; }

/* ── Horizontal rule ─────────────────────────────────────────── */
hr {
  border: none;
  border-top: 1px solid var(--navy-border);
  margin: 3rem 0;
}

/* ── HiDPI / Retina support ─────────────────────────────── */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  ::-webkit-scrollbar { width: 8px; }

  .hero__bg-grid {
    background-size: 30px 30px;
  }
}

/* ── Theming override file ─────────────────────────────── */
/* Define custom theme in static/css/theme.css to override CSS variables */
