/* ==========================================================================
   Remo Oostdam — shared stylesheet
   Loaded by index.html, cv.html and curiosity.html.
   Page-specific rules live in a small <style> block on the page itself.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */

:root {
  --bg:          #FFF9F0;
  --text:        #0f1115;
  --muted:       #5f6670;
  --line:        #e0d9ca;   /* hairline rules, warm to match the cream */
  --line-strong: #cfc7b4;   /* sidebar divider */
  --link:        #3f6193;   /* SSRN / [PDF] style links, AA on cream */
  --accent:      #b55e33;

  --sidebar-width: 240px;
  --gutter:        56px;
  --measure:       744px;   /* text column cap; each page may narrow this */

  /* Width of the outer frame. CONSTANT on every page — this is what keeps the
     sidebar in exactly the same place as you move between pages. Only
     --measure varies per page, and it caps the text column inside the frame. */
  --page-max:      1196px;
}

/* --------------------------------------------------------------------------
   2. Base
   -------------------------------------------------------------------------- */

html {
  box-sizing: border-box;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;   /* in-page jumps; disabled under reduced-motion */

  /* Always reserve the scrollbar track, so a short page and a long page put
     the centred layout in the same place instead of shifting by ~15px. */
  scrollbar-gutter: stable;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color .18s ease, opacity .18s ease;
}

a:hover { text-decoration: underline; text-underline-offset: 2px; }

/* Visible keyboard focus everywhere. */
a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
  border-radius: 2px;
}

img { max-width: 100%; }

/* --------------------------------------------------------------------------
   3. Layout
   Desktop: a centred grid of [sidebar | content]. The sidebar is sticky
   rather than fixed, so the whole composition centres on wide monitors
   instead of hugging the left edge.
   -------------------------------------------------------------------------- */

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, var(--measure));
  gap: var(--gutter);
  align-items: start;           /* required for position: sticky to work */
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 28px;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 40px 28px 32px 0;
  border-right: 1px solid var(--line-strong);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
}

.content-wrap {
  min-width: 0;
  padding: 44px 0 96px;
}

/* --------------------------------------------------------------------------
   4. Sidebar
   -------------------------------------------------------------------------- */

.sidebar-top { display: flex; flex-direction: column; gap: 20px; }

.sidebar-name {
  font-weight: 700;
  font-size: 21px;
  line-height: 1.25;
  letter-spacing: .01em;
  margin-bottom: 5px;
}

.sidebar-role {
  font-size: 11.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }

.sidebar-link {
  position: relative;
  display: inline-block;
  width: max-content;
  padding: 5px 0;
  font-size: 14px;
  color: var(--text);
}

.sidebar-link:hover { text-decoration: none; }

.sidebar-link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 1px;
  height: 2px;
  background: var(--text);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .18s ease;
}

.sidebar-link:hover::after { transform: scaleX(1); }

.sidebar-link[aria-current="page"] {
  font-weight: 600;
  cursor: default;
}

.sidebar-link[aria-current="page"]::after { transform: scaleX(1); }

/* Bottom block: institution, contact, copyright. */

.sidebar-bottom { display: flex; flex-direction: column; gap: 10px; }

/* Stacked on desktop so the email address never wraps mid-address in the
   narrow sidebar column; a single row on mobile, where there is width. */
.uva-contact-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
}

.uva-logo img {
  height: 36px;
  width: auto;
  display: block;
  opacity: .85;
  transition: opacity .18s ease;
}

.uva-logo img:hover { opacity: 1; }

.sidebar-contact {
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: 13.5px;
}

.sidebar-copy { font-size: 12px; color: var(--muted); }

/* --------------------------------------------------------------------------
   5. Typography inside the content column
   Section labels are deliberately small and quiet so that paper titles and
   headings read as the dominant level.
   -------------------------------------------------------------------------- */

h2 {
  font-weight: 600;
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 14px;
}

p { margin: 0 0 12px; }

section {
  margin-top: 40px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

section:first-of-type { margin-top: 36px; }

.lead {
  font-size: 16.5px;
  line-height: 1.65;
  margin: 0;
  max-width: 62ch;
}

.fields {
  font-size: 14px;
  line-height: 1.6;
  margin: 0 0 4px;
  /* No max-width: these are meant to hold one line each. */
}

.fields-group { margin-top: 20px; }

.fields strong { font-weight: 600; }

/* --------------------------------------------------------------------------
   6. Reusable link + button styles
   -------------------------------------------------------------------------- */

.link-ref {
  font-size: 13px;
  color: var(--link);
  white-space: nowrap;
  margin-left: 4px;
}

.link-ref:hover { text-decoration: underline; }

.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: transparent;   /* flush on the cream, not a floating white chip */
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  transition: border-color .18s ease, background .18s ease;
}

.btn-download:hover {
  text-decoration: none;
  border-color: var(--text);
  background: rgba(181, 94, 51, .06);                    /* fallback */
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}

.btn-download svg { flex: none; }

/* --------------------------------------------------------------------------
   7. Lightbox (figure panels on index.html, photos on curiosity.html)
   -------------------------------------------------------------------------- */

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, .85);
  backdrop-filter: blur(4px);
  overflow: auto;
  padding: 48px 16px;
}

.lightbox.is-open { display: block; }

.lightbox-content {
  display: block;
  margin: auto;
  max-width: 90vw;
  max-height: 85vh;
  border: 4px solid #fff;
  box-shadow: 0 0 30px rgba(0, 0, 0, .6);
  transition: transform .3s ease;
}

.lightbox-content.rotated {
  transform: rotate(90deg) scale(1.25);
  max-width: 85vh;
  max-height: 85vw;
}

.lightbox-caption {
  margin: 16px auto 0;
  text-align: center;
  color: #f0f0f0;
  font-size: 14px;
  max-width: 60ch;
}

.lightbox-close {
  position: fixed;
  top: 16px;
  right: 24px;
  color: #f0f0f0;
  font-size: 34px;
  line-height: 1;
  font-weight: 300;
  cursor: pointer;
  padding: 4px 10px;
}

.lightbox-close:hover { color: #fff; }

/* --------------------------------------------------------------------------
   8. Tablet and phone
   Below 900px the grid unwinds. `display: contents` on the sidebar promotes
   its two children to flex items of .layout, which lets the contact block
   drop below the content instead of pushing it down the page.
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .layout {
    display: flex;
    flex-direction: column;
    align-items: stretch;   /* overrides the grid's align-items: start */
    max-width: none;
    padding: 0;
    gap: 0;
  }

  .sidebar { display: contents; }

  .sidebar-top {
    order: 1;
    gap: 14px;
    padding: 22px 20px 16px;
    border-bottom: 1px solid var(--line);
  }

  .content-wrap {
    order: 2;
    padding: 26px 20px 40px;
  }

  .sidebar-bottom {
    order: 3;
    gap: 12px;
    padding: 22px 20px 32px;
    border-top: 1px solid var(--line);
  }

  /* Three links do not need a hamburger — lay them out in a row. */
  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 20px;
  }

  .sidebar-link { font-size: 14.5px; padding: 2px 0; }

  .uva-contact-row { flex-direction: row; align-items: center; gap: 14px; }

  .sidebar-contact { flex-direction: row; flex-wrap: wrap; gap: 4px 18px; font-size: 14px; }

  section { margin-top: 32px; padding-top: 22px; }

  .lead { font-size: 16px; }
}

@media (max-width: 400px) {
  .sidebar-name { font-size: 19px; }
  .sidebar-nav { gap: 16px; }
  .uva-contact-row { gap: 10px; }
  .uva-logo img { height: 30px; }
}

/* --------------------------------------------------------------------------
   9. Motion preferences
   -------------------------------------------------------------------------- */

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