/* Anuj S.S. Mishra: personal site
   Type: Archivo (variable, weight 400–800, width 100–125%) and IBM Plex Mono (block hashes only).
   Both fonts are self-hosted under the SIL Open Font License (see assets/fonts). */

@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-var-latin.woff2") format("woff2-variations"),
       url("../fonts/archivo-var-latin.woff2") format("woff2");
  font-weight: 400 800;
  font-stretch: 100% 125%;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Plex Mono Hex";
  src: url("../fonts/plex-mono-hex.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

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

:root {
  color-scheme: light;
  --paper: #f1f4f2;
  --surface: #ffffff;
  --ink: #16201c;
  --muted: #56635d;
  --rule: #cfd9d3;
  --rule-strong: #a3b3aa;
  --accent: #0c5a47;
  --accent-soft: #dcebe4;
  --pending: #8a5000;
  --pending-soft: #fbecd4;
  --review: #66727d;

  --font: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Plex Mono Hex", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --wrap: 75rem;
  --gutter: clamp(1rem, 4vw, 2rem);
  --head-h: 3.75rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #0e1513;
    --surface: #151e1b;
    --ink: #e4ece8;
    --muted: #9daea6;
    --rule: #26332e;
    --rule-strong: #43554d;
    --accent: #7fd0b6;
    --accent-soft: #173a30;
    --pending: #f2b866;
    --pending-soft: #2e2311;
    --review: #a8b3bc;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0e1513;
  --surface: #151e1b;
  --ink: #e4ece8;
  --muted: #9daea6;
  --rule: #26332e;
  --rule-strong: #43554d;
  --accent: #7fd0b6;
  --accent-soft: #173a30;
  --pending: #f2b866;
  --pending-soft: #2e2311;
  --review: #a8b3bc;
}

/* ---------- Base ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--head-h) + 1rem);
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  font-weight: 400;
  font-stretch: 100%;
  line-height: 1.6;
  font-variant-numeric: lining-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { display: block; max-width: 100%; height: auto; }

a {
  color: var(--accent);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
a:hover { text-decoration-thickness: 2px; }

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

button { font: inherit; color: inherit; }

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 50;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
  text-decoration: none;
}
.skip:focus { top: 0.75rem; }

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

.site-head {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}
.site-head.is-scrolled { border-bottom-color: var(--rule); }

.head-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: var(--head-h);
}

.brand {
  margin-right: auto;
  color: var(--ink);
  font-weight: 700;
  font-stretch: 116%;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}

.nav { display: flex; align-items: center; }

.nav-list {
  display: flex;
  align-items: center;
  gap: 0.125rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-list a {
  display: block;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  color: var(--ink);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
}
.nav-list a:hover { background: var(--accent-soft); }
.nav-list a[aria-current="true"] { color: var(--accent); font-weight: 650; }
.nav-list .nav-cv { margin-left: 0.375rem; border: 1px solid var(--rule-strong); }
.nav-list .nav-cv:hover { border-color: var(--ink); background: transparent; }

.menu-btn,
.theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--rule-strong);
  background: transparent;
  border-radius: 999px;
  cursor: pointer;
}
.menu-btn { display: none; padding: 0.35rem 0.85rem; font-size: 0.9375rem; font-weight: 600; }
.theme-btn { width: 2.25rem; height: 2.25rem; flex: none; }
.menu-btn:hover,
.theme-btn:hover { border-color: var(--ink); }

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

@media (max-width: 47.99rem) {
  .menu-btn { display: inline-flex; }
  .nav-list {
    display: none;
    position: absolute;
    top: var(--head-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.5rem var(--gutter) 1rem;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
  }
  .nav-list.is-open { display: flex; }
  .nav-list a { padding: 0.75rem 0; border-radius: 0; border-bottom: 1px solid var(--rule); font-size: 1.0625rem; }
  .nav-list a:hover { background: transparent; color: var(--accent); }
  .nav-list .nav-cv { margin: 0; border: 0; border-bottom: 1px solid var(--rule); }
}

/* ---------- Hero ---------- */

.hero { padding-top: clamp(2rem, 6vw, 5rem); }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.75rem;
}

.name {
  margin: 0 0 1.25rem;
  font-size: clamp(2.875rem, 8.2vw, 6rem);
  font-weight: 760;
  font-stretch: 125%;
  line-height: 0.92;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.role {
  max-width: 44ch;
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-weight: 500;
}

.statement {
  max-width: 36ch;
  margin: 0 0 2rem;
  font-size: clamp(1.25rem, 2.1vw, 1.5rem);
  line-height: 1.42;
  text-wrap: pretty;
}

.actions { display: flex; flex-wrap: wrap; gap: 0.625rem; }

.btn {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  padding: 0.7rem 1.15rem;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { border-color: var(--ink); }
.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); }
:root[data-theme="dark"] .btn-primary:hover { color: var(--paper); }
.btn-note { font-size: 0.8125rem; font-weight: 500; opacity: 0.72; }
.btn-small { padding: 0.45rem 0.9rem; font-size: 0.875rem; }

.portrait { margin: 0; order: -1; width: 8.5rem; }
.portrait img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 2px;
  background: var(--rule);
}

@media (min-width: 52rem) {
  .hero-grid {
    grid-template-columns: minmax(0, 7fr) minmax(0, 4fr);
    gap: clamp(2rem, 5vw, 4.5rem);
    align-items: end;
  }
  .portrait { order: 0; width: min(100%, 22rem); justify-self: end; }
}

/* ---------- Research chain ---------- */

.chain-wrap {
  margin-top: clamp(2.5rem, 6vw, 4.5rem);
  padding-bottom: clamp(2.25rem, 5vw, 3.5rem);
  border-bottom: 1px solid var(--rule);
}

.chain-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 2rem;
  margin-bottom: 1rem;
}

.chain-title { margin: 0; font-size: 1.0625rem; font-weight: 650; }
.chain-note { max-width: 62ch; margin: 0; color: var(--muted); font-size: 0.875rem; }

.chain-scroll {
  position: relative; /* clips the hidden screen-reader text inside the blocks, so the page itself never scrolls sideways */
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  scrollbar-color: var(--rule-strong) transparent;
  padding-block: 0.5rem 0.75rem;
  min-height: 10.5rem;
}
.chain-scroll:focus-visible { outline-offset: -2px; }
.chain-scroll[data-edge~="start"] { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 3rem), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 3rem), transparent); }
.chain-scroll[data-edge~="end"] { -webkit-mask-image: linear-gradient(90deg, transparent, #000 3rem); mask-image: linear-gradient(90deg, transparent, #000 3rem); }
.chain-scroll[data-edge~="middle"] { -webkit-mask-image: linear-gradient(90deg, transparent, #000 3rem, #000 calc(100% - 3rem), transparent); mask-image: linear-gradient(90deg, transparent, #000 3rem, #000 calc(100% - 3rem), transparent); }

/* On wide screens the chain fills the content column exactly; on narrow ones it scrolls sideways. */
.chain {
  display: flex;
  align-items: stretch;
  min-width: 100%;
  width: max-content;
  margin: 0;
  padding: 0;
  padding-inline: max(var(--gutter), calc((100% - var(--wrap)) / 2 + var(--gutter)));
  list-style: none;
}

.block {
  display: flex;
  flex: 1 0 auto;
  align-items: center;
  scroll-snap-align: start;
  scroll-margin-inline: var(--gutter);
}

/* the link drawn into each block from the one before it */
.block + .block::before {
  content: "";
  display: block;
  flex: none;
  width: 0.75rem;
  height: 0;
  border-top: 2px solid var(--rule-strong);
  transition: border-color 0.3s ease;
}
.block.is-verified::before { border-top-color: var(--accent); }
.block + .block--pending::before { border-top-style: dashed; }
.block--pending.is-verified::before { border-top-color: var(--pending); }

.block a {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 6.25rem;
  min-height: 9.25rem;
  padding: 0.55rem 0.65rem 0.6rem;
  border: 1.5px solid var(--ink);
  border-radius: 3px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.block a:hover,
.block a:focus-visible { border-color: var(--accent); transform: translateY(-2px); }

.block-height { font-family: var(--mono); font-size: 0.75rem; color: var(--muted); letter-spacing: 0.02em; }
.block-venue { margin-top: 0.3rem; font-size: 0.9375rem; font-weight: 700; font-stretch: 104%; line-height: 1.12; }
.block-place,
.block-date { font-size: 0.8125rem; color: var(--muted); line-height: 1.35; }
.block-place { margin-top: 0.2rem; }
.block-hash {
  margin-top: auto;
  padding-top: 0.45rem;
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.02em;
  color: var(--accent);
  opacity: 0.35;
  transition: opacity 0.35s ease;
}
.block.is-verified .block-hash { opacity: 1; }

.block--pending a { border-style: dashed; border-color: var(--pending); background: var(--pending-soft); }
.block--pending .block-hash { color: var(--pending); }
.block--pending a:hover,
.block--pending a:focus-visible { border-color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  .block a,
  .block-hash,
  .block + .block::before { transition: none; }
  .block a:hover,
  .block a:focus-visible { transform: none; }
}

/* ---------- Sections ---------- */

.section {
  padding-block: clamp(3.25rem, 8vw, 6rem);
  border-bottom: 1px solid var(--rule);
}
.section--last { border-bottom: 0; }

.section-title {
  margin: 0 0 1.75rem;
  font-size: clamp(1.875rem, 3.6vw, 2.75rem);
  font-weight: 720;
  font-stretch: 118%;
  line-height: 1.05;
  letter-spacing: -0.025em;
}

/* Research */

.lede {
  max-width: 40ch;
  margin: 0 0 1rem;
  font-size: clamp(1.25rem, 2.1vw, 1.5rem);
  line-height: 1.42;
  text-wrap: pretty;
}
.methods { max-width: 62ch; margin: 0 0 2.75rem; color: var(--muted); }

.themes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
  gap: 0 2.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.theme { padding: 1.1rem 0 1.75rem; border-top: 1.5px solid var(--ink); }
.theme h3 { margin: 0 0 0.5rem; font-size: 1.1875rem; font-weight: 680; font-stretch: 110%; line-height: 1.25; }
.theme p { max-width: 60ch; margin: 0 0 0.75rem; }
.theme .related { margin: 0; color: var(--muted); font-size: 0.875rem; }

/* Publications: a ledger with a date column, the particulars, and a status column */

.group-title { margin: 3rem 0 0.75rem; font-size: 1.1875rem; font-weight: 680; font-stretch: 110%; }
.group-title:first-of-type { margin-top: 0.5rem; }

.ledger-year {
  margin: 1.75rem 0 0;
  padding-bottom: 0.4rem;
  border-bottom: 1.5px solid var(--ink);
  font-size: 1.0625rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.ledger { margin: 0; padding: 0; list-style: none; }
.ledger--plain { border-top: 1.5px solid var(--ink); }

.entry {
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr) 11.5rem;
  gap: 0.25rem 1.5rem;
  padding-block: 1.05rem;
  border-bottom: 1px solid var(--rule);
}
.ledger--plain .entry { grid-template-columns: minmax(0, 1fr) 11.5rem; }

.entry-date { margin: 0; padding-top: 0.05rem; color: var(--muted); font-size: 0.9375rem; font-variant-numeric: tabular-nums; }

.entry-title { max-width: 72ch; margin: 0 0 0.2rem; font-weight: 600; line-height: 1.4; text-wrap: pretty; }
.entry-title a { color: var(--ink); text-decoration-color: var(--rule-strong); }
.entry-title a:hover { color: var(--accent); text-decoration-color: currentColor; }
.entry-authors { margin: 0 0 0.15rem; font-size: 0.9375rem; line-height: 1.45; }
.entry-authors strong { font-weight: 650; }
.entry-venue { margin: 0; color: var(--muted); font-size: 0.9375rem; }

.entry-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.1rem;
  margin: 0.45rem 0 0;
  font-size: 0.875rem;
}

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  cursor: pointer;
}
.link-btn:hover { text-decoration-thickness: 2px; }

.entry-status {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin: 0;
  padding-top: 0.1rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.dot {
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  transform: translateY(-0.05rem);
}
.dot--done { background: var(--accent); }
.dot--pending { border: 1.5px solid var(--pending); background: var(--pending-soft); }
.dot--review { background: var(--review); }

@media (max-width: 40rem) {
  .entry,
  .ledger--plain .entry { grid-template-columns: auto minmax(0, 1fr); gap: 0.35rem 1rem; }
  .entry-body { grid-column: 1 / -1; order: 2; }
  .entry-date { order: 0; }
  .entry-status { order: 1; justify-self: end; }
  .ledger--plain .entry-status { grid-column: 1 / -1; justify-self: start; }
}

/* Background */

.bg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
  gap: 2.5rem 3rem;
}
.bg-block h3 {
  margin: 0;
  padding-bottom: 0.45rem;
  border-bottom: 1.5px solid var(--ink);
  font-size: 1.0625rem;
  font-weight: 680;
  font-stretch: 110%;
}
.bg-list { margin: 0; padding: 0; list-style: none; }
.bg-list li { padding-block: 0.7rem; border-bottom: 1px solid var(--rule); }
.bg-list .k { display: block; font-weight: 600; line-height: 1.35; }
.bg-list .v { display: block; margin-top: 0.15rem; color: var(--muted); font-size: 0.9375rem; line-height: 1.5; }

/* Contact */

.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2rem 4rem;
}
@media (min-width: 52rem) {
  .contact-grid { grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); align-items: end; }
}

.contact-lede { max-width: 48ch; margin: 0 0 1.25rem; color: var(--muted); }

.email-line { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem; margin: 0; }
.email {
  color: var(--ink);
  font-size: clamp(1.5rem, 5.4vw, 3rem);
  font-weight: 700;
  font-stretch: 112%;
  letter-spacing: -0.02em;
  line-height: 1.1;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  overflow-wrap: anywhere;
}
.email:hover { color: var(--accent); }

.contact-links { margin: 0 0 1.25rem; padding: 0; list-style: none; }
.contact-links li { border-bottom: 1px solid var(--rule); }
.contact-links li:first-child { border-top: 1px solid var(--rule); }
.contact-links a { display: block; padding: 0.6rem 0; font-weight: 600; text-decoration: none; }
.contact-links a:hover { text-decoration: underline; }

address { color: var(--muted); font-size: 0.9375rem; font-style: normal; line-height: 1.55; }

/* Footer */

.site-foot { border-top: 1px solid var(--rule); color: var(--muted); font-size: 0.875rem; }
.foot-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.25rem 2rem; padding-block: 1.5rem 2rem; }
.foot-inner p { margin: 0; }

/* 404 */

.notfound { min-height: 70vh; display: grid; align-content: center; padding-block: 4rem; }
.notfound p { max-width: 44ch; color: var(--muted); }

/* ---------- Print ---------- */

@media print {
  :root { --paper: #fff; --surface: #fff; --ink: #000; --muted: #333; --rule: #bbb; --rule-strong: #888; --accent: #000; }
  .site-head, .skip, .actions, .chain-wrap, .theme-btn, .entry-links .link-btn, .email-line .btn { display: none !important; }
  .hero { padding-top: 0; }
  .portrait { width: 6rem; }
  .section { padding-block: 1.5rem; break-inside: auto; }
  .entry { break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}
