/* =========================================================================
   sergred.emcomm.cc — single hand-authored stylesheet.
   Paper-white, monospace, minimal. No framework, no JS, no web-font
   downloads: the stack prefers a locally-installed IBM Plex Mono (OFL) and
   falls back to open system monos. Light/dark via prefers-color-scheme.
   Palette: white/near-white paper, neutral ink, rust accent — no blue,
   no prominent grey surfaces. All text tones measured ≥ 4.5:1 (WCAG AA).
   ========================================================================= */

:root {
  --bg: #ffffff;          /* paper */
  --bg-soft: #f6f6f5;     /* very light grey, used sparingly (code) */
  --fg: #1d1d1b;          /* ink */
  --fg-muted: #5f5f5b;
  --fg-faint: #747470;    /* 4.69:1 on --bg — AA for small text */
  --border: #e4e4e1;
  --accent: #9c3b22;      /* rust */
  --accent-fg: #ffffff;
  --you: #7d2f1a;
  --measure: 46rem;
  --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", "Cascadia Code",
    Consolas, "DejaVu Sans Mono", "Liberation Mono", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1a19;        /* dark paper */
    --bg-soft: #232322;
    --fg: #e8e8e5;
    --fg-muted: #a8a8a2;
    --fg-faint: #96968f;  /* 5.85:1 on --bg — AA for small text */
    --border: #333330;
    --accent: #d98a63;
    --accent-fg: #1a1a19;
    --you: #e8b39a;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  line-height: 1.7;
  text-rendering: optimizeLegibility;
}

/* --- layout ------------------------------------------------------------- */

.wrap {
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: 1.25rem;
}

main {
  padding-block: 2.5rem 3rem;
}

/* --- backlink ------------------------------------------------------------
   There is no site header: each page opens with at most one contextual
   "← back" link; the footer is the site-wide constant. */

.backlink {
  margin-bottom: 1.75rem;
  font-size: 0.88rem;
}
.backlink a {
  color: var(--fg-muted);
  text-decoration: none;
}
.backlink a::before {
  content: "← " / "";
}
.backlink a:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* --- typography --------------------------------------------------------- */

h1,
h2,
h3 {
  line-height: 1.3;
  font-weight: 700;
}
h1 {
  font-size: 1.45rem;
  margin: 0 0 0.75rem;
}
h2 {
  font-size: 1.1rem;
  margin: 2.25rem 0 0.75rem;
}
h3 {
  font-size: 1rem;
  margin: 1.5rem 0 0.5rem;
}
p {
  margin: 0 0 1rem;
}
a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover {
  text-decoration-thickness: 2px;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}
code {
  background: var(--bg-soft);
  padding: 0.1em 0.35em;
  font-size: 0.9em;
}

/* --- home / profile ----------------------------------------------------- */

.profile {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  flex-wrap: wrap;
}
.profile-photo {
  width: 128px;
  height: 128px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  flex: 0 0 auto;
}
.profile-intro {
  flex: 1 1 16rem;
  min-width: 15rem;
}
.profile-name {
  margin: 0 0 0.2rem;
  font-size: 1.45rem;
}
.profile-tagline {
  color: var(--fg-muted);
  margin: 0 0 0.75rem;
}

/* Icon links (inline SVG, currentColor). */
.contact-links {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.contact-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  border: 1px solid var(--border);
  color: var(--fg-muted);
}
.contact-links a:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.contact-links svg {
  display: block;
  width: 1.35rem;
  height: 1.35rem;
}

.bio {
  margin-top: 2rem;
}

/* --- publications list -------------------------------------------------- */

.year-heading {
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-faint);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.35rem;
  margin: 1.75rem 0 0.75rem;
}
.pub {
  padding: 0.75rem 0;
}
.pub + .pub {
  border-top: 1px dashed var(--border);
}
.pub-title {
  margin: 0 0 0.2rem;
  font-weight: 700;
}
.pub-title a {
  color: var(--fg);
  text-decoration: none;
}
.pub-title a:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.pub-meta {
  color: var(--fg-muted);
  font-size: 0.88rem;
}
.pub-authors {
  color: var(--fg-muted);
  font-size: 0.85rem;
  margin: 0.15rem 0 0;
}
.author-you {
  color: var(--you);
  font-weight: 700;
}

/* --- small labels ------------------------------------------------------- */

.tag {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-faint);
}
.tag::before {
  content: "· " / "";
}
.cite-badge {
  font-size: 0.82rem;
  color: var(--fg-muted);
  white-space: nowrap;
}
.cite-badge::before {
  content: "· " / "";
}
.cite-badge strong {
  color: var(--fg);
}

/* --- single paper ------------------------------------------------------- */

.paper-title {
  margin-bottom: 0.4rem;
}
.paper-venue {
  color: var(--fg-muted);
  margin: 0 0 0.25rem;
}
.paper-authors {
  color: var(--fg-muted);
  font-size: 0.9rem;
  margin: 0 0 1.25rem;
}

/* Bracketed action links: [pdf] [doi] [arxiv] */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin: 1.25rem 0;
}
.btn {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
/* Brackets are decorative: the `/ ""` alternative text keeps them out of the
   link's accessible name so screen readers say "PDF", not "[PDF]". Engines
   without support ignore the whole declaration — cosmetic loss only. */
.btn::before {
  content: "[" / "";
  color: var(--fg-faint);
}
.btn::after {
  content: "]" / "";
  color: var(--fg-faint);
}
.btn:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.btn-primary {
  font-weight: 700;
}

.abstract {
  border-left: 3px solid var(--border);
  padding: 0.25rem 0 0.25rem 1.1rem;
  margin: 1.5rem 0;
}
.abstract h2 {
  margin-top: 0;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-faint);
}
.abstract p {
  font-size: 0.9rem;
}
.abstract p:last-child {
  margin-bottom: 0;
}

/* --- citations panel ---------------------------------------------------- */

.cite-panel {
  margin-top: 2.5rem;
}
.cite-headline {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.cite-number {
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1;
}
.cite-source-breakdown {
  color: var(--fg-faint);
  font-size: 0.82rem;
}
.cite-note {
  color: var(--fg-faint);
  font-size: 0.82rem;
  margin-top: 0.35rem;
}
.notice {
  color: var(--fg-muted);
  border: 1px dashed var(--border);
  padding: 0.75rem 1rem;
  font-size: 0.88rem;
}

.cited-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
}
.cited-item {
  padding: 0.65rem 0;
  border-top: 1px dashed var(--border);
  font-size: 0.9rem;
}
.cited-item .ct {
  font-weight: 500;
}
.cited-item .cm {
  color: var(--fg-muted);
  font-size: 0.82rem;
}

/* --- CV prose ----------------------------------------------------------- */

.prose ul {
  padding-left: 1.2rem;
}
.prose li {
  margin-bottom: 0.35rem;
}

/* --- footer ------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--fg-faint);
  font-size: 0.82rem;
  padding-block: 1.5rem 2.5rem;
}
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  justify-content: space-between;
}
.site-footer a {
  color: var(--fg-muted);
}

/* --- small screens ------------------------------------------------------ */

@media (max-width: 34rem) {
  body {
    font-size: 0.9rem;
  }
  .profile {
    gap: 1.1rem;
  }
  .profile-photo {
    width: 92px;
    height: 92px;
  }
  main {
    padding-block: 1.75rem 2.5rem;
  }
}

/* --- print -------------------------------------------------------------- */

@media print {
  .backlink,
  .site-footer,
  .actions {
    display: none;
  }
  body {
    color: #000;
    background: #fff;
  }
  a {
    color: #000;
    text-decoration: underline;
  }
}
