/* ==========================================================================
   Sabadnoor Singh — personal research site
   Plain CSS, no build step. Design tokens live in :root.
   ========================================================================== */

:root {
  /* Color */
  --bg: #faf8f4;
  --surface: #f3efe7;
  --text: #1d1a18;
  --muted: #57504a;
  --rule: #e3ddd3;
  --rule-strong: #cfc6b8;
  --accent: #7b1e2e;
  --accent-hover: #5c1421;
  --accent-soft: #f5e9e8;

  /* Type */
  --serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, "Iowan Old Style", Georgia, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --fs-body: 1.0625rem;      /* 17px */
  --fs-small: 0.9rem;
  --fs-meta: 0.8125rem;
  --lh-body: 1.65;

  /* Layout */
  --measure: 42rem;
  --gutter: 1rem;
  --section-gap: 4.5rem;
}

@media (min-width: 40rem) {
  :root {
    --fs-body: 1.125rem;     /* 18px */
    --gutter: 1.5rem;
  }
}

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

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

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}

h1,
h2,
h3,
h4 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.25;
  margin: 0;
  color: var(--text);
}

p,
ul,
ol,
dl {
  margin: 0;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

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

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

strong {
  font-weight: 700;
}

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

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -3rem;
  z-index: 10;
  padding: 0.5rem 0.9rem;
  background: var(--text);
  color: var(--bg);
  font-family: var(--sans);
  font-size: var(--fs-small);
  text-decoration: none;
  border-radius: 3px;
}

.skip-link:focus {
  top: 0.75rem;
  color: var(--bg);
}

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

.layout {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.site-header {
  padding: 1.5rem 0 1rem;
  border-bottom: 1px solid var(--rule);
}

.site-title {
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.005em;
}

.site-title:hover {
  color: var(--accent);
  text-decoration: none;
}

.site-role {
  margin-top: 0.15rem;
  font-family: var(--sans);
  font-size: var(--fs-meta);
  color: var(--muted);
}

.site-nav ul {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
}

.site-nav a,
.site-contact a {
  font-family: var(--sans);
  font-size: var(--fs-small);
  color: var(--muted);
  text-decoration: none;
}

.site-nav a:hover,
.site-contact a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.site-contact {
  display: none;
}

main {
  max-width: var(--measure);
  padding: 2.5rem 0 1rem;
}

@media (min-width: 62rem) {
  .layout {
    display: grid;
    grid-template-columns: 14rem minmax(0, 1fr);
    column-gap: 5rem;
  }

  .site-header {
    position: sticky;
    top: 0;
    align-self: start;
    max-height: 100vh;
    overflow-y: auto;
    padding: 3rem 0 1rem;
    border-bottom: 0;
  }

  .site-nav ul {
    flex-direction: column;
    gap: 0.45rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--rule);
  }

  .site-contact {
    display: block;
    list-style: none;
    padding: 1.25rem 0 0;
    margin: 1.25rem 0 0;
    border-top: 1px solid var(--rule);
  }

  .site-contact li + li {
    margin-top: 0.4rem;
  }

  main {
    padding-top: 3rem;
  }
}

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

img {
  max-width: 100%;
}

.section {
  padding-top: var(--section-gap);
  scroll-margin-top: 1rem;
}

.section + .section {
  margin-top: 0;
}

.section-title {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  font-size: 1.5rem;
  padding-bottom: 0.75rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--rule-strong);
}

.section-intro {
  color: var(--muted);
  margin: -0.75rem 0 2rem;
  font-size: var(--fs-small);
  font-family: var(--sans);
}

/* ---------- Introduction ---------- */

.intro h1 {
  font-size: clamp(1.4rem, 1.2rem + 0.6vw, 1.7rem);
  font-weight: 500;
  line-height: 1.32;
  letter-spacing: -0.005em;
  max-width: 32ch;
}

.intro .lede {
  margin-top: 1rem;
  max-width: 38rem;
  color: var(--muted);
}

.intro-links,
.file-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin-top: 1.25rem;
  padding: 0;
  list-style: none;
  font-family: var(--sans);
  font-size: var(--fs-small);
  font-weight: 600;
}

.label {
  font-family: var(--sans);
  font-size: var(--fs-meta);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.note {
  margin-top: 1rem;
  font-family: var(--sans);
  font-size: var(--fs-meta);
  color: var(--muted);
}

/* ---------- Featured paper ---------- */

.featured {
  margin-top: 2.5rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule-strong);
  display: grid;
  gap: 1.25rem;
}

.featured-thumb {
  order: 2;
  display: block;
  max-width: 16rem;
  border: 1px solid var(--rule);
  line-height: 0;
}

.featured-thumb img {
  width: 100%;
  height: auto;
}

.featured h2 {
  font-size: 1.25rem;
  margin-top: 0.4rem;
}

.featured-body > p:not(.label):not(.pub-status) {
  margin-top: 0.6rem;
}

.featured .file-links {
  margin-top: 0.85rem;
}

@media (min-width: 48rem) {
  .featured {
    grid-template-columns: 14rem minmax(0, 1fr);
    gap: 1.75rem;
    align-items: start;
  }

  .featured-thumb {
    order: 0;
  }
}

/* ---------- Status tags ---------- */

.status {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.3;
  padding: 0.15rem 0.5rem;
  border-radius: 2px;
  border: 1px solid var(--rule-strong);
  color: var(--muted);
  white-space: nowrap;
  vertical-align: 0.1em;
}

.status--accepted {
  border-color: transparent;
  background: var(--accent-soft);
  color: var(--accent);
}

.status--ongoing {
  border-color: var(--rule-strong);
  color: var(--text);
}

.status--completed {
  border-style: dashed;
}

/* ---------- Research entries ---------- */

.entry + .entry {
  margin-top: 3.25rem;
  padding-top: 3.25rem;
  border-top: 1px solid var(--rule);
}

.entry-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
  font-family: var(--sans);
  font-size: var(--fs-meta);
  color: var(--muted);
  margin-bottom: 0.6rem;
}

.entry h3 {
  font-size: 1.3rem;
}

.entry-org {
  margin-top: 0.35rem;
  font-family: var(--sans);
  font-size: var(--fs-small);
  color: var(--muted);
  line-height: 1.5;
}

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

.entry-summary {
  margin-top: 0.9rem;
}

.points {
  margin-top: 1rem;
  padding-left: 1.15rem;
}

.points li {
  padding-left: 0.2rem;
}

.points li + li {
  margin-top: 0.55rem;
}

.points li::marker {
  color: var(--accent);
}

/* ---------- Disclosure (details/summary) ---------- */

details {
  margin-top: 1.25rem;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 0;
  font-family: var(--sans);
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--accent);
}

summary::-webkit-details-marker {
  display: none;
}

summary::before {
  content: "";
  flex: none;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  margin-right: 0.15rem;
}

details[open] > summary::before {
  transform: rotate(45deg) translate(-0.1rem, -0.1rem);
}

@media (prefers-reduced-motion: no-preference) {
  summary::before {
    transition: transform 0.15s ease;
  }
}

summary:hover {
  color: var(--accent-hover);
}

.details-body {
  padding: 0.25rem 0 1.25rem;
  font-size: var(--fs-body);
}

.details-body > * + * {
  margin-top: 0.9rem;
}

.details-body ul {
  padding-left: 1.2rem;
}

.details-body li + li {
  margin-top: 0.45rem;
}

.details-body h4 {
  font-family: var(--sans);
  font-size: var(--fs-small);
  font-weight: 600;
  margin: 1.25rem 0 0;
}

.details-body h4:first-child {
  margin-top: 0.25rem;
}

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

.pub-group + .pub-group {
  margin-top: 2.5rem;
}

.pub-group h3 {
  font-family: var(--sans);
  font-size: var(--fs-meta);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1rem;
}

.pub-list {
  list-style: none;
  padding: 0;
}

.pub-list > li + li {
  margin-top: 1.75rem;
}

.citation {
  line-height: 1.6;
}

.citation .title {
  font-style: normal;
}

.pub-status {
  margin-top: 0.6rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  align-items: center;
  font-family: var(--sans);
  font-size: var(--fs-meta);
  color: var(--muted);
}

.pub-note {
  margin-top: 0.5rem;
  font-size: var(--fs-small);
  color: var(--muted);
  font-family: var(--sans);
  line-height: 1.55;
}

/* ---------- Projects ---------- */

.project + .project {
  margin-top: 2.25rem;
  padding-top: 2.25rem;
  border-top: 1px solid var(--rule);
}

.project h3 {
  font-size: 1.2rem;
}

.project p {
  margin-top: 0.6rem;
}

.project .project-link {
  margin-top: 0.25rem;
  font-family: var(--sans);
  font-size: var(--fs-small);
  font-weight: 600;
}

.project-link a::after {
  content: " \2197";
  font-weight: 400;
}

.shot {
  margin: 1.25rem 0 0;
}

.shot img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--rule-strong);
  border-radius: 3px;
}

.shot figcaption {
  margin-top: 0.5rem;
  font-family: var(--sans);
  font-size: var(--fs-meta);
  color: var(--muted);
}

/* ---------- Education, methods, community: compact definition rows ---------- */

.rows {
  display: grid;
  gap: 1.5rem;
}

.row dt {
  font-family: var(--sans);
  font-size: var(--fs-meta);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.row dd {
  margin: 0.35rem 0 0;
}

@media (min-width: 40rem) {
  .row {
    display: grid;
    grid-template-columns: 11rem minmax(0, 1fr);
    column-gap: 1.5rem;
  }

  .row dt {
    padding-top: 0.3rem;
  }

  .row dd {
    margin: 0;
  }
}

.edu h3 {
  font-size: 1.2rem;
}

.edu-meta {
  margin-top: 0.35rem;
  font-family: var(--sans);
  font-size: var(--fs-small);
  color: var(--muted);
}

.edu .rows {
  margin-top: 1.5rem;
}

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

.plain-list li + li {
  margin-top: 0.3rem;
}

.methods details {
  margin-top: 0.6rem;
}

.community-list {
  list-style: none;
  padding: 0;
}

.community-list li + li {
  margin-top: 1.25rem;
}

.community-list .what {
  display: block;
}

.community-list .when {
  display: block;
  font-family: var(--sans);
  font-size: var(--fs-meta);
  color: var(--muted);
  margin-top: 0.15rem;
}

/* ---------- Contact & footer ---------- */

.contact-list {
  list-style: none;
  padding: 0;
  margin-top: 1.25rem;
}

.contact-list li + li {
  margin-top: 0.5rem;
}

.contact-list .label {
  display: inline-block;
  min-width: 6rem;
}

.site-footer {
  margin-top: var(--section-gap);
  padding: 1.5rem 0 3rem;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: var(--fs-meta);
  color: var(--muted);
}

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

@media print {
  :root {
    --bg: #fff;
    --section-gap: 1.5rem;
  }

  .site-nav,
  .skip-link,
  .shot,
  .featured-thumb {
    display: none;
  }

  .layout {
    display: block;
  }

  .site-header {
    position: static;
    padding: 0 0 0.5rem;
  }

  main {
    max-width: none;
    padding-top: 1rem;
  }

  a {
    color: inherit;
  }

  .entry,
  .project {
    break-inside: avoid;
  }
}

/* ---------- 404 page ---------- */

.notfound h1 {
  font-size: 1.6rem;
}

.notfound p {
  margin-top: 1rem;
}
