/* Björn Ross — personal site. Hand-written, no framework. Edit freely.
   Design mirrors the previous Wowchemy "Academic" site: Source Sans, 18px body,
   two-column sections (title/portrait left, content right), Edinburgh blue. */

:root {
  --font: "Source Sans 3", "Source Sans Pro", -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --bg: #ffffff;
  --bg-alt: #f7f7f7;
  --text: rgba(0, 0, 0, 0.8);
  --text-strong: #000000;
  --muted: rgba(0, 0, 0, 0.54);
  --faint: rgba(0, 0, 0, 0.6);
  --heading: #313131;
  --brand: #2b2b2b;
  --primary: #226cc5;
  --primary-hover: #17457f;
  --border: #e6e6e6;
  --shadow: 0 2.25px 4.5px rgba(0, 0, 0, 0.11);

  --container: 1290px;   /* matches the old Wowchemy content width */
  --header-h: 64px;
}

:root[data-theme="dark"] {
  --bg: #16181c;
  --bg-alt: #1c1f25;
  --text: rgba(255, 255, 255, 0.82);
  --text-strong: #ffffff;
  --muted: rgba(255, 255, 255, 0.55);
  --faint: rgba(255, 255, 255, 0.6);
  --heading: #e9eaec;
  --brand: #e9eaec;
  --primary: #7fb2ec;
  --primary-hover: #a9ccf4;
  --border: #2c2f36;
  --shadow: 0 2.25px 4.5px rgba(0, 0, 0, 0.5);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16181c;
    --bg-alt: #1c1f25;
    --text: rgba(255, 255, 255, 0.82);
    --text-strong: #ffffff;
    --muted: rgba(255, 255, 255, 0.55);
    --faint: rgba(255, 255, 255, 0.6);
    --heading: #e9eaec;
    --brand: #e9eaec;
    --primary: #7fb2ec;
    --primary-hover: #a9ccf4;
    --border: #2c2f36;
    --shadow: 0 2.25px 4.5px rgba(0, 0, 0, 0.5);
  }
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 12px);
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 18px/1.65 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

.wrap {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 15px;
}

a { color: var(--primary); text-decoration: none; }
@media (hover: hover) {
  a:hover { color: var(--primary-hover); text-decoration: underline; }
}
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

h1, h2, h3, h4 { color: var(--heading); line-height: 1.25; margin: 0; }

p { margin: 0 0 1rem; }
img { max-width: 100%; height: auto; }

.icon { display: inline-block; vertical-align: -0.125em; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--bg);
  box-shadow: var(--shadow);
}
.site-header__inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  min-height: var(--header-h);
}
.site-header__brand {
  font-size: 21.6px;
  font-weight: 700;
  color: var(--brand);
}
.site-header__brand:hover { color: var(--brand); text-decoration: none; }
.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 0.25rem;
  margin-right: auto;
}
.site-nav__link {
  font-size: 14px;
  font-weight: 600;
  color: var(--heading);
  padding: 9px;
  white-space: nowrap;
}
.site-nav__link.is-active { color: var(--primary); }
@media (hover: hover) {
  .site-nav__link:hover { color: var(--primary); text-decoration: none; }
}

.theme-toggle {
  background: none;
  border: 0;
  padding: 6px;
  margin-left: auto;
  cursor: pointer;
  color: var(--muted);
  font-size: 18px;
  line-height: 0;
}
.theme-toggle:hover { color: var(--primary); }
.theme-toggle__sun { display: none; }
:root[data-theme="dark"] .theme-toggle__moon { display: none; }
:root[data-theme="dark"] .theme-toggle__sun { display: inline; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle__moon { display: none; }
  :root:not([data-theme="light"]) .theme-toggle__sun { display: inline; }
}

/* ---------- Sections (two-column: title/portrait left, content right) ---------- */
.section { padding: 30px 0; }
.section:nth-of-type(even) { background: var(--bg-alt); }
.section--about { padding: 46px 0 30px; }

.section__row {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 2rem;
}
.section__title {
  font-size: 40px;
  font-weight: 400;
  color: var(--heading);
}
.section__main { min-width: 0; }

/* ---------- Profile (About aside) ---------- */
.profile { text-align: center; }
.profile__avatar {
  width: 220px;
  max-width: 72%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 50%;
}
.profile__name {
  font-size: 31.5px;
  font-weight: 300;
  color: var(--text-strong);
  margin: 0.6rem 0 0;
}
.profile__role,
.profile__org {
  font-size: 18px;
  font-weight: 300;
  line-height: 1.35;
  margin: 0.25rem 0 0;
}
.profile__role { color: var(--muted); }
.profile__org a { font-weight: 400; }
.profile__social {
  list-style: none;
  padding: 0;
  margin: 1.1rem 0 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.85rem;
  font-size: 20px;
}
.profile__social a { color: var(--primary); line-height: 0; display: inline-block; }
.profile__social a:hover { color: var(--primary-hover); }

/* ---------- About extra: Interests / Education ---------- */
.about-extra {
  display: grid;
  grid-template-columns: 5fr 7fr;
  gap: 20px;
}
.subheading {
  font-size: 22.5px;
  font-weight: 700;
  color: var(--text);
  margin: 18px 0 9px;
}
.interests {
  margin: 0;
  padding-left: 20px;
  font-size: 16.2px;
  line-height: 1.65;
}
.interests li { margin: 0; }

.education {
  list-style: none;
  margin: 0;
  padding: 0;
}
.education li {
  display: flex;
  gap: 0.6rem;
  margin: 0 0 0.85rem;
}
.education .icon {
  flex: 0 0 auto;
  width: 1em;
  margin-top: 0.28em;
  color: var(--muted);
}
.education__course { font-size: 16.2px; margin: 0; }
.education__inst { font-size: 13.5px; color: var(--faint); margin: 0; }

/* ---------- Contact map ---------- */
.map {
  position: relative;
  z-index: 0;
  margin-top: 1.25rem;
}
.map__canvas {
  width: 100%;
  height: 360px;
  border: 1px solid var(--border);
  border-radius: 4px;
}
.map__canvas .leaflet-container { font-family: var(--font); }

/* ---------- Prose ---------- */
.prose > :first-child { margin-top: 0; }
.prose h2 { font-size: 1.35rem; font-weight: 700; margin: 2rem 0 0.6rem; }
.prose h3 { font-size: 1.1rem; font-weight: 700; margin: 1.7rem 0 0.5rem; }
.prose ul { padding-left: 1.4rem; margin: 0 0 1rem; }
.prose li { margin: 0.35rem 0; }
.prose li ul,
.prose li ol { margin-top: 0.35rem; }

/* ---------- Standalone pages (Publications) ---------- */
.page { padding: 40px 0 56px; }
.page__title {
  font-size: 40px;
  font-weight: 400;
  color: var(--heading);
  margin: 0 0 1.5rem;
}
.page .prose h2 {
  font-size: 1.7rem;
  font-weight: 400;
  color: var(--heading);
  margin: 2.4rem 0 0.4rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border);
}
.page .prose h2:first-of-type { margin-top: 0.5rem; }
.page .prose h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 1.5rem 0 0.4rem;
}
.page .prose ul { padding-left: 1.2rem; }
.page .prose li { margin: 0.55rem 0; }
.page__back { margin-top: 2.5rem; font-size: 0.95rem; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.75rem 0;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ================= Responsive ================= */

/* Tablet / small laptop — sections go single column */
@media (max-width: 900px) {
  .section { padding: 26px 0; }
  .section--about { padding: 30px 0 26px; }

  .section__row { grid-template-columns: 1fr; gap: 0.85rem; }
  .section__title { font-size: 30px; }

  .about-extra { grid-template-columns: 1fr; gap: 0; margin-top: 0.25rem; }
  .about-extra .subheading:first-child { margin-top: 6px; }

  .page { padding: 30px 0 44px; }
  .page__title { font-size: 30px; }
}

/* Phones — compact header, tighter rhythm */
@media (max-width: 720px) {
  .site-header__inner { min-height: 0; padding-top: 10px; padding-bottom: 10px; row-gap: 0; }
  .site-header__brand { font-size: 20px; }
  .site-nav { order: 3; flex-basis: 100%; margin: 6px 0 0; }
  .site-nav__link { padding: 6px 14px 6px 0; font-size: 13.5px; }
}

@media (max-width: 600px) {
  .wrap { padding: 0 18px; }
  .section__title, .page__title { font-size: 25px; }
  .profile__avatar { width: 150px; }
  .profile__name { font-size: 26px; }
  .profile__role, .profile__org { font-size: 17px; }
  .subheading { font-size: 20px; }
  .map__canvas { height: 280px; }
  .page .prose h2 { font-size: 1.45rem; }
}

@media (max-width: 380px) {
  .wrap { padding: 0 14px; }
  .section__title, .page__title { font-size: 22px; }
  .profile__avatar { width: 128px; }
  .site-nav__link { font-size: 13px; padding: 6px 11px 6px 0; }
}

/* ---------- Print ---------- */
@media print {
  .site-header, .site-footer, .page__back, .theme-toggle, .map { display: none; }
  .section { background: #fff !important; padding: 1rem 0; }
  .section__row { display: block; }
  a { color: #000; text-decoration: underline; }
  body { color: #000; }
}
