/* ==========================================================================
   Ayush Mishra — personal site
   Minimal editorial design system. All content pages share this stylesheet.
   ========================================================================== */

@font-face {
  font-family: 'Libertinus Serif';
  src: url('../../font/WOFF2/LibertinusSerif-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Libertinus Serif';
  src: url('../../font/WOFF2/LibertinusSerif-Semibold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Libertinus Serif';
  src: url('../../font/WOFF2/LibertinusSerif-Italic.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

/* --- Tokens --------------------------------------------------------------- */

:root {
  --bg:            #fcfcfb;
  --bg-subtle:     #f4f4f1;
  --text:          #1c1c1a;
  --text-muted:    #6b6b66;
  --text-faint:    #93938c;
  --accent:        #8c2332;
  --accent-soft:   rgba(140, 35, 50, 0.09);
  --accent-border: rgba(140, 35, 50, 0.25);
  --border:        #e3e3de;
  --border-strong: #cdcdc6;

  --serif: 'Libertinus Serif', Georgia, 'Times New Roman', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;

  --measure: 44rem;
  --gutter: 1.5rem;
  --radius: 8px;
}

:root[data-theme='dark'] {
  --bg:            #131315;
  --bg-subtle:     #1b1b1e;
  --text:          #e9e9e6;
  --text-muted:    #a3a39d;
  --text-faint:    #7a7a75;
  --accent:        #e0919c;
  --accent-soft:   rgba(224, 145, 156, 0.12);
  --accent-border: rgba(224, 145, 156, 0.28);
  --border:        #2b2b30;
  --border-strong: #3d3d43;
}

/* --- Reset ---------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

h1, h2, h3, h4, p, ul, ol, figure, table { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img { max-width: 100%; display: block; }

a {
  color: inherit;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

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

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

/* --- Layout --------------------------------------------------------------- */

.wrap {
  width: 100%;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

main.wrap {
  flex: 1;
  padding-top: 3.5rem;
  padding-bottom: 5rem;
}

.section { margin-top: 3.5rem; }

/* Collapse the gap only where a section follows the page intro directly — the
   intro already carries its own bottom margin. Keyed to the intro rather than
   :first-of-type, which also matched the first section on pages that open with
   a bio or profile links and left it jammed against them. */
.page-intro + .section { margin-top: 0; }

/* --- Header / nav --------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

/* color-mix is well supported, but fall back to a solid bar if it is not. */
@supports not (background: color-mix(in srgb, red 50%, transparent)) {
  .site-header { background: var(--bg); }
}

.site-header__inner {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 var(--gutter);
  height: 60px;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.site-header__name {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

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

.site-nav a {
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
}

.site-nav a:hover {
  color: var(--text);
  background: var(--bg-subtle);
}

.site-nav a[aria-current='page'] {
  color: var(--accent);
  background: var(--accent-soft);
}

.theme-toggle {
  flex: none;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.theme-toggle:hover { color: var(--text); border-color: var(--border-strong); }
.theme-toggle svg { width: 15px; height: 15px; }

/* --- Typography ----------------------------------------------------------- */

.page-title {
  font-family: var(--serif);
  font-size: clamp(2rem, 5vw, 2.6rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin-bottom: 0.5rem;
}

.page-intro {
  color: var(--text-muted);
  font-size: 1.02rem;
  max-width: 36rem;
  margin-bottom: 2.75rem;
}

.section-title {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  margin-bottom: 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.section-title__aside {
  margin-left: auto;
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 400;
}

.subhead {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 0.9rem;
}

/* A second group under the same heading needs air above it. */
.row-list + .subhead,
.name-grid + .subhead,
.venue-list + .subhead { margin-top: 2rem; }

.page-intro + .profile-links { margin-top: 0; }
.section-title + .prose { margin-bottom: 1.5rem; }

.prose p { margin-bottom: 1.1rem; }
.prose p:last-child { margin-bottom: 0; }
.prose a { text-decoration-color: var(--accent); }

/* --- Venue pills ----------------------------------------------------------
   Every conference name on the site renders as a .pill. Tier-1 venues get a
   dedicated hue so they are easy to pick out when scanning; everything else
   falls back to the neutral tokens below. To add a venue, add a colour block
   here and a matching entry to VENUE_STYLES in assets/js/site.js. */

.pill {
  display: inline-block;
  padding: 0.05rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.55;
  white-space: nowrap;
  color: var(--pill-fg, var(--text-muted));
  background: var(--pill-bg, var(--bg-subtle));
  border: 1px solid var(--pill-bd, var(--border));
}

/* Listed in hue order. Spacing is checked so no two sit closer than ~20deg —
   at 11 venues that is about the limit of what stays tellable apart. */
.pill--icnp       { --pill-fg: #a8321f; --pill-bg: rgba(168, 50, 31, 0.10);  --pill-bd: rgba(168, 50, 31, 0.22); }
.pill--imc        { --pill-fg: #8f5310; --pill-bg: rgba(143, 83, 16, 0.11);  --pill-bd: rgba(143, 83, 16, 0.24); }
.pill--mobicom    { --pill-fg: #5b6a10; --pill-bg: rgba(91, 106, 16, 0.10);  --pill-bd: rgba(91, 106, 16, 0.22); }
.pill--nsdi       { --pill-fg: #12654c; --pill-bg: rgba(18, 101, 76, 0.10);  --pill-bd: rgba(18, 101, 76, 0.22); }
.pill--nines      { --pill-fg: #0f5f70; --pill-bg: rgba(15, 95, 112, 0.10);  --pill-bd: rgba(15, 95, 112, 0.22); }
.pill--sigcomm    { --pill-fg: #1a4f8a; --pill-bg: rgba(26, 79, 138, 0.10);  --pill-bd: rgba(26, 79, 138, 0.22); }
.pill--infocom    { --pill-fg: #2f6d33; --pill-bg: rgba(47, 109, 51, 0.10);  --pill-bd: rgba(47, 109, 51, 0.22); }
.pill--atc        { --pill-fg: #3a3f9e; --pill-bg: rgba(58, 63, 158, 0.10);  --pill-bd: rgba(58, 63, 158, 0.22); }
.pill--sigmetrics { --pill-fg: #653396; --pill-bg: rgba(101, 51, 150, 0.10); --pill-bd: rgba(101, 51, 150, 0.22); }
.pill--hotnets    { --pill-fg: #8d2478; --pill-bg: rgba(141, 36, 120, 0.10); --pill-bd: rgba(141, 36, 120, 0.22); }
.pill--osdi       { --pill-fg: #a31f45; --pill-bg: rgba(163, 31, 69, 0.10);  --pill-bd: rgba(163, 31, 69, 0.22); }

:root[data-theme='dark'] .pill--icnp       { --pill-fg: #ef9370; --pill-bg: rgba(239, 147, 112, 0.13); --pill-bd: rgba(239, 147, 112, 0.26); }
:root[data-theme='dark'] .pill--imc        { --pill-fg: #e2a75d; --pill-bg: rgba(226, 167, 93, 0.13);  --pill-bd: rgba(226, 167, 93, 0.26); }
:root[data-theme='dark'] .pill--mobicom    { --pill-fg: #b8c95c; --pill-bg: rgba(184, 201, 92, 0.13);  --pill-bd: rgba(184, 201, 92, 0.26); }
:root[data-theme='dark'] .pill--nsdi       { --pill-fg: #63c9a5; --pill-bg: rgba(99, 201, 165, 0.13);  --pill-bd: rgba(99, 201, 165, 0.26); }
:root[data-theme='dark'] .pill--nines      { --pill-fg: #6fc9dd; --pill-bg: rgba(111, 201, 221, 0.13); --pill-bd: rgba(111, 201, 221, 0.26); }
:root[data-theme='dark'] .pill--sigcomm    { --pill-fg: #8cb8ec; --pill-bg: rgba(140, 184, 236, 0.13); --pill-bd: rgba(140, 184, 236, 0.26); }
:root[data-theme='dark'] .pill--infocom    { --pill-fg: #85cc85; --pill-bg: rgba(133, 204, 133, 0.13); --pill-bd: rgba(133, 204, 133, 0.26); }
:root[data-theme='dark'] .pill--atc        { --pill-fg: #9ea6f5; --pill-bg: rgba(158, 166, 245, 0.13); --pill-bd: rgba(158, 166, 245, 0.26); }
:root[data-theme='dark'] .pill--sigmetrics { --pill-fg: #c4a2f0; --pill-bg: rgba(196, 162, 240, 0.13); --pill-bd: rgba(196, 162, 240, 0.26); }
:root[data-theme='dark'] .pill--hotnets    { --pill-fg: #eb92d4; --pill-bg: rgba(235, 146, 212, 0.13); --pill-bd: rgba(235, 146, 212, 0.26); }
:root[data-theme='dark'] .pill--osdi       { --pill-fg: #f0879f; --pill-bg: rgba(240, 135, 159, 0.13); --pill-bd: rgba(240, 135, 159, 0.26); }

/* Quiet variant: keeps the venue hue as text colour but drops the fill and
   border, so a long list of them reads as secondary to the filled pills.
   Must follow .pill to win on equal specificity. */
.pill--quiet {
  padding: 0;
  background: transparent;
  border-color: transparent;
}

/* Inline wrapped list of venues, used for each service group. */
.venue-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1.15rem;
  align-items: baseline;
}

.venue-list li {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Quiet group: same pill size, but unfilled and with fainter years, so it
   reads as secondary without shrinking to the point of being hard to read. */
.venue-list--quiet li {
  font-size: 0.82rem;
  color: var(--text-faint);
}

.venue {
  color: var(--accent);
  font-weight: 500;
}

.muted { color: var(--text-muted); }

/* --- Home ----------------------------------------------------------------- */

.hero {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  margin-bottom: 2.5rem;
}

.hero__photo {
  flex: none;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
}

.hero__name {
  font-family: var(--serif);
  font-size: clamp(2.4rem, 7vw, 3.4rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.015em;
  margin-bottom: 0.75rem;
}

.hero__roles {
  color: var(--text-muted);
  font-size: 1.02rem;
  line-height: 1.5;
}

.hero__roles span { display: block; }
.hero__roles .now { color: var(--text); }

.profile-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 2rem;
}

.profile-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
}

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

/* --- News ----------------------------------------------------------------- */

.news-list { display: flex; flex-direction: column; }

.news-item {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 1.25rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}

.news-list .news-item:last-child { border-bottom: none; }

.news-item__date {
  color: var(--text-faint);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  padding-top: 0.15rem;
  white-space: nowrap;
}

.news-item__text { font-size: 0.97rem; }

/* --- Publications --------------------------------------------------------- */

.pub-list { counter-reset: pub; }

.pub {
  counter-increment: pub;
  display: grid;
  grid-template-columns: 2.25rem 1fr;
  gap: 0.5rem;
  padding: 1.15rem 0;
  border-bottom: 1px solid var(--border);
}

.pub-list .pub:last-child { border-bottom: none; }

.pub::before {
  content: '[' counter(pub) ']';
  color: var(--text-faint);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  padding-top: 0.2rem;
}

.pub__title {
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 0.25rem;
}

.pub__authors {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}

.pub__authors strong { color: var(--text); font-weight: 600; }

.pub__venue {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem;
}

/* Year headings in the "all publications" view. */
.pub-year {
  margin: 2.25rem 0 0.25rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

.pub-list > .pub-year:first-child { margin-top: 0; }

.pub-year h2 {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-faint);
}

.pub__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.6rem;
}

.pub__links a,
.tag {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.76rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-decoration: none;
}

.pub__links a:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.toggle-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.25rem 0.7rem;
  font-family: var(--sans);
  font-size: 0.82rem;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
}

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

/* --- Talks ---------------------------------------------------------------- */

.talks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
}

.talk {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.talk:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  color: inherit;
}

.talk__thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
}

.talk__body {
  padding: 0.9rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

/* Wrapper only — the pill inside carries the styling, and this keeps it from
   stretching to the full width of the flex column. */
.talk__venue { display: flex; }

.talk__title {
  font-size: 0.97rem;
  font-weight: 600;
  line-height: 1.35;
}

.talk__desc {
  font-size: 0.86rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.talk__kind {
  margin-top: auto;
  padding-top: 0.5rem;
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* --- Generic rows (awards, teaching, service) ----------------------------- */

.row-list { display: flex; flex-direction: column; }

.row {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 1.25rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--border);
}

.row-list .row:last-child { border-bottom: none; }

.row__meta {
  color: var(--text-faint);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.row__main { font-size: 0.97rem; }
.row__sub { font-size: 0.88rem; color: var(--text-muted); margin-top: 0.1rem; }

.course { padding: 0.9rem 0; border-bottom: 1px solid var(--border); }
.row-list .course:last-child { border-bottom: none; }
.course__name { font-weight: 600; font-size: 0.99rem; }
.course__meta { font-size: 0.88rem; color: var(--text-muted); margin-top: 0.1rem; }

.course__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.course__links a {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.76rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-decoration: none;
}

.course__links a:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

.name-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.35rem 1.25rem;
}

.name-grid li { font-size: 0.95rem; }

.bullets { display: flex; flex-direction: column; gap: 0.6rem; }
.bullets li { font-size: 0.95rem; padding-left: 1.1rem; position: relative; }
.bullets li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.65em;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--border-strong);
}

/* --- Notice banner --------------------------------------------------------
   Accent-tinted announcement block. Matches .profile-links' top margin so the
   home page keeps one rhythm below the bio. */

.notice {
  margin-top: 2rem;
  padding: 1.05rem 1.3rem;
  border: 1px solid var(--accent-border);
  border-radius: var(--radius);
  background: var(--accent-soft);
  font-size: 0.95rem;
  line-height: 1.6;
}

.notice__eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.3rem;
}

.notice a {
  text-decoration-color: var(--accent);
}

/* --- Callout -------------------------------------------------------------- */

.callout {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  background: var(--bg-subtle);
  font-size: 0.95rem;
}

/* --- Footer --------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  font-size: 0.85rem;
  color: var(--text-faint);
}

.site-footer__inner {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  justify-content: space-between;
}

/* --- Loading / error states ----------------------------------------------- */

.state {
  padding: 1.25rem 0;
  color: var(--text-faint);
  font-size: 0.9rem;
}

.state--error {
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  background: var(--bg-subtle);
}

.state--error code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--accent-soft);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

/* --- Small screens -------------------------------------------------------- */

@media (max-width: 640px) {
  /* Stack the header so every nav item stays visible instead of scrolling
     off the side: name + toggle on one row, the full nav on the next. The
     two-row header is too tall to keep pinned on a phone, so let it scroll. */
  .site-header { position: static; }

  .site-header__inner {
    height: auto;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
  }

  .site-header__name { font-size: 1.05rem; }
  .theme-toggle { order: 2; margin-left: auto; }

  .site-nav {
    order: 3;
    width: 100%;
    margin-left: -0.6rem;
    flex-wrap: wrap;
    overflow-x: visible;
  }

  main.wrap { padding-top: 2.5rem; }

  /* Stack the portrait above the name rather than squeezing them side by side. */
  .hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.1rem;
  }

  .hero__photo { width: 104px; height: 104px; }

  .news-item,
  .row { grid-template-columns: 1fr; gap: 0.15rem; }
  .pub { grid-template-columns: 1fr; }
  .pub::before { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
