/* =========================================================
   Colours and fonts. Change these to restyle the whole site.
   ========================================================= */
:root {
  --bg: #DDEBF3;      /* sky: page background */
  --ink: #0E3B43;     /* deep teal: text */
  --accent: #F0603F;  /* coral: rings, dots, underlines (decoration only) */
  --hover: #B8381E;   /* darker coral: link hover, readable on sky */
  --rule: rgba(14, 59, 67, 0.15);

  --display: "Familjen Grotesk", "Avenir Next", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;

  --pad: clamp(1.25rem, 5vw, 4.5rem);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.125rem;
  line-height: 1.6;
  overflow-x: clip;
  min-height: 100svh;
  display: flex; flex-direction: column;
}
body > main { flex: 1 0 auto; }
img { max-width: 100%; }
a { color: var(--ink); text-underline-offset: 0.18em; }
a:hover { color: var(--hover); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

.skip { position: absolute; left: 1rem; top: -4rem; background: var(--ink); color: var(--bg); padding: 0.5rem 1rem; z-index: 10; }
.skip:focus { top: 1rem; }

/* ---------- Header and navigation ---------- */
.top {
  position: relative; z-index: 3;
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: 0.75rem 2rem;
  padding: 2.25rem var(--pad) 0;
}
.home .top { justify-content: flex-end; }
.name-link {
  font-family: var(--display); font-weight: 700; font-size: 1.375rem;
  text-decoration: none;
}
.nav { display: flex; flex-wrap: wrap; gap: 0.5rem 2.25rem; font-weight: 700; font-size: 1.0625rem; }
.nav a { text-decoration: none; padding: 0.35rem 0; }
.nav a[aria-current="page"] {
  text-decoration: underline; text-decoration-color: var(--accent);
  text-decoration-thickness: 3px; text-underline-offset: 6px;
}

/* ---------- Landing page ---------- */
.landing {
  position: relative;
  min-height: 100svh;
  margin-top: -5rem;           /* let the stage run under the header */
}
.stage {
  position: absolute; top: 0; right: 0; bottom: 0; width: 64%;
}
.stage .orbit {
  position: absolute; inset: 0; width: 100%; height: 100%;
  overflow: visible; color: var(--ink); pointer-events: none;
}
.stage .star { fill: var(--accent); }
.portrait {
  position: absolute; left: 50%; top: 50%;
  width: clamp(200px, 21vw, 300px); height: auto; aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%; object-fit: cover; object-position: 50% 25%;
  box-shadow: 0 0 0 10px var(--bg), 0 0 0 13px var(--accent);
}
.intro {
  position: absolute; left: var(--pad); bottom: clamp(3rem, 10vh, 6rem);
  z-index: 2; max-width: 37rem;
}
.intro h1 {
  margin: 0 0 1.75rem;
  font-family: var(--display); font-weight: 700;
  font-size: clamp(3.5rem, 9vw, 8rem); line-height: 0.92; letter-spacing: -0.03em;
}
.intro p { margin: 0; font-size: 1.25rem; line-height: 1.55; max-width: 30rem; }

/* ---------- Inner pages ---------- */
main.page { padding: 0 var(--pad) 6rem; }
.page-title {
  margin: clamp(3rem, 9vw, 6rem) 0 2rem;
  font-family: var(--display); font-weight: 700;
  font-size: clamp(3rem, 7vw, 6rem); line-height: 0.95; letter-spacing: -0.03em;
}
.lead { font-size: 1.25rem; max-width: 60rem; margin: 0 0 3rem; }
h2.section {
  margin: 4rem 0 1rem;
  font-family: var(--display); font-weight: 700; font-size: 1.875rem; line-height: 1.2;
}
.measure { max-width: 80rem; }

/* Research */
.project {
  display: grid; grid-template-columns: 24rem minmax(0, 1fr); gap: 2.5rem;
  align-items: start; padding: 2.25rem 0; border-top: 2px solid var(--rule);
}
.project figure { margin: 0; }
.project figure a {
  display: block; background: #fff; border-radius: 10px; padding: 10px;
  box-shadow: 0 0 0 2px var(--accent);
}
.project figure a:hover { box-shadow: 0 0 0 4px var(--accent); }
.project figure img { display: block; width: 100%; height: auto; }
.project figcaption { font-size: 0.875rem; margin-top: 0.5rem; opacity: 0.8; }
.project h3 {
  margin: 0 0 0.5rem; font-family: var(--display); font-weight: 700;
  font-size: 1.625rem; line-height: 1.2;
}
.project h3 a { text-decoration: none; }
.project h3 a:hover { text-decoration: underline; text-decoration-color: var(--accent); }
.byline { margin: 0 0 1.1rem; font-size: 0.9375rem; opacity: 0.85; }
.project p:last-child { margin: 0; }

.pubs { margin: 0; padding-left: 1.4rem; font-size: 1.0625rem; line-height: 1.55; }
.pubs li { margin-bottom: 0.9rem; }
.pubs li::marker { color: var(--accent); }

/* CV */
.cv-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem 2rem; }
.cv-head .page-title { margin-bottom: 2rem; }
.button {
  display: inline-flex; align-items: center; gap: 0.6rem; margin-bottom: 2.5rem;
  padding: 0.85rem 1.6rem; border-radius: 999px; min-height: 44px;
  background: var(--ink); color: var(--bg); text-decoration: none; font-weight: 700;
}
.button:hover { background: var(--hover); color: #fff; }
.timeline { list-style: none; margin: 0; padding: 0; max-width: 66rem; }
.timeline li {
  display: grid; grid-template-columns: 14rem minmax(0, 1fr); gap: 2rem;
  padding: 1.35rem 0; border-top: 2px solid var(--rule);
}
.timeline .when { font-family: var(--display); font-weight: 700; font-size: 1.125rem; }
.timeline p { margin: 0; font-size: 1.1875rem; line-height: 1.5; }
.timeline p + p { margin-top: 0.35rem; font-size: 1rem; opacity: 0.85; }

/* Off-orbit */
.off-orbit { position: relative; overflow-x: clip; }
.off-orbit .doodle {
  position: absolute; right: -1rem; top: 4rem;
  width: min(36rem, 52vw); height: auto; pointer-events: none;
}
.off-orbit > *:not(.doodle) { position: relative; }
.hobbies {
  list-style: none; margin: 0; padding: 0; max-width: 56rem;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.75rem 3rem;
}
.hobbies li {
  display: flex; align-items: center; gap: 1.1rem;
  font-family: var(--display); font-weight: 500; font-size: 1.875rem; line-height: 1.25;
}
.hobbies li::before {
  content: ""; flex: 0 0 14px; height: 14px; border-radius: 50%; background: var(--accent);
}

/* Contact */
.emails { max-width: 56rem; margin: 0; }
.emails > div {
  display: grid; grid-template-columns: 9rem auto auto; justify-content: start;
  align-items: center; gap: 0.5rem 1.5rem; padding: 1.1rem 0; border-top: 2px solid var(--rule);
}
.emails dt { font-weight: 700; font-size: 1rem; opacity: 0.85; }
.emails dd { margin: 0; display: contents; }
.addr { font-family: var(--display); font-weight: 500; font-size: 1.625rem; overflow-wrap: anywhere; user-select: all; }
.copy {
  font: inherit; font-weight: 700; font-size: 0.9375rem; cursor: pointer;
  min-height: 44px; padding: 0.5rem 1.1rem; border-radius: 999px;
  border: 2px solid var(--ink); background: transparent; color: var(--ink);
}
.copy:hover { background: var(--ink); color: var(--bg); }
.links { list-style: none; margin: 2.5rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.85rem; }
.links a {
  display: inline-block; padding: 0.75rem 1.4rem; border-radius: 999px;
  background: var(--ink); color: var(--bg); text-decoration: none; font-weight: 700;
}
.links a:hover { background: var(--hover); color: #fff; }

.foot { padding: 0 var(--pad) 2.5rem; font-size: 0.875rem; opacity: 0.75; }
.home .foot { display: none; }

/* ---------- Tablets and phones ---------- */
@media (max-width: 860px) {
  .landing { margin-top: 0; min-height: 0; display: flex; flex-direction: column; }
  .stage { position: relative; width: 100%; height: min(84vw, 440px); order: 0; overflow: hidden; }
  .intro { position: relative; left: auto; bottom: auto; padding: 0 var(--pad) 3rem; order: 1; }
    .portrait { width: 34vw; max-width: 200px; box-shadow: 0 0 0 7px var(--bg), 0 0 0 10px var(--accent); }
  .project { grid-template-columns: 1fr; gap: 1.25rem; }
  .project figure { max-width: 28rem; }
  .timeline li { grid-template-columns: 1fr; gap: 0.25rem; }
  .off-orbit .doodle { opacity: 0.5; }
}
@media (max-width: 560px) {
  .top { padding-top: 1.5rem; }
  .nav { gap: 0.25rem 1rem; font-size: 1rem; }
  .hobbies { grid-template-columns: 1fr; }
  .hobbies li { font-size: 1.5rem; }
  .emails > div { grid-template-columns: 1fr auto; }
  .emails dt { grid-column: 1 / -1; }
  .addr { font-size: 1.25rem; }
}
