/* Editorial portrait. White page, black type, one accent. Colours live here. */
:root {
  --paper: #ffffff;
  --ink: #161616;
  --quiet: #6b6b6b;
  --rule: #e2e2e2;
  --accent: #8f1d2c;        /* crimson: link underlines and small markers only */
  --photo-bg: #ececea;
  --serif: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --arabic: "Amiri", "Geeza Pro", "Times New Roman", serif;
  --ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --measure: 64ch;
}
/* Dark theme: follows the device unless the visitor picked a theme with the header switch. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121212; --ink: #ececec; --quiet: #9a9a9a; --rule: #2c2c2c;
    --accent: #e0707e; --photo-bg: #1e1e1e; --hl: #2a1a1d;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #121212; --ink: #ececec; --quiet: #9a9a9a; --rule: #2c2c2c;
  --accent: #e0707e; --photo-bg: #1e1e1e; --hl: #2a1a1d;
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 1.125rem/1.7 var(--serif);
  font-optical-sizing: auto;
}
a { color: inherit; text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 4px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1, h2, h3 { font-weight: 600; line-height: 1.15; margin: 0; }
p { margin: 0 0 1em; }
ul { margin: 0 0 1em; padding-left: 1.1em; }
li { margin-bottom: .4em; }
.quiet { color: var(--quiet); }
.small { font: 400 .8rem/1.5 var(--ui); }
.wrap { max-width: 1080px; margin: 0 auto; padding-inline: 28px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 12px; background: var(--ink); color: var(--paper); padding: 8px 12px; }

/* Masthead */
.masthead-inner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px 28px; padding-block: 26px 22px; background: linear-gradient(var(--rule), var(--rule)) no-repeat; background-size: calc(100% - 56px) 1px; background-position: center bottom; }
.brand { font: 600 1.05rem/1 var(--serif); text-decoration: none; display: inline-flex; align-items: center; gap: 12px; }
.brand-mark { height: 34px; width: auto; display: block; }
.masthead nav { display: flex; flex-wrap: wrap; gap: 6px 24px; font: 400 .9rem/1 var(--ui); }
.masthead nav a { text-decoration: none; color: var(--quiet); }
.masthead nav a:hover, .masthead nav a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent); }

/* Portrait hero */
.portrait { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 64px; align-items: center; padding-block: 64px 72px; }
.photo { margin: 0; aspect-ratio: 4 / 5; max-width: 100%; background: var(--photo-bg); overflow: hidden; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-empty { display: grid; place-items: center; }
.photo-mark { font: 700 clamp(7rem, 16vw, 12rem)/1 var(--arabic); color: var(--quiet); opacity: .35; }
.name-ar { font: 700 clamp(2.6rem, 5.4vw, 4rem)/1.3 var(--arabic); margin: 0; text-align: left; }
.portrait h1 { font-size: clamp(2.4rem, 5vw, 3.7rem); letter-spacing: -0.01em; margin-bottom: 28px; }
.standfirst { font-size: clamp(1.25rem, 2.1vw, 1.5rem); line-height: 1.45; max-width: 30ch; margin-bottom: 20px; }
.role-line { color: var(--quiet); max-width: 44ch; }
.links { display: flex; gap: 28px; font: 600 1rem/1 var(--ui); margin-top: 28px; }

/* About */
.about { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); gap: 64px; background: linear-gradient(var(--rule), var(--rule)) no-repeat; background-size: calc(100% - 56px) 1px; background-position: center top; padding-block: 56px; }
.about-text p { max-width: var(--measure); }
.about-text p:first-child { font-size: 1.25rem; line-height: 1.6; }
.figures { font: 400 .95rem/1.5 var(--ui); color: var(--quiet); }
.figures p { border-top: 1px solid var(--rule); padding-top: 14px; margin-bottom: 18px; }
.figures strong { display: block; font: 600 1.9rem/1.1 var(--serif); color: var(--ink); margin-bottom: 4px; }

/* Chapters */
.chapter { background: linear-gradient(var(--rule), var(--rule)) no-repeat; background-size: calc(100% - 56px) 1px; background-position: center top; padding-block: 48px 40px; }
.chapter > h2 { font-size: 1.7rem; margin-bottom: 28px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; }
.two h2 { font-size: 1.7rem; margin-bottom: 24px; }
.entry { margin-bottom: 22px; }
.entry h3 { font-size: 1.15rem; }
.entry .quiet { font: 400 .9rem/1.5 var(--ui); margin: 4px 0 6px; }

/* Career */
.job { border-top: 1px solid var(--rule); }
.job:last-child { border-bottom: 1px solid var(--rule); }
.job summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: 170px minmax(0, 1fr) 20px; gap: 16px; padding: 16px 0; align-items: baseline; }
.job summary::-webkit-details-marker { display: none; }
.job summary::after { content: "+"; font: 400 1.3rem/1 var(--ui); color: var(--quiet); justify-self: end; }
.job[open] summary::after { content: "−"; }
.job-when { font: 400 .9rem/1.4 var(--ui); color: var(--quiet); }
.job-what { font-size: 1.15rem; }
.job-title { font-weight: 600; }
.job summary:hover .job-title { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 4px; }
.job-body { padding: 0 0 18px 186px; max-width: calc(var(--measure) + 186px); }
.job-body .quiet { font: 400 .9rem/1.5 var(--ui); }
.earlier { margin-top: 18px; font-size: 1rem; }

/* Selected work list */
.selected { display: grid; grid-template-columns: 1fr 1fr; gap: 0 48px; }
.piece { display: block; text-decoration: none; border-top: 1px solid var(--rule); padding: 18px 0 22px; }
.piece-title { display: block; font: 600 1.3rem/1.3 var(--serif); }
.piece-sub { display: block; font: 400 .9rem/1.5 var(--ui); color: var(--quiet); margin-top: 6px; }
.piece:hover .piece-title { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 5px; }

/* Inner pages */
.page-intro { padding-block: 64px 40px; }
.page-intro h1 { font-size: clamp(2.6rem, 6vw, 4.2rem); margin-bottom: 20px; }
.page-intro .standfirst { max-width: 40ch; }
.essay { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: 56px; background: linear-gradient(var(--rule), var(--rule)) no-repeat; background-size: calc(100% - 56px) 1px; background-position: center top; padding-block: 52px; scroll-margin-top: 16px; }
.essay h2 { font-size: 1.8rem; }
.essay header .quiet { font: 400 .9rem/1.5 var(--ui); margin-top: 10px; }
.essay-body { max-width: var(--measure); }
.essay-body h3 { font-size: 1.05rem; margin: 26px 0 10px; }
.essay-body li::marker { color: var(--accent); }
.principle { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: 56px; padding-block: 18px; }
.principle h2 { font-size: 1.35rem; }
.principle p { max-width: var(--measure); }
.rhythm { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 14px 16px; margin: 0; }
.rhythm dt { font: 600 .95rem/1.7 var(--ui); }
.rhythm dd { margin: 0; max-width: var(--measure); }
.pull { margin: 0 0 14px; border-left: 2px solid var(--accent); padding-left: 24px; }
.pull p { font: 400 italic clamp(1.6rem, 3.4vw, 2.3rem)/1.3 var(--serif); max-width: 28ch; margin: 0; }

/* Colophon */
.colophon { border-top: 1px solid var(--rule); margin-top: 24px; }
.colophon-inner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 24px; padding-block: 48px 24px; }
.colophon .sign { font: 700 2.6rem/1.2 var(--arabic); margin: 0; }
.colophon p { font: 400 .95rem/1.8 var(--ui); }

@media (max-width: 860px) {
  .portrait, .about, .two, .essay, .principle { grid-template-columns: 1fr; gap: 28px; }
  .portrait { padding-block: 36px 48px; }
  .photo { max-width: 420px; }
  .selected { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  body { font-size: 1.0625rem; }
  .wrap { padding-inline: 20px; }
  .masthead-inner, .about, .chapter, .essay { background-size: calc(100% - 40px) 1px; }
  .job summary { grid-template-columns: minmax(0, 1fr) 20px; gap: 2px 12px; }
  .job-when { grid-column: 1; grid-row: 1; }
  .job-what { grid-column: 1; grid-row: 2; }
  .job summary::after { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
  .job-body { padding-left: 0; }
  .rhythm { grid-template-columns: 1fr; gap: 0; }
  .rhythm dd { margin-bottom: 14px; }
}

/* ---------- People field ---------- */
:root { --hl: #f6e9eb; }
:root[data-theme="dark"] { --hl: #2a1a1d; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --hl: #2a1a1d; } }
.people { padding-block: 56px 24px; }
.people-head { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 24px 64px; align-items: end; margin-bottom: 40px; }
.people-head h1 { font-size: clamp(2.4rem, 5vw, 3.7rem); letter-spacing: -0.01em; }
.headline { font: 600 clamp(1.5rem, 2.6vw, 2rem)/1.25 var(--serif); margin-bottom: 14px; }
.people-intro .standfirst { font-size: 1.15rem; max-width: 42ch; color: var(--quiet); margin-bottom: 0; }
.people-intro .links { margin-top: 22px; }

.field {
  margin: 0; display: grid; align-items: stretch;
  grid-template-columns: var(--field-cols);
}
.side { display: grid; grid-template-rows: repeat(var(--rows), auto); grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.field-photo { margin: 6px 10px; background: var(--photo-bg); overflow: hidden; }
.field-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 35%; display: block; }
.field-photo.photo-empty { display: grid; place-items: center; }
.field-photo .photo-mark { font-size: clamp(5rem, 11vw, 9rem); }

.dot {
  aspect-ratio: 1; display: grid; place-items: center; color: var(--ink);
  transition: opacity .25s ease, color .25s ease;
  animation: dot-in .5s cubic-bezier(.2, .7, .3, 1) backwards; animation-delay: calc(var(--i) * 9ms);
}
.dot::after {
  content: ""; width: 46%; aspect-ratio: 1; border-radius: 50%;
  border: 1.5px solid currentColor; opacity: .55;
}
.dot.on::after { background: currentColor; opacity: 1; }
@keyframes dot-in { from { opacity: 0; transform: scale(.3); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .dot { animation: none; transition: none; } }

.legend { list-style: none; margin: 28px 0 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0 20px; }
.legend li { border-top: 2px solid var(--ink); }
.lg { display: block; text-decoration: none; padding: 12px 8px 14px; margin-inline: -8px; height: 100%; transition: background .2s ease; }
.lg:hover, .lg:focus-visible { background: var(--hl); }
.lg-count { display: block; font: 600 2rem/1.1 var(--serif); }
.lg-label { display: block; font: 600 .95rem/1.35 var(--ui); margin-top: 4px; }
.lg-note { display: block; font: 400 .85rem/1.45 var(--ui); color: var(--quiet); margin-top: 6px; }
.field-key { font: 400 .8rem/1.5 var(--ui); color: var(--quiet); margin: 18px 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.key-dot { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--ink); display: inline-block; opacity: .6; margin-left: 10px; }
.key-dot.on { background: var(--ink); opacity: 1; margin-left: 0; }

@media (max-width: 960px) {
  .legend { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; }
  .legend li { margin-bottom: 8px; }
}
@media (max-width: 760px) {
  .people-head { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .field { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .field-photo { order: -1; aspect-ratio: 4 / 5; margin: 0; }
  .side { grid-template-rows: none; grid-auto-flow: row; grid-template-columns: repeat(10, minmax(0, 1fr)); }
  .legend { grid-template-columns: 1fr; }
}

/* ---------- Theme switch ---------- */
.masthead nav { align-items: center; }
.theme-switch {
  appearance: none; background: none; border: 1px solid var(--rule); color: var(--ink);
  width: 34px; height: 34px; border-radius: 50%; padding: 0; cursor: pointer;
  display: inline-grid; place-items: center; margin-left: 4px;
}
.theme-switch:hover { border-color: var(--ink); }
.theme-switch svg { width: 17px; height: 17px; display: block; }
.theme-switch .i-sun { display: none; }
:root[data-theme="dark"] .theme-switch .i-sun { display: block; }
:root[data-theme="dark"] .theme-switch .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-switch .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-switch .i-moon { display: none; }
}

/* Header mark: one image per theme */
.brand-mark.for-dark { display: none; }
:root[data-theme="dark"] .brand-mark.for-light { display: none; }
:root[data-theme="dark"] .brand-mark.for-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-mark.for-light { display: none; }
  :root:not([data-theme="light"]) .brand-mark.for-dark { display: block; }
}
