/* ══════════════════════════════════════════════
   sasanica.com  —  style.css  v11
   Lighter slate-gray dark mode · clean academic
══════════════════════════════════════════════ */
:root {
  /* ── Palette: lighter slate-gray dark mode ──
     Not black, not navy. Mid-range gray with a
     slight blue-slate tint — clearly dark mode
     but comfortable for long reading.          */
  --bg:       #282b36;   /* main bg                */
  --bg2:      #2f3242;   /* alternate section bg   */
  --bg3:      #242735;   /* deepest bg (hero/footer)*/
  --surface:  #363a4f;   /* cards / code blocks    */
  --surface2: #3d4255;   /* hover surface          */

  /* ── Borders ── */
  --line:     rgba(255,255,255,0.09);
  --line2:    rgba(255,255,255,0.05);

  /* ── Text ── */
  --text:     #e4e2dc;   /* primary               */
  --text2:    #a4a2b0;   /* secondary / body      */
  --text3:    #686680;   /* muted / labels        */

  /* ── Accent: warm amber ── */
  --amber:    #c89850;
  --amber2:   #d8a860;
  --amber-bg: rgba(200,152,80,0.09);

  /* ── Typography ── */
  --serif: 'Cormorant Garamond', 'Georgia', serif;
  --sans:  'Inter', system-ui, sans-serif;
  --mono:  'JetBrains Mono', 'SF Mono', monospace;

  /* ── Layout ── */
  --max:  1200px;
  --nav-h: 56px;   /* NAV height — used in multiple places */
  --ease:  cubic-bezier(0.4, 0, 0.2, 1);
  --eout:  cubic-bezier(0, 0, 0.15, 1);
}

/* ── RESET ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.65;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img, video { max-width: 100%; display: block; }
::selection { background: var(--amber); color: #000; }
strong { font-weight: 600; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 4rem; }

/* ── TYPOGRAPHY ─────────────────────────────── */
.label {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 0.6rem;
}
.display-head {
  font-family: var(--serif);
  font-size: clamp(3.5rem, 6.5vw, 6.5rem);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 2.5rem;
}
.display-head em { font-style: italic; color: var(--amber); }
.body-text {
  font-size: 1.05rem;
  font-weight: 300;
  color: var(--text2);
  line-height: 1.85;
  text-align: justify;
}

/* ── ANIMATE IN ─────────────────────────────── */
.ai {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.65s var(--eout), transform 0.65s var(--eout);
}
.ai.in { opacity: 1; transform: translateY(0); }

/* ══════════════════════════════════════════════
   NAV  —  z:400, always above everything
══════════════════════════════════════════════ */
#nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 400;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4rem;
  background: rgba(36, 39, 53, 0.95);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
  transition: box-shadow 0.3s;
}
#nav.scrolled { box-shadow: 0 4px 24px rgba(0,0,0,0.4); }
.nav-logo {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.24em;
  color: var(--text);
  background: none;
  border: 1px solid var(--line2);
  padding: 0.28rem 0.65rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.nav-logo:hover { border-color: var(--amber); color: var(--amber); }
#nav-links { display: flex; gap: 2.5rem; }
#nav-links a {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--text3);
  transition: color 0.2s;
}
#nav-links a:hover,
#nav-links a.active { color: var(--text); }
.nav-email {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: var(--text3);
  transition: color 0.2s;
}
.nav-email:hover { color: var(--amber); }

/* ══════════════════════════════════════════════
   HERO
══════════════════════════════════════════════ */
#hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 7rem 0 5rem;
  overflow: hidden;
  background: var(--bg3);
  border-bottom: 1px solid var(--line);
}
#sig-canvas {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.30;
}
.hero-inner {
  position: relative;
  z-index: 1;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 4rem;
  display: grid;
  grid-template-columns: 1fr 255px;
  gap: 5rem;
  align-items: center;
}
.hero-kicker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
.hero-kicker span {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  padding: 0.24rem 0.65rem;
  border: 1px solid var(--line);
  color: var(--text3);
  background: var(--surface);
}
.hero-name {
  font-family: var(--serif);
  font-size: clamp(5.5rem, 11vw, 10rem);
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 1.3rem;
}
.hn-accent { color: var(--amber); }
.hero-tagline {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.4rem, 2.5vw, 2rem);
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1.1rem;
  letter-spacing: -0.01em;
}
.hero-body {
  font-size: 1rem;
  font-weight: 300;
  color: var(--text2);
  line-height: 1.8;
  max-width: 480px;
  margin-bottom: 2.2rem;
  text-align: justify;
}
.hero-btns { display: flex; gap: 1rem; }
.btn-solid {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  padding: 0.85rem 2rem;
  background: var(--amber);
  color: #000;
  font-weight: 500;
  transition: background 0.2s, transform 0.15s;
}
.btn-solid:hover { background: var(--amber2); transform: translateY(-2px); }
.btn-line {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  padding: 0.85rem 2rem;
  border: 1px solid var(--line);
  color: var(--text2);
  transition: border-color 0.2s, color 0.2s;
}
.btn-line:hover { border-color: var(--amber); color: var(--amber); }

/* Hero video — ambient autoplay, click opens fullscreen */
.hero-vid-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 9/16;
  background: #000;
  overflow: hidden;
  border: 1px solid var(--line);
  cursor: pointer;
}
.hero-vid-frame video {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  user-select: none;
  -webkit-user-select: none;
}
.hero-vid-frame:hover::after {
  content: '▶';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: rgba(255,255,255,0.75);
  background: rgba(0,0,0,0.25);
}
.hvf-tag {
  position: absolute;
  bottom: 0.7rem; right: 0.7rem;
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  background: rgba(36,39,53,0.88);
  color: var(--amber);
  padding: 0.18rem 0.55rem;
  z-index: 2;
  border: 1px solid var(--line);
  pointer-events: none;
}
.hero-vid-cap {
  font-family: var(--mono);
  font-size: 0.58rem;
  color: var(--text3);
  letter-spacing: 0.06em;
  line-height: 1.5;
  margin-top: 0.5rem;
}
.hero-scroll {
  position: absolute;
  bottom: 2.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  z-index: 1;
}
.scroll-bar {
  width: 1px; height: 52px;
  background: linear-gradient(to bottom, transparent, var(--line));
  animation: scrollAnim 2s ease-in-out infinite;
}
@keyframes scrollAnim {
  0%   { transform: scaleY(0); transform-origin: top; }
  50%  { transform: scaleY(1); transform-origin: top; }
  51%  { transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}
.hero-scroll span {
  font-family: var(--mono);
  font-size: 0.56rem;
  letter-spacing: 0.2em;
  color: var(--text3);
}

/* ══════════════════════════════════════════════
   VIDEO FULLSCREEN OVERLAY  —  z:600
   Completely separate from all other layers.
   Opens on any video click. Back button top-left.
   URL changes to /video/<key> while open.
══════════════════════════════════════════════ */
#vid-overlay {
  position: fixed;
  inset: 0;
  z-index: 600;
  background: rgba(0, 0, 0, 0.97);
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease);
}
body.vid-open #vid-overlay  { opacity: 1; pointer-events: all; }
body.vid-open               { overflow: hidden; }

#vid-overlay-top {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.9rem 2rem;
  background: rgba(0,0,0,0.5);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}
#vid-overlay-back {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  background: none;
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.7);
  padding: 0.45rem 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: border-color 0.2s, color 0.2s;
  flex-shrink: 0;
}
#vid-overlay-back::before { content: '←'; font-size: 0.85rem; }
#vid-overlay-back:hover { border-color: var(--amber); color: var(--amber); }
#vid-overlay-title {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: rgba(255,255,255,0.45);
  letter-spacing: 0.06em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#vid-overlay-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  overflow: hidden;
}
#vid-overlay-video {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  user-select: none;
  -webkit-user-select: none;
}

/* ══════════════════════════════════════════════
   ABOUT
══════════════════════════════════════════════ */
#about { padding: 8rem 0; background: var(--bg2); border-bottom: 1px solid var(--line); }
.about-grid { display: grid; grid-template-columns: 280px 1fr; gap: 6rem; align-items: start; }
.about-photo {
  display: block;
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  object-position: center top;
  filter: grayscale(10%) contrast(1.02);
  border: 1px solid var(--line);
  background: var(--surface);
  user-select: none;
  -webkit-user-select: none;
}
.about-loc { font-family: var(--mono); font-size: 0.62rem; color: var(--text3); letter-spacing: 0.1em; margin-top: 0.6rem; }
.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  margin-top: 3rem;
}
.metric { background: var(--bg); padding: 1.2rem 1rem; display: flex; flex-direction: column; gap: 0.25rem; }
.metric-n { font-family: var(--serif); font-size: 2.2rem; font-weight: 700; color: var(--amber); line-height: 1; }
.metric-l { font-family: var(--mono); font-size: 0.58rem; color: var(--text3); letter-spacing: 0.1em; }

/* ══════════════════════════════════════════════
   SKILLS
══════════════════════════════════════════════ */
#skills { padding: 8rem 0; background: var(--bg); border-bottom: 1px solid var(--line); }
.skills-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border: 1px solid var(--line);
  margin-bottom: 2rem;
}
.sk-col { padding: 2.5rem 2rem; border-right: 1px solid var(--line); }
.sk-col:last-child { border-right: none; }
.sk-head {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(200,152,80,0.2);
}
.sk-col h3.sk-head:not(:first-child) { margin-top: 2rem; }
.sk-col ul { list-style: none; display: flex; flex-direction: column; gap: 0.4rem; }
.sk-col li {
  font-size: 0.85rem;
  color: var(--text2);
  line-height: 1.4;
  padding-left: 0.85rem;
  position: relative;
}
.sk-col li::before { content: '·'; position: absolute; left: 0; color: var(--amber); font-size: 0.9rem; }

/* ══════════════════════════════════════════════
   PROJECTS — main listing
══════════════════════════════════════════════ */
#projects { padding-top: 8rem; background: var(--bg); border-bottom: 1px solid var(--line); }
#projects > .wrap { padding-bottom: 4rem; }
.proj { padding: 5rem 0; border-top: 1px solid var(--line); }
.proj-alt { background: var(--bg2); }
.proj-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 6rem; align-items: center; }

/* Squared thumb strip */
.proj-media { display: flex; flex-direction: column; gap: 0.7rem; cursor: pointer; }
.img-strip { overflow: hidden; background: var(--bg3); }
.strip-frame { display: none; aspect-ratio: 1/1; overflow: hidden; background: var(--bg3); }
.strip-frame.active { display: block; }
.strip-frame img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.5s var(--ease);
  user-select: none;
  -webkit-user-select: none;
  display: block;
}
.proj-media:hover .strip-frame.active img { transform: scale(1.04); }
.strip-nav { display: flex; gap: 0.5rem; padding-top: 0.3rem; }
.sn-btn {
  width: 6px; height: 6px;
  border-radius: 50%;
  border: none;
  background: var(--line);
  cursor: pointer;
  padding: 0;
  transition: background 0.2s, transform 0.2s;
}
.sn-btn.active { background: var(--amber); transform: scale(1.3); }

.proj-media-text .mosaic-art {
  aspect-ratio: 1/1;
  background: var(--surface);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 2rem;
  text-align: center;
}
.ma-label { font-family: var(--serif); font-size: 3rem; font-weight: 700; color: var(--amber); opacity: 0.55; line-height: 1; }
.ma-sub   { font-family: var(--mono);  font-size: 0.65rem; letter-spacing: 0.12em; color: var(--amber); opacity: 0.45; }
.ma-detail { font-family: var(--mono); font-size: 0.62rem; color: var(--text3); letter-spacing: 0.06em; margin-top: 0.5rem; line-height: 1.6; }

.proj-info { display: flex; flex-direction: column; }
.proj-idx  { font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.2em; color: var(--amber); margin-bottom: 0.6rem; }
.proj-title {
  font-family: var(--serif);
  font-size: clamp(2.8rem, 4.5vw, 4rem);
  font-weight: 700; line-height: 0.95; letter-spacing: -0.01em;
  color: var(--text); margin-bottom: 1.2rem;
}
.proj-byline { font-family: var(--mono); font-size: 0.63rem; color: var(--text3); letter-spacing: 0.04em; line-height: 1.55; margin-bottom: 0.5rem; }
.proj-kpi   { font-family: var(--serif); font-style: italic; font-size: 1rem; color: var(--amber); margin-bottom: 1.2rem; }
.proj-text  { font-size: 0.92rem; color: var(--text2); line-height: 1.8; margin-bottom: 1.5rem; text-align: justify; }
.proj-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 1.8rem; }
.proj-chips span { font-family: var(--mono); font-size: 0.6rem; padding: 0.16rem 0.55rem; border: 1px solid var(--line); color: var(--text3); }
.read-more-btn {
  font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.1em;
  background: none; border: none; color: var(--text); cursor: pointer;
  padding: 0; display: inline-flex; align-items: center; gap: 0.5rem;
  border-bottom: 1px solid var(--line); padding-bottom: 3px;
  align-self: flex-start; transition: color 0.2s, border-color 0.2s;
}
.read-more-btn::after { content: '→'; transition: transform 0.2s; }
.read-more-btn:hover { color: var(--amber); border-color: var(--amber); }
.read-more-btn:hover::after { transform: translateX(4px); }

/* ══════════════════════════════════════════════
   VIDEOS — 4 equal square cards, uniform grid
══════════════════════════════════════════════ */
#videos { padding: 8rem 0; background: var(--bg2); border-bottom: 1px solid var(--line); }
.vid-cap { font-family: var(--mono); font-size: 0.58rem; color: var(--text3); letter-spacing: 0.05em; line-height: 1.5; margin-top: 0.5rem; }
.videos-layout {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.2rem;
  align-items: start;
}
.vid-item { display: flex; flex-direction: column; }

/* Square card */
.vid-card {
  position: relative;
  background: var(--bg3);
  border: 1px solid var(--line);
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 1/1;
  transition: border-color 0.2s;
}
.vid-card:hover { border-color: var(--amber); }

/* Text label at bottom of card */
.vid-card-label {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 2.5rem 0.75rem 0.65rem;
  background: linear-gradient(to top, rgba(20,22,30,0.96) 0%, transparent 100%);
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.07em;
  color: rgba(255,255,255,0.8);
  line-height: 1.4;
  z-index: 3;
  text-align: center;
}

/* Play button */
.vid-play {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 2;
  padding-bottom: 1.8rem;
}
.vid-play span {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(200,152,80,0.85);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; color: #000;
  transition: transform 0.2s, background 0.2s;
  flex-shrink: 0;
}
.vid-card:hover .vid-play span { transform: scale(1.12); background: var(--amber); }

/* ══════════════════════════════════════════════
   CONTACT
══════════════════════════════════════════════ */
#contact { padding: 8rem 0; background: var(--bg3); border-bottom: 1px solid var(--line); }
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7rem; align-items: start; }
.contact-sub { font-size: 0.95rem; color: var(--text2); line-height: 1.75; margin-bottom: 0.8rem; text-align: justify; }
.contact-loc { font-family: var(--mono); font-size: 0.65rem; color: var(--text3); letter-spacing: 0.08em; }
.contact-links { display: flex; flex-direction: column; margin-top: 1rem; }
.clink { display: flex; align-items: center; padding: 1.5rem 0; border-bottom: 1px solid var(--line); transition: opacity 0.2s; gap: 1.5rem; }
.clink:first-child { border-top: 1px solid var(--line); }
.clink:hover { opacity: 0.65; }
.cl-type { font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.14em; color: var(--amber); text-transform: uppercase; min-width: 80px; }
.cl-val  { font-family: var(--mono); font-size: 0.78rem; color: var(--text2); flex: 1; }
.cl-arr  { font-family: var(--mono); font-size: 0.9rem; color: var(--text3); transition: transform 0.2s; }
.clink:hover .cl-arr { transform: translateX(6px); }
footer {
  padding: 1.2rem 4rem;
  background: var(--bg3);
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-between;
  font-family: var(--mono); font-size: 0.6rem;
  letter-spacing: 0.08em; color: var(--text3);
}

/* ══════════════════════════════════════════════
   DETAIL PANEL  —  z:300

   KEY LAYOUT FIX:
   The NAV is position:fixed at z:400 covering the top 56px.
   To prevent the nav from covering the detail panel content,
   #detail starts at top:56px (not top:0 / inset:0).
   This means the detail panel occupies the screen area below
   the nav. The sticky #detail-top then sticks at top:0 of
   the detail panel, which is at viewport y:56px — right below
   the nav. The back button is always visible and never covered.
══════════════════════════════════════════════ */
body.dp-open { overflow: hidden; }

#detail {
  position: fixed;
  top: var(--nav-h);   /* starts BELOW the nav — this is the key fix */
  left: 0; right: 0; bottom: 0;
  z-index: 300;
  background: var(--bg);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  /* Fade transition */
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s var(--ease);
}
body.dp-open #detail { opacity: 1; pointer-events: all; }

/* Sticky top bar — sticks at top:0 of the detail panel
   which is at viewport y:56px (just below the nav).      */
#detail-top {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(36, 39, 53, 0.97);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding: 0.85rem 4rem;
  display: flex;
  align-items: center;
  gap: 2rem;
}
#detail-back {
  font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.1em;
  background: none; border: 1px solid var(--line);
  color: var(--text2); padding: 0.45rem 1rem; cursor: pointer;
  transition: border-color 0.2s, color 0.2s; flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 0.4rem;
}
#detail-back::before { content: '←'; font-size: 0.85rem; }
#detail-back:hover { border-color: var(--amber); color: var(--amber); }
#detail-top-title {
  font-family: var(--mono); font-size: 0.7rem;
  color: var(--text3); letter-spacing: 0.06em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

#detail-body { max-width: 840px; margin: 0 auto; padding: 4rem 4rem 8rem; }

/* Detail header */
.db-header { margin-bottom: 3rem; padding-bottom: 3rem; border-bottom: 1px solid var(--line); }
.db-num  { font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.22em; color: var(--amber); margin-bottom: 0.6rem; }
.db-title {
  font-family: var(--serif); font-size: clamp(2.8rem, 5vw, 4.2rem);
  font-weight: 700; line-height: 0.95; letter-spacing: -0.01em;
  color: var(--text); margin-bottom: 1rem;
}
.db-meta { font-family: var(--mono); font-size: 0.63rem; color: var(--text3); letter-spacing: 0.04em; margin-bottom: 1rem; line-height: 1.6; }
.db-kpi {
  font-family: var(--serif); font-style: italic;
  font-size: 1.05rem; color: var(--amber);
  margin-bottom: 1.5rem;
  padding: 0.85rem 1.2rem;
  background: var(--amber-bg);
  border-left: 2px solid var(--amber);
}
.db-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.db-chips span {
  font-family: var(--mono); font-size: 0.62rem;
  padding: 0.28rem 0.7rem;
  border: 1px solid rgba(200,152,80,0.28);
  color: var(--amber); background: var(--amber-bg);
  letter-spacing: 0.04em;
}

/* Sections */
.db-sections { display: flex; flex-direction: column; }
.db-section { padding: 2.8rem 0; border-top: 1px solid var(--line); }
.db-section:first-child { border-top: none; padding-top: 0; }
.db-section-label {
  font-family: var(--mono); font-size: 0.6rem;
  letter-spacing: 0.18em; color: var(--amber);
  text-transform: uppercase; margin-bottom: 0.5rem; opacity: 0.7;
}
.db-section h4 {
  font-family: var(--serif);
  font-size: clamp(1.6rem, 2.8vw, 2.4rem);
  font-weight: 700; line-height: 1.0;
  color: var(--text); letter-spacing: -0.01em;
  margin-bottom: 1.4rem;
}

/* ── INLINE IMAGES inside detail sections ──
   - float:right → small image floats right, text wraps left
   - float:left  → small image floats left, text wraps right
   - float:wide  → full-width centered, no float (charts, groups)
   - group       → related images in one flex row
   
   All images use height:auto — NEVER cropped.
   max-height caps very tall images.
   No background color — edges blend with dark bg.        */
.db-content { display: block; }
.db-content::after { content: ''; display: table; clear: both; }

.db-content p {
  font-size: 0.95rem; color: var(--text2);
  line-height: 1.85; margin-bottom: 0.9rem;
  text-align: justify;
}
.db-content p:last-child { margin-bottom: 0; }

/* Default figure */
.db-fig {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

/* Floated right — beside text on its left */
.db-fig.right {
  float: right;
  margin: 0.2rem 0 1rem 2rem;
  max-width: 240px;
  clear: right;
}

/* Floated left — beside text on its right */
.db-fig.left {
  float: left;
  margin: 0.2rem 2rem 1rem 0;
  max-width: 240px;
  clear: left;
}

/* Wide / centered — full column width, not floated */
.db-fig.wide {
  float: none;
  clear: both;
  max-width: 100%;
  margin: 2rem 0;
}

/* Image itself — always natural ratio, never cropped */
.db-fig img {
  display: block;
  width: 100%;
  height: auto;              /* preserves aspect ratio always */
  max-height: 260px;         /* caps very tall images         */
  object-fit: contain;
  object-position: center;
  user-select: none;
  -webkit-user-select: none;
  /* NO background, NO border — edges blend with dark bg     */
}
.db-fig.wide img { max-height: 380px; }

figcaption {
  font-family: var(--mono);
  font-size: 0.6rem;
  color: var(--text3);
  letter-spacing: 0.04em;
  line-height: 1.5;
  font-style: italic;
}

/* Group: multiple related images in one horizontal row */
.db-img-group {
  clear: both;
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
  margin: 2rem 0;
  align-items: flex-start;
}
.db-img-group .db-fig {
  float: none; margin: 0;
  flex: 1 1 140px;
  max-width: 210px;
}
.db-img-group .db-fig img {
  width: 100%;
  max-height: 180px;
  object-fit: contain;
  object-position: top;
}

/* ══════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .wrap, .hero-inner, #detail-body, #detail-top, footer, #nav {
    padding-left: 2.5rem; padding-right: 2.5rem;
  }
  /* Keep hero video on tablet but shrink it */
  .hero-inner { grid-template-columns: 1fr 160px; gap: 2.5rem; }
  .about-grid { grid-template-columns: 1fr; gap: 3rem; }
  .about-photo { max-width: 200px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .skills-grid { grid-template-columns: 1fr 1fr; }
  .sk-col:nth-child(2)      { border-right: none; }
  .sk-col:nth-child(n+3)    { border-top: 1px solid var(--line); }
  .proj-wrap { grid-template-columns: 1fr; gap: 3rem; }
  .videos-layout { grid-template-columns: repeat(2, 1fr); }
  .contact-grid { grid-template-columns: 1fr; gap: 3rem; }
  #detail-body { padding: 3rem 2.5rem 6rem; }
}
@media (max-width: 768px) {
  .wrap, .hero-inner, #detail-body, #detail-top, footer, #nav {
    padding-left: 1.5rem; padding-right: 1.5rem;
  }
  #nav-links { gap: 1.5rem; }
  .nav-email { display: none; }
  .skills-grid { grid-template-columns: 1fr; }
  .sk-col { border-right: none; border-top: 1px solid var(--line); }
  .sk-col:first-child { border-top: none; }
  /* Hero: keep 2 columns on mobile but narrow video */
  .hero-inner { grid-template-columns: 1fr 100px; gap: 1.2rem; }
  .hero-kicker { display: none; }   /* save space on small screens */
  .hero-name { font-size: 3.5rem; }
  .hero-body { font-size: 0.9rem; }
  /* About photo smaller on mobile */
  .about-photo { max-width: 140px; }
  /* Videos: 2 columns on mobile */
  .videos-layout { grid-template-columns: repeat(2, 1fr); }
  #detail-body { padding: 2rem 1.5rem 5rem; }
  /* Mobile: no float — images stack between paragraphs */
  .db-fig.right, .db-fig.left {
    float: none;
    margin: 1.5rem 0;
    max-width: 100%;
    clear: both;
  }
  .db-img-group .db-fig { max-width: 100%; flex: 1 1 100%; }
  /* Captions centered on mobile */
  figcaption { text-align: center; }
}
@media (max-width: 480px) {
  .hero-name { font-size: 2.8rem; }
  .hero-inner { grid-template-columns: 1fr 80px; gap: 0.8rem; }
  .videos-layout { grid-template-columns: repeat(2, 1fr); }
}
