/*
 * nikhilreddybilla28.github.io
 * Single-page academic layout in the style of Jon Barron's template
 * (bio + photo header, publication rows with thumbnails, highlighted papers),
 * extended with experience, projects, and skills sections.
 */

/* ---------- tokens ---------- */
:root {
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --bg: #ffffff;
  --bg-soft: #f6f6f3;
  --surface: #ffffff;
  --text: #1b1c1f;
  --text-2: #474c54;
  --muted: #6b717b;
  --border: #e6e4de;
  --accent: #1a5fb4;
  --accent-hover: #124a8f;
  --on-accent: #ffffff;
  --accent-soft: #eaf1fb;
  --hl-bg: #fffaea;
  --hl-border: #f1dc9a;
  --chip-bg: #f2f3f5;
  --badge-bg: #eaf1fb;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 8px 24px rgba(16, 24, 40, 0.06);

  --svg-bg: #f4f5f7;
  --svg-ink: #3b4048;
  --svg-muted: #b3b8c0;
  --svg-a: #1a5fb4;
  --svg-b: #d9822b;
  --svg-c: #1e9468;
  --svg-d: #8b55c9;
  --svg-hot: #d64545;

  --maxw: 880px;
  --radius: 12px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1216;
    --bg-soft: #151a20;
    --surface: #141920;
    --text: #e7e9ec;
    --text-2: #bcc2cb;
    --muted: #8d95a1;
    --border: #262c35;
    --accent: #82b6ff;
    --accent-hover: #a9ceff;
    --on-accent: #0b1320;
    --accent-soft: #172538;
    --hl-bg: #1a1810;
    --hl-border: #4f4420;
    --chip-bg: #1b2129;
    --badge-bg: #172538;
    --shadow: none;

    --svg-bg: #171c23;
    --svg-ink: #d5d9df;
    --svg-muted: #4b535e;
    --svg-a: #6fa8ff;
    --svg-b: #f0a45a;
    --svg-c: #45c88e;
    --svg-d: #b98cf0;
    --svg-hot: #ff7b7b;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0f1216;
  --bg-soft: #151a20;
  --surface: #141920;
  --text: #e7e9ec;
  --text-2: #bcc2cb;
  --muted: #8d95a1;
  --border: #262c35;
  --accent: #82b6ff;
  --accent-hover: #a9ceff;
  --on-accent: #0b1320;
  --accent-soft: #172538;
  --hl-bg: #1a1810;
  --hl-border: #4f4420;
  --chip-bg: #1b2129;
  --badge-bg: #172538;
  --shadow: none;

  --svg-bg: #171c23;
  --svg-ink: #d5d9df;
  --svg-muted: #4b535e;
  --svg-a: #6fa8ff;
  --svg-b: #f0a45a;
  --svg-c: #45c88e;
  --svg-d: #b98cf0;
  --svg-hot: #ff7b7b;
  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* In-text links are underlined so they don't rely on color alone (WCAG 1.4.1). */
a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
}

a:hover {
  color: var(--accent-hover);
  text-decoration-color: currentColor;
}

.brand,
.nav a,
.links a,
.pill,
.pub-title a,
.card h3 a,
.section-title .aside,
.skip {
  text-decoration: none;
}

.pub-title a:hover,
.card h3 a:hover,
.section-title .aside:hover {
  text-decoration: underline;
}

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

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

strong {
  font-weight: 650;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 100;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--on-accent);
}

.skip:focus {
  left: 12px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

@supports (backdrop-filter: blur(8px)) or (-webkit-backdrop-filter: blur(8px)) {
  .topbar {
    background: color-mix(in srgb, var(--bg) 84%, transparent);
    -webkit-backdrop-filter: saturate(1.4) blur(10px);
    backdrop-filter: saturate(1.4) blur(10px);
  }
}

.topbar-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  font-weight: 650;
  color: var(--text);
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.brand:hover {
  color: var(--text);
  text-decoration: none;
}

.nav {
  display: flex;
  gap: 2px;
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.nav::-webkit-scrollbar {
  display: none;
}

.nav a {
  color: var(--text-2);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 500;
  white-space: nowrap;
}

.nav a:hover,
.nav a[aria-current="true"] {
  background: var(--chip-bg);
  color: var(--text);
  text-decoration: none;
}

.theme-toggle {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--muted);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

.theme-toggle .icon-sun {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun {
    display: block;
  }

  :root:not([data-theme="light"]) .theme-toggle .icon-moon {
    display: none;
  }
}

/* ---------- layout ---------- */
.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
}

main > section {
  padding: 30px 0 6px;
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 14px;
  font-size: 1.32rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.section-title .aside {
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0;
}

.lead {
  margin: 0 0 16px;
  color: var(--text-2);
}

/* ---------- intro ---------- */
.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  grid-template-rows: auto 1fr;
  gap: 24px 40px;
  align-items: start;
  padding-top: 44px;
}

.intro-text {
  grid-column: 1;
  grid-row: 1 / span 2;
}

.photo {
  grid-column: 2;
  grid-row: 1;
}

.interests {
  grid-column: 2;
  grid-row: 2;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-soft);
}

.interests .subhead {
  margin: 0 0 6px;
}

.interests ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.interests li {
  position: relative;
  padding: 3px 0 3px 14px;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--text-2);
}

.interests li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.intro h1 {
  margin: 0 0 4px;
  font-size: 2.35rem;
  line-height: 1.15;
  font-weight: 750;
  letter-spacing: -0.025em;
}

.role {
  margin: 0 0 18px;
  color: var(--text-2);
  font-size: 1.06rem;
}

.intro p {
  margin: 0 0 14px;
}

.photo img {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow:
    0 0 0 1px var(--border),
    var(--shadow);
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.links a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.3;
}

.links a:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.links a.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.links a.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--on-accent);
}

.links svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  flex: none;
}

/* ---------- news ---------- */
.news {
  list-style: none;
  margin: 0;
  padding: 0;
}

.news li {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 14px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--border);
}

.news li:last-child {
  border-bottom: 0;
}

.news time {
  color: var(--muted);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  padding-top: 1px;
  white-space: nowrap;
}

details.more > summary {
  display: inline-block;
  margin-top: 8px;
  color: var(--accent);
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  list-style: none;
}

details.more > summary::-webkit-details-marker {
  display: none;
}

details.more > summary::after {
  content: " \2193";
}

details.more[open] > summary::after {
  content: " \2191";
}

details.more[open] > summary {
  margin-bottom: 4px;
}

/* ---------- publications ---------- */
.pubs {
  display: grid;
  gap: 6px;
}

.pub {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 22px;
  padding: 18px;
  margin: 0 -18px;
  border-radius: var(--radius);
  scroll-margin-top: 72px;
}

.pub--hl {
  background: var(--hl-bg);
  box-shadow: inset 0 0 0 1px var(--hl-border);
}

.pub-thumb {
  position: relative;
  align-self: start;
  aspect-ratio: 4 / 3;
  border-radius: 10px;
  overflow: hidden;
  background: var(--svg-bg);
  box-shadow: 0 0 0 1px var(--border);
}

.pub-thumb img,
.pub-thumb svg,
.pub-thumb picture {
  width: 100%;
  height: 100%;
}

.pub-thumb img {
  object-fit: cover;
}

.pub-thumb .tag {
  position: absolute;
  bottom: 6px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.pub-title {
  margin: 0 0 4px;
  font-size: 1.02rem;
  line-height: 1.42;
  font-weight: 650;
  letter-spacing: -0.005em;
}

.pub-title a {
  color: var(--text);
}

.pub-title a:hover {
  color: var(--accent);
}

.pub-authors {
  margin: 0 0 5px;
  color: var(--text-2);
  font-size: 0.93rem;
}

.pub-authors strong {
  color: var(--text);
}

.pub-authors a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--border);
}

.pub-authors a:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}

.pub-venue {
  margin: 0 0 9px;
  color: var(--text-2);
  font-size: 0.92rem;
}

.badge {
  display: inline-block;
  margin-right: 6px;
  vertical-align: 1px;
  padding: 1px 8px;
  border-radius: 6px;
  background: var(--badge-bg);
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.pub-links {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 6px;
  margin: 0 0 9px;
}

.pill,
details.bib > summary {
  display: inline-block;
  padding: 2px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.6;
  cursor: pointer;
}

.pill:hover,
details.bib > summary:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

details.bib > summary {
  display: block;
  width: fit-content;
  list-style: none;
}

details.bib > summary::-webkit-details-marker {
  display: none;
}

details.bib[open] {
  flex-basis: 100%;
}

details.bib[open] > summary {
  border-color: var(--accent);
  color: var(--accent);
}

.bib-body {
  position: relative;
  margin-top: 8px;
}

.bib-body pre {
  margin: 0;
  padding: 12px 14px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-soft);
  color: var(--text);
  font: 12.5px/1.55 var(--font-mono);
  white-space: pre;
}

.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-2);
  font: 600 0.75rem/1.6 var(--font-sans);
  cursor: pointer;
}

.copy-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.pub-tldr {
  margin: 0;
  font-size: 0.95rem;
}

.pub-note {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.subhead {
  margin: 22px 0 8px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pub--plain {
  grid-template-columns: minmax(0, 1fr);
  padding-top: 4px;
}

/* inline SVG thumbnails pick up theme colors through these classes */
.pub-thumb text {
  font-family: var(--font-sans);
  fill: var(--svg-ink);
}

.t-bg {
  fill: var(--svg-bg);
}

.t-ink {
  fill: var(--svg-ink);
}

.t-muted {
  fill: var(--svg-muted);
}

.t-a {
  fill: var(--svg-a);
}

.t-b {
  fill: var(--svg-b);
}

.t-c {
  fill: var(--svg-c);
}

.t-d {
  fill: var(--svg-d);
}

.t-hot {
  fill: var(--svg-hot);
}

.s-ink {
  stroke: var(--svg-ink);
}

.s-muted {
  stroke: var(--svg-muted);
}

.s-a {
  stroke: var(--svg-a);
}

.s-hot {
  stroke: var(--svg-hot);
}

.pub-thumb text.t-muted {
  fill: var(--muted);
}

.pub-thumb text.t-a {
  fill: var(--svg-a);
}

.pub-thumb text.t-hot {
  fill: var(--svg-hot);
}

.pub-thumb text.t-c {
  fill: var(--svg-c);
}

/* ---------- experience ---------- */
.job {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 20px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
}

.job:first-of-type {
  border-top: 0;
  padding-top: 4px;
}

.job-when {
  padding-top: 2px;
  color: var(--muted);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.job-role {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 650;
  line-height: 1.45;
}

.job-org {
  margin: 0;
  color: var(--text-2);
  font-size: 0.95rem;
}

.job ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.job li {
  margin: 4px 0;
  font-size: 0.95rem;
}

.job li::marker {
  color: var(--muted);
}

.job--compact ul {
  margin-top: 4px;
}

/* ---------- projects ---------- */
.projects {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.card h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.4;
}

.card p {
  margin: 0;
  color: var(--text-2);
  font-size: 0.93rem;
}

.card .meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.card .chips {
  margin-top: auto;
  padding-top: 4px;
}

.chips li {
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--chip-bg);
  color: var(--text-2);
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.6;
}

/* ---------- education / service ---------- */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 36px;
}

.two-col h2 {
  margin-top: 0;
}

.plain-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.plain-list li {
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 0.95rem;
}

.plain-list li:last-child {
  border-bottom: 0;
}

.plain-list .when {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
}

/* ---------- skills ---------- */
.skills {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 12px 20px;
  margin: 0;
}

.skills dt {
  padding-top: 2px;
  font-size: 0.93rem;
  font-weight: 600;
}

.skills dd {
  margin: 0;
}

/* ---------- footer ---------- */
.site-footer {
  max-width: var(--maxw);
  margin: 44px auto 0;
  padding: 22px 20px 44px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.87rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 20px;
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  color: var(--text-2);
}

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .intro {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
    padding-top: 28px;
  }

  .intro-text,
  .photo,
  .interests {
    grid-column: auto;
    grid-row: auto;
  }

  .photo {
    order: -1;
  }

  .photo img {
    width: 132px;
    height: 132px;
  }

  .intro h1 {
    font-size: 1.95rem;
  }

  .job {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }

  .two-col {
    grid-template-columns: minmax(0, 1fr);
  }

  .skills {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }

  .skills dd {
    margin-bottom: 10px;
  }
}

@media (max-width: 640px) {
  .brand,
  .nav .nav-wide {
    display: none;
  }

  .nav {
    margin-left: -6px;
  }

  .nav a {
    padding: 6px 8px;
  }

  .pub {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    padding: 16px 14px;
    margin: 0 -14px;
  }

  .pub-thumb {
    aspect-ratio: 16 / 9;
  }

  .news li {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* ---------- print ---------- */
@media print {
  .topbar,
  .theme-toggle,
  .skip,
  details.bib {
    display: none !important;
  }

  body {
    font-size: 11pt;
  }

  .pub--hl {
    box-shadow: none;
    background: none;
  }

  a {
    color: inherit;
  }
}
