/* Vipin Singh, personal site. Colors follow the CV (navy #27438D, light blue #C3DFF1). */
@font-face { font-family: "Ubuntu"; src: url("../fonts/Ubuntu-L.woff2") format("woff2"); font-weight: 300 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Ubuntu"; src: url("../fonts/Ubuntu-LI.woff2") format("woff2"); font-weight: 300 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Ubuntu"; src: url("../fonts/Ubuntu-B.woff2") format("woff2"); font-weight: 500 700; font-style: normal; font-display: swap; }

:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --text: #18202f;
  --muted: #586276;
  --line: #e1e6ef;
  --accent: #27438d;
  --accent-ink: #ffffff;
  --accent-soft: #e5eefa;
  --accent-2: #2f7d8c;
  --side-bg: linear-gradient(165deg, #1c3270 0%, #27438d 55%, #2c5a9e 100%);
  --side-text: #f1f5ff;
  --side-muted: #c3d3f2;
  --side-iso: rgba(195, 223, 241, 0.16);
  --shadow: 0 1px 2px rgba(20, 30, 60, .05), 0 6px 24px rgba(20, 30, 60, .06);
  --b-journal: #1f6f4a; --b-conference: #27438d; --b-demo: #8a4b0f; --b-workshop: #6b3c8f;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1220; --surface: #141b2c; --text: #e4e9f3; --muted: #9ba6bb; --line: #253049;
    --accent: #93b4f6; --accent-ink: #0d1220; --accent-soft: #1b2847; --accent-2: #7cc6d2;
    --side-bg: linear-gradient(165deg, #0a1124 0%, #111d3d 60%, #142650 100%);
    --side-text: #e8eefc; --side-muted: #9fb2db; --side-iso: rgba(147, 180, 246, 0.14);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 28px rgba(0, 0, 0, .25);
    --b-journal: #7fd1a8; --b-conference: #93b4f6; --b-demo: #f2b16b; --b-workshop: #c9a3ec;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1220; --surface: #141b2c; --text: #e4e9f3; --muted: #9ba6bb; --line: #253049;
  --accent: #93b4f6; --accent-ink: #0d1220; --accent-soft: #1b2847; --accent-2: #7cc6d2;
  --side-bg: linear-gradient(165deg, #0a1124 0%, #111d3d 60%, #142650 100%);
  --side-text: #e8eefc; --side-muted: #9fb2db; --side-iso: rgba(147, 180, 246, 0.14);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 28px rgba(0, 0, 0, .25);
  --b-journal: #7fd1a8; --b-conference: #93b4f6; --b-demo: #f2b16b; --b-workshop: #c9a3ec;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 300 17px/1.65 "Ubuntu", system-ui, -apple-system, "Segoe UI", sans-serif;
  display: grid; grid-template-columns: 330px minmax(0, 1fr);
}
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px; border-radius: 4px; }
strong, b, h1, h2, h3, h4 { font-weight: 700; }
.ic { width: 1.05em; height: 1.05em; vertical-align: -0.15em; flex: none; }
.ic.sm { width: .75em; height: .75em; vertical-align: 0; opacity: .7; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }

/* ---------- sidebar ---------- */
.side {
  position: sticky; top: 0; height: 100vh; overflow: hidden auto;
  background: var(--side-bg); color: var(--side-text);
}
.iso { position: absolute; inset: 0; width: 100%; height: 100%; color: var(--side-iso); pointer-events: none; }
.side-inner { position: relative; padding: 48px 36px 32px; display: flex; flex-direction: column; align-items: center; text-align: center; min-height: 100%; }
.avatar {
  width: 168px; height: 168px; border-radius: 50%; object-fit: cover;
  border: 4px solid rgba(255, 255, 255, .85); box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
}
.name { margin: 20px 0 2px; font-size: 1.75rem; letter-spacing: .01em; line-height: 1.2; }
.role { margin: 0; color: var(--side-muted); font-weight: 400; }
.aff { margin: 8px 0 0; font-size: .9rem; color: var(--side-muted); line-height: 1.5; }
.aff a { color: inherit; }
.nav { list-style: none; padding: 0; margin: 34px 0 0; width: 100%; }
.nav a {
  display: block; padding: 9px 14px; margin: 2px 0; border-radius: 8px;
  color: var(--side-text); text-decoration: none; font-weight: 400; letter-spacing: .02em;
}
.nav a:hover { background: rgba(255, 255, 255, .08); }
.nav a.active { background: rgba(255, 255, 255, .14); font-weight: 700; }
.social { list-style: none; display: flex; gap: 5px; padding: 0; margin: 28px 0 28px; justify-content: center; flex-wrap: wrap; }
.social a {
  display: grid; place-items: center; width: 37px; height: 37px; border-radius: 50%;
  color: var(--side-text); background: rgba(255, 255, 255, .08); transition: background .15s, transform .15s;
}
.social a:hover { background: rgba(255, 255, 255, .2); transform: translateY(-1px); }
.social .ic { width: 17px; height: 17px; }
.social .lab-ic { width: 22px; height: 22px; }
.inline-ic { width: 1.1em; height: 1.1em; vertical-align: -0.2em; margin-right: .3em; }
.lab-link { white-space: nowrap; }
.theme {
  margin-top: auto; padding: 7px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .25); background: transparent; color: var(--side-muted);
  font: inherit; font-size: .85rem; display: inline-flex; gap: 8px; align-items: center;
}
.theme:hover { color: var(--side-text); border-color: rgba(255, 255, 255, .5); }
.theme .sun { display: none; }
:root[data-theme="dark"] .theme .moon { display: none; }
:root[data-theme="dark"] .theme .sun { display: inline; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme .moon { display: none; }
  :root:not([data-theme="light"]) .theme .sun { display: inline; }
}

/* ---------- main ---------- */
main { padding: 56px clamp(20px, 5vw, 72px) 40px; max-width: 920px; width: 100%; margin: 0 auto; }
section { padding: 8px 0 48px; scroll-margin-top: 24px; }
section + section { border-top: 1px solid var(--line); padding-top: 44px; }
.eyebrow { margin: 0; text-transform: uppercase; letter-spacing: .14em; font-size: .78rem; font-weight: 700; color: var(--accent-2); }
h2 { font-size: clamp(1.6rem, 2.6vw, 2.1rem); line-height: 1.2; margin: 6px 0 18px; letter-spacing: -.005em; }
h3.sub { font-size: 1.05rem; margin: 30px 0 12px; }
.lede { color: var(--muted); margin-top: -6px; }
p { margin: 0 0 14px; }

.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 12px 0 0; }
.tags li { font-size: .8rem; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 400; }
.tags.big li { font-size: .9rem; padding: 5px 13px; }

/* news */
.news { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.news-card {
  display: flex; flex-direction: column; height: 100%; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  box-shadow: var(--shadow); transition: transform .15s, border-color .15s;
}
.news-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.news-img { display: block; aspect-ratio: 4 / 3; background: #fff; overflow: hidden; }
.news-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.news-img.fit-contain img { object-fit: contain; padding: 8px; }
.news-card time { font-size: .75rem; color: var(--muted); margin: 10px 14px 0; letter-spacing: .02em; }
.news-title { font-weight: 700; font-size: .92rem; line-height: 1.35; margin: 2px 14px 14px; }
.news-card:hover .news-title { color: var(--accent); }

/* news detail pages */
body.subpage { display: block; }
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px clamp(16px, 4vw, 40px); background: var(--side-bg); color: var(--side-text);
}
.home { display: inline-flex; align-items: center; gap: 10px; color: var(--side-text); text-decoration: none; font-weight: 700; }
.home img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255, 255, 255, .8); }
.topnav { display: flex; align-items: center; gap: 14px; }
.topnav a { color: var(--side-text); text-decoration: none; font-size: .92rem; }
.topnav a:hover { text-decoration: underline; }
.topbar .theme { margin: 0; padding: 6px 10px; }
.post { max-width: 780px; margin: 0 auto; padding: 40px 16px 32px; }
.post h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); line-height: 1.2; margin: 6px 0 10px; }
.post-meta { color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.post-meta .btn { padding: 5px 12px; font-size: .88rem; }
.post-hero { margin: 18px 0 12px; }
.post-hero .plate { display: flex; align-items: center; justify-content: center; background: var(--surface); height: min(560px, 70vh); }
.post-hero .plate img { width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; }  /* never upscaled */
.post-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 18px; }
.post-gallery .plate { aspect-ratio: 4 / 3; cursor: pointer; outline-offset: 2px; }
.post-gallery .plate img { width: 100%; height: 100%; object-fit: cover; }
.post-gallery .plate.is-on { outline: 2px solid var(--accent); }
.post-gallery .plate:not(.is-on) img { opacity: .75; }
.post-gallery .plate:hover img { opacity: 1; }
.post-body { margin: 22px 0 30px; overflow-wrap: anywhere; }
.pagers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 28px; }
.pager {
  display: block; padding: 12px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  color: var(--text); text-decoration: none; font-weight: 700; font-size: .9rem; line-height: 1.35;
}
.pager span { display: block; font-weight: 400; font-size: .75rem; color: var(--muted); margin-bottom: 2px; }
.pager:hover { border-color: var(--accent); color: var(--accent); }
.pager.older { grid-column: 2; text-align: right; }
@media (max-width: 600px) { .pagers { grid-template-columns: 1fr; } .pager.older { grid-column: 1; } .home span { display: none; } }

/* projects */
.cards { display: grid; gap: 18px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 22px 24px;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent); opacity: .8; }
.card h3 { margin: 2px 0 8px; font-size: 1.15rem; line-height: 1.35; }
.card p { margin-bottom: 8px; }
.card-kicker { font-size: .82rem; color: var(--muted); margin: 0; }
.card-links { display: flex; gap: 16px; margin: 12px 0 0; font-weight: 400; }

/* publications */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 8px; }
.filter {
  font: inherit; font-size: .88rem; padding: 6px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
}
.filter:hover { border-color: var(--accent); }
.filter.is-on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
h3.year { font-size: .95rem; color: var(--muted); margin: 26px 0 8px; letter-spacing: .04em; }
.pubs { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.pub { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px 22px; box-shadow: var(--shadow); }
.pub[hidden] { display: none; }
.pub-meta { display: flex; gap: 10px; align-items: center; font-size: .82rem; color: var(--muted); }
.badge { font-weight: 700; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; padding: 2px 8px; border-radius: 6px; border: 1px solid currentColor; }
.b-journal { color: var(--b-journal); } .b-conference { color: var(--b-conference); }
.b-demo { color: var(--b-demo); }
.b-track { color: var(--muted); border-style: dashed; } .b-workshop { color: var(--b-workshop); }
.pub-title { font-size: 1.05rem; line-height: 1.4; margin: 8px 0 4px; }
.pub-authors { font-size: .93rem; margin: 0 0 2px; }
.pub-authors .me { color: var(--text); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.pub-where { font-size: .9rem; color: var(--muted); margin: 0 0 8px; }
.pub-where .note { white-space: nowrap; }
.oa { font-size: .78rem; color: var(--b-journal); font-weight: 700; margin-left: 4px; }
.pub-sum { font-size: .93rem; margin-bottom: 10px; }
.pub-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
.chip {
  display: inline-block; font-size: .8rem; font-weight: 400; padding: 3px 11px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--accent); text-decoration: none; cursor: pointer; list-style: none;
}
.chip:hover { border-color: var(--accent); background: var(--accent-soft); }
.bib { flex-basis: auto; }
.bib summary::-webkit-details-marker { display: none; }
.bib[open] { flex-basis: 100%; }
.bib-box { position: relative; margin-top: 8px; }
.bib pre {
  margin: 0; padding: 14px 16px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--text);
  white-space: pre-wrap; overflow-wrap: anywhere;   /* wrap long fields inside the card; copying keeps the original */
  padding-right: 64px;                               /* room for the Copy button */
}
.pub-body, .pub-actions, .bib, .bib-box { min-width: 0; max-width: 100%; }
.copy {
  position: absolute; top: 8px; right: 8px; font: inherit; font-size: .75rem; padding: 3px 10px; cursor: pointer;
  border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--text);
}

/* figures */
figure { margin: 0; }
figcaption { font-size: .8rem; line-height: 1.45; color: var(--muted); margin-top: 8px; }
.plate {
  display: block; background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  transition: transform .15s, box-shadow .15s;
}
.plate:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.plate img { display: block; width: 100%; height: auto; object-fit: contain; }
:root[data-theme="dark"] .plate img { filter: brightness(.93); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .plate img { filter: brightness(.93); } }
.schematic { display: block; width: 100%; height: auto; }
/* project cards: figure across the full card, text below */
.card { display: grid; grid-template-columns: 1fr; gap: 16px; }
.card-fig .plate { display: flex; justify-content: center; padding: 14px; }
.card-fig .plate img { width: auto; max-width: 100%; max-height: 340px; }
.card-fig.is-svg .schematic { max-width: 620px; margin: 0 auto; }
.card-fig figcaption { max-width: 72ch; }
/* switchable figure views */
.view-tabs { display: none; gap: 6px; margin-bottom: 10px; }
.js .view-tabs { display: flex; }
.js .view:not(.is-on) { display: none; }
.view + .view { margin-top: 16px; }
.js .view + .view { margin-top: 0; }
.view-tab {
  font: inherit; font-size: .82rem; padding: 4px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
}
.view-tab:hover { border-color: var(--accent); }
.view-tab.is-on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.card-fig .plate img[src$="project-groundwater.webp"] { max-height: 360px; }

/* publication thumbnails */
.pub { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; align-items: start; }
.pub-fig .plate { display: flex; align-items: center; justify-content: center; height: 170px; padding: 10px; }
.pub-fig .plate img { width: auto; height: auto; max-width: 100%; max-height: 100%; }
.pub-fig .plate.fit-cover { padding: 0; }
.pub-fig .plate.fit-cover-right { padding: 0; }
.pub-fig .plate.fit-cover-right img { width: 100%; height: 100%; max-width: none; max-height: none; object-fit: cover; object-position: right center; }
.pub-fig .plate.fit-cover img { width: 100%; height: 100%; max-width: none; max-height: none; object-fit: cover; object-position: left top; }
.pub-fig figcaption { display: none; }
@media (max-width: 960px) {
  .pub { grid-template-columns: 1fr; gap: 14px; }
  .pub-fig .plate { height: auto; max-height: 240px; }
  .pub-fig .plate img { max-height: 220px; }
  .pub-fig .plate.fit-cover, .pub-fig .plate.fit-cover-right { height: 200px; }
  .card-fig .plate { padding: 8px; }
}

/* CV */
.cv-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 10px; font-weight: 400;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); text-decoration: none;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.timeline { list-style: none; margin: 0; padding: 0; }
.news-link:hover .news-title { color: var(--accent); }
.tl-item { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 20px; padding: 12px 0; }
.tl-item + .tl-item { border-top: 1px dashed var(--line); }
.tl-when { font-size: .85rem; color: var(--muted); padding-top: 3px; }
.tl-body h4 { margin: 0; font-size: 1rem; }
.tl-org { margin: 0 0 6px; color: var(--muted); font-size: .92rem; }
.tl-body ul { margin: 0; padding-left: 1.1em; font-size: .93rem; }
.tl-body li { margin: 2px 0; }
.tl-body li::marker { color: var(--accent); }
.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; }
.kv { margin: 0; }
.kv div { display: grid; grid-template-columns: 140px 1fr; gap: 12px; padding: 5px 0; font-size: .95rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* contact */
.contact { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 24px; box-shadow: var(--shadow); }
.mail { display: inline-flex; gap: 10px; align-items: center; font-size: 1.15rem; font-weight: 400; }
.addr { display: flex; gap: 10px; color: var(--muted); margin: 14px 0 0; font-size: .95rem; line-height: 1.5; }
.addr .ic { margin-top: 3px; }
.social.inline { justify-content: flex-start; margin-top: 18px; }
.social.inline a { color: var(--accent); background: var(--accent-soft); }

.foot { color: var(--muted); font-size: .82rem; border-top: 1px solid var(--line); padding-top: 20px; }
.foot p { margin: 0 0 4px; }
.foot a { color: inherit; }

/* ---------- small screens: sidebar becomes a header ---------- */
@media (max-width: 960px) {
  body { display: block; }
  .side { position: relative; height: auto; }
  .side-inner { padding: 36px 16px 22px; min-height: 0; }
  .avatar { width: 128px; height: 128px; }
  .name { font-size: 1.55rem; margin-top: 14px; }
  .nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin-top: 20px; }
  .nav a { padding: 6px 12px; margin: 0; background: rgba(255, 255, 255, .08); }
  .social { margin: 18px 0 0; }
  .side-inner > .theme { margin-top: 16px; }
  main { padding: 36px 16px 32px; }
  .tl-item { grid-template-columns: 1fr; gap: 2px; }
  .kv-grid { grid-template-columns: 1fr; }
  .kv div { grid-template-columns: 120px 1fr; }
  .pub, .card { padding: 16px; }
}
@media print {
  body { display: block; }
  .side, .filters, .theme, .pub-actions, .cv-actions { display: none; }
  .pub, .card, .contact { box-shadow: none; }
}
