/* ==========================================================================
   NISAR Laboratory — site styles
   Aesthetic inspired by the al-folio academic theme (clean, responsive,
   light/dark). Hand-authored static CSS — no build step required.
   ========================================================================== */

:root {
  /* Palette (light) */
  --bg: #ffffff;
  --bg-soft: #f7f8fa;
  --bg-card: #ffffff;
  --border: #e6e8eb;
  --text: #1b1f23;
  --text-muted: #5b6470;
  --heading: #11161c;
  --accent: #0e7c86;          /* teal — robotics/medical feel */
  --accent-hover: #0a5d65;
  --accent-soft: #e3f3f4;
  --shadow: 0 1px 2px rgba(16,22,28,.06), 0 4px 16px rgba(16,22,28,.06);
  --radius: 12px;
  --maxw: 1080px;
  --font-body: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-head: "Roboto Slab", Georgia, serif;
}

html[data-theme="dark"] {
  --bg: #1c1c1d;
  --bg-soft: #232325;
  --bg-card: #242426;
  --border: #34343a;
  --text: #e3e3e3;
  --text-muted: #a3a8b0;
  --heading: #f2f2f2;
  --accent: #34d0dc;
  --accent-hover: #6fe2ea;
  --accent-soft: #14343a;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 18px rgba(0,0,0,.45);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  transition: background .25s ease, color .25s ease;
}

h1, h2, h3, h4 { font-family: var(--font-head); color: var(--heading); line-height: 1.2; font-weight: 700; }
h1 { font-size: 2.6rem; margin: 0 0 .4rem; }
h2 { font-size: 1.9rem; margin: 0 0 1rem; }
h3 { font-size: 1.25rem; margin: 0 0 .4rem; }
p { margin: 0 0 1rem; }

a { color: var(--accent); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--accent-hover); }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.section { padding: 56px 0; }
.section-tight { padding: 36px 0; }
.bg-soft { background: var(--bg-soft); }
.center { text-align: center; }
.muted { color: var(--text-muted); }
.lead { font-size: 1.18rem; color: var(--text-muted); }

/* ---------- Navbar ---------- */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-head); font-weight: 700; font-size: 1.15rem; color: var(--heading); }
.brand:hover { color: var(--heading); }
.brand .logo { width: 34px; height: 34px; }
.brand small { display:block; font-family: var(--font-body); font-weight:400; font-size:.66rem; letter-spacing:.04em; color: var(--text-muted); text-transform: uppercase; }
.nav-links { display: flex; align-items: center; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  display: inline-block; padding: 8px 12px; border-radius: 8px;
  color: var(--text); font-size: .95rem; font-weight: 500;
}
.nav-links a:hover { background: var(--bg-soft); color: var(--accent); }
.nav-links a.active { color: var(--accent); }
.theme-toggle, .nav-burger {
  background: none; border: 1px solid var(--border); color: var(--text);
  width: 38px; height: 38px; border-radius: 9px; cursor: pointer; font-size: 1rem;
  display: inline-flex; align-items: center; justify-content: center; transition: background .15s;
}
.theme-toggle:hover, .nav-burger:hover { background: var(--bg-soft); }
.nav-burger { display: none; }

@media (max-width: 820px) {
  .nav-burger { display: inline-flex; }
  .nav-links {
    position: absolute; top: 64px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--border);
    padding: 8px 16px 16px; box-shadow: var(--shadow);
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px 8px; border-radius: 8px; }
}

/* ---------- Hero / About ---------- */
.hero { padding: 64px 0 32px; }
.hero-grid { display: grid; grid-template-columns: 1fr 280px; gap: 48px; align-items: start; }
.hero h1 { font-size: 3rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .8rem; font-weight: 600; color: var(--accent); margin-bottom: .5rem; }
.hero .tagline { font-size: 1.35rem; color: var(--text-muted); font-family: var(--font-head); margin-bottom: 1.2rem; }
.affil { font-size: .98rem; color: var(--text-muted); margin-bottom: 1.4rem; }

.profile-card { text-align: center; }
.avatar {
  width: 220px; height: 220px; border-radius: 50%; margin: 0 auto 14px;
  object-fit: cover; border: 4px solid var(--bg-card); box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: #fff; font-family: var(--font-head); font-size: 4rem; font-weight: 700;
}
.profile-card .name { font-family: var(--font-head); font-weight: 700; font-size: 1.2rem; color: var(--heading); }
.profile-card .role { color: var(--text-muted); font-size: .92rem; margin-bottom: 10px; }

.socials { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 8px; }
.socials a {
  display: inline-flex; align-items: center; gap: 6px; font-size: .82rem;
  padding: 5px 10px; border: 1px solid var(--border); border-radius: 20px; color: var(--text-muted);
}
.socials a:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Pills / tags ---------- */
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.pill {
  font-size: .82rem; padding: 5px 12px; border-radius: 20px;
  background: var(--accent-soft); color: var(--accent); font-weight: 500;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; padding: 10px 20px; border-radius: 9px; font-weight: 500; font-size: .95rem;
  background: var(--accent); color: #fff; border: 1px solid var(--accent);
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.ghost:hover { background: var(--accent-soft); color: var(--accent); }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 18px; }

/* ---------- Cards & grids ---------- */
.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } .hero-grid { grid-template-columns: 1fr; } .hero .avatar { width: 180px; height: 180px; } }
@media (max-width: 600px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow); transition: transform .18s ease, box-shadow .18s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 8px 28px rgba(16,22,28,.12); }
.card .icon { font-size: 1.7rem; margin-bottom: 8px; }
.card h3 { margin-bottom: .5rem; }
.card p { color: var(--text-muted); font-size: .96rem; margin-bottom: .6rem; }
.card .tags { display: flex; flex-wrap: wrap; gap: 6px; }
.card .tags span { font-size: .74rem; color: var(--text-muted); background: var(--bg-soft); padding: 3px 9px; border-radius: 12px; }

/* ---------- Section heading ---------- */
.sec-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 26px; flex-wrap: wrap; gap: 8px; }
.sec-head h2 { margin: 0; }
.sec-head a { font-size: .92rem; font-weight: 500; }

/* ---------- People ---------- */
.person { text-align: center; }
.person .pavatar {
  width: 120px; height: 120px; border-radius: 50%; margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-head); font-weight: 700; font-size: 2.4rem; color: #fff;
  box-shadow: var(--shadow);
}
.person .pname { font-weight: 600; color: var(--heading); font-size: 1.02rem; }
.person .ptopic { color: var(--text-muted); font-size: .86rem; }
.person.pi .pavatar { width: 160px; height: 160px; font-size: 3rem; }

/* ---------- News ---------- */
.news-item { display: grid; grid-template-columns: 130px 1fr; gap: 18px; padding: 18px 0; border-bottom: 1px solid var(--border); }
.news-item:last-child { border-bottom: none; }
.news-item .date { color: var(--accent); font-weight: 600; font-size: .9rem; font-family: var(--font-head); }
.news-item .body { color: var(--text); }
.news-item .body p { margin: 0; }
@media (max-width: 600px) { .news-item { grid-template-columns: 1fr; gap: 4px; } }

/* ---------- Publications ---------- */
.pub-controls { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; align-items: center; }
.pub-search {
  flex: 1; min-width: 220px; padding: 10px 14px; border: 1px solid var(--border);
  border-radius: 9px; background: var(--bg-card); color: var(--text); font-size: .95rem;
}
.pub-search:focus { outline: none; border-color: var(--accent); }
.year-head { font-family: var(--font-head); font-weight: 700; color: var(--accent); font-size: 1.4rem; margin: 28px 0 12px; padding-bottom: 6px; border-bottom: 2px solid var(--border); }
.pub {
  display: grid; grid-template-columns: 52px 1fr; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--border);
}
.pub:last-child { border-bottom: none; }
.pub .num { color: var(--text-muted); font-size: .85rem; font-weight: 600; text-align: right; padding-top: 2px; }
.pub .ptitle { font-weight: 600; color: var(--heading); margin-bottom: 3px; }
.pub .pauth { font-size: .92rem; color: var(--text-muted); }
.pub .pauth .me { color: var(--text); font-weight: 600; }
.pub .pvenue { font-size: .9rem; color: var(--text-muted); font-style: italic; }
.pub .plinks { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 8px; }
.pub .plinks a { font-size: .76rem; border: 1px solid var(--border); padding: 2px 9px; border-radius: 14px; color: var(--text-muted); }
.pub .plinks a:hover { border-color: var(--accent); color: var(--accent); }
.badge { display:inline-block; font-size:.7rem; font-weight:600; color: var(--accent); background: var(--accent-soft); padding: 2px 8px; border-radius: 12px; margin-left: 6px; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; text-align: center; }
.stats .num { font-family: var(--font-head); font-size: 2.4rem; font-weight: 700; color: var(--accent); }
.stats .lbl { color: var(--text-muted); font-size: .9rem; }
@media (max-width: 600px) { .stats { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Contact ---------- */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; align-items: start; }
@media (max-width: 800px) { .contact-grid { grid-template-columns: 1fr; } }
.info-row { display: flex; gap: 12px; margin-bottom: 14px; }
.info-row .k { font-weight: 600; min-width: 90px; color: var(--heading); }
.map-embed { width: 100%; height: 320px; border: 0; border-radius: var(--radius); box-shadow: var(--shadow); }

/* ---------- Callout ---------- */
.callout { background: var(--accent-soft); border-radius: var(--radius); padding: 28px 32px; }
.callout h2 { margin-top: 0; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border); padding: 28px 0; color: var(--text-muted); font-size: .88rem; }
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.footer a { color: var(--text-muted); }
.footer a:hover { color: var(--accent); }

/* ---------- Page header ---------- */
.page-head { padding: 48px 0 8px; }
.page-head h1 { font-size: 2.6rem; }
.page-head p { color: var(--text-muted); font-size: 1.1rem; max-width: 720px; }

/* ---------- Gallery ---------- */
.gallery-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 800px) { .gallery-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .gallery-grid { grid-template-columns: 1fr; } }
.gphoto { margin: 0; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.gphoto img { width: 100%; height: 220px; object-fit: cover; display: block; }
.gphoto figcaption { padding: 10px 14px; font-size: .88rem; color: var(--text-muted); }
.empty-state { text-align: center; padding: 48px 20px; background: var(--bg-soft); border: 1px dashed var(--border); border-radius: var(--radius); }
.empty-state p:first-child { font-size: 1.3rem; color: var(--heading); }
code { background: var(--bg-soft); padding: 1px 6px; border-radius: 5px; font-size: .88em; }

/* ---------- Editor / Update page ---------- */
.admin-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 24px; border-bottom: 1px solid var(--border); }
.admin-tabs button {
  background: none; border: none; border-bottom: 3px solid transparent; color: var(--text-muted);
  padding: 10px 16px; font-size: .98rem; font-weight: 600; cursor: pointer; font-family: var(--font-body);
}
.admin-tabs button:hover { color: var(--accent); }
.admin-tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.admin-panel { display: none; }
.admin-panel.active { display: block; }
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 5px; color: var(--heading); }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--bg-card); color: var(--text); font-size: .95rem; font-family: var(--font-body);
}
.field textarea { min-height: 80px; resize: vertical; }
.field .hint { font-size: .8rem; color: var(--text-muted); margin-top: 4px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 600px) { .field-row { grid-template-columns: 1fr; } }
.admin-list { margin: 18px 0; }
.admin-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px; border: 1px solid var(--border); border-radius: 9px; margin-bottom: 8px; background: var(--bg-card);
}
.admin-row .ar-text { font-size: .9rem; color: var(--text); overflow: hidden; }
.admin-row .ar-text small { color: var(--text-muted); }
.admin-row .ar-actions { display: flex; gap: 6px; flex-shrink: 0; }
.btn-sm { font-size: .8rem; padding: 5px 10px; border-radius: 7px; cursor: pointer; border: 1px solid var(--border); background: var(--bg-soft); color: var(--text); }
.btn-sm:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { color: #c0392b; }
.btn-danger:hover { border-color: #c0392b; color: #c0392b; }
.export-box { margin-top: 18px; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-soft); }
.export-box textarea { width: 100%; min-height: 160px; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .82rem; padding: 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg-card); color: var(--text); }
.steps { counter-reset: s; padding-left: 0; list-style: none; }
.steps li { counter-increment: s; padding: 6px 0 6px 34px; position: relative; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 6px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; font-size: .8rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.note { background: var(--accent-soft); border-radius: 9px; padding: 12px 16px; font-size: .9rem; margin: 12px 0; }

/* Highlights list (grants & honors) */
.hl-list{margin:.6rem 0 0;padding-left:1.15rem;line-height:1.6}
.hl-list li{margin:.28rem 0}

/* Per-publication BibTeX toggle */
.bibtex-btn{margin-left:6px;font:inherit;font-size:.74rem;font-weight:500;color:var(--accent);background:none;border:1px solid var(--border);border-radius:6px;padding:1px 9px;cursor:pointer;vertical-align:middle}
.bibtex-btn:hover{border-color:var(--accent);color:var(--accent-hover)}
.bibtex-box{margin-top:8px}
.bibtex-box pre{margin:0;background:var(--bg-soft);border:1px solid var(--border);border-radius:8px;padding:10px 12px;overflow:auto;font-size:.76rem;line-height:1.5;color:var(--text);white-space:pre;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}
.bibtex-copy{margin-top:6px;font:inherit;font-size:.72rem;color:var(--text-muted);background:none;border:1px solid var(--border);border-radius:6px;padding:1px 9px;cursor:pointer}
.bibtex-copy:hover{color:var(--text);border-color:var(--accent)}

/* Publications: filters, search, topic tags */
.pub-controls{display:flex;flex-direction:column;gap:10px;margin-bottom:22px}
.pub-search{width:100%;max-width:520px;padding:9px 14px;font:inherit;font-size:.95rem;color:var(--text);background:var(--bg-card);border:1px solid var(--border);border-radius:10px}
.pub-search:focus{outline:none;border-color:var(--accent)}
.chip-row{display:flex;flex-wrap:wrap;gap:8px}
.chip{font:inherit;font-size:.8rem;color:var(--text-muted);background:var(--bg-soft);border:1px solid var(--border);border-radius:20px;padding:4px 13px;cursor:pointer;transition:background .15s,color .15s,border-color .15s}
.chip:hover{border-color:var(--accent);color:var(--accent)}
.chip.active{background:var(--accent);border-color:var(--accent);color:#fff}
.ptitle a{color:inherit;text-decoration:none}
.ptitle a:hover{color:var(--accent);text-decoration:underline}
.ptags{display:flex;flex-wrap:wrap;gap:6px;margin-top:7px}
.ptag{font-size:.7rem;color:var(--text-muted);background:var(--bg-soft);border:1px solid var(--border);border-radius:12px;padding:1px 9px}
.pub-controls{align-items:flex-start}

/* Funding list: two columns on wider screens */
@media (min-width:640px){.hl-grants{columns:2;column-gap:36px}}
.hl-grants li{break-inside:avoid}
.theme-more{margin-top:14px;font-weight:500}

/* Funder / sponsor logo strip */
.funder-strip{display:flex;flex-wrap:wrap;gap:14px;align-items:center}
.funder{display:flex;align-items:center;justify-content:center;background:#fff;border:1px solid var(--border);border-radius:10px;padding:10px 16px;height:72px;box-sizing:border-box}
.funder img{max-height:44px;max-width:150px;width:auto;height:auto;display:block}

/* Funder marquee: auto horizontal scroll, larger logos, pause on hover */
.funder-marquee{overflow:hidden;-webkit-mask-image:linear-gradient(90deg,transparent,#000 7%,#000 93%,transparent);mask-image:linear-gradient(90deg,transparent,#000 7%,#000 93%,transparent)}
.funder-track{display:flex;gap:18px;width:max-content;animation:funder-scroll 45s linear infinite}
.funder-marquee:hover .funder-track{animation-play-state:paused}
.funder-track .funder{flex:0 0 auto;height:92px;padding:14px 24px}
.funder-track .funder img{max-height:56px;max-width:200px}
@keyframes funder-scroll{from{transform:translateX(0)}to{transform:translateX(-50%)}}
@media (prefers-reduced-motion:reduce){.funder-track{animation:none;flex-wrap:wrap}}
.funder-note{margin-top:14px;font-size:.78rem;line-height:1.55;max-width:760px}

/* Gallery: video thumbnails + lightbox */
.gphoto{cursor:pointer}
.gvideo{position:relative}
.gvideo .play{position:absolute;top:50%;left:50%;width:56px;height:56px;transform:translate(-50%,-50%);border-radius:50%;background:rgba(0,0,0,.55);pointer-events:none}
.gvideo .play::after{content:"";position:absolute;top:50%;left:55%;transform:translate(-50%,-50%);border:11px solid transparent;border-left:18px solid #fff}
.lightbox{position:fixed;inset:0;z-index:1000;display:flex;align-items:center;justify-content:center;background:rgba(0,0,0,.85);padding:24px}
.lightbox[hidden]{display:none}
.lb-body{max-width:min(1100px,92vw);max-height:88vh}
.lb-body img{max-width:100%;max-height:88vh;border-radius:8px;display:block}
.lb-video{position:relative;width:min(1100px,92vw);aspect-ratio:16/9}
.lb-video iframe{position:absolute;inset:0;width:100%;height:100%;border:0;border-radius:8px}
.lb-close{position:absolute;top:16px;right:22px;background:none;border:0;color:#fff;font-size:2.2rem;line-height:1;cursor:pointer}
