/*
Theme Name: Aidan Somani
Theme URI: https://aidansomani.com
Author: Aidan Somani
Description: Custom dark portfolio theme for Aidan Somani — Mechanical Engineering. H3X-inspired aesthetic with custom Projects post type.
Version: 1.4
License: All rights reserved
Text Domain: aidan-somani
*/

/* =========================================================
   AIDAN SOMANI — site stylesheet
   Dark theme, H3X-inspired. One file, shared across pages.
   ========================================================= */

/* ---------- Fonts ---------- */
/* Body / UI: JetBrains Mono — technical, monospaced feel like H3X's "Alliance"
   Display: Space Grotesk — modern geometric sans for headers
   (Free, Google Fonts hosted) */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;600;700&family=Space+Grotesk:wght@300;400;500;600;700&display=swap');

/* ---------- Tokens ---------- */
:root {
  --bg:          #0a0a0a;
  --bg-elev:     #111111;
  --bg-card:     #131313;
  --line:        #1f1f1f;
  --line-strong: #2a2a2a;

  --text:        #e2e2e2;
  --text-dim:    #7c7c7c;
  --text-faint:  #4a4a4a;

  --accent:      #ff6e42;   /* signature H3X orange */
  --accent-soft: #ff6e4222;

  --max-w:       1280px;
  --pad-x:       clamp(20px, 4vw, 48px);

  --font-mono:   "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-display:"Space Grotesk", "JetBrains Mono", system-ui, sans-serif;

  --t:           220ms cubic-bezier(.4,0,.2,1);
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  /* subtle grain so the dark surface doesn't feel flat */
  background-image:
    radial-gradient(1200px 600px at 80% -10%, #1a1a1a 0%, transparent 60%),
    radial-gradient(900px 500px at -10% 110%, #181818 0%, transparent 60%);
  background-attachment: fixed;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--t);
}
a:hover { color: var(--accent); }

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

::selection { background: var(--accent); color: #0a0a0a; }

/* ---------- Layout helpers ---------- */
.wrap {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding-left: var(--pad-x);
  padding-right: var(--pad-x);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before {
  content: "";
  width: 10px;
  height: 1px;
  background: var(--accent);
  display: inline-block;
}

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(10, 10, 10, 0.72);
  border-bottom: 1px solid var(--line);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
}
.brand .dot {
  display: inline-block;
  width: 8px; height: 8px;
  background: var(--accent);
  margin-right: 10px;
  vertical-align: middle;
  transform: translateY(-1px);
}
.nav-links {
  display: flex;
  gap: 28px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links a {
  position: relative;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 6px 2px;
  transition: color var(--t);
}
.nav-links a:hover,
.nav-links a.active { color: var(--text); }
.nav-links a.active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 1px;
  background: var(--accent);
}

/* shuffle target span has fixed width while animating */
.shuffle { display: inline-block; }

/* ---------- Hero (home) ---------- */
.hero {
  position: relative;
  padding: clamp(60px, 10vw, 120px) 0 clamp(60px, 8vw, 96px);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: clamp(32px, 6vw, 80px);
  align-items: center;
}
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; }
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(40px, 6.4vw, 84px);
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin: 18px 0 22px;
  color: var(--text);
}
.hero h1 em {
  font-style: normal;
  color: var(--accent);
}
.hero p.lead {
  max-width: 56ch;
  font-size: 15px;
  color: var(--text-dim);
  line-height: 1.7;
  margin: 0 0 32px;
}
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 24px 36px;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.hero-meta span strong {
  display: block;
  color: var(--text);
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
  font-size: 14px;
  margin-top: 4px;
}

/* portrait */
.portrait {
  position: relative;
  aspect-ratio: 4 / 5;
  border: 1px solid var(--line-strong);
  background: var(--bg-card);
  overflow: hidden;
}
.portrait img {
  width: 100%; height: 100%;
  object-fit: cover;
  filter: grayscale(15%) contrast(1.05);
}
.portrait .corner {
  position: absolute;
  width: 14px; height: 14px;
  border: 1px solid var(--accent);
}
.portrait .corner.tl { top: 10px; left: 10px; border-right: 0; border-bottom: 0; }
.portrait .corner.tr { top: 10px; right: 10px; border-left: 0; border-bottom: 0; }
.portrait .corner.bl { bottom: 10px; left: 10px; border-right: 0; border-top: 0; }
.portrait .corner.br { bottom: 10px; right: 10px; border-left: 0; border-top: 0; }
.portrait .tag {
  position: absolute;
  bottom: 14px; left: 14px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
  background: rgba(10,10,10,0.7);
  padding: 6px 10px;
  border: 1px solid var(--line-strong);
}

/* placeholder portrait when no photo yet */
.portrait.placeholder {
  display: flex; align-items: center; justify-content: center;
  background:
    repeating-linear-gradient(45deg, #131313 0 12px, #161616 12px 24px);
}
.portrait.placeholder span {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
  transition: background var(--t), border-color var(--t), color var(--t);
}
.btn .arrow { transition: transform var(--t); }
.btn:hover .arrow { transform: translateX(4px); }

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #0a0a0a;
}
.btn.primary:hover {
  background: #ff7d56;
  border-color: #ff7d56;
  color: #0a0a0a;
}
.btn.ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

/* ---------- Section heading ---------- */
.section {
  padding: clamp(64px, 9vw, 120px) 0;
  border-bottom: 1px solid var(--line);
}
.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 48px;
  flex-wrap: wrap;
}
.section-head h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 12px 0 0;
  color: var(--text);
}
.section-head h2 em {
  font-style: italic;
  color: var(--text-dim);
  font-weight: 300;
}
.section-head .meta {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* sub-section labels (Mechanical / Software within FSAE) */
.subsection-label {
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 56px 0 24px;
}
.subsection-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line-strong);
}
.subsection-label:first-child { margin-top: 0; }

/* ---------- Project cards (portfolio) ---------- */
.project-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  border-top: 1px solid var(--line);
}
.project-card {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 40px;
  padding: 32px 0;
  border-bottom: 1px solid var(--line);
  align-items: center;
  transition: background var(--t);
}
.project-card:hover { background: rgba(255, 110, 66, 0.02); }
@media (max-width: 760px) {
  .project-card { grid-template-columns: 1fr; gap: 20px; }
}

.project-card .info { padding-right: 8px; }
.project-card h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(22px, 2.4vw, 30px);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 6px 0 12px;
  color: var(--text);
}
.project-card .index {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.1em;
}
.project-card p {
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.65;
  margin: 0 0 16px;
  max-width: 62ch;
}
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  border: 1px solid var(--line-strong);
  padding: 5px 9px;
}

.project-card .thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--bg-card);
  border: 1px solid var(--line-strong);
  overflow: hidden;
}
.project-card .thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 600ms cubic-bezier(.2,0,.2,1);
}
.project-card:hover .thumb img { transform: scale(1.04); }

.project-card .thumb.placeholder {
  display: flex; align-items: center; justify-content: center;
  background:
    linear-gradient(135deg, #121212 0%, #161616 100%);
}
.project-card .thumb.placeholder::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.6;
}
.project-card .thumb.placeholder span {
  position: relative;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-faint);
  background: var(--bg);
  padding: 6px 10px;
  border: 1px solid var(--line);
}

/* ---------- Highlights / Skills (home page bottom) ---------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}
@media (max-width: 900px) { .skills-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .skills-grid { grid-template-columns: 1fr; } }
.skill-cell {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 28px 24px;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: background var(--t);
}
.skill-cell:hover { background: rgba(255,110,66,0.03); }
.skill-cell .num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.18em;
}
.skill-cell h4 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 18px;
  margin: 16px 0 8px;
  letter-spacing: -0.005em;
  color: var(--text);
}
.skill-cell p {
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-dim);
  margin: 0;
}

/* ---------- Highlights row (home, above skills) ---------- */
.highlights {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}
@media (max-width: 760px) { .highlights { grid-template-columns: 1fr; } }
.hl-cell {
  position: relative;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 0;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--bg-card);
  display: block;
}
.hl-cell .ph {
  position: absolute; inset: 0;
  background:
    repeating-linear-gradient(135deg, #121212 0 14px, #151515 14px 28px);
  display: flex; align-items: center; justify-content: center;
}
.hl-cell .ph span {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-faint);
  background: var(--bg);
  padding: 6px 10px;
  border: 1px solid var(--line);
}
.hl-cell img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 600ms cubic-bezier(.2,0,.2,1);
}
.hl-cell:hover img { transform: scale(1.05); }
.hl-cell .label {
  position: absolute;
  left: 16px; bottom: 16px; right: 16px;
  display: flex; align-items: end; justify-content: space-between;
  gap: 12px;
  z-index: 2;
}
.hl-cell .label::before {
  content: "";
  position: absolute; left: -16px; right: -16px; bottom: -16px; top: -40px;
  background: linear-gradient(to top, rgba(10,10,10,0.85), transparent);
  z-index: -1;
  pointer-events: none;
}
.hl-cell .label h5 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 16px;
  letter-spacing: -0.005em;
  margin: 0;
  color: var(--text);
}
.hl-cell .label .arrow {
  color: var(--accent);
  font-size: 14px;
  transition: transform var(--t);
}
.hl-cell:hover .label .arrow { transform: translate(2px, -2px); }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--bg);
  border-top: 1px solid var(--line);
  padding: 56px 0 32px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 32px;
  align-items: end;
}
@media (max-width: 640px) { .footer-grid { grid-template-columns: 1fr; } }

.footer-brand {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0 0 8px;
}
.footer-brand em {
  font-style: italic;
  font-weight: 300;
  color: var(--text-dim);
}
.footer-tagline {
  color: var(--text-dim);
  font-size: 13px;
  margin: 0;
  max-width: 48ch;
}

.footer-contact {
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 13px;
}
.footer-contact a {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  transition: border-color var(--t), color var(--t);
}
.footer-contact a:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.footer-contact .lbl {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim);
  min-width: 78px;
}

.footer-bottom {
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  flex-wrap: wrap;
  gap: 12px;
}

/* ---------- Page header (portfolio) ---------- */
.page-head {
  padding: clamp(60px, 9vw, 100px) 0 clamp(48px, 6vw, 64px);
  border-bottom: 1px solid var(--line);
}
.page-head h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(40px, 6vw, 76px);
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin: 14px 0 18px;
  color: var(--text);
}
.page-head h1 em {
  font-style: italic;
  font-weight: 300;
  color: var(--text-dim);
}
.page-head p {
  color: var(--text-dim);
  max-width: 64ch;
  margin: 0;
  font-size: 15px;
}

/* role tag (e.g. "Suspension & Vehicle Dynamics Lead") */
.role-tag {
  display: inline-block;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: 17px;
  color: var(--text-dim);
  margin-bottom: 18px;
}

/* ---------- Reveal animation on scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 700ms ease, transform 700ms cubic-bezier(.2,0,.2,1);
}
.reveal.in {
  opacity: 1;
  transform: none;
}

/* =========================================================
   Single project page styles
   ========================================================= */
.project-hero {
  padding: clamp(48px, 7vw, 80px) 0 clamp(32px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
}
.project-hero .back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 32px;
  transition: color var(--t);
}
.project-hero .back-link:hover { color: var(--accent); }
.project-hero .meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 24px;
  margin-bottom: 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.project-hero .meta-row .accent { color: var(--accent); }
.project-hero h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(36px, 5.5vw, 68px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 12px 0 24px;
  max-width: 22ch;
}
.project-hero .lede {
  color: var(--text-dim);
  max-width: 64ch;
  font-size: 15px;
  line-height: 1.7;
  margin: 0 0 28px;
}
.hero-image {
  margin: clamp(24px, 4vw, 48px) 0;
  aspect-ratio: 16 / 9;
  background: var(--bg-card);
  border: 1px solid var(--line-strong);
  overflow: hidden;
  position: relative;
}
.hero-image img { width: 100%; height: 100%; object-fit: cover; }

/* Per-project hero fit modes
   crop (default)      = fixed 16:9 box, image zooms & crops to fill
   contain             = box up to 16:9 max, image fits inside untouched
   contain-tall        = box can be much taller, image fits inside untouched
*/
.hero-image.hero-fit-contain,
.hero-image.hero-fit-contain-tall {
  aspect-ratio: auto;       /* let height come from the image */
  background: var(--bg);    /* matte color around the image */
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-image.hero-fit-contain img,
.hero-image.hero-fit-contain-tall img {
  width: auto;
  height: auto;
  max-width: 100%;
  object-fit: contain;
}
.hero-image.hero-fit-contain img       { max-height: 60vh; }
.hero-image.hero-fit-contain-tall img  { max-height: 80vh; }

@media (max-width: 760px) {
  .hero-image.hero-fit-contain img       { max-height: 50vh; }
  .hero-image.hero-fit-contain-tall img  { max-height: 65vh; }
}

.hero-image.placeholder {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #121212 0%, #161616 100%);
}
.hero-image.placeholder::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.6;
}
.hero-image.placeholder span {
  position: relative;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-faint);
  background: var(--bg);
  padding: 8px 14px;
  border: 1px solid var(--line);
}

.project-body {
  padding: clamp(32px, 5vw, 64px) 0 clamp(48px, 7vw, 80px);
  font-size: 16px;
  line-height: 1.75;
  color: var(--text);
  min-width: 0; /* prevent grid overflow */
}
.project-body p { margin: 0 0 1.4em; color: #c8c8c8; }
.project-body h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 26px;
  letter-spacing: -0.01em;
  margin: 2em 0 0.6em;
  color: var(--text);
}
.project-body h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 20px;
  margin: 1.6em 0 0.5em;
  color: var(--text);
}
.project-body ul, .project-body ol {
  margin: 0 0 1.4em;
  padding-left: 22px;
  color: #c8c8c8;
}
.project-body li { margin-bottom: 0.4em; }
.project-body li::marker { color: var(--accent); }
.project-body a {
  color: var(--accent);
  border-bottom: 1px solid var(--accent-soft);
}
.project-body a:hover { border-color: var(--accent); }
.project-body strong { color: var(--text); font-weight: 600; }
.project-body code, .project-body pre {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  padding: 2px 6px;
}
.project-body pre {
  padding: 16px;
  overflow-x: auto;
  margin: 1.4em 0;
  line-height: 1.55;
}
.project-body img {
  margin: 1.6em auto;
  border: 1px solid var(--line-strong);
  max-width: 100%;
  height: auto;
}
.project-body figure { margin: 2em 0; }
.project-body figcaption {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-align: center;
  margin-top: 10px;
}
.project-body blockquote {
  margin: 2em 0;
  padding: 0 0 0 20px;
  border-left: 2px solid var(--accent);
  color: var(--text-dim);
  font-style: italic;
}

/* gallery */
.project-gallery {
  padding: clamp(40px, 6vw, 64px) 0 clamp(56px, 8vw, 88px);
  border-top: 1px solid var(--line);
}
.project-gallery .gal-head {
  display: flex; justify-content: space-between; align-items: end;
  margin-bottom: 32px;
  flex-wrap: wrap; gap: 16px;
}
.project-gallery h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(24px, 3vw, 32px);
  margin: 8px 0 0;
  letter-spacing: -0.01em;
}
.project-gallery h2 em { font-style: italic; color: var(--text-dim); font-weight: 300; }
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
@media (max-width: 640px) { .gallery-grid { grid-template-columns: 1fr; } }
.gallery-grid figure {
  margin: 0;
  border: 1px solid var(--line-strong);
  background: var(--bg-card);
  overflow: hidden;
}
.gallery-grid img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  transition: transform 600ms cubic-bezier(.2,0,.2,1);
}
.gallery-grid figure:hover img { transform: scale(1.04); }
.gallery-grid figcaption {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}

/* next/prev project nav */
.project-nav {
  border-top: 1px solid var(--line);
  padding: 32px 0;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.project-nav a {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.project-nav a:hover { color: var(--accent); }
.project-nav .label {
  display: block;
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--text-faint);
  margin-bottom: 4px;
}
.project-nav .title {
  display: block;
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: -0.005em;
  text-transform: none;
  color: var(--text);
  margin-top: 2px;
}
.project-nav a:hover .title { color: var(--accent); }

/* =========================================================
   Project page TOC layout
   ========================================================= */
.project-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 760px);
  gap: clamp(40px, 5vw, 72px);
  justify-content: center;
  max-width: 1100px;
  margin: 0 auto;
}

/* When the TOC is hidden (short articles), center the body */
.project-layout.no-toc {
  grid-template-columns: minmax(0, 760px);
  max-width: 760px;
}

@media (max-width: 960px) {
  .project-layout {
    grid-template-columns: minmax(0, 1fr);
    max-width: 760px;
  }
}

.project-toc {
  position: sticky;
  top: 96px; /* clears the sticky header */
  align-self: start;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding-top: clamp(32px, 5vw, 64px);
  /* hide entirely if empty (no headings found) */
}
.project-toc:empty,
.project-toc.is-hidden { display: none; }

.project-toc .toc-inner {
  border-left: 1px solid var(--line-strong);
  padding-left: 18px;
}

.project-toc .toc-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 18px;
}

.project-toc .toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.project-toc .toc-list li {
  margin: 0;
  padding: 0;
}

.project-toc .toc-list a {
  display: block;
  position: relative;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  padding: 8px 0 8px 14px;
  border-left: 1px solid transparent;
  margin-left: -19px; /* aligns with parent border so active overlaps */
  padding-left: 18px;
  line-height: 1.45;
  transition: color var(--t), border-color var(--t);
}

.project-toc .toc-list a:hover {
  color: var(--text);
}

.project-toc .toc-list a.active {
  color: var(--accent);
  border-left-color: var(--accent);
}

/* indent for sub-headings (h3) inside the TOC */
.project-toc .toc-list .lvl-3 a {
  padding-left: 30px;
  font-size: 11px;
  color: var(--text-faint);
}
.project-toc .toc-list .lvl-3 a.active {
  color: var(--accent);
}

/* mobile: collapse to a horizontal scrollable jump bar at the top */
@media (max-width: 960px) {
  .project-toc {
    position: relative;
    top: auto;
    max-height: none;
    overflow: visible;
    padding-top: 0;
    margin-bottom: 0;
  }
  .project-toc .toc-inner {
    border-left: 0;
    border-bottom: 1px solid var(--line-strong);
    padding: 18px 0 14px;
  }
  .project-toc .toc-label {
    margin-bottom: 12px;
  }
  .project-toc .toc-list {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }
  .project-toc .toc-list a {
    white-space: nowrap;
    border-left: 0;
    border-bottom: 1px solid transparent;
    margin-left: 0;
    padding: 6px 12px;
    font-size: 11px;
  }
  .project-toc .toc-list a.active {
    border-left: 0;
    border-bottom-color: var(--accent);
  }
  .project-toc .toc-list .lvl-3 a {
    padding-left: 12px;
    font-size: 10px;
  }
}

/* offset anchor scrolling so headings clear the sticky site header */
.project-body h2,
.project-body h3 {
  scroll-margin-top: 88px;
}

/* =========================================================
   Compact hero (small portrait in top-right corner)
   ========================================================= */

.hero.hero-compact {
  padding: clamp(48px, 7vw, 88px) 0 clamp(56px, 7vw, 96px);
}

.hero.hero-compact .hero-grid {
  display: block; /* override the 2-column grid from the standard hero */
}

.hero.hero-compact .hero-text {
  max-width: 760px;
}

/* Eyebrow + small portrait sit on one line */
.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.hero-portrait-inline {
  flex-shrink: 0;
}

/* Small circular portrait */
.portrait.portrait-small {
  width: 96px;
  height: 96px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  overflow: hidden;
  background: var(--bg-card);
  position: relative;
  transition: border-color var(--t);
}
.portrait.portrait-small:hover {
  border-color: var(--accent);
}
.portrait.portrait-small img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: grayscale(15%) contrast(1.05);
}
.portrait.portrait-small.placeholder {
  display: flex; align-items: center; justify-content: center;
  background:
    repeating-linear-gradient(45deg, #131313 0 8px, #161616 8px 16px);
}
.portrait.portrait-small.placeholder span {
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  text-align: center;
  padding: 0 6px;
  line-height: 1.3;
}

/* On mobile, keep it on the same line but slightly smaller */
@media (max-width: 600px) {
  .portrait.portrait-small {
    width: 72px;
    height: 72px;
  }
  .hero-top {
    margin-bottom: 20px;
  }
}

/* Globally make text-style arrows render as text, not emoji.
   Defensive: also force the font on .arrow spans so iOS/macOS
   doesn't substitute the Apple Color Emoji glyph. */
.arrow,
.btn .arrow,
.hl-cell .label .arrow,
.footer-contact a .arrow,
.project-nav a {
  font-variant-emoji: text;
  font-family: var(--font-mono);
  font-feature-settings: "liga" off;
}
