/* ==========================================================================
   Shayaan Shaikh: personal site
   Layout: one academic column (in the spirit of Jon Barron's page) with a
   label rail on wide screens. The hero pairs the name and photo with a live,
   pushable Unitree G1. This file holds the layout and the original palette;
   assets/css/motosu.css swaps in the Motosu Lake colors on top of it.
   Display face Archivo (expanded), text Source Serif 4.
   ========================================================================== */

:root {
  --bg: #f6f7f5;
  --surface: #ffffff;
  --ink: #16191d;
  --ink-2: #454c54;
  --ink-3: #6c737c;
  --rule: #dcdfdb;
  --chip: #eaece8;
  --accent: #c41230;
  --accent-strong: #9e0e26;
  --link-line: var(--accent);
  --label: var(--ink-3);
  --logo-tile: #ffffff;
  --band: transparent;
  --band-ink: var(--ink);
  --band-ink-2: var(--ink-2);
  --band-ink-3: var(--ink-3);
  --band-rule: var(--rule);
  --band-accent: var(--accent);
  --g1-grid: rgba(22, 25, 29, 0.085);
  --g1-grid-strong: rgba(22, 25, 29, 0.18);
  --g1-ink: #16191d;
  --g1-accent: #c41230;
  --g1-shadow: 0.2;
  --g1-rim: 0.75;
  --font-display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Source Serif 4", "Source Serif Pro", Georgia, "Times New Roman", serif;
  --wrap: 1100px;
  --rail: 172px;
  --radius: 8px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1113;
    --surface: #171a1d;
    --ink: #e8eaed;
    --ink-2: #b4bac1;
    --ink-3: #8a919a;
    --rule: #272b30;
    --chip: #1e2226;
    --accent: #ff5a6e;
    --accent-strong: #ff8a98;
    --logo-tile: #f3f4f2;
    --g1-grid: rgba(232, 234, 237, 0.07);
    --g1-grid-strong: rgba(232, 234, 237, 0.15);
    --g1-ink: #e8eaed;
    --g1-accent: #ff5a6e;
    --g1-shadow: 0.55;
    --g1-rim: 1.6;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0f1113;
  --surface: #171a1d;
  --ink: #e8eaed;
  --ink-2: #b4bac1;
  --ink-3: #8a919a;
  --rule: #272b30;
  --chip: #1e2226;
  --accent: #ff5a6e;
  --accent-strong: #ff8a98;
  --logo-tile: #f3f4f2;
  --g1-grid: rgba(232, 234, 237, 0.07);
  --g1-grid-strong: rgba(232, 234, 237, 0.15);
  --g1-ink: #e8eaed;
  --g1-accent: #ff5a6e;
  --g1-shadow: 0.55;
  --g1-rim: 1.6;
  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
html.lb-open { overflow: hidden; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.62;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  text-decoration-color: var(--link-line);
  transition: color 0.15s ease;
}
a:hover { color: var(--accent-strong); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
@media (min-width: 720px) {
  .wrap {
    padding-left: max(32px, env(safe-area-inset-left, 0px));
    padding-right: max(32px, env(safe-area-inset-right, 0px));
  }
}

.skip {
  position: absolute; left: 8px; top: -60px;
  background: var(--ink); color: var(--bg); padding: 8px 12px; border-radius: 6px;
  font-family: var(--font-display); font-size: 0.875rem; text-decoration: none; z-index: 20;
}
.skip:focus { top: 8px; }

/* -------------------------------------------------------------- top bar */
.topbar { border-bottom: 1px solid var(--rule); background: var(--bg); }
.topbar-inner {
  display: flex; align-items: center; gap: 24px;
  padding-block: 14px;
}
.wordmark {
  font-family: var(--font-display);
  font-stretch: 112%;
  font-weight: 650;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  text-decoration: none;
}
.topbar nav { display: flex; gap: 20px; margin-left: auto; flex-wrap: wrap; }
.topbar nav a {
  font-family: var(--font-display);
  font-size: 0.875rem;
  color: var(--ink-2);
  text-decoration: none;
}
.topbar nav a:hover { color: var(--accent-strong); }
.theme-toggle {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px; flex: none;
  border: 1px solid var(--rule); border-radius: 50%;
  background: transparent; color: var(--ink-2); cursor: pointer;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--ink-3); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: block; }
}
@media (max-width: 640px) {
  .topbar nav a:not(.nav-cv) { display: none; }
}

/* ----------------------------------------------------------------- hero */
.hero-band { background: var(--band); color: var(--band-ink); }
.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 24px 48px;
  align-items: center;
  padding-block: 36px 28px;
}
.hero-copy { min-width: 0; }
.eyebrow {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--band-accent);
}
h1 {
  margin: 0 0 20px;
  font-family: var(--font-display);
  font-stretch: 125%;
  font-weight: 680;
  font-size: clamp(2.5rem, 2.1rem + 2.5vw, 3.9rem);
  line-height: 0.98;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.hero-photo { margin: 0 0 20px; max-width: 480px; }
.hero-photo a { display: block; position: relative; border-radius: 12px; overflow: hidden; }
.hero-photo img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; }
.contact {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin: 0; padding: 0; list-style: none;
  max-width: 480px;
}
.contact.centered { justify-content: center; }
.cmu-key::before { content: "·"; margin-right: 0.5em; }
.contact a {
  display: grid; place-items: center;
  width: 42px; height: 42px; padding: 0;
  border: 1px solid var(--rule); border-radius: 50%;
  color: var(--ink); text-decoration: none; background: var(--surface);
}
.contact a:hover { border-color: var(--ink-3); color: var(--ink); }
.contact svg { width: 18px; height: 18px; flex: none; }

/* G1 viewport */
.g1 { margin: 0; min-width: 0; }
.g1-stage {
  position: relative;
  aspect-ratio: 1 / 1.02;
  max-height: 600px;
  width: 100%;
  max-width: 100%;
  touch-action: pan-y;
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
}
.g1-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block;
  -webkit-mask-image: radial-gradient(ellipse 72% 68% at 50% 52%, #000 62%, transparent 100%);
  mask-image: radial-gradient(ellipse 72% 68% at 50% 52%, #000 62%, transparent 100%);
}
.g1.is-hover .g1-stage { cursor: grab; }
.g1.is-grabbing .g1-stage, .g1-stage.is-grabbing { cursor: grabbing; }
.g1-stage.is-hover { cursor: grab; }
.g1-poster {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; object-position: 50% 50%;
  transition: opacity 0.5s ease;
  pointer-events: none;
}
.g1.is-ready .g1-poster { opacity: 0; }
.g1-tag {
  position: absolute; left: 0; top: 4px; margin: 0;
  font-family: var(--font-display); font-size: 0.75rem; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--band-ink-3);
  display: inline-flex; align-items: center; gap: 8px; pointer-events: none;
}
.g1-tag .live { width: 7px; height: 7px; border-radius: 50%; background: var(--band-ink-3); }
.g1.is-ready .g1-tag .live { background: var(--g1-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--g1-accent) 25%, transparent); }
.g1-bar {
  display: grid; gap: 10px;
  margin-top: 6px; padding-top: 12px;
  border-top: 1px solid var(--band-rule);
  font-family: var(--font-display); font-size: 0.8125rem; color: var(--band-ink-3);
}
.g1-hint { margin: 0; color: var(--band-ink-2); font-size: 0.875rem; line-height: 1.45; }
.g1-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.g1-legend { display: inline-flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.g1-legend span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.lg-com, .lg-xi, .lg-hull { display: inline-block; flex: none; }
.lg-com { width: 8px; height: 8px; border-radius: 50%; background: var(--g1-ink); }
.lg-xi { width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--g1-accent); }
.lg-hull { width: 14px; height: 9px; border: 1px solid var(--band-ink-3); background: color-mix(in srgb, var(--g1-ink) 10%, transparent); }
.g1-actions { display: inline-flex; gap: 8px; margin-left: auto; align-items: center; }
.g1-stats { font-variant-numeric: tabular-nums; color: var(--band-ink-2); margin-right: 4px; }
.g1-actions button {
  font: 600 0.8125rem/1 var(--font-display);
  padding: 8px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--rule); background: var(--surface); color: var(--ink);
}
.g1-actions button:hover { border-color: var(--ink-3); }
.g1-actions button.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.g1-actions button.primary:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.g1.is-static .g1-actions, .g1.is-static .g1-legend, .g1.is-static .g1-tag { display: none; }

@media (max-width: 560px) {
  .eyebrow { font-size: 0.72rem; letter-spacing: 0.06em; }
  h1 { margin-bottom: 16px; }
  .hero-photo { margin-bottom: 16px; }
}
@media (max-width: 860px) {
  .hero { grid-template-columns: minmax(0, 1fr); padding-block: 24px 20px; }
  .hero-photo { max-width: 560px; }
  .g1-stage { aspect-ratio: auto; height: min(80vw, 470px); }
}

/* ------------------------------------------------------------- sections */
.sec {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  gap: 8px 40px;
  padding-block: 0 40px;
}
.sec::before {
  content: "";
  grid-column: 1 / -1;
  border-top: 1px solid var(--rule);
  margin-bottom: 32px;
}
.hero-band + .sec::before { border-top-color: transparent; }
.sec-label {
  margin: 0;
  font-family: var(--font-display);
  font-stretch: 112%;
  font-size: 0.8125rem;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--label);
  line-height: 1.9;
}
.sec-body { min-width: 0; }
@media (max-width: 860px) {
  .sec { grid-template-columns: minmax(0, 1fr); padding-block: 0 32px; }
  .sec::before { margin-bottom: 26px; }
  .sec-label { margin-bottom: 8px; }
}

h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 640;
  font-size: 1.06rem;
  line-height: 1.3;
  letter-spacing: -0.003em;
  text-wrap: balance;
}
.meta, .venue, .when, .role-title, .lab {
  font-family: var(--font-display);
  font-size: 0.875rem;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.lab { margin: 3px 0 0; color: var(--ink-2); line-height: 1.45; }
.desc { margin: 6px 0 0; color: var(--ink-2); font-size: 1rem; line-height: 1.58; max-width: 46em; }
.chip {
  display: inline-block; vertical-align: 1px;
  margin-left: 6px; padding: 2px 8px; border-radius: 999px;
  background: var(--chip); color: var(--ink-2);
  font-family: var(--font-display); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.02em;
}

/* about */
.about-text p { margin: 0 0 14px; max-width: 42em; }
.about-text p:last-child { margin-bottom: 0; }
.interests { font-family: var(--font-display); font-size: 0.875rem; color: var(--ink-3); }
.interests b { color: var(--ink-2); font-weight: 600; margin-right: 6px; }

/* news */
.news { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.news li { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 14px; align-items: baseline; }
.news time {
  font-family: var(--font-display); font-size: 0.8125rem; font-weight: 600;
  color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.news p { margin: 0; }

/* current research */
.feature {
  padding: 22px 24px 20px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
.status {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 8px;
  font-family: var(--font-display); font-size: 0.75rem; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent);
}
.status .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.feature h3 { font-size: 1.22rem; }
.feature .lab { margin: 4px 0 12px; }
.bullets { margin: 0; padding-left: 1.1em; color: var(--ink-2); }
.bullets li { margin: 4px 0; padding-left: 2px; }
.bullets li::marker { color: var(--accent); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 0; padding: 0; list-style: none; }
.tags li {
  padding: 3px 10px; border-radius: 999px; background: var(--chip); color: var(--ink-2);
  font-family: var(--font-display); font-size: 0.78rem; font-weight: 500;
}
.feature-note { margin: 12px 0 0; font-family: var(--font-display); font-size: 0.8125rem; color: var(--ink-3); }

/* research, publications and projects */
.entries { display: grid; gap: 30px; }
.entry { display: grid; grid-template-columns: 208px minmax(0, 1fr); gap: 0 24px; align-items: start; }
.entry .thumb { grid-row: 1 / span 3; }
.entry-head, .entry > .output, .entry > .desc { grid-column: 2; min-width: 0; }
.output {
  margin: 10px 0 2px; padding: 10px 14px 11px;
  border-radius: var(--radius); background: var(--surface); border: 1px solid var(--rule);
}
.output .kind {
  margin: 0 0 2px; font-family: var(--font-display); font-size: 0.6875rem; font-weight: 650;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent);
}
.out-title { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 0.98rem; line-height: 1.35; color: var(--ink); }
.thumb {
  position: relative; width: 100%; aspect-ratio: 4 / 3; overflow: hidden;
  border-radius: var(--radius); border: 1px solid var(--rule); background: #fff;
}
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; }
.thumb.fig img { object-fit: contain; padding: 4px; }
.thumb .credit {
  position: absolute; right: 6px; bottom: 6px; padding: 1px 6px; border-radius: 4px;
  background: rgba(15, 17, 19, 0.62); color: #fff; pointer-events: none;
  font-family: var(--font-display); font-size: 0.6875rem; line-height: 1.5;
}
.authors { margin: 3px 0 0; font-size: 0.95rem; color: var(--ink-2); }
.authors b { color: var(--ink); font-weight: 650; }
.venue { margin: 2px 0 0; }
.venue i { font-style: italic; font-family: var(--font-body); font-size: 0.95rem; color: var(--ink-2); }
.result { font-weight: 650; color: var(--ink); }
@media (max-width: 560px) {
  .entry { grid-template-columns: 116px minmax(0, 1fr); column-gap: 14px; }
  .entry .thumb { grid-row: 1; }
  .entry > .output, .entry > .desc { grid-column: 1 / -1; }
  .entry > .output { margin-top: 12px; }
  .entry > .desc { margin-top: 12px; }
  .thumb .credit { display: none; }
  .news li { grid-template-columns: 66px minmax(0, 1fr); gap: 10px; }
}

/* clickable media: thumbnails open a gallery viewer */
.media > a { display: block; width: 100%; height: 100%; cursor: zoom-in; color: inherit; }
.media > a[hidden] { display: none; }
.media .zoom, .media .more {
  position: absolute; display: inline-flex; align-items: center; gap: 5px; pointer-events: none;
  font: 600 0.6875rem/1 var(--font-display); letter-spacing: 0.02em;
  color: #fff; background: rgba(10, 22, 32, 0.68); border-radius: 999px;
}
.media .zoom { top: 7px; right: 7px; padding: 6px; opacity: 0; transition: opacity 0.15s ease; }
.media .zoom svg { width: 14px; height: 14px; }
.media:hover .zoom, .media:focus-within .zoom { opacity: 1; }
.media .more { left: 7px; bottom: 7px; padding: 4px 8px; }
.media .more svg { width: 12px; height: 12px; }
@media (hover: none) { .media .zoom { opacity: 1; } }
.hero-photo.media { position: relative; }

/* industry and education */
.roles { display: grid; gap: 26px; }
.role { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 0 18px; align-items: start; }
.role .logo { grid-row: 1 / span 2; }
.role-top, .role > .desc { grid-column: 2; min-width: 0; }
.logo {
  width: 64px; height: 64px; display: grid; place-items: center;
  border-radius: 12px; border: 1px solid var(--rule); background: var(--logo-tile); overflow: hidden;
}
.logo img { width: 100%; height: 100%; object-fit: contain; padding: 8px; }
.logo.fill img { padding: 0; object-fit: cover; }
.logo.wide img { padding: 5px; }
.role-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 16px; }
.role-title { margin: 1px 0 0; color: var(--ink-2); }
@media (max-width: 560px) {
  .role { grid-template-columns: 48px minmax(0, 1fr); column-gap: 14px; }
  .role .logo { grid-row: 1; width: 48px; height: 48px; border-radius: 10px; }
  .role .logo img { padding: 6px; }
  .role .logo.fill img { padding: 0; }
  .role > .desc { grid-column: 1 / -1; margin-top: 10px; }
}

/* service and honors */
.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.plain li { display: grid; gap: 1px; }
.plain .row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 16px; }
.plain .what { font-family: var(--font-display); font-weight: 600; font-size: 0.98rem; }
.plain .desc { margin-top: 2px; font-size: 0.97rem; }
.honors { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 32px; }
.honors li { display: grid; gap: 0; align-content: start; }
.honors .what { font-family: var(--font-display); font-weight: 600; font-size: 0.95rem; line-height: 1.35; }
.honors .meta { font-size: 0.8125rem; }
@media (max-width: 640px) { .honors { grid-template-columns: minmax(0, 1fr); } }

/* footer */
.foot {
  border-top: 1px solid var(--rule);
  padding-block: 28px 40px;
  font-family: var(--font-display); font-size: 0.8125rem; color: var(--ink-3);
}
.foot p { margin: 0 0 6px; max-width: 60em; }
.foot a { color: var(--ink-2); text-decoration-thickness: 1px; }

/* ------------------------------------------------- gallery viewer (always dark) */
.lightbox {
  position: fixed; inset: 0;
  width: 100%; height: 100%; max-width: 100%; max-height: 100%;
  margin: 0; padding: 0; border: 0;
  background: rgba(7, 15, 22, 0.97); color: #eef1f3;
  font-family: var(--font-display);
}
.lightbox::backdrop { background: rgba(7, 15, 22, 0.6); }
.lightbox[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; }
.lb-top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: max(12px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 8px max(16px, env(safe-area-inset-left, 0px));
}
.lb-count { font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.06em; color: #a9b7c2; font-variant-numeric: tabular-nums; }
.lb-actions { display: flex; gap: 8px; }
.lb-btn {
  width: 40px; height: 40px; display: grid; place-items: center; flex: none;
  border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.07); color: #fff; cursor: pointer;
}
.lb-btn:hover { background: rgba(255, 255, 255, 0.16); }
.lb-btn svg { width: 18px; height: 18px; }
.lb-stage { position: relative; min-height: 0; }
.lb-media { position: absolute; inset: 0 76px; display: flex; align-items: center; justify-content: center; }
.lb-media img, .lb-media video {
  max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain;
  border-radius: 6px; background: #fff;
}
.lb-media video { background: #000; }
.lb-prev, .lb-next { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; }
.lb-prev { left: max(14px, env(safe-area-inset-left, 0px)); }
.lb-next { right: max(14px, env(safe-area-inset-right, 0px)); }
.lb-caption {
  margin: 12px auto 0; padding: 0 20px; max-width: 60em; text-align: center;
  font-family: var(--font-body); font-size: 1rem; color: #d7dfe5; min-height: 1.6em;
}
.lb-strip {
  display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
  padding: 12px 16px max(16px, env(safe-area-inset-bottom, 0px));
}
.lb-strip button {
  width: 64px; height: 48px; padding: 0; border-radius: 6px; overflow: hidden; cursor: pointer;
  border: 2px solid transparent; background: #fff; opacity: 0.6;
}
.lb-strip button[aria-current="true"] { border-color: #7fd0ea; opacity: 1; }
.lb-strip button:hover { opacity: 1; }
.lb-strip img { width: 100%; height: 100%; object-fit: cover; }
.lightbox:fullscreen { background: #070f16; }
@media (max-width: 640px) {
  .lb-media { inset: 0 8px; }
  .lb-prev, .lb-next { width: 40px; height: 40px; background: rgba(7, 15, 22, 0.55); }
  .lb-strip button { width: 52px; height: 40px; }
}
