/* No external fonts or assets: nothing is loaded from third parties. */

/* Colours are taken from the portrait: warm ochre walls, teal-blue shirt, pale stone steps. */
:root {
  --bg: #f5f0e6;
  --text: #1f1b16;
  --muted: #6b6358;
  --line: #ddd3c2;
  --accent: #1d5468;
  --warm: #96580f;
  --pill: #ebe3d3;
  --todo-bg: #ffe19a;
  --todo-text: #4a3a00;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16130f;
    --text: #efe9dd;
    --muted: #a69d8f;
    --line: #332d25;
    --accent: #86bfd0;
    --warm: #dba554;
    --pill: #26211a;
    --todo-bg: #5a4a10;
    --todo-text: #ffe9a8;
  }
}

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

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

/* Language switch: show only the blocks matching <html lang>. */
html[lang="en"] [data-l="de"],
html[lang="de"] [data-l="en"] {
  display: none;
}

/* No-JavaScript fallback. lang.js adds the class "js" to <html>; without it the
   switch links (#en / #de) select the language through :target instead, and the
   German variants of the internal links (page.html#de) carry it to the next page. */
.lang-anchor {
  position: fixed;
  top: 0;
  left: 0;
}

html:not(.js):has(#de:target) [data-l="en"] {
  display: none;
}

html:not(.js):has(#de:target) [data-l="de"] {
  display: revert;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
}

.topbar,
main,
footer {
  width: 100%;
  max-width: 46rem;
  margin: 0 auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

/* ---------- Top bar ---------- */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding-top: 1.25rem;
  padding-bottom: 1.25rem;
}

.monogram {
  font-family: var(--serif);
  font-size: 1.125rem;
  letter-spacing: 0.08em;
  color: var(--warm);
  text-decoration: none;
}

.nav {
  display: flex;
  gap: 1.25rem;
  margin-right: auto;
  margin-left: 0.5rem;
  font-size: 0.9375rem;
}

.nav a {
  color: var(--text);
  text-decoration: none;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
}

.nav a:hover,
.nav a[aria-current="page"] {
  border-bottom-color: var(--warm);
}

.lang-switch {
  display: flex;
  gap: 0.125rem;
  padding: 0.1875rem;
  background: var(--pill);
  border-radius: 999px;
}

.lang-switch a {
  display: inline-flex;
  align-items: center;
  gap: 0.4375rem;
  font-size: 0.875rem;
  color: var(--muted);
  text-decoration: none;
  border-radius: 999px;
  padding: 0.3125rem 0.75rem;
}

.lang-switch a:hover {
  color: var(--text);
}

/* Active language: follows <html lang>, or the #de target when JavaScript is off. */
html[lang="en"] [data-set-lang="en"],
html[lang="de"] [data-set-lang="de"],
html:not(.js):has(#de:target) [data-set-lang="de"] {
  background: var(--bg);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.18);
}

html:not(.js):has(#de:target) [data-set-lang="en"] {
  background: none;
  color: var(--muted);
  font-weight: 400;
  box-shadow: none;
}

.flag {
  width: 1.25rem;
  height: 0.8125rem;
  border-radius: 2px;
  flex: none;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.15);
}

html[lang="en"] [data-set-lang="de"] .flag,
html[lang="de"] [data-set-lang="en"] .flag,
html:not(.js):has(#de:target) [data-set-lang="en"] .flag {
  opacity: 0.6;
}

html:not(.js):has(#de:target) [data-set-lang="de"] .flag {
  opacity: 1;
}

/* ---------- Portrait ---------- */

.portrait {
  margin: 0 auto;
  width: 100%;
  max-width: 46rem;
  padding: 0 1.5rem;
}

.portrait img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: 50% 28%;
  border-radius: 6px;
  background: var(--line);
}

@media (min-width: 30rem) {
  .portrait img {
    aspect-ratio: 4 / 3;
    object-position: 50% 42%;
  }
}

/* ---------- Content ---------- */

main {
  flex: 1;
  padding-top: 2.5rem;
  padding-bottom: 4rem;
}

.prefix {
  margin: 0 0 0.25rem;
  font-family: var(--serif);
  font-size: 1.25rem;
  color: var(--muted);
}

h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.75rem, 9vw, 4.5rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
}

.roles {
  margin: 1rem 0 0;
  color: var(--accent);
  font-size: 1.0625rem;
  font-weight: 500;
}

.sep {
  margin: 0 0.4em;
  color: var(--warm);
}

.lede {
  margin: 1.75rem 0 0;
  max-width: 36rem;
  font-family: var(--serif);
  font-size: 1.3125rem;
  line-height: 1.5;
}

.sides {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 2.5rem;
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
}

h2 {
  margin: 0 0 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--warm);
}

.sides p {
  margin: 0 0 0.75rem;
}

.topics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
  font-size: 0.875rem;
}

.topics li {
  padding: 0.125rem 0.625rem;
  border: 1px solid var(--accent);
  border-radius: 0.875rem;
  color: var(--accent);
}

.note {
  color: var(--muted);
  font-size: 0.9375rem;
}

.contact {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
}

.contact p {
  margin: 0;
}

.contact .note {
  margin-top: 0.5rem;
}

.email {
  font-family: var(--serif);
  font-size: 1.4375rem;
  overflow-wrap: anywhere;
}

/* Same two columns as the sections above: academic left, consulting right. */
.contacts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1.75rem 2.5rem;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem 1.25rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.9375rem;
}

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

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

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

.lang-switch a:focus-visible {
  border-radius: 999px;
}

footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-top: 1.5rem;
  padding-bottom: 2rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.875rem;
}

footer a {
  color: inherit;
}

/* Placeholders that still need real content. Remove once none are left. */
.todo {
  background: var(--todo-bg);
  color: var(--todo-text);
  padding: 0.05em 0.3em;
  border-radius: 3px;
}

.more {
  font-weight: 600;
}

.sides .more {
  margin: 1rem 0 0;
}

.sides .more + .links {
  margin-top: 0.5rem;
}

/* ---------- Publications and talks ---------- */

.sub {
  padding-top: 2rem;
}

.sub h1 {
  font-size: clamp(2rem, 6vw, 2.75rem);
}

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

.sub h2 {
  margin: 3rem 0 0.25rem;
}

.entries {
  margin: 0;
  padding: 0;
  list-style: none;
}

.entries li {
  padding: 0.875rem 0;
  border-bottom: 1px solid var(--line);
}

.e-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.1875rem;
  line-height: 1.35;
}

.e-meta {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.9375rem;
}

.tag {
  display: inline-block;
  margin-left: 0.375rem;
  padding: 0 0.5rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.8125rem;
  white-space: nowrap;
}

/* ---------- Legal page ---------- */

.legal {
  padding-top: 2rem;
}

.legal h1 {
  font-size: clamp(2rem, 6vw, 2.75rem);
}

.legal h1 + h2 {
  margin-top: 2rem;
}

.legal h2 {
  margin-top: 2.5rem;
}

.legal section + section {
  margin-top: 4rem;
}

.legal p,
.legal address {
  max-width: 38rem;
  margin: 0 0 1rem;
  font-style: normal;
}

/* ---------- Phones: navigation moves to its own row ---------- */

@media (max-width: 26rem) {
  .topbar {
    flex-wrap: wrap;
    row-gap: 0.5rem;
  }

  .nav {
    order: 3;
    width: 100%;
    margin-left: 0;
  }
}

/* ---------- Stack the two roles wherever one line would not fit ---------- */

@media (max-width: 70rem) {
  .sep {
    display: block;
    height: 0;
    overflow: hidden;
  }
}

/* ---------- Wide screens: photo as a full-height panel beside the text ---------- */

@media (min-width: 48rem) {
  body.home {
    display: grid;
    grid-template-columns: minmax(0, 1fr) min(42vw, 36rem);
    grid-template-rows: auto 1fr auto;
  }

  .home .topbar,
  .home main,
  .home footer {
    grid-column: 1;
    padding-left: clamp(1.5rem, 4vw, 3.5rem);
    padding-right: clamp(1.5rem, 4vw, 3.5rem);
  }

  .home main {
    padding-top: clamp(2rem, 9vh, 6rem);
  }

  .home .portrait {
    grid-column: 2;
    grid-row: 1 / span 3;
    max-width: none;
    padding: 0;
  }

  .home .portrait img {
    position: sticky;
    top: 0;
    height: 100vh;
    aspect-ratio: auto;
    object-position: 50% 40%;
    border-radius: 0;
  }
}

/* Entry titles that link to their source keep the title look. */
.e-title a {
  color: inherit;
  text-decoration-color: var(--accent);
}

.e-title a:hover {
  color: var(--accent);
}
