/* ==========================================================================
   Academic website of Florian Lang
   Dark theme, designed for WCAG 2.2 conformance (target: AA, contrast AAA).

   Key accessibility decisions:
   - All text/background pairs exceed a 7:1 contrast ratio (AAA).
   - Links are underlined, so colour is never the only distinction.
   - A highly visible focus indicator is provided for keyboard users.
   - All sizes use rem/em so the layout follows user font-size settings
     and text can be resized to 200% without loss of content (SC 1.4.4).
   - Content reflows on small viewports / high zoom (SC 1.4.10).
   ========================================================================== */

:root {
  --bg: #0e1420;          /* dark blue-grey page background          */
  --bg-alt: #182233;      /* header, cards, code                     */
  --text: #e8edf5;        /* main text  (~16:1 on --bg)              */
  --text-muted: #a9b4c6;  /* secondary text (~8.5:1 on --bg)         */
  --accent: #82b6ff;      /* links (~8.7:1 on --bg)                  */
  --accent-hover: #b3d3ff;
  --border: #2e3d57;
  --focus: #ffcf40;       /* focus ring: high-contrast yellow        */
}

* {
  box-sizing: border-box;
}

html {
  /* Respect the user's default font size (do NOT set a px font size). */
  font-size: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  line-height: 1.6;
  font-size: 1.0625rem; /* slightly above browser default for readability */
}

/* --------------------------------------------------------------------------
   Skip link (SC 2.4.1 Bypass Blocks): first focusable element on every page.
   Visually hidden until it receives keyboard focus.
   -------------------------------------------------------------------------- */
.skip-link {
  position: absolute;
  left: -999rem;
  top: auto;
  background: var(--focus);
  color: #1a1a00;
  padding: 0.75rem 1.25rem;
  font-weight: 700;
  text-decoration: none;
  border-radius: 0 0 0.375rem 0.375rem;
  z-index: 100;
}

.skip-link:focus {
  left: 1rem;
  top: 0;
}

/* --------------------------------------------------------------------------
   Focus visibility (SC 2.4.7 / 2.4.11): thick, offset, non-colour-reliant.
   -------------------------------------------------------------------------- */
a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 0.1875rem solid var(--focus);
  outline-offset: 0.1875rem;
  border-radius: 0.125rem;
}

/* Fallback for browsers without :focus-visible */
a:focus {
  outline: 0.1875rem solid var(--focus);
  outline-offset: 0.1875rem;
}

a:focus:not(:focus-visible) {
  outline: none;
}

/* --------------------------------------------------------------------------
   Header and navigation
   -------------------------------------------------------------------------- */
header.site-header {
  background: var(--bg-alt);
  border-bottom: 0.0625rem solid var(--border);
  padding: 1.25rem 1rem 0.75rem;
}

.site-header .header-inner {
  max-width: 50rem;
  margin: 0 auto;
}

.site-title {
  margin: 0 0 0.75rem;
  font-size: 1.375rem;
  font-weight: 700;
}

.site-title a {
  color: var(--text);
  text-decoration: none;
}

.site-title a:hover {
  text-decoration: underline;
}

nav.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
}

nav.site-nav a {
  display: inline-block;
  padding: 0.5rem 0.125rem; /* generous target size (SC 2.5.8) */
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

nav.site-nav a:hover {
  color: var(--accent-hover);
}

/* Current page: bold + no underline + marker, so the state is conveyed
   by more than colour alone (SC 1.4.1). aria-current="page" is set in
   the HTML for assistive technology. */
nav.site-nav a[aria-current="page"] {
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
  border-bottom: 0.1875rem solid var(--accent);
}

/* --------------------------------------------------------------------------
   Main content
   -------------------------------------------------------------------------- */
main {
  max-width: 50rem;
  margin: 0 auto;
  padding: 2rem 1rem 3rem;
}

h1,
h2,
h3 {
  line-height: 1.25;
  color: var(--text);
}

h1 {
  font-size: 2rem;
  margin: 0 0 1rem;
}

h2 {
  font-size: 1.5rem;
  margin: 2.5rem 0 0.75rem;
  padding-bottom: 0.25rem;
  border-bottom: 0.0625rem solid var(--border);
}

h3 {
  font-size: 1.1875rem;
  margin: 1.75rem 0 0.5rem;
}

p {
  max-width: 70ch; /* comfortable measure, aligned with SC 1.4.8 */
}

ul,
ol {
  padding-left: 1.5rem;
}

li {
  margin-bottom: 0.375rem;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--accent-hover);
}

strong {
  color: var(--text);
}

/* Muted, still >7:1 contrast */
.muted {
  color: var(--text-muted);
}

/* Lead paragraph on the home page */
.lead {
  font-size: 1.1875rem;
}

/* --------------------------------------------------------------------------
   Cards / boxed sections (projects, news)
   -------------------------------------------------------------------------- */
.card {
  background: var(--bg-alt);
  border: 0.0625rem solid var(--border);
  border-radius: 0.5rem;
  padding: 1rem 1.25rem;
  margin: 1rem 0;
}

.card h3 {
  margin-top: 0;
}

.card p:last-child {
  margin-bottom: 0;
}

/* Placeholder text is marked visually AND textually ("[Placeholder]" in
   the content itself), never by styling alone. */
.placeholder {
  border-left: 0.25rem solid var(--text-muted);
  padding-left: 0.75rem;
  font-style: italic;
}

/* --------------------------------------------------------------------------
   Definition lists (contact details, CV entries)
   -------------------------------------------------------------------------- */
dl.meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.375rem 1.25rem;
  margin: 1rem 0;
}

dl.meta dt {
  font-weight: 700;
}

dl.meta dd {
  margin: 0;
}

@media (max-width: 34rem) {
  dl.meta {
    grid-template-columns: 1fr; /* reflow on small screens / high zoom */
  }

  dl.meta dd {
    margin-bottom: 0.625rem;
  }
}

/* CV timeline entries: date in a left column, text beside it.
   Collapses to a single column on narrow viewports / high zoom. */
.cv-entry {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 0 1.5rem;
  margin: 0 0 1.25rem;
}

.cv-entry .cv-date {
  font-weight: 700;
}

.cv-entry .cv-body {
  margin: 0;
  max-width: 62ch;
}

@media (max-width: 40rem) {
  .cv-entry {
    grid-template-columns: 1fr;
    gap: 0.125rem;
  }
}

/* --------------------------------------------------------------------------
   Publications
   -------------------------------------------------------------------------- */
ul.publications {
  list-style: none;
  padding: 0;
}

ul.publications > li {
  background: var(--bg-alt);
  border: 0.0625rem solid var(--border);
  border-radius: 0.5rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}

/* Teaser images: white backing plate so light diagrams keep their
   contrast on the dark card. Images are capped by HEIGHT rather than
   width, so wide panorama figures and near-square ones end up with a
   similar visual weight instead of squarer images filling the page. */
.pub-figure {
  margin: 0 0 0.875rem;
}

.pub-figure img {
  max-width: 100%;
  max-height: 12rem;
  width: auto;
  height: auto;
  display: block;
  margin-inline: auto; /* centre the figure within the card */
  background: #ffffff;
  padding: 0.5rem;
  border-radius: 0.375rem;
  box-sizing: border-box;
}

/* Portrait on the About page: text runs alongside it. The float is
   dropped on narrow viewports and at high zoom so the content reflows
   into a single column (SC 1.4.10). */
.portrait {
  float: left;
  width: 11rem;
  height: auto;
  margin: 0.25rem 1.5rem 0.75rem 0;
  border-radius: 0.5rem;
}

@media (max-width: 34rem) {
  .portrait {
    float: none;
    width: 9rem;
    margin: 0 0 1rem;
  }
}

.pub-title {
  font-weight: 700;
  font-style: normal;
  display: block;
  margin-bottom: 0.25rem;
  font-size: 1.0625rem;
}

.pub-authors {
  display: block;
  margin-bottom: 0.25rem;
}

.pub-venue {
  display: block;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.pub-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
}

.pub-links li {
  margin: 0;
}

/* --------------------------------------------------------------------------
   Address / footer
   -------------------------------------------------------------------------- */
address {
  font-style: normal;
}

footer.site-footer {
  border-top: 0.0625rem solid var(--border);
  background: var(--bg-alt);
  padding: 1.5rem 1rem;
}

/* Wider than the main column and a slightly smaller type size, so the
   footer sentence stays on one line on normal screens. It still wraps
   on narrow viewports and at high zoom, as it must. */
footer.site-footer .footer-inner {
  max-width: 62rem;
  margin: 0 auto;
  color: var(--text-muted);
  font-size: 0.875rem;
}

footer.site-footer p {
  max-width: none;
}

footer.site-footer p {
  margin: 0.25rem 0;
}

/* --------------------------------------------------------------------------
   Visually hidden utility: text available to screen readers only.
   Used e.g. to disambiguate repeated link texts such as "DOI" (SC 2.4.4).
   -------------------------------------------------------------------------- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   User preference media queries
   -------------------------------------------------------------------------- */

/* No animations are used on this site, but guard against any that might
   be added later (SC 2.3.3 Animation from Interactions). */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Users who ask for more contrast get pure black/white. */
@media (prefers-contrast: more) {
  :root {
    --bg: #000000;
    --bg-alt: #000000;
    --text: #ffffff;
    --text-muted: #ffffff;
    --accent: #99ccff;
    --accent-hover: #cce6ff;
    --border: #ffffff;
  }
}

/* Print: light background, hide navigation chrome. */
@media print {
  :root {
    --bg: #ffffff;
    --bg-alt: #ffffff;
    --text: #000000;
    --text-muted: #333333;
    --accent: #000000;
    --border: #999999;
  }

  .skip-link,
  nav.site-nav {
    display: none;
  }
}
