:root {
  --ink: #eef1f6;
  --muted: #aab7c8;
  --accent: #d1b276;
  --accent-soft: rgba(209, 178, 118, 0.3);
  --rule: 2px solid var(--accent);
  --identity-w: 224px;
  --identity-space: calc(var(--identity-w) + 2.5rem);
}

* {
  box-sizing: border-box;
}

/* Content flows on the starfield (Starfield.astro) in a dark card. */
html {
  background: radial-gradient(
    120% 120% at 50% 42%,
    #03050a 0%,
    #04070d 14%,
    #050b14 28%,
    #071019 42%,
    #0a1723 56%,
    #0f2131 70%,
    #163047 84%,
    #1d4060 100%
  );
  background-attachment: fixed;
  color: var(--ink);
}

body {
  width: min(100% - 2rem, 920px);
  min-height: 100vh;
  margin: 0 auto;
  padding: clamp(1.5rem, 5vw, 3.5rem);
  background: rgba(5, 9, 16, 0.78);
  border-radius: 6px;
  box-shadow: 0 0 80px rgba(0, 0, 0, 0.55);
  font:
    1.05rem/1.65 "Source Serif 4",
    serif;
}

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

a:hover {
  text-decoration-thickness: 2px;
}

p {
  max-width: 68ch;
}

/* Headings keep their left edge; justifying a short wrapped heading
   stretches its gaps into rivers. */
h1,
h2,
h3,
h4 {
  text-align: left;
}

.identity {
  float: right;
  width: var(--identity-w);
  margin: 0 0 2rem 2.5rem;
  font-family: "IBM Plex Sans", sans-serif;
}

.portrait {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  border: var(--rule);
  object-fit: cover;
  object-position: center;
}

.contact-list {
  margin: 1rem 0 0;
  padding: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.contact-list li {
  display: grid;
  grid-template-columns: 1.25rem 1fr;
  gap: 0.45rem;
  margin: 0.65rem 0;
  list-style: none;
}

.contact-list li > span:first-child {
  display: grid;
  place-items: center;
  color: var(--accent);
  font-weight: 500;
}

.contact-list li > span.email-icon:first-child {
  color: #ff6a10;
}

.contact-list img {
  display: block;
  width: 1rem;
  height: 1rem;
}

.eyebrow,
.venue,
.authors,
.paper-links,
.year,
footer {
  font-family: "IBM Plex Sans", sans-serif;
}

.eyebrow {
  margin: 0 0 0.4rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2 {
  max-width: calc(100% - var(--identity-space));
  border-bottom: var(--rule);
  color: var(--accent);
  font-family: "Fraunces", serif;
  line-height: 1.12;
}

h1 {
  margin: 0 0 1.25rem;
  padding-bottom: 0.35rem;
  font-size: clamp(2.35rem, 7vw, 4.3rem);
  letter-spacing: -0.045em;
}

h2 {
  margin: 3rem 0 1.35rem;
  padding-bottom: 0.35rem;
  font-size: clamp(1.55rem, 4vw, 2.15rem);
}

h3 {
  margin: 0;
  font-family: "Source Serif 4", serif;
  font-size: 1.08rem;
  font-style: italic;
  font-weight: 600;
}

.lede {
  font-size: 1.1rem;
}

.publication {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1rem;
  margin: 0 0 2.25rem;
}

.year {
  margin: 0;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 500;
}

/* A post's summary on the blog page: full text, not a byline. */
.post-summary {
  margin: 0.35rem 0;
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.95rem;
  line-height: 1.6;
}

.venue,
.authors {
  margin: 0.25rem 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.authors strong {
  color: var(--ink);
  font-weight: 500;
}

.paper-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0.5rem 0;
  padding: 0;
  font-size: 0.82rem;
}

.paper-links li {
  list-style: none;
}

.paper-links a::before {
  content: "[";
}

.paper-links a::after {
  content: "]";
}

details {
  margin-top: 0.8rem;
}

summary {
  width: max-content;
  color: var(--accent);
  cursor: pointer;
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.82rem;
}

/* All text: full-width rows. Hyphenation supplies the extra break points,
 so justification fills rows without stretching word spacing. */
body {
  text-align: justify;
  -webkit-hyphens: auto;
  hyphens: auto;
}
/* Phone-width columns are too narrow to justify evenly: ragged right. */
@media (max-width: 600px) {
  body {
    text-align: left;
  }
}
/* Abstracts: smaller, dimmer and more loosely leaded than the titles. */
details p {
  max-width: 96ch;
  font-size: 0.95rem;
  line-height: 1.75;
  color: var(--muted);
  text-wrap: pretty;
}
details[open] {
  padding: 0.15rem 1rem 0.4rem;
  border-left: 3px solid var(--accent-soft);
}

footer {
  clear: both;
  margin-top: 4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--accent-soft);
  color: var(--muted);
  font-size: 0.78rem;
}

@media (max-width: 760px) {
  body {
    width: 100%;
    padding: 1.25rem;
  }

  /* The desktop layout, scaled down: the portrait and contacts stay
     beside the text. */
  :root {
    --identity-w: min(224px, 38vw);
    --identity-space: calc(var(--identity-w) + 1rem);
  }

  .identity {
    margin: 0 0 1.25rem 1rem;
  }

  .contact-list {
    font-size: 0.8rem;
    overflow-wrap: anywhere;
  }

  h1 {
    font-size: 6.6vw;
  }
}

@media (max-width: 480px) {
  .publication {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
}

@media (prefers-reduced-motion: no-preference) {
  a,
  summary {
    transition:
      color 140ms ease,
      text-decoration-thickness 140ms ease;
  }
}

/* Printers drop the dark backgrounds: dark ink on white paper. */
@media print {
  :root {
    --ink: #1c1f24;
    --muted: #4f5660;
    --accent: #7b5a1d;
    --accent-soft: #c9b48a;
  }

  html {
    background: none;
  }

  body {
    width: auto;
    padding: 0;
    background: none;
    border-radius: 0;
    box-shadow: none;
  }
}
