/* ==========================================================
   Shared styles for every page.
   Black & white only. The one interaction is a headline
   underline on hover.
   ========================================================== */

:root {
  --ink: #141414;
  --soft: #545658;
  --line: #dcdcdc;
  --paper: #ffffff;
  --img: #e6e6e6;
  --tint: #f4f4f4;
  --dark-line: #3a3a3a;

  --font: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; height: auto; }

.wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Top bar ---------- */
.topbar { background: var(--ink); color: #fff; }
.topbar .wrap {
  display: flex;
  align-items: stretch;
  height: 52px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 3px;
  padding-right: 20px;
  margin-right: 4px;
  border-right: 1px solid var(--dark-line);
}
.logo span {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  font-size: 15px;
}
/* nav, ul, li and a are all flex so the links fill the bar's full height
   and the active underline sits on the bar's bottom edge */
.topbar nav { display: flex; }
.topnav {
  display: flex;
  list-style: none;
  font-size: 14px;
  font-weight: 600;
}
.topnav li { display: flex; }
.topnav a {
  display: flex;
  align-items: center;
  padding: 0 16px;
  white-space: nowrap;
  border-right: 1px solid var(--dark-line);
  border-top: 3px solid transparent;
  border-bottom: 3px solid transparent;
}
.topnav a:hover,
.topnav a[aria-current="page"] { border-bottom-color: #fff; }
.topbar .contact {
  margin-left: auto;
  display: flex;
  align-items: center;
  font-size: 14px;
  font-weight: 600;
}
.topbar .contact:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ---------- Title band ---------- */
.band { border-bottom: 1px solid var(--line); }
.band .wrap {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  padding-top: 28px;
  padding-bottom: 18px;
}
.band h1 {
  font-size: clamp(34px, 5vw, 48px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
}
.band p { color: var(--soft); font-size: 15px; }

/* ---------- Cards ---------- */
.card { display: block; }
.card .media {
  background: var(--img);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  margin-bottom: 12px;
}
.card .media img { width: 100%; height: 100%; object-fit: cover; }
.card h3 {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.005em;
}
.card p {
  font-size: 15px;
  color: #333;
  margin-top: 8px;
}
.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--soft);
}
.meta b { color: var(--ink); font-weight: 600; }
.meta i {
  width: 1px;
  height: 12px;
  background: var(--line);
}

.card:hover h3,
.card:focus-visible h3 {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
.card:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }

/* ---------- Section headings ---------- */
.section { margin-top: 48px; scroll-margin-top: 20px; }
.section-head {
  border-top: 1px solid var(--ink);
  padding-top: 10px;
  margin-bottom: 18px;
}
.section-head h2 { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; }
.section-head a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.section-head a::after {
  content: "›";
  font-size: 26px;
  line-height: 1;
  transform: translateY(-1px);
}
.section-head a:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ---------- Home: top stories ---------- */
.top {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 24px;
  margin-top: 28px;
}
.lead h3 { font-size: clamp(24px, 2.6vw, 32px); line-height: 1.12; letter-spacing: -0.015em; }
.lead p { font-size: 17px; }
.stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.stack .card + .card {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

/* ---------- Four-up grid ---------- */
.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}
.grid-4.spaced { row-gap: 40px; }

/* ---------- Home: writing + about ---------- */
.split {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 48px;
}

/* ---------- Row list (writing, research pages) ---------- */
.rows { list-style: none; }
.rows li + li { border-top: 1px solid var(--line); }
.rows .card {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 20px;
  padding: 16px 0;
}
.rows li:first-child .card { padding-top: 0; }
.rows .card .media { margin-bottom: 0; }
.rows.large .card { grid-template-columns: 280px 1fr; gap: 24px; padding: 22px 0; }
.rows.large h3 { font-size: 22px; }

.year-head {
  font-size: 15px;
  font-weight: 800;
  margin: 36px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--ink);
}
.year-head:first-child { margin-top: 0; }

/* ---------- About box (home sidebar) ---------- */
.about-box img { width: 96px; height: 96px; object-fit: cover; margin-bottom: 14px; }
.about-box p { font-size: 15px; color: #333; }
.link-list { list-style: none; margin-top: 14px; font-size: 14px; font-weight: 600; }
.link-list li { border-top: 1px solid var(--line); }
.link-list li:last-child { border-bottom: 1px solid var(--line); }
.link-list a {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
}
.link-list a::after { content: "›"; font-size: 18px; line-height: 1; }
.link-list a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Article / item pages ---------- */
.article {
  max-width: 740px;
  margin: 40px auto 0;
}
.kicker {
  display: inline-block;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
}
a.kicker:hover { text-decoration: underline; text-underline-offset: 3px; }
.article h1 {
  font-size: clamp(30px, 4.6vw, 44px);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.025em;
}
.standfirst {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.4;
  margin-top: 16px;
}
.byline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-size: 14px;
  color: var(--soft);
  margin-top: 22px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.byline b { color: var(--ink); font-weight: 600; }

.figure { margin: 28px 0; }
.figure img { width: 100%; background: var(--img); }
.figure figcaption {
  font-size: 13px;
  color: var(--soft);
  margin-top: 8px;
}
.article > .figure:first-of-type { margin-top: 24px; }

.prose { font-size: 18px; line-height: 1.65; }
.prose > * + * { margin-top: 20px; }
.prose h2 {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin-top: 40px;
}
.prose a { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.prose a:hover { text-decoration-thickness: 2px; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li + li { margin-top: 8px; }
.prose blockquote {
  border-left: 4px solid var(--ink);
  padding: 4px 0 4px 20px;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.35;
}
.prose code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--tint);
  padding: 2px 5px;
}
.prose .figure { margin: 32px 0; }

pre.code {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  background: var(--tint);
  border: 1px solid var(--line);
  padding: 16px 18px;
  overflow-x: auto;
}

/* Buttons (paper links) */
.buttons { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.btn {
  display: inline-block;
  font-size: 14px;
  font-weight: 700;
  padding: 9px 18px;
  border: 1px solid var(--ink);
}
.btn:hover { background: var(--tint); }
.btn.primary { background: var(--ink); color: #fff; }
.btn.primary:hover { background: #333; }

/* Download box */
.download {
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--ink);
  padding: 14px 18px;
}
.download .type {
  flex: none;
  width: 44px;
  height: 52px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.download .info { flex: 1; min-width: 0; }
.download .info b { display: block; font-size: 16px; line-height: 1.3; }
.download .info span { font-size: 13px; color: var(--soft); }
.download .go { font-size: 14px; font-weight: 700; white-space: nowrap; }
.download:hover .go { text-decoration: underline; text-underline-offset: 3px; }
.prose .download { text-decoration: none; }

.related { margin-top: 64px; }

/* ---------- About page ---------- */
.about-page {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 48px;
  margin-top: 40px;
}
.about-page .portrait img { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--img); }
.about-page .prose > p:first-child { font-size: 21px; font-weight: 600; line-height: 1.45; }

/* ---------- 404 ---------- */
.notfound { padding: 96px 0 40px; max-width: 620px; }
.notfound h1 { font-size: 44px; font-weight: 800; letter-spacing: -0.02em; }
.notfound p { font-size: 18px; margin-top: 12px; color: #333; }
.notfound .btn { margin-top: 24px; }

/* ---------- Footer ---------- */
footer {
  margin-top: 72px;
  background: var(--ink);
  color: #fff;
}
footer .wrap { padding-top: 28px; padding-bottom: 28px; }
footer .logo { border-right: 0; padding-right: 0; display: inline-flex; }
footer ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  margin: 22px 0;
  padding: 18px 0;
  border-top: 1px solid var(--dark-line);
  border-bottom: 1px solid var(--dark-line);
  font-size: 14px;
  font-weight: 600;
}
footer ul a:hover { text-decoration: underline; text-underline-offset: 4px; }
footer p { font-size: 13px; color: #b5b5b5; }
footer .logo + .copyright { margin-top: 18px; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .top { grid-template-columns: 1fr 1fr; }
  .top .lead { grid-column: 1 / -1; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .split { grid-template-columns: 1fr; gap: 0; }
  .about-page { grid-template-columns: 1fr; gap: 28px; }
  .about-page .portrait { max-width: 280px; }
}

@media (max-width: 700px) {
  /* Nav drops to its own scrollable row under the logo */
  .topbar .wrap { flex-wrap: wrap; height: auto; padding: 0 16px; }
  .topbar .logo { height: 52px; border-right: 0; }
  .topbar nav {
    order: 3;
    width: calc(100% + 32px);
    margin: 0 -16px;
    border-top: 1px solid var(--dark-line);
    overflow-x: auto;
    scrollbar-width: none;
  }
  .topbar nav::-webkit-scrollbar { display: none; }
  .topnav a { height: 44px; padding: 0 14px; }
  .topnav li:first-child a { padding-left: 16px; }
  .band .wrap { flex-direction: column; align-items: flex-start; gap: 8px; }
}

@media (max-width: 600px) {
  .wrap { padding: 0 16px; }
  .band .wrap { padding-top: 22px; padding-bottom: 14px; }
  .top { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: 1fr; }
  .grid-4 .card {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 14px;
  }
  .grid-4 .card .media { margin-bottom: 0; }
  .grid-4 .card p { display: none; }
  .grid-4 .card h3 { font-size: 16px; }
  .grid-4.spaced { row-gap: 20px; }
  .rows .card,
  .rows.large .card { grid-template-columns: 120px 1fr; gap: 14px; }
  .rows .card p { display: none; }
  .rows .card h3,
  .rows.large h3 { font-size: 16px; }
  .article { margin-top: 28px; }
  .prose { font-size: 17px; }
  .standfirst { font-size: 18px; }
  .download { flex-wrap: wrap; }
  .download .go { width: 100%; padding-left: 60px; }
}

/* ---------- Back to top ---------- */
.to-top {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 40px;
  height: 40px;
  display: none;
  place-items: center;
  background: var(--ink);
  color: #fff;
  border: 1px solid #fff;   /* keeps it visible over the black footer */
  z-index: 10;
}
.to-top.show { display: grid; }
.to-top:hover { background: #333; }
.to-top:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.to-top svg { width: 16px; height: 16px; }

@media (max-width: 600px) {
  .to-top { right: 16px; bottom: 16px; }
}
