/* Adiba Shaira — personal site
   Type: Newsreader (headings) + IBM Plex Sans (text), both SIL OFL, self-hosted.
   Layout: one compact column; lists use a two-column ledger (meta | body) that stacks on phones. */

@font-face {
  font-family: "Newsreader";
  src: url("../fonts/newsreader-var.woff2") format("woff2");
  font-weight: 400 650;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/plex-sans-var.woff2") format("woff2");
  font-weight: 100 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/plex-sans-var-italic.woff2") format("woff2");
  font-weight: 100 700;
  font-style: italic;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;
  --paper: #ffffff;
  --paper-glass: rgba(255, 255, 255, 0.88);
  --band: #f3f5f8;
  --ink: #172233;
  --ink-2: #364256;
  --muted: #5c6778;
  --rule: #dde2ea;
  --accent: #ad2550;
  --accent-text: #9f2048;
  --accent-line: rgba(173, 37, 80, 0.42);
  --accent-wash: #fbecf1;
  --ongoing-bg: #e6eaf0;
  --ongoing-ink: #364256;
  --button-bg: #172233;
  --button-ink: #ffffff;

  --display: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;

  --container: 1040px;
  --gutter: clamp(16px, 4vw, 32px);
  --meta: 9rem;
  --topbar-h: 60px;
  --section-pad: clamp(32px, 4.5vw, 52px);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #0f1520;
    --paper-glass: rgba(15, 21, 32, 0.86);
    --band: #151d2a;
    --ink: #e7ebf1;
    --ink-2: #c4ccd8;
    --muted: #98a4b4;
    --rule: #283447;
    --accent: #ef6f96;
    --accent-text: #f48aab;
    --accent-line: rgba(239, 111, 150, 0.5);
    --accent-wash: #2c1823;
    --ongoing-bg: #222d3d;
    --ongoing-ink: #c4ccd8;
    --button-bg: #e7ebf1;
    --button-ink: #0f1520;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0f1520;
  --paper-glass: rgba(15, 21, 32, 0.86);
  --band: #151d2a;
  --ink: #e7ebf1;
  --ink-2: #c4ccd8;
  --muted: #98a4b4;
  --rule: #283447;
  --accent: #ef6f96;
  --accent-text: #f48aab;
  --accent-line: rgba(239, 111, 150, 0.5);
  --accent-wash: #2c1823;
  --ongoing-bg: #222d3d;
  --ongoing-ink: #c4ccd8;
  --button-bg: #e7ebf1;
  --button-ink: #0f1520;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-h) + 12px);
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; height: auto; }
p { margin: 0; }
ul, ol, dl, dd { margin: 0; padding: 0; }
ul, ol { list-style: none; }
strong { font-weight: 600; }

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-color: var(--accent-line);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}
a:hover { color: var(--accent-text); text-decoration-color: currentColor; }

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

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 50;
  padding: 8px 14px;
  background: var(--button-bg);
  color: var(--button-ink);
  border-radius: 6px;
  text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--paper-glass);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}
.topbar.is-scrolled { border-bottom-color: var(--rule); }

.topbar__inner {
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--topbar-h);
}

.topbar__name {
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}
.topbar__name:hover { color: var(--ink); }

.nav { margin-left: auto; }
.nav__list { display: flex; align-items: center; gap: 2px; }
.nav__link {
  display: block;
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
}
.nav__link:hover { color: var(--ink); background: var(--band); }
.nav__link[aria-current="location"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); border-radius: 6px 6px 0 0; }
.nav__link--cv {
  margin-left: 6px;
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 4px 14px;
}
.nav__link--cv:hover { border-color: var(--ink); background: transparent; }

.topbar__tools { display: flex; align-items: center; gap: 4px; }

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
}
.icon-button:hover { background: var(--band); color: var(--ink); }

.menu-toggle { display: none; }

/* ---------- Intro ---------- */
.intro { padding: clamp(28px, 4.5vw, 52px) 0 clamp(32px, 5vw, 56px); }

.intro__grid {
  display: grid;
  grid-template-columns: 184px minmax(0, 1fr);
  grid-template-areas:
    "photo head"
    "photo bio"
    "photo links";
  grid-template-rows: auto auto 1fr;
  column-gap: clamp(28px, 4vw, 48px);
}

.intro__photo { grid-area: photo; margin: 0; }
.intro__photo img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 4px;
  background: var(--band);
}

.intro__head { grid-area: head; }
.intro__name {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.75rem, 3vw, 2.125rem);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.012em;
}
.intro__role { margin-top: 2px; color: var(--muted); font-size: 1rem; }

.intro__bio { grid-area: bio; max-width: 72ch; margin-top: 14px; }
.intro__bio p + p { margin-top: 0.7em; }
.intro__interests { color: var(--ink-2); }

.intro__links {
  grid-area: links;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 22px;
  margin-top: 18px;
  font-weight: 500;
}

.button {
  display: inline-flex;
  align-items: center;
  padding: 6px 18px;
  border-radius: 999px;
  background: var(--button-bg);
  color: var(--button-ink);
  font-weight: 500;
  text-decoration: none;
}
.button:hover { color: var(--button-ink); background: var(--accent); }

/* ---------- Sections ---------- */
.section { padding: var(--section-pad) 0; }
.section--band { background: var(--band); }

.section-title {
  margin: 0 0 18px;
  font-family: var(--display);
  font-size: clamp(1.5rem, 2.4vw, 1.75rem);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

/* Two blocks side by side on wide screens */
.split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: clamp(32px, 5vw, 56px);
  row-gap: 36px;
}
.split .row { --meta: 8.5rem; }
.split .rows--short-meta .row { --meta: 5.25rem; }

/* Ledger rows: meta | body */
.row {
  display: grid;
  grid-template-columns: var(--meta) minmax(0, 1fr);
  column-gap: clamp(16px, 3vw, 32px);
}
.rows > .row + .row { margin-top: 16px; }
.rows--tight > .row + .row { margin-top: 8px; }
.rows--loose > .row + .row { margin-top: 28px; }

.row__meta {
  padding-top: 0.1em;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
}
.row__meta p + p { margin-top: 6px; }
.row__body { max-width: 76ch; }
.row__body > * + * { margin-top: 6px; }

.entry__detail { color: var(--muted); font-size: 0.9375rem; }
.row__body > .entry__detail { margin-top: 0; }

.status {
  display: inline-block;
  padding: 1px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.7;
  white-space: nowrap;
}
.status--published { background: var(--accent-wash); color: var(--accent-text); }
.status--ongoing { background: var(--ongoing-bg); color: var(--ongoing-ink); }

/* Research */
.project__title {
  margin: 0;
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.25;
}
.now {
  padding-left: 14px;
  border-left: 2px solid var(--accent);
}

/* Publications */
.pub__venue-short { color: var(--ink); font-weight: 600; }
.pub__title {
  margin: 0;
  font-family: var(--display);
  font-size: 1.1875rem;
  font-weight: 560;
  line-height: 1.3;
}
.pub__title a { text-decoration-color: transparent; }
.pub__title a:hover { text-decoration-color: currentColor; }
.row__body > .pub__authors { margin-top: 4px; color: var(--ink-2); }
.pub__authors strong { color: var(--ink); }
.row__body > .pub__venue { margin-top: 0; color: var(--muted); font-style: italic; }
.pub__links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 20px;
  font-size: 0.9375rem;
  font-weight: 500;
}
.award {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-text);
}

/* Other projects */
.mini-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px clamp(32px, 5vw, 56px);
}
.mini__title {
  margin: 0 0 4px;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.45;
}
.mini__year { margin-left: 4px; color: var(--muted); font-weight: 400; font-size: 0.875rem; }
.mini p { color: var(--ink-2); font-size: 0.9375rem; }
.mini__tech { color: var(--muted); }
.mini__tech::before { content: " "; }

/* Skills */
.skills dt { font-weight: 500; color: var(--ink-2); }

/* ---------- Footer ---------- */
.footer {
  padding: var(--section-pad) 0 28px;
  border-top: 1px solid var(--rule);
}
.footer__grid {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 12px clamp(24px, 4vw, 48px);
}
.footer__title {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.5rem, 2.4vw, 1.75rem);
  font-weight: 500;
  line-height: 1.15;
}
.footer__text { color: var(--ink-2); }
.footer__links { display: flex; gap: 18px; font-weight: 500; }
.footer__meta {
  grid-column: 1 / -1;
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.8125rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .footer__grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
  .menu-toggle { display: inline-grid; }
  .nav {
    position: absolute;
    top: var(--topbar-h);
    left: 0;
    right: 0;
    display: none;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
    box-shadow: 0 12px 24px -16px rgba(23, 34, 51, 0.35);
  }
  .nav.is-open { display: block; }
  .nav__list {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px var(--gutter) 16px;
  }
  .nav__link { padding: 11px 4px; font-size: 1rem; border-radius: 0; }
  .nav__link:hover { background: transparent; }
  .nav__link[aria-current="location"] { box-shadow: inset 3px 0 0 var(--accent); padding-left: 14px; border-radius: 0; }
  .nav__link--cv { margin: 8px 0 0; padding: 9px 16px; text-align: center; border-radius: 999px; }
  .topbar__tools { margin-left: auto; }
}

@media (max-width: 640px) {
  .intro__grid {
    grid-template-columns: 96px minmax(0, 1fr);
    grid-template-areas:
      "photo head"
      "bio bio"
      "links links";
    grid-template-rows: auto;
    column-gap: 18px;
    align-items: center;
  }
  .intro__bio { margin-top: 18px; }

  .row, .split .row { grid-template-columns: minmax(0, 1fr); row-gap: 2px; }
  .rows--dates > .row,
  .split .rows--dates > .row { grid-template-columns: 4.75rem minmax(0, 1fr); column-gap: 12px; }
  .project .row__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
  .project .row__meta p + p { margin-top: 0; }
  .mini-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  a, .topbar { transition: none; }
}

@media print {
  .topbar, .skip-link { display: none; }
  .section--band { background: none; }
  a { text-decoration: none; }
}
