/* Simen Aardal Ulsaker — personal academic site.
   Plain CSS, no build step. Palette: warm neutrals, one restrained blue accent.
   Light/dark follows the OS via prefers-color-scheme. */

:root {
  --bg: #fdfdfb;
  --text: #24292e;
  --muted: #6a737d;
  --accent: #2f6fb2;
  --rule: #e6e3dc;
  --card: #f6f5f1;
  /* Pinned in px so browser font-size scaling doesn't widen the column. */
  --max: 928px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181c;
    --text: #d7dae0;
    --muted: #8b939e;
    --accent: #6ea3d8;
    --rule: #2b2f36;
    --card: #1d2025;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1.125rem/1.6 Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Anchored sections would otherwise land under the sticky header. */
section { scroll-margin-top: 4rem; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}

.site-header nav {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 0.9rem;
}

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

main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1.25rem 4rem;
}

section { padding-top: 3rem; }

h1 {
  font-size: 2.1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 0.25rem;
}

h2 {
  font-size: 1.35rem;
  font-weight: 600;
  margin: 0 0 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--rule);
}

h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 2rem 0 0.6rem;
}

.hero {
  display: flex;
  gap: 2.5rem;
  align-items: flex-start;
  padding-top: 3.5rem;
}

.hero-text { flex: 1 1 auto; }

.role {
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-size: 1.1rem;
}

.bio { margin: 0 0 1rem; }

.hero-photo { flex: 0 0 180px; }

.hero-photo img {
  width: 180px;
  height: 180px;
  object-fit: cover;
  /* The source is a 4:5 portrait, so a square crop discards 20% of the height.
     Biasing the window above centre keeps headroom above the hairline instead
     of clipping it. */
  object-position: center 30%;
  border-radius: 10px;
  border: 1px solid var(--rule);
}

/* Until a portrait file exists, hide only the broken-image box — the links
   below it stay visible. */
.hero-photo img.missing { display: none; }

.hero-photo .social {
  list-style: none;
  margin: 0.9rem 0 0;
  padding: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 0.92rem;
}

.hero-photo .social li { margin-bottom: 0.4rem; }

.hero-photo .social a {
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
}
.hero-photo .social a:hover { color: var(--accent); text-decoration: none; }

/* The sprite is markup, not content — keep it out of the layout. */
.icon-sprite { display: none; }

/* Icons inherit the link colour, so they follow hover and dark mode for free. */
.icon {
  width: 1.05em;
  height: 1.05em;
  flex: 0 0 auto;
  fill: currentColor;
}

ul.papers, ul.affiliations {
  margin: 0;
  padding-left: 1.2rem;
}

ul.papers li, ul.affiliations li { margin-bottom: 0.7rem; }

/* Coauthors and the journal/venue line sit under the title in muted small type. */
.coauthors, .venue {
  display: block;
  color: var(--muted);
  font-size: 0.95rem;
}

.award { color: var(--accent); }

.papers details { margin-top: 0.3rem; }

.papers summary {
  cursor: pointer;
  width: fit-content;
  color: var(--accent);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 0.85rem;
  user-select: none;
}

.papers summary:hover { text-decoration: underline; }

.papers details[open] summary { margin-bottom: 0.4rem; }

.papers details p {
  margin: 0;
  padding: 0.8rem 1rem;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.95rem;
}

footer {
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
  padding: 1.5rem 1rem 2.5rem;
}

@media (max-width: 560px) {
  .hero { flex-direction: column-reverse; gap: 1.5rem; }
  h1 { font-size: 1.8rem; }
  body { font-size: 1.0625rem; }
}
