/* =========================================================
   Sreeram M.V. — Design System
   Phase 1: tokens, navbar, hero
   ========================================================= */

:root {
  /* Color */
  --bg:            #faf8f5;
  --bg-raised:     #ffffff;
  --text:          #1a1a2e;
  --text-muted:    #4a5568;
  --accent:        #c75b39;
  --accent-dark:   #a94a2d;
  --accent-tint:   rgba(199, 91, 57, 0.08);
  --slate:         #718096;
  --slate-tint:    rgba(113, 128, 150, 0.10);
  --border:        #e2e8f0;

  /* Type */
  --font-display: "Playfair Display", Georgia, serif;
  --font-body:    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono:    "JetBrains Mono", "SF Mono", Menlo, monospace;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  /* Layout */
  --container: 1100px;
  --nav-h: 72px;
  --section-y: 100px;
  --section-x: 60px;

  /* Effect */
  --radius:      6px;
  --radius-lg:   10px;
  --radius-full: 999px;
  --shadow-sm:   0 4px 16px rgba(26, 26, 46, 0.07);
  --shadow-nav:  0 1px 0 var(--border);
  --ease:        cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: var(--nav-h); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; margin: 0; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
img, svg, canvas { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

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

.skip-link {
  position: absolute; left: -9999px; top: var(--space-2);
  background: var(--accent); color: #fff; padding: var(--space-3) var(--space-4);
  border-radius: var(--radius); z-index: 200;
}
.skip-link:focus { left: var(--space-4); }

.mono { font-family: var(--font-mono); font-size: 0.94em; letter-spacing: -0.01em; }
.sep  { color: var(--border); margin: 0 var(--space-1); }

/* ---------- Layout primitives ---------- */
.container { max-width: var(--container); margin-inline: auto; padding-inline: var(--space-5); }
section    { padding: var(--section-y) var(--section-x); }
section:empty { padding: 0; } /* Phase 2 placeholders: anchor only, no dead scroll */
@media (max-width: 768px) { section { padding: var(--space-8) var(--space-5); } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: 12px 22px;
  border-radius: var(--radius);
  font-size: 16px; font-weight: 500;
  border: 1px solid transparent;
  transition: background .2s var(--ease), color .2s var(--ease),
              border-color .2s var(--ease), transform .2s var(--ease);
}
.btn:hover { transform: translateY(-1px); }

.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-dark); }

.btn--outline { border-color: var(--accent); color: var(--accent); }
.btn--outline:hover { background: var(--accent-tint); }

.btn--ghost { color: var(--text-muted); padding-inline: var(--space-3); }
.btn--ghost:hover { color: var(--accent); }

/* ---------- Cards & tags (shared, used from Phase 2 on) ---------- */
.card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s var(--ease);
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-sm); border-color: #d6dee8; }

.tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background: var(--slate-tint);
  color: var(--text-muted);
}

/* Inline accent link (professor / lab names in Experience) */
.ilink {
  color: var(--accent);
  border-bottom: 1px solid transparent;
  transition: border-color .2s var(--ease);
}
.ilink:hover { border-bottom-color: var(--accent); }

/* =========================================================
   NAVBAR
   ========================================================= */
.nav {
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-h);
  background: transparent;
  transition: background .3s var(--ease), box-shadow .3s var(--ease),
              backdrop-filter .3s var(--ease);
}
.nav.is-scrolled {
  background: rgba(250, 248, 245, 0.78);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  box-shadow: var(--shadow-nav);
}

.nav__inner {
  max-width: var(--container); height: 100%;
  margin-inline: auto; padding-inline: var(--space-5);
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-5);
}

.nav__brand {
  font-family: var(--font-display);
  font-size: 24px; font-weight: 700; letter-spacing: 0.04em;
}
.nav__brand:hover { color: var(--accent); }

.nav__links { display: flex; align-items: center; gap: var(--space-5); }
.nav__links a {
  position: relative;
  font-size: 16px; color: var(--text-muted);
  transition: color .2s var(--ease);
}
.nav__links a:not(.btn)::after {
  content: ""; position: absolute; left: 0; bottom: -5px;
  width: 100%; height: 1.5px; background: var(--accent);
  transform: scaleX(0); transform-origin: right;
  transition: transform .25s var(--ease);
}
.nav__links a:not(.btn):hover { color: var(--text); }
.nav__links a:not(.btn):hover::after { transform: scaleX(1); transform-origin: left; }
.nav__links a.is-active { color: var(--accent); }

.nav__cta-mobile { display: none; }

.nav__burger { display: none; width: 40px; height: 40px; padding: 9px; }
.nav__burger span {
  display: block; height: 1.5px; width: 100%; background: var(--text);
  border-radius: 2px; transition: transform .3s var(--ease), opacity .2s var(--ease);
}
.nav__burger span + span { margin-top: 5px; }
.nav__burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav__burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav__burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

.nav__scrim {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(26, 26, 46, 0.35);
  opacity: 0; transition: opacity .3s var(--ease);
}
.nav__scrim.is-open { opacity: 1; }

@media (max-width: 900px) {
  .nav__cta { display: none; }
  .nav__burger { display: block; }
  .nav__cta-mobile { display: inline-flex; margin-top: var(--space-3); }

  .nav__links {
    position: fixed; top: 0; right: 0; z-index: 95;
    width: min(320px, 82vw); height: 100dvh;
    flex-direction: column; align-items: flex-start; justify-content: center;
    gap: var(--space-5);
    padding: var(--space-8) var(--space-6);
    background: var(--bg);
    border-left: 1px solid var(--border);
    transform: translateX(100%);
    transition: transform .32s var(--ease);
  }
  .nav__links.is-open { transform: translateX(0); }
  .nav__links a { font-size: 19px; }
}

body.is-locked { overflow: hidden; }

/* =========================================================
   HERO
   ========================================================= */
.hero {
  min-height: 100vh;
  /* Cap on very tall windows so content isn't marooned in a sea of whitespace */
  min-height: min(100svh, 880px);
  margin-top: calc(var(--nav-h) * -1);
  display: flex; align-items: center;
  padding: var(--nav-h) var(--section-x) var(--space-7);
}
.hero__inner {
  width: 100%; max-width: var(--container); margin-inline: auto;
  display: grid; grid-template-columns: 55fr 45fr;
  align-items: center; gap: var(--space-7);
}

.hero__avatar {
  width: 150px; height: 150px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--accent);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-5);
}
.hero__name {
  font-size: 56px;
  letter-spacing: -0.015em;
  color: var(--text);
}
.hero__tagline {
  margin-top: var(--space-4);
  font-size: 19px; color: var(--text-muted);
}
.hero__status {
  margin-top: var(--space-3);
  font-size: 17px; color: var(--accent);
}
.hero__about {
  margin-top: var(--space-5);
  max-width: 56ch;
  font-size: 17px; line-height: 1.65; color: var(--text-muted);
}
.hero__academic {
  margin-top: var(--space-3);
  max-width: 56ch;
  font-size: 15px; font-style: italic; color: var(--text-muted);
}
.hero__cta {
  margin-top: var(--space-6);
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3);
}

/* --- Visual column --- */
.hero__visual { position: relative; align-self: stretch; }
/* Tall canvas anchored near the page top so the arm reads as mounted up by the navbar */
.hero__canvas-wrap { position: relative; width: 100%; height: min(82vh, 740px); }
#hero-canvas { width: 100%; height: 100%; cursor: pointer; }

.hero__hint {
  position: absolute; left: 50%; top: 56%; transform: translateX(-50%);
  width: max-content; max-width: 92%; text-align: center;
  font-size: 14px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--slate); opacity: 0.75;
  pointer-events: none;
}

.hero__svg-arm { display: none; width: 100%; max-width: 260px; margin-inline: auto; }

/* Mobile: swap canvas for SVG */
@media (max-width: 768px) {
  .hero { padding-inline: var(--space-5); }
  .hero__inner { grid-template-columns: 1fr; gap: var(--space-7); }
  .hero__name { font-size: 40px; }
  .hero__canvas-wrap { display: none; }
  .hero__svg-arm { display: block; }
}
@media (max-width: 400px) { .hero__name { font-size: 34px; } }

/* JS sets this when WebGL fails to initialise */
.no-webgl .hero__canvas-wrap { display: none; }
.no-webgl .hero__svg-arm { display: block; }

/* =========================================================
   SECTION CHROME
   ========================================================= */
.section--alt { background: var(--bg-raised); border-block: 1px solid var(--border); }

.section__head { margin-bottom: var(--space-7); }
.section__eyebrow {
  font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent); margin-bottom: var(--space-3);
}
.section__title { font-size: 38px; letter-spacing: -0.01em; }
.section__sub { margin-top: var(--space-2); font-size: 17px; color: var(--text-muted); }
@media (max-width: 768px) { .section__title { font-size: 30px; } }

.grid { display: grid; gap: var(--space-5); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) { .grid--3 { grid-template-columns: 1fr; } }
@media (max-width: 768px) { .grid--2 { grid-template-columns: 1fr; } }

.card__title { font-size: 22px; margin-bottom: var(--space-3); }
.card__body  { color: var(--text-muted); font-size: 16px; }

.card__links { margin-top: var(--space-4); }
.card__links a {
  font-family: var(--font-mono); font-size: 13px; color: var(--accent);
  border-bottom: 1px solid transparent; transition: border-color .2s var(--ease);
}
.card__links a:hover { border-bottom-color: var(--accent); }

.tags {
  list-style: none; margin: var(--space-4) 0 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: var(--space-2);
}

/* =========================================================
   PUBLICATIONS
   ========================================================= */
.pubs { display: flex; flex-direction: column; gap: var(--space-4); }

.pub {
  display: grid; grid-template-columns: 190px 1fr; gap: var(--space-5);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s var(--ease);
}
.pub:hover { transform: translateY(-4px); box-shadow: var(--shadow-sm); border-color: #d6dee8; }
.pub--nothumb { grid-template-columns: 74px 1fr; align-items: center; }

.pub__thumb {
  display: block; overflow: hidden;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--border);
  aspect-ratio: 4 / 3;
}
.pub__thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s var(--ease); }
.pub__thumb:hover img { transform: scale(1.04); }

.pub__thumb--empty {
  aspect-ratio: 1; display: grid; place-items: center;
  background: var(--slate-tint); border-style: dashed;
  color: var(--slate); font-size: 11px; letter-spacing: 0.06em;
}

.pub__badges { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-3); }
.badge {
  font-family: var(--font-mono); font-size: 12.5px;
  padding: 5px 11px; border-radius: var(--radius-full);
  background: var(--slate-tint); color: var(--text-muted);
}
.badge--workshop { background: var(--accent); color: #fff; }
.badge--muted { background: transparent; border: 1px dashed var(--border); color: var(--slate); }

.pub__title { font-size: 21px; line-height: 1.3; }
.pub__authors { margin-top: var(--space-2); font-size: 15px; color: var(--text-muted); }
.pub__authors strong { color: var(--text); font-weight: 600; }
.pub__note { margin-top: var(--space-2); font-size: 15px; color: var(--slate); }

.pub__links { margin-top: var(--space-3); display: flex; gap: var(--space-4); }
.pub__links a {
  font-family: var(--font-mono); font-size: 14px; color: var(--accent);
  border-bottom: 1px solid transparent; transition: border-color .2s var(--ease);
}
.pub__links a:hover { border-bottom-color: var(--accent); }

@media (max-width: 768px) {
  .pub, .pub--nothumb { grid-template-columns: 1fr; gap: var(--space-4); }
  .pub__thumb { aspect-ratio: 16 / 9; }
  .pub__thumb--empty { aspect-ratio: 4 / 1; }
}

/* =========================================================
   PROJECTS
   ========================================================= */
.card--project { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.card__pad { padding: var(--space-5); }

/* Image-less project cards: text only, no empty media box */
.card--text { justify-content: center; min-height: 240px; }
.card--text .card__pad { padding: var(--space-6); }

.media {
  position: relative; aspect-ratio: 16 / 10;
  background: var(--border); overflow: hidden;
}
.media__img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  transition: opacity .45s var(--ease), transform .5s var(--ease);
}
.media__video {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
}
.media__img--hover { opacity: 0; }
.card--project:hover .media__img--hover { opacity: 1; }
.card--project:hover .media__img { transform: scale(1.03); }

.media--placeholder {
  display: grid; place-items: center;
  background: #e2e8f0;
  background-image:
    linear-gradient(rgba(255,255,255,.5) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.5) 1px, transparent 1px);
  background-size: 24px 24px;
}
.media__label {
  font-size: 15px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--slate);
}

/* Hover cross-fade is meaningless without a pointer */
@media (hover: none) { .media__img--hover { display: none; } }

/* =========================================================
   EXPERIENCE TIMELINE
   ========================================================= */
.timeline { list-style: none; margin: 0; padding: 0 0 0 var(--space-6); position: relative; }
.timeline::before {
  content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px;
  width: 1px; background: var(--border);
}
.timeline__item { position: relative; padding-bottom: var(--space-7); }
.timeline__item:last-child { padding-bottom: 0; }
.timeline__item::before {
  content: ""; position: absolute; left: calc(var(--space-6) * -1); top: 7px;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--accent);
}
.section--alt .timeline__item::before { background: var(--bg-raised); }

/* Timeline items that carry a photo (Mentored section) */
.timeline__item--media { display: grid; grid-template-columns: 1fr 520px; gap: var(--space-6); align-items: center; }
.timeline__media { margin: 0; display: block; overflow: hidden; border-radius: var(--radius-lg); border: 1px solid var(--border); }
.timeline__media img {
  width: 100%; aspect-ratio: 3 / 2; object-fit: cover; display: block;
  transition: transform .4s var(--ease);
}
.timeline__media a { display: block; }
.timeline__media:hover img { transform: scale(1.03); }
@media (max-width: 980px) {
  .timeline__item--media { grid-template-columns: 1fr 400px; }
}
@media (max-width: 760px) {
  .timeline__item--media { grid-template-columns: 1fr; gap: var(--space-4); }
  .timeline__media { order: -1; } /* photo first on mobile */
  .timeline__media img { aspect-ratio: 16 / 10; }
}

.timeline__meta { font-size: 13.5px; color: var(--slate); letter-spacing: 0.02em; }

/* Institution logo chip (white bg so dark-text logos stay visible in any theme) */
.exp-logo {
  display: inline-flex; align-items: center;
  height: 38px; padding: 5px 11px; margin: var(--space-3) 0 var(--space-1);
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
}
.exp-logo img { height: 100%; width: auto; display: block; }
.timeline__title { font-size: 23px; margin-top: var(--space-2); }
.timeline__role { font-size: 16px; color: var(--accent); margin-top: 2px; }
.timeline__body { font-size: 16px; color: var(--text-muted); margin-top: var(--space-2); max-width: 64ch; }

/* =========================================================
   BEYOND
   ========================================================= */
.beyond__text { font-size: 19px; line-height: 1.6; color: var(--text-muted); max-width: 62ch; }
.beyond__subtitle { font-size: 20px; margin-bottom: var(--space-2); }
.beyond__subtitle--gallery { margin: var(--space-8) 0 var(--space-5); }

.quote {
  margin: var(--space-6) 0 0; padding-left: var(--space-5);
  border-left: 2px solid var(--accent);
}
.quote p { font-family: var(--font-display); font-size: 20px; font-style: italic; color: var(--text); }
.quote cite { display: block; margin-top: var(--space-2); font-size: 14px; color: var(--slate); font-style: normal; }

/* Large, page-centred quote with accent stripe */
.quote--center { max-width: 720px; margin: var(--space-7) auto 0; border-left-width: 3px; }
.quote--center p { font-size: 27px; line-height: 1.32; }
.quote--center cite { font-size: 15px; }

/* Masonry gallery — natural aspect ratios, no face cropping, no empty gaps */
.gallery { column-count: 3; column-gap: var(--space-3); }
.gallery__item {
  display: block; margin: 0 0 var(--space-3);
  break-inside: avoid; -webkit-column-break-inside: avoid;
  overflow: hidden; border-radius: var(--radius); border: 1px solid var(--border);
  cursor: zoom-in;
}
.gallery__item img { width: 100%; height: auto; display: block; transition: transform .4s var(--ease); }
.gallery__item:hover img { transform: scale(1.04); }

@media (max-width: 900px) { .gallery { column-count: 2; } }
@media (max-width: 560px) { .gallery { column-count: 1; } }

/* Closing portrait */
.beyond__portrait { margin: var(--space-8) auto 0; max-width: 440px; text-align: center; }
.beyond__portrait img {
  width: 100%; border-radius: var(--radius-lg);
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.beyond__portrait figcaption {
  margin-top: var(--space-4); font-size: 15px;
  font-family: var(--font-mono); color: var(--text-muted);
}

/* Lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 250;
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-5);
  background: rgba(10, 12, 18, 0.92);
  opacity: 0; transition: opacity .25s var(--ease);
}
.lightbox.is-open { opacity: 1; }
.lightbox[hidden] { display: none; }
.lightbox__img {
  max-width: 92vw; max-height: 88vh; object-fit: contain;
  border-radius: var(--radius); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.lightbox__close {
  position: absolute; top: 18px; right: 24px;
  width: 46px; height: 46px; font-size: 30px; line-height: 1;
  color: #fff; background: rgba(255, 255, 255, 0.12); border-radius: 50%;
  transition: background .2s var(--ease);
}
.lightbox__close:hover { background: rgba(255, 255, 255, 0.24); }

/* =========================================================
   SKILLS
   ========================================================= */
.skills { margin: 0; }
.skills__row {
  display: grid; grid-template-columns: 190px 1fr;
  gap: var(--space-5); align-items: baseline;
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border);
}
.skills__row:last-child { border-bottom: 0; }
.skills__key {
  font-family: var(--font-mono); font-size: 14.5px;
  color: var(--text); letter-spacing: 0.02em;
}
.skills__val { margin: 0; }
.skills__val .tags { margin-top: 0; justify-content: flex-end; }
@media (max-width: 640px) {
  .skills__row { grid-template-columns: 1fr; gap: var(--space-3); }
  .skills__val .tags { justify-content: flex-start; } /* left-align when stacked */
}

/* =========================================================
   CONTACT
   ========================================================= */
.contact__inner {
  display: grid; grid-template-columns: 220px 1fr;
  gap: var(--space-7); align-items: center;
}
.contact__photo {
  width: 220px; height: 220px; object-fit: cover;
  border-radius: 50%; border: 1px solid var(--border);
}
.contact__title { margin-bottom: var(--space-3); }
.contact__sub { font-size: 18px; color: var(--text-muted); max-width: 56ch; }

.contact__email {
  display: inline-block; margin-top: var(--space-5);
  font-size: 17px; color: var(--accent);
  border-bottom: 1px solid var(--border);
  transition: border-color .2s var(--ease);
}
.contact__email:hover { border-bottom-color: var(--accent); }

.contact__cta { margin-top: var(--space-5); display: flex; flex-wrap: wrap; gap: var(--space-3); }

.socials {
  list-style: none; margin: var(--space-6) 0 0; padding: 0;
  display: flex; gap: var(--space-5);
}
.socials a { color: var(--text-muted); transition: color .2s var(--ease), transform .2s var(--ease); display: block; }
.socials a:hover { color: var(--accent); transform: translateY(-2px); }

@media (max-width: 768px) {
  .contact__inner { grid-template-columns: 1fr; justify-items: start; gap: var(--space-6); }
  .contact__photo { width: 150px; height: 150px; }
}

/* =========================================================
   FOOTER
   ========================================================= */
.footer { border-top: 1px solid var(--border); padding: var(--space-6) 0; }
.footer__inner {
  display: flex; flex-wrap: wrap; gap: var(--space-4);
  align-items: center; justify-content: space-between;
}
.footer__credit { font-size: 15px; color: var(--slate); }
.footer__links { list-style: none; margin: 0; padding: 0; display: flex; gap: var(--space-5); }
.footer__links a { font-size: 15px; color: var(--text-muted); transition: color .2s var(--ease); }
.footer__links a:hover { color: var(--accent); }

/* =========================================================
   RESOURCES
   ========================================================= */
.res__block { margin-bottom: var(--space-8); }
.res__block:last-child { margin-bottom: 0; }
.res__heading {
  font-size: 26px; margin-bottom: var(--space-5);
  padding-bottom: var(--space-3); border-bottom: 1px solid var(--border);
}
.res__subheading { font-family: var(--font-body); font-size: 18px; font-weight: 600; margin-bottom: var(--space-4); }
.card__title--sm { font-size: 18px; }

/* Clickable landscape cards */
.res__card { display: block; }
.res__card .card__title--sm { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.res__card .linklist__arrow { color: var(--slate); font-size: 13px; transition: color .2s var(--ease); }
.res__card:hover .card__title--sm { color: var(--accent); }
.res__card:hover .linklist__arrow { color: var(--accent); }

.res__coldemail { max-width: 70ch; }

.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li {
  position: relative; padding-left: var(--space-6);
  margin-bottom: var(--space-3); color: var(--text-muted); font-size: 16px;
}
.checklist li::before {
  content: ""; position: absolute; left: 0; top: 9px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
}

.linklist { list-style: none; margin: 0; padding: 0; }
.linklist li + li { border-top: 1px solid var(--border); }
.linklist a {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  padding: var(--space-4) 0;
  transition: padding-left .25s var(--ease), color .2s var(--ease);
}
.linklist a:hover { padding-left: var(--space-3); color: var(--accent); }
.linklist__title { font-size: 17px; }
.linklist__arrow { color: var(--slate); font-size: 15px; }
.linklist a:hover .linklist__arrow { color: var(--accent); }

.toollist { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-3); }
.tool {
  display: inline-block; font-size: 14px;
  padding: 10px 17px; border-radius: var(--radius-full);
  border: 1px solid var(--border); color: var(--text-muted);
  transition: border-color .2s var(--ease), color .2s var(--ease), transform .2s var(--ease);
}
.tool:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }

/* =========================================================
   LOADER
   ========================================================= */
.loader {
  position: fixed; inset: 0; z-index: 300;
  display: grid; place-items: center;
  background: var(--bg);
  transition: opacity .5s var(--ease), visibility .5s var(--ease);
}
.loader.is-done { opacity: 0; visibility: hidden; }
.loader__inner { display: flex; align-items: center; gap: var(--space-3); }
.loader__text { font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-muted); }
.loader__dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--accent);
  animation: pulse 1.1s var(--ease) infinite;
}
.loader__ellipsis::after { content: "..."; animation: ellipsis 1.2s steps(4, end) infinite; }

@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.75); } }
@keyframes ellipsis { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

/* =========================================================
   REVEAL ON SCROLL
   ========================================================= */
.js .reveal { opacity: 0; transform: translateY(18px); }
.reveal { transition: opacity .5s var(--ease), transform .5s var(--ease); }
.js .reveal.is-visible { opacity: 1; transform: none; }

/* =========================================================
   FLOATING BUTTONS
   ========================================================= */
.fab {
  position: fixed; right: var(--space-5); z-index: 80;
  display: inline-flex; align-items: center; gap: var(--space-2);
  border: 1px solid var(--border);
  background: var(--bg-raised); color: var(--text);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
  transition: transform .2s var(--ease), border-color .2s var(--ease),
              color .2s var(--ease), right .32s var(--ease);
}
.fab:hover { transform: translateY(-2px); border-color: var(--accent); color: var(--accent); }

.fab--rviz { bottom: var(--space-5); padding: 11px 18px; font-size: 12.5px; letter-spacing: 0.08em; text-transform: uppercase; }
.fab--top  { bottom: 76px; width: 42px; height: 42px; padding: 0; justify-content: center; }
.fab--top[hidden] { display: none; }

.fab__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--slate); transition: background .2s var(--ease); }
.rviz-mode .fab__dot { background: var(--accent); box-shadow: 0 0 8px var(--accent); }

/* Slide the FABs clear of the sidebar */
@media (min-width: 769px) {
  .rviz-mode .fab { right: calc(280px + var(--space-5)); }
}

/* =========================================================
   DARK THEME (toggled by the arm's end-effector lamp)
   Overrides the design tokens; every component reads these,
   so the whole page follows. RViz mode (below) still wins
   when active because its rules come later.
   ========================================================= */
body.theme-dark {
  --bg:          #14151c;
  --bg-raised:   #1c1e28;
  --text:        #eceef4;
  --text-muted:  #a5abbd;
  --accent:      #e0714c;
  --accent-dark: #c75b39;
  --accent-tint: rgba(224, 113, 76, 0.12);
  --slate:       #7f8798;
  --slate-tint:  rgba(150, 160, 180, 0.12);
  --border:      #2b2e3b;
  --shadow-sm:   0 6px 20px rgba(0, 0, 0, 0.45);
  --shadow-nav:  0 1px 0 var(--border);
}
body.theme-dark { background: var(--bg); color: var(--text); }
.theme-dark .nav.is-scrolled { background: rgba(20, 21, 28, 0.8); }
.theme-dark .btn--primary { color: #fff; }
.theme-dark .media--placeholder { background: #232636; background-image: none; }
/* Tame bright paper thumbnails / photos against the dark page */
.theme-dark .pub__thumb img,
.theme-dark .gallery img,
.theme-dark .media__img,
.theme-dark .beyond__teaching img,
.theme-dark .contact__photo { filter: brightness(0.92) contrast(1.02); }

/* Smooth cross-fade when the lamp flips the theme */
body, .nav, .card, .pub, .fab, .tool, .rviz-panel,
.section--alt, .footer, .timeline__item::before {
  transition: background-color .45s var(--ease), color .45s var(--ease),
              border-color .45s var(--ease);
}

/* =========================================================
   RVIZ MODE
   ========================================================= */
body.rviz-mode {
  --bg:         #0a0e17;
  --bg-raised:  #10151f;
  --text:       #e2e8f0;
  --text-muted: #8b97a8;
  --accent:     #64ffda;
  --accent-dark:#4fd8b8;
  --accent-tint: rgba(100, 255, 218, 0.10);
  --slate:      #6b7a8f;
  --slate-tint: rgba(139, 151, 168, 0.12);
  --border:     #202a3a;
  --shadow-sm:  0 4px 16px rgba(0, 0, 0, 0.5);
}
body.rviz-mode { background: var(--bg); color: var(--text); }
.rviz-mode .nav.is-scrolled { background: rgba(10, 14, 23, 0.8); }
.rviz-mode .btn--primary { color: #05221c; }
.rviz-mode .badge--workshop { color: #05221c; }
.rviz-mode .media--placeholder { background: #172033; background-image: none; }
.rviz-mode .pub__thumb img,
.rviz-mode .gallery img,
.rviz-mode .media__img,
.rviz-mode .media__video,
.rviz-mode .beyond__teaching img,
.rviz-mode .contact__photo { filter: saturate(.55) brightness(.82); }

body.rviz-mode, .rviz-mode .nav, .rviz-mode .card, .rviz-mode .pub, .rviz-mode .fab {
  transition: background-color .35s var(--ease), color .35s var(--ease), border-color .35s var(--ease);
}

/* --- Sidebar --- */
.rviz-panel {
  position: fixed; top: 0; right: 0; z-index: 85;
  width: 280px; height: 100dvh;
  padding: var(--space-6) var(--space-5);
  overflow-y: auto;
  background: #0d1220;
  border-left: 1px solid #202a3a;
  color: #e2e8f0;
  transform: translateX(100%);
  transition: transform .35s var(--ease);
}
.rviz-mode .rviz-panel { transform: translateX(0); }
.rviz-mode { padding-right: 0; }

@media (min-width: 769px) {
  .rviz-mode main, .rviz-mode .nav__inner, .rviz-mode .footer { padding-right: 280px; }
}

.rviz-panel__group { margin-bottom: var(--space-7); }
.rviz-panel__title {
  font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  color: #64ffda; margin-bottom: var(--space-4);
  padding-bottom: var(--space-2); border-bottom: 1px solid #202a3a;
}
.rviz-panel__foot { margin-top: var(--space-3); font-size: 10.5px; color: #5a6779; }

/* TF tree */
.tf-tree { list-style: none; margin: 0; padding: 0; font-size: 12px; }
.tf-tree li { position: relative; padding: 5px 0 5px var(--space-5); color: #b6c2d2; }
.tf-tree li:first-child { padding-left: 0; color: #e2e8f0; }
.tf-tree li:not(:first-child)::before {
  content: "└─"; position: absolute; left: 4px; color: #3d4d66;
}
.tf-tree li { margin-left: 0; }
.tf-tree li:nth-child(2) { margin-left: 6px; }
.tf-tree li:nth-child(3) { margin-left: 18px; }
.tf-tree li:nth-child(4) { margin-left: 30px; }
.tf-tree li:nth-child(5) { margin-left: 42px; }

/* Topics */
.topics { list-style: none; margin: 0; padding: 0; font-size: 11.5px; }
.topics li {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-2);
  padding: 7px 0; border-bottom: 1px dashed #1a2330;
}
.topics li:last-child { border-bottom: 0; }
.topics__name { color: #8b97a8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pill {
  flex-shrink: 0;
  font-size: 9.5px; letter-spacing: 0.08em;
  padding: 3px 8px; border-radius: var(--radius-full);
  background: rgba(139, 151, 168, .14); color: #b6c2d2;
}
.pill--active { background: rgba(100, 255, 218, .14); color: #64ffda; }
.pill--stable { background: rgba(129, 199, 132, .14); color: #81c784; }
.pill--teleop { background: rgba(255, 183, 77, .14); color: #ffb74d; }

/* Joint states */
.joints { list-style: none; margin: 0; padding: 0; font-size: 12px; }
.joints li {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 0; border-bottom: 1px dashed #1a2330;
}
.joints li:last-child { border-bottom: 0; }
.joints__name { color: #8b97a8; }
.joints__val { color: #64ffda; font-variant-numeric: tabular-nums; white-space: pre; }

/* Mobile: sidebar becomes a bottom sheet */
@media (max-width: 768px) {
  .rviz-panel {
    top: auto; bottom: 0; left: 0; right: 0;
    width: 100%; height: auto; max-height: 58dvh;
    border-left: 0; border-top: 1px solid #202a3a;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    transform: translateY(100%);
    padding-bottom: var(--space-8);
  }
  .rviz-mode .rviz-panel { transform: translateY(0); }
  .rviz-panel__group { margin-bottom: var(--space-6); }
  .rviz-mode .fab--rviz { bottom: calc(58dvh + var(--space-3)); }
  .rviz-mode .fab--top { bottom: calc(58dvh + 68px); }
}

/* =========================================================
   Accessibility — reduced motion
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .btn:hover, .card:hover, .pub:hover, .gallery__item:hover img,
  .socials a:hover, .card--project:hover .media__img,
  .fab:hover, .tool:hover, .timeline__media:hover img { transform: none; }
  .pub__thumb:hover img { transform: none; }
  .linklist a:hover { padding-left: 0; }
  .hero__hint { display: none; }

  /* Reveal must never latch content at opacity 0 when JS is skipped */
  .js .reveal, .js .reveal.is-visible { opacity: 1; transform: none; }
  .loader__dot, .loader__ellipsis::after { animation: none; }
  .loader__ellipsis::after { content: "..."; }
}

/* =========================================================
   Print
   ========================================================= */
@media print {
  .nav, .nav__scrim, .hero__canvas-wrap, .hero__svg-arm,
  .hero__cta, .skip-link, .gallery, .media, .contact__cta,
  .socials, .beyond__portrait, .timeline__media, .lightbox,
  .loader, .fab, .rviz-panel { display: none !important; }
  /* Print the light theme even if RViz mode is on */
  body, body.rviz-mode { background: #fff !important; color: #000 !important; }
  .rviz-mode main, .rviz-mode .footer { padding-right: 0 !important; }
  .js .reveal { opacity: 1 !important; transform: none !important; }
  .hero { min-height: auto; margin-top: 0; padding: 0; }
  .hero__inner, .beyond__top, .contact__inner { grid-template-columns: 1fr; }
  .section--alt { background: none; border: 0; }
  section { padding: 24px 0; break-inside: avoid; }
  .pub, .card, .timeline__item { break-inside: avoid; }
  .pub, .pub--nothumb { grid-template-columns: 1fr; }
  .pub__thumb { display: none; }
  .badge--workshop { background: none !important; color: #000 !important; border: 1px solid #000; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 10px; color: #555; }
  .pub__links a::after { content: "" !important; }
}
