/* Neil Tibrewal, site styles. October 2026. */

:root {
  --bg: #FAFAF7;
  --bg-2: #EFEFE9;
  --ink: #15171C;
  --ink-2: #3B3E46;
  --muted: #676B74;
  --rule: #DEDED7;
  --accent: #C4351B;
  --band: #C4351B;
  --tile: #15171C;
  --on-tile: #FAFAF7;
  --sans: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --wrap: 1200px;
  --gut: clamp(16px, 4vw, 40px);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121316;
    --bg-2: #1C1D21;
    --ink: #ECECE7;
    --ink-2: #C7C7C1;
    --muted: #999CA4;
    --rule: #2C2E34;
    --accent: #FF7357;
    --band: #A42D17;
    --tile: #202227;
    --on-tile: #ECECE7;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 18px/1.6 var(--serif);
  border-top: 5px solid var(--accent);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
figure { margin: 0; }
p { margin: 0 0 1em; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
::selection { background: var(--accent); color: #fff; }

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--sans);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -.02em;
  color: var(--ink);
}

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gut); }
.muted { color: var(--muted); }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 16px; background: var(--ink); color: var(--bg); padding: 8px 12px; z-index: 10; font-family: var(--sans); }

/* Header */
.top .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px 32px;
  padding-top: 22px;
  padding-bottom: 20px;
}
.top .bar { border-bottom: 1px solid var(--rule); }
.name {
  font: 800 21px/1 var(--sans);
  letter-spacing: -.025em;
  color: var(--ink);
  text-decoration: none;
}
.top nav { display: flex; flex-wrap: wrap; gap: 4px 26px; font: 500 16px/1 var(--sans); }
.top nav a {
  color: var(--ink-2);
  text-decoration: none;
  padding: 6px 0 5px;
  border-bottom: 2px solid transparent;
}
.top nav a:hover { color: var(--ink); border-color: var(--rule); }
.top nav a[aria-current] { color: var(--ink); border-color: var(--accent); }

/* Buttons and small links */
.btn {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  padding: 13px 18px 12px;
  background: var(--ink);
  color: var(--bg);
  font: 600 15px/1 var(--sans);
  text-decoration: none;
}
.btn:hover { background: var(--accent); color: #fff; }
.btn small { font-weight: 400; opacity: .7; font-size: 13px; }
.go { font: 600 16px/1.4 var(--sans); }

/* Home: hero */
.hero { padding: clamp(44px, 8vw, 104px) 0 clamp(48px, 7vw, 88px); }
.hero .where { font: 500 16px/1.4 var(--sans); color: var(--muted); margin-bottom: 22px; }
.hero h1 {
  font-size: clamp(40px, 7.2vw, 98px);
  font-weight: 800;
  line-height: .98;
  letter-spacing: -.045em;
  max-width: 14ch;
  margin-bottom: clamp(32px, 5vw, 60px);
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 96px);
  align-items: start;
}
.hero .intro { font-size: clamp(19px, 1.9vw, 23px); line-height: 1.5; color: var(--ink-2); max-width: 32em; }
.hero .intro p:last-child { margin-bottom: 0; }
.portrait { margin-bottom: 24px; }
.portrait img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; background: var(--bg-2); }

/* Key-value lists: hero glance, project facts */
.kv { margin: 0; border-top: 2px solid var(--ink); font-family: var(--sans); }
.kv div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 11px 0 10px;
  border-bottom: 1px solid var(--rule);
}
.kv dt { color: var(--muted); font-size: 15px; flex: none; }
.kv dd { margin: 0; font-size: 16px; font-weight: 600; text-align: right; }
.kv.stack div { display: block; }
.kv.stack dt { font-size: 14px; }
.kv.stack dd { text-align: left; font-weight: 500; margin-top: 2px; line-height: 1.4; }

/* Home: featured essay band */
.feature { background: var(--band); color: #fff; padding: clamp(48px, 7vw, 92px) 0; }
.feature .wrap {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 96px);
  align-items: end;
}
.feature .label { font: 500 15px/1.4 var(--sans); color: rgba(255, 255, 255, .82); margin-bottom: 18px; }
.feature h2 {
  font-size: clamp(34px, 4.8vw, 62px);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -.035em;
  color: #fff;
}
.feature h2 a { color: inherit; text-decoration: none; }
.feature h2 a:hover { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: .12em; }
.feature .dek { font-size: clamp(18px, 1.7vw, 21px); line-height: 1.5; margin: 22px 0 26px; color: rgba(255, 255, 255, .92); max-width: 30em; }
.feature .go { color: #fff; }
.feature blockquote {
  margin: 0;
  padding-left: 24px;
  border-left: 3px solid rgba(255, 255, 255, .55);
  font: italic 400 clamp(22px, 2.4vw, 30px)/1.38 var(--serif);
}

/* Sections */
.section { padding: clamp(52px, 7vw, 92px) 0 0; }
.sec-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px 24px;
  border-top: 2px solid var(--ink);
  padding-top: 14px;
  margin-bottom: clamp(28px, 4vw, 44px);
}
.sec-head h2 { font-size: clamp(24px, 2.6vw, 32px); }
.sec-head a { font: 500 16px/1.4 var(--sans); }

/* Project blocks */
.proj { display: block; color: inherit; text-decoration: none; }
.proj h3 { font-size: clamp(26px, 3vw, 40px); letter-spacing: -.03em; margin-bottom: 6px; }
.proj:hover h3 { color: var(--accent); }
.proj .meta { font: 500 15px/1.4 var(--sans); color: var(--muted); margin-bottom: 14px; }
.proj p { color: var(--ink-2); }
.proj .nums {
  font: 500 15px/1.5 var(--sans);
  color: var(--ink);
  border-top: 1px solid var(--rule);
  padding-top: 12px;
  margin: 18px 0 0;
}
.media { overflow: hidden; background: var(--bg-2); }
.media img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.proj:hover .media img { transform: scale(1.02); }

.proj.lead {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  gap: clamp(24px, 4vw, 52px);
  align-items: center;
  margin-bottom: clamp(44px, 6vw, 72px);
}
.proj.lead .media { aspect-ratio: 3 / 2; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px, 4vw, 52px); }
.pair .media { aspect-ratio: 4 / 3; margin-bottom: 20px; }
.pair h3 { font-size: clamp(24px, 2.4vw, 32px); }

.tile {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(20px, 3vw, 32px);
  background: var(--tile);
  color: var(--on-tile);
  font-family: var(--sans);
}
.tile b { font-size: clamp(28px, 3.4vw, 46px); font-weight: 800; line-height: 1.02; letter-spacing: -.035em; }
.tile span { font-size: 15px; opacity: .72; }

/* Rows on the projects page */
.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: clamp(24px, 4vw, 52px);
  align-items: center;
  padding: clamp(28px, 4vw, 40px) 0;
  border-top: 1px solid var(--rule);
}
.row:first-child { border-top: 0; padding-top: 0; }
.row .media { aspect-ratio: 3 / 2; }
.row p:last-child { margin-bottom: 0; }

/* Ledger tables */
.ledger { width: 100%; border-collapse: collapse; font-family: var(--sans); font-size: 16.5px; }
.ledger th {
  text-align: left;
  font-weight: 600;
  font-size: 14px;
  color: var(--muted);
  padding: 0 16px 10px 0;
  border-bottom: 1px solid var(--ink);
}
.ledger td { padding: 13px 16px 12px 0; border-bottom: 1px solid var(--rule); vertical-align: top; line-height: 1.45; }
.ledger td:first-child { color: var(--muted); white-space: nowrap; width: 8.5em; }
.ledger th:last-child, .ledger td:last-child { padding-right: 0; }
.ledger strong { font-weight: 600; }
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.scroll table { min-width: 640px; }

/* Inner page head */
.page-head { padding: clamp(44px, 7vw, 96px) 0 clamp(36px, 5vw, 60px); }
.page-head .back { display: inline-block; font: 500 15px/1.4 var(--sans); margin-bottom: 22px; }
.page-head .label { font: 500 16px/1.4 var(--sans); color: var(--muted); margin-bottom: 16px; }
.page-head h1 {
  font-size: clamp(40px, 6.4vw, 86px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.045em;
  max-width: 16ch;
}
.page-head .lede { font-size: clamp(19px, 1.9vw, 23px); line-height: 1.5; color: var(--ink-2); max-width: 34em; margin: 26px 0 0; }
.page-head .btn { margin-top: 30px; }

/* Two-column sections with the heading on the left */
.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2.7fr);
  gap: 16px clamp(24px, 5vw, 72px);
  padding: clamp(36px, 5vw, 60px) 0;
  border-top: 1px solid var(--rule);
}
.split > h2 { font-size: clamp(22px, 2.2vw, 28px); position: sticky; top: 24px; align-self: start; }
.split > div > p, .split > div > ul { max-width: 40em; }
.split h3 { font-size: 22px; margin: 2em 0 .5em; }
.split h3:first-child { margin-top: 0; }
.split .sub { font: 500 15px/1.4 var(--sans); color: var(--muted); margin: -.2em 0 1.2em; }

ul.plain { padding-left: 1.1em; margin: 0 0 1em; }
ul.plain li { margin-bottom: .4em; padding-left: .2em; }
ul.plain li::marker { color: var(--accent); }

/* Big numbers */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 2px solid var(--ink); font-family: var(--sans); }
.stats div { padding: 20px 20px 22px 0; border-bottom: 1px solid var(--rule); }
.stats div + div { padding-left: 20px; border-left: 1px solid var(--rule); }
.stats b {
  display: block;
  font-size: clamp(34px, 4.4vw, 58px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.04em;
  margin-bottom: 10px;
}
.stats span { display: block; font-size: 15px; line-height: 1.35; color: var(--muted); }
.stats.small b { font-size: clamp(30px, 3.2vw, 42px); }
.split .stats { margin: 4px 0 28px; }

/* Interests and books */
.defs { margin: 0; }
.defs div { padding: 18px 0; border-top: 1px solid var(--rule); }
.defs div:first-child { border-top: 0; padding-top: 0; }
.defs dt { font: 600 19px/1.3 var(--sans); letter-spacing: -.01em; margin-bottom: 4px; }
.defs dd { margin: 0; color: var(--ink-2); max-width: 40em; }

.books { list-style: none; padding: 0; margin: 0; }
.books li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.8fr);
  gap: 8px 32px;
  padding: 20px 0;
  border-top: 1px solid var(--rule);
}
.books li:first-child { border-top: 0; padding-top: 0; }
.books cite { display: block; font: italic 600 21px/1.25 var(--serif); }
.books .by { font: 500 15px/1.4 var(--sans); color: var(--muted); margin-top: 4px; display: block; }
.books p { margin: 0; color: var(--ink-2); }

/* Other work entries */
.work { padding: clamp(28px, 4vw, 40px) 0; border-top: 1px solid var(--rule); }
.work:first-child { border-top: 0; padding-top: 0; }
.work h3 { font-size: clamp(24px, 2.4vw, 30px); margin-bottom: 4px; }
.work .meta { font: 500 15px/1.4 var(--sans); color: var(--muted); margin-bottom: 16px; }
.cols3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px 32px; margin-top: 20px; }
.cols3 h4 { font-size: 15px; font-weight: 600; letter-spacing: 0; color: var(--muted); margin-bottom: 6px; padding-bottom: 6px; border-bottom: 1px solid var(--rule); }
.cols3 p, .cols3 li { font-size: 17px; }
.cols3 ul { padding-left: 1.1em; margin: 0; }
.cols3 li { margin-bottom: .35em; }
.cols3 li::marker { color: var(--accent); }

/* Project detail pages */
.cover { margin-bottom: clamp(36px, 5vw, 64px); }
.cover img { width: 100%; max-height: 680px; object-fit: cover; }
figcaption { font: 400 14.5px/1.45 var(--sans); color: var(--muted); margin-top: 10px; }
.detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2.3fr);
  gap: 36px clamp(28px, 5vw, 72px);
}
.detail aside { align-self: start; }
.detail aside figure { margin-top: 28px; }
.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 2.4em 0; }
.gallery.four { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 0; }
.gallery img { width: 100%; }
.cover .gallery { margin: 0; }

/* Long-form prose */
.prose { max-width: 37em; }
.prose p, .prose li { font-size: clamp(18px, 1.55vw, 20px); line-height: 1.7; }
.prose h2 { font-size: clamp(24px, 2.4vw, 30px); letter-spacing: -.025em; margin: 1.9em 0 .6em; }
.prose > h2:first-child { margin-top: 0; }
.prose blockquote {
  margin: 1.6em 0;
  padding-left: 22px;
  border-left: 3px solid var(--accent);
  font: italic 400 clamp(21px, 2vw, 25px)/1.45 var(--serif);
}
.prose .note { font-size: 16px; line-height: 1.6; color: var(--muted); border-top: 1px solid var(--rule); padding-top: 18px; margin-top: 3em; }
.prose sup a { text-decoration: none; font-family: var(--sans); font-size: .75em; padding: 0 1px; }

/* Essay page */
.essay-head { padding: clamp(44px, 7vw, 96px) 0 clamp(32px, 4vw, 52px); }
.essay-head .label { font: 500 16px/1.4 var(--sans); color: var(--muted); margin-bottom: 16px; }
.essay-head h1 {
  font-size: clamp(38px, 5.6vw, 76px);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -.04em;
  max-width: 17ch;
}
.essay-head .lede { font-size: clamp(19px, 1.9vw, 23px); line-height: 1.5; color: var(--ink-2); max-width: 33em; margin: 26px 0 0; }
.byline { font: 500 15px/1.4 var(--sans); color: var(--muted); margin-top: 26px; padding-top: 14px; border-top: 1px solid var(--rule); max-width: 37em; }
.essay { padding-bottom: 8px; }
.essay .prose > p:first-child::first-line { font-family: var(--sans); font-weight: 600; letter-spacing: -.005em; }
.refs { padding-left: 1.3em; margin: 0; }
.refs li { font-size: 16px !important; line-height: 1.55 !important; color: var(--muted); margin-bottom: .6em; }

/* Writing list */
.posts { list-style: none; margin: 0; padding: 0; }
.posts a { display: block; color: inherit; text-decoration: none; padding: 26px 0; border-bottom: 1px solid var(--rule); }
.posts li:first-child a { padding-top: 0; }
.posts .meta { font: 500 15px/1.4 var(--sans); color: var(--muted); margin-bottom: 10px; }
.posts h2 { font-size: clamp(28px, 3.4vw, 44px); letter-spacing: -.035em; margin-bottom: 10px; max-width: 20ch; }
.posts a:hover h2 { color: var(--accent); }
.posts p { color: var(--ink-2); max-width: 36em; margin: 0; }

/* Contact */
.contact { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }
.contact a {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 4px 24px;
  padding: 22px 0;
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
  text-decoration: none;
  font: 700 clamp(22px, 3.8vw, 44px)/1.15 var(--sans);
  letter-spacing: -.03em;
  overflow-wrap: anywhere;
}
.contact a span { font: 500 15px/1.4 var(--sans); letter-spacing: 0; color: var(--muted); }
.contact a:hover { color: var(--accent); }

/* Footer */
.foot { margin-top: clamp(64px, 9vw, 120px); border-top: 1px solid var(--rule); padding: 36px 0 44px; font: 400 15.5px/1.5 var(--sans); color: var(--muted); }
.foot .wrap { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px 48px; }
.foot p { margin: 0; }
.foot-name { font-weight: 800; font-size: 19px; color: var(--ink); letter-spacing: -.02em; margin-bottom: 4px !important; }
.foot ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: flex-end; align-content: start; gap: 6px 24px; }
.foot a { color: var(--ink); text-decoration: none; }
.foot a:hover { color: var(--accent); text-decoration: underline; }
.foot-base { grid-column: 1 / -1; font-size: 14px; }

/* Small screens */
@media (max-width: 820px) {
  .hero-grid, .feature .wrap, .proj.lead, .pair, .row, .split, .detail, .foot .wrap, .cols3, .books li { grid-template-columns: minmax(0, 1fr); }
  .split > h2, .detail aside { position: static; }
  .feature .wrap { align-items: start; }
  .row .media { order: -1; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stats div:nth-child(3) { padding-left: 0; border-left: 0; }
  .gallery.four { grid-template-columns: 1fr 1fr; }
  .foot ul { justify-content: flex-start; }
  .ledger td:first-child { width: 5.5em; white-space: normal; }
  .portrait { max-width: 280px; }
}
@media (max-width: 480px) {
  body { font-size: 17px; }
  .top nav { gap: 4px 18px; font-size: 15px; }
  .ledger { font-size: 15.5px; }
  .gallery { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .media img { transition: none; }
}

/* Print: mostly for the record page */
@media print {
  :root { --bg: #fff; --ink: #000; --ink-2: #222; --muted: #555; --rule: #bbb; --accent: #000; }
  body { border-top: 0; font-size: 11pt; }
  .top nav, .foot ul, .btn, .feature, .skip { display: none !important; }
  a { color: inherit; text-decoration: none; }
  .split > h2, .detail aside { position: static; }
  .split, .row, tr { break-inside: avoid; }
  .page-head, .section, .essay-head { padding-top: 12pt; }
}
