/*-----------------------------------*\
  Christian Höhne — personal site
  Light academic stylesheet
\*-----------------------------------*/

:root {
  /* surfaces */
  --paper:      hsl(40, 33%, 99%);
  --paper-sunk: hsl(40, 20%, 96%);
  --rule:       hsl(215, 16%, 89%);
  --rule-soft:  hsl(215, 16%, 93%);

  /* ink */
  --ink:        hsl(215, 22%, 14%);
  --ink-2:      hsl(215, 12%, 38%);
  --ink-3:      hsl(215, 10%, 55%);

  /* accent */
  --accent:     hsl(205, 58%, 30%);
  --accent-lit: hsl(205, 58%, 24%);
  --accent-wash:hsl(205, 58%, 30%, 0.07);

  /* type */
  --serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* metrics */
  --measure: 68ch;
  --gutter: clamp(1.25rem, 5vw, 3rem);
  --nav-h: 3.75rem;
  --layout-pad: 2.5rem;
}

/*--- reset ---*/
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-family: var(--sans);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }
ul, ol { list-style: none; }

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
a:hover { color: var(--accent-lit); }

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

::selection { background: var(--accent-wash); }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 0.6rem 1rem;
  z-index: 10;
}
.skip-link:focus { left: 0; }

/*--- shell ---*/
.page {
  max-width: 62rem;
  margin-inline: auto;
  padding: 0 var(--gutter) 5rem;
}

/*--- top navigation: pinned, so it is reachable at any scroll depth ---*/
.topnav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 1.75rem;
  height: var(--nav-h);
  background: hsl(40, 33%, 99%, 0.94);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.topnav.is-stuck { border-bottom-color: var(--rule); }

.topnav a {
  font-family: var(--sans);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
  text-decoration: none;
  padding-bottom: 0.3rem;
  border-bottom: 1.5px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.topnav a:hover { color: var(--ink); }

.topnav a[aria-current="page"],
.topnav a.is-active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

/*--- two-column layout ---*/
.layout {
  display: grid;
  grid-template-columns: 15rem 1fr;
  gap: clamp(2rem, 5vw, 3.5rem);
  align-items: start;
  padding-top: var(--layout-pad);
}

/*--- profile column: portrait, then identity beneath it ---*/
.profile {
  position: sticky;
  top: calc(var(--nav-h) + var(--layout-pad));

  /* Flex column, not block: it stops the affiliation's bottom margin from
     collapsing into the contact row's top margin, which would silently
     swallow any alignment offset smaller than that margin. */
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.portrait {
  width: 100%;
  height: auto;          /* required: the width/height attributes would
                            otherwise pin the box and defeat aspect-ratio */
  display: block;
  border-radius: 6px;
  margin-bottom: 1.1rem;
  background: var(--paper-sunk);
}

.profile h1 {
  font-family: var(--serif);
  font-size: 1.6875rem;
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.15;
  margin-bottom: 0.4rem;
}

.profile .role {
  font-family: var(--serif);
  font-size: 1rem;
  font-style: italic;
  color: var(--ink-2);
  line-height: 1.4;
}

.profile .affiliation {
  font-size: 0.875rem;
  color: var(--ink-3);
  margin-bottom: 1.1rem;
}

/*--- contact row ---*/
.contact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--rule);
}

.contact a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8125rem;
  color: var(--ink-2);
  text-decoration: none;
  transition: color 0.15s ease;
}

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

.contact svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
  flex-shrink: 0;
}

/* WCAG 2.5.8 asks for a 24x24 minimum target regardless of input device;
   the icons themselves stay 15px. Phones widen this further, below. */
.contact .icon-only {
  gap: 0;
  min-width: 26px;
  min-height: 26px;
  justify-content: center;
}

.contact a { min-height: 26px; }

/*--- prose ---*/
.bio {
  padding: 0 0 0.5rem;
  max-width: var(--measure);
}

.bio p {
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--ink);
  margin-bottom: 1.15rem;
}

.bio p:last-child { margin-bottom: 0; }

/*--- section labels ---*/
.section-label {
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding-bottom: 0.75rem;
  margin-top: 2.75rem;
  border-bottom: 1px solid var(--rule);
  scroll-margin-top: calc(var(--nav-h) + 1rem);   /* clear the pinned nav */
}

#research { scroll-margin-top: calc(var(--nav-h) + 1rem); }

/*--- papers ---*/
.paper-list { margin-top: 0.5rem; }

.paper {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--rule-soft);
}

.paper:last-child { border-bottom: none; }

.paper-title {
  font-family: var(--serif);
  font-size: 1.1875rem;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.005em;
  margin-bottom: 0.3rem;
  max-width: var(--measure);
}

.paper-authors {
  font-size: 0.875rem;
  color: var(--ink-3);
}

/*--- abstract disclosure ---*/
.abstract-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.7rem;
  padding: 0.35rem 0.6rem 0.35rem 0.45rem;
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-wash);
  border: none;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.abstract-toggle:hover { background: hsl(205, 58%, 30%, 0.13); }

.abstract-toggle svg {
  width: 11px;
  height: 11px;
  fill: currentColor;
  transition: transform 0.2s ease;
}

.abstract-toggle[aria-expanded="true"] svg { transform: rotate(90deg); }

.abstract {
  max-width: var(--measure);
  margin-top: 0.9rem;
  padding-left: 1rem;
  border-left: 2px solid var(--rule);
  animation: unfold 0.25s ease-out;
}

.abstract p {
  font-family: var(--serif);
  font-size: 0.9688rem;
  line-height: 1.7;
  color: var(--ink-2);
}

@keyframes unfold {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/*--- CV page ---*/
.cv-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.05rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--paper);
  background: var(--accent);
  border-radius: 4px;
  text-decoration: none;
  transition: background 0.15s ease;
}

.btn:hover { background: var(--accent-lit); color: var(--paper); }

.btn svg { width: 15px; height: 15px; fill: currentColor; }

.btn-secondary {
  color: var(--ink-2);
  background: transparent;
  border: 1px solid var(--rule);
}

.btn-secondary:hover {
  color: var(--ink);
  background: var(--paper-sunk);
}

/* desktop inline viewer */
.pdf-frame {
  margin-top: 1.75rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  overflow: hidden;
  background: var(--paper-sunk);
}

.pdf-frame object,
.pdf-frame iframe {
  display: block;
  width: 100%;
  height: 82vh;
  min-height: 620px;
  border: none;
}

.pdf-frame .pdf-fallback {
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--ink-2);
  font-size: 0.9375rem;
}

/* small-screen replacement: shown only where inline PDF cannot render */
.pdf-note {
  display: none;
  margin-top: 1.75rem;
  padding: 1.5rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--paper-sunk);
  font-size: 0.9375rem;
  color: var(--ink-2);
}

.pdf-note p { margin-bottom: 1rem; }

@media (max-width: 820px) {
  .pdf-frame { display: none; }
  .pdf-note  { display: block; }
}

/*--- footer ---*/
.site-footer {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-size: 0.8125rem;
  color: var(--ink-3);
}

/*--- narrow screens ---*/

/* Below the two-column threshold the profile stops being a column and
   becomes a compact header, so the reader is not scrolling past a
   full-width portrait to reach the text. */
@media (max-width: 760px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 2rem;
    padding-top: 1.75rem;
  }

  .profile {
    position: static;
    display: grid;
    grid-template-columns: 132px 1fr;
    gap: 1.25rem;
    align-items: start;
  }

  .portrait { margin-bottom: 0; }

  .contact {
    grid-column: 1 / -1;
    padding-top: 1.1rem;
  }
}

@media (max-width: 560px) {
  body { font-size: 16px; }

  .profile {
    grid-template-columns: 110px 1fr;
    gap: 1rem;
  }

  .profile h1 { font-size: 1.5rem; }
  .topnav { gap: 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* While the Research section is on screen its nav item takes the underline. */
.topnav a[aria-current="page"].is-muted {
  color: var(--ink-2);
  border-bottom-color: transparent;
}

/**
 * The CV page carries a wider page box: it keeps the same two-column split as
 * About, but an A4 document needs more room than prose does.
 *
 * The extra width is spent entirely on the right. Pinning the left margin to
 * where the narrower About box starts — rather than letting the wider box
 * re-centre — keeps the portrait in an identical position on both pages at
 * every viewport width, while margin-right:0 lets the document column claim
 * whatever is left over.
 */
.page.page--wide {
  max-width: 74rem;
  margin-left: max(0px, calc(50% - 31rem));
  margin-right: 0;
}

/* The CV page leads with a section label; it needs no leading air. */
main > .section-label:first-child { margin-top: 0; }

/*-----------------------------------*\
  #TOUCH TARGETS
\*-----------------------------------*/

/**
 * On phones the icon-only contact links were 15x15 CSS px and the abstract
 * toggle 23px tall. WCAG 2.5.8 asks for 24x24 as a floor; platform guidance
 * is 44x44. The icons are given real boxes (spacing is widened so the
 * enlarged targets cannot overlap each other), while the nav links keep
 * their compact look and gain an invisible centred hit area instead.
 */
@media (max-width: 760px) {
  .contact {
    gap: 0.5rem;
    align-items: center;
  }

  .contact a:not(.icon-only) { min-height: 44px; }

  .contact .icon-only {
    width: 44px;
    height: 44px;
    justify-content: center;
  }

  .contact svg {
    width: 18px;
    height: 18px;
  }

  .abstract-toggle {
    min-height: 40px;
    padding: 0.5rem 0.9rem 0.5rem 0.75rem;
  }

  .topnav a { position: relative; }

  .topnav a::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: max(100%, 44px);
    height: 44px;
  }
}

.pdf-note p:last-child { margin-bottom: 0; }
