/* narinder.com. Colours and fonts are tokens here; chat.css uses them too. */
:root {
  --bg: #fbfaf7;
  --surface: #f2f0ea;
  --ink: #1b2229;
  --muted: #5d6974;
  --rule: #e3dfd6;
  --accent: #0f5f66;
  --accent-dark: #0a474c;
  --accent-soft: #e2eff0;
  --health: #0f5f66;
  --cloud: #2f5aa8;
  --civil: #9a4b16;
  --tech: #6b3fa0;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Source Serif 4", Georgia, serif;
  /* Pages use the full window up to --wrap, then centre. Running text keeps
     a readable line length (--read) inside that. */
  --wrap: 96rem;
  --read: 46rem;
  --gutter: clamp(20px, 4vw, 56px);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 var(--sans); }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-dark); }
img { max-width: 100%; height: auto; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.wrap.narrow > * { max-width: var(--read); }
.muted { color: var(--muted); }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 12px; border-radius: 6px; z-index: 50; }
.skip-link:focus { left: 8px; }

/* Header and footer */
.site-header { border-bottom: 1px solid var(--rule); background: var(--bg); position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; gap: 16px; height: 60px; }
.site-nav { display: flex; gap: 4px; flex: 1; }
/* Home on the left, lined up with the page; the other links on the right */
.site-nav a:first-child { margin: 0 auto 0 -12px; }
.site-nav a { color: var(--ink); text-decoration: none; padding: 6px 12px; border-radius: 8px; font-weight: 500; }
.site-nav a:hover { background: var(--surface); }
.site-nav a[aria-current="page"] { background: var(--ink); color: #fff; }
.site-footer { border-top: 1px solid var(--rule); margin-top: 72px; padding: 28px 0 40px; color: var(--muted); font-size: .92rem; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }
.footer-name { margin: 0; font-weight: 600; color: var(--ink); }
.footer-links { display: flex; flex-wrap: wrap; gap: 18px; }

/* Headings */
h1, h2, h3 { line-height: 1.2; letter-spacing: -.015em; }
h1 { font-size: clamp(2rem, 4.5vw, 3rem); margin: 0 0 12px; }
h2 { font-size: 1.35rem; margin: 40px 0 16px; }
.page-header { padding: 44px 0 8px; }
.page-intro { color: var(--muted); max-width: var(--read); margin: 0; font-size: 1.05rem; }
.roles { color: var(--muted); font-size: 1.05rem; margin: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.section-head a { font-weight: 500; white-space: nowrap; }

/* Home */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hero { padding: 56px 0 40px; }
.hero-inner { display: grid; gap: 40px; align-items: center; }
.hero.with-photo .hero-inner { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: clamp(32px, 5vw, 80px); }
.hero h1 { font-size: clamp(2.4rem, 6vw, 3.6rem); margin-bottom: 14px; }
.lede { font-size: 1.2rem; max-width: var(--read); margin: 0 0 12px; }
.lede-more { font-size: 1.05rem; color: var(--muted); }
.hero-photo { display: block; width: 100%; height: auto; border-radius: 18px; object-fit: cover; aspect-ratio: 1600 / 935; box-shadow: 0 10px 30px rgba(27, 34, 41, .12); }
.search-home { display: flex; gap: 8px; max-width: 36rem; margin: 24px 0 14px; }
.search-home input, .search-bar input { flex: 1; font: 1rem var(--sans); padding: 12px 14px; border: 1px solid var(--rule); border-radius: 12px; background: #fff; color: var(--ink); min-width: 0; }
.search-home input:focus, .search-bar input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.search-home button { font: 600 .95rem var(--sans); padding: 0 18px; border: 0; border-radius: 12px; background: var(--ink); color: #fff; cursor: pointer; }
.thread-links { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { display: inline-flex; gap: 6px; align-items: center; padding: 6px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--rule); color: var(--ink); text-decoration: none; font-weight: 500; font-size: .92rem; }
.pill span { color: var(--muted); font-weight: 400; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.pill-health, .card-health, .tile-health { --c: var(--health); }
.pill-cloud, .card-cloud, .tile-cloud { --c: var(--cloud); }
.pill-civil-rights, .card-civil-rights, .tile-civil-rights { --c: var(--civil); }
.pill-technology, .card-technology, .tile-technology { --c: var(--tech); }
.tile-general { --c: var(--muted); }
.band { padding: 8px 0 40px; margin: 8px 0 8px; }
.band-dark { background: #141b21; color: #eef2f4; }
.band-dark h2, .band-dark .section-head a { color: #fff; }
.video-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 18px; }
.video-card { display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: inherit; }
.video-card:hover .video-title { text-decoration: underline; }
.video-title { font-weight: 600; line-height: 1.35; }
.video-meta { font-size: .85rem; opacity: .7; }
.thumb { position: relative; display: block; border-radius: 12px; overflow: hidden; background: #26313a; aspect-ratio: 16 / 9; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s ease; }
.video-card:hover .thumb img, .item-media.thumb:hover img { transform: scale(1.03); }
.play { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%; background: rgba(0, 0, 0, .62); }
.play::after { content: ""; position: absolute; left: 21px; top: 16px; border-style: solid; border-width: 10px 0 10px 16px; border-color: transparent transparent transparent #fff; }
.text-thumb { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 4px; padding: 18px 20px; background: #f5f1ea; color: #141b21; border-top: 4px solid var(--c); }
.text-thumb-outlet { font: 600 1.35rem/1.15 var(--serif); }
.text-thumb-detail { font-size: .9rem; color: #4b5560; }
.text-thumb-read { margin-top: auto; font-size: .8rem; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: #4b5560; }
.dur { position: absolute; right: 8px; bottom: 8px; font-size: .75rem; background: rgba(0, 0, 0, .75); color: #fff; padding: 1px 6px; border-radius: 4px; }
/* Recent writing: 4 across on wide screens (8 cards), 2 on tablets, 1 on phones */
.card-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
@media (max-width: 1150px) { .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .card-grid { grid-template-columns: 1fr; } }
.card { display: flex; flex-direction: column; gap: 8px; padding: 18px 18px 16px; background: #fff; border: 1px solid var(--rule); border-left: 4px solid var(--c); border-radius: 12px; text-decoration: none; color: var(--ink); transition: box-shadow .12s ease, transform .12s ease; }
.card:hover { box-shadow: 0 6px 20px rgba(27, 34, 41, .08); transform: translateY(-2px); color: var(--ink); }
.card.has-image { padding-top: 0; overflow: hidden; }
.card-image { display: block; width: calc(100% + 36px); max-width: none; margin: 0 -18px 4px; aspect-ratio: 16 / 9; object-fit: cover; }
.card-image.tile { border-radius: 0; }
.card-meta { display: flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--muted); }
.card-title { font: 600 1.08rem/1.3 var(--serif); }
.card-summary { font-size: .92rem; color: #3d4852; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-thread { margin-top: auto; font-size: .78rem; font-weight: 600; color: var(--c); text-transform: uppercase; letter-spacing: .05em; }
.favicon { width: 16px; height: 16px; border-radius: 3px; vertical-align: -3px; margin-right: 6px; }

/* Item rows (home, Work) */
.item-list { list-style: none; margin: 0; padding: 0; }
.item { display: grid; grid-template-columns: 176px minmax(0, 1fr); gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--rule); }
.item[hidden], .year[hidden] { display: none; }
/* Pictures and stand-in tiles share one 16:9 shape */
.item-media { width: 176px; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; }
.tile { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 10px; color: var(--c);
  background: radial-gradient(circle at 85% 15%, color-mix(in srgb, var(--c) 28%, transparent), transparent 55%), linear-gradient(135deg, color-mix(in srgb, var(--c) 10%, #fff), color-mix(in srgb, var(--c) 22%, #fff)); }
.tile svg { width: 30px; height: 30px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tile-label { max-width: 100%; font: 600 .72rem/1.2 var(--sans); letter-spacing: .03em; text-transform: uppercase; text-align: center; color: color-mix(in srgb, var(--c) 75%, #1b2229); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card-image.tile svg { width: 36px; height: 36px; }
.item-media.thumb img { aspect-ratio: 16 / 9; object-fit: cover; }
.item-media.thumb .play { width: 38px; height: 38px; margin: -19px 0 0 -19px; }
.item-media.thumb .play::after { left: 15px; top: 11px; border-width: 8px 0 8px 12px; }
.item-meta { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.item-title { display: inline-block; margin: 3px 0 2px; font-weight: 600; font-size: 1.06rem; color: var(--ink); text-decoration: none; line-height: 1.35; }
a.item-title:hover { color: var(--accent); text-decoration: underline; }
.item-outlet { color: var(--muted); font-size: .9rem; }
.item-summary { margin: 6px 0 0; max-width: var(--read); font-size: .95rem; }
.item-links { margin-top: 6px; font-size: .9rem; display: flex; gap: 14px; }

/* Work page */
.search-bar { display: flex; margin: 24px 0 0; max-width: 40rem; }
.filters { margin: 16px 0 4px; display: grid; gap: 10px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-row button { font: 500 .92rem/1 var(--sans); padding: 9px 14px; border-radius: 999px; border: 1px solid var(--rule); background: #fff; color: var(--ink); cursor: pointer; }
.filter-row button:hover { border-color: var(--muted); }
.filter-row button[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.filter-row .n { opacity: .6; font-weight: 400; margin-left: 2px; }
.type-tabs { border-bottom: 1px solid var(--rule); gap: 2px; }
.type-tabs button { border: 0; border-radius: 0; background: none; padding: 12px 12px 14px; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.type-tabs button[aria-selected="true"] { background: none; color: var(--ink); border-bottom-color: var(--accent); }
.filter-status { color: var(--muted); font-size: .9rem; margin: 14px 0 0; min-height: 1.5em; }
.year-h { font-size: 1rem; color: var(--muted); margin: 28px 0 0; padding-bottom: 6px; border-bottom: 2px solid var(--ink); }

/* Video overlay */
dialog.player { width: min(960px, 94vw); padding: 0; border: 0; border-radius: 14px; background: #000; color: #fff; overflow: hidden; }
dialog.player::backdrop { background: rgba(10, 14, 18, .8); }
.player-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; font-size: .92rem; }
.player-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-close { border: 0; background: none; color: #fff; font-size: 1.6rem; line-height: 1; width: 36px; height: 36px; border-radius: 8px; cursor: pointer; }
.player-close:hover { background: rgba(255, 255, 255, .15); }
.player-frame { aspect-ratio: 16 / 9; }
.player-frame iframe, .player-frame video { width: 100%; height: 100%; border: 0; display: block; background: #000; }

/* Articles */
.article { padding-top: 32px; }
.article-main { max-width: var(--read); }
@media (min-width: 1100px) {
  .article { display: grid; grid-template-columns: minmax(0, var(--read)) minmax(14rem, 22rem); column-gap: clamp(40px, 6vw, 96px); align-items: start; }
  .article-side { position: sticky; top: 84px; }
  .article-side .related { border-top: 0; margin-top: 8px; }
}
.crumbs { font-size: .9rem; color: var(--muted); margin: 0 0 12px; }
.article h1 { font-size: clamp(1.8rem, 4vw, 2.5rem); }
.byline { color: var(--muted); margin: 0 0 18px; }
.cover { margin: 0 0 20px; }
.cover img { display: block; width: 100%; border-radius: 12px; }
.provenance { background: var(--accent-soft); border-radius: 10px; padding: 12px 16px; font-size: .92rem; margin-bottom: 28px; }
.prose { font: 1.12rem/1.72 var(--serif); }
.prose h2, .prose h3, .prose h4 { font-family: var(--sans); }
.prose h2 { font-size: 1.35rem; } .prose h3 { font-size: 1.15rem; }
.prose blockquote { margin: 1.2em 0; padding-left: 18px; border-left: 3px solid var(--rule); color: #37414a; }
.prose .img-note { font: italic .9rem/1.4 var(--sans); color: var(--muted); }
.prose .figure { margin: 1.6em 0; }
.prose .figure img { display: block; max-width: 100%; height: auto; margin: 0 auto; border-radius: 8px; }
.prose .figure figcaption { font: .9rem/1.45 var(--sans); color: var(--muted); text-align: center; margin-top: 8px; }
.related { border-top: 1px solid var(--rule); margin-top: 40px; }
.related ul { padding-left: 18px; }
.related li { margin: 6px 0; }

/* About */
.about { display: grid; gap: 8px; }
@media (min-width: 960px) {
  .about { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); column-gap: clamp(40px, 6vw, 96px); align-items: start; }
  .about .prose { grid-row: span 2; }
}
.source-note { font: .9rem var(--sans); color: var(--muted); }
.timeline ol { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--rule); }
.timeline li { position: relative; padding: 0 0 16px 20px; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: .55em; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.t-date { font-weight: 600; margin-right: 6px; }
.t-src { font-size: .85rem; white-space: nowrap; }
.to-confirm { font-size: .72rem; background: #fdf1e3; color: #8a4a12; border-radius: 999px; padding: 1px 8px; white-space: nowrap; }

@media (max-width: 1100px) {
  .hero.with-photo .hero-inner { grid-template-columns: 1fr; row-gap: 28px; }
  .hero-photo { max-width: 40rem; }
}
@media (max-width: 720px) {
  .hero-photo { order: -1; }
}
@media (max-width: 560px) {
  .hero { padding-top: 32px; }
  .item { gap: 12px; grid-template-columns: 120px minmax(0, 1fr); }
  .item-media { width: 120px; }
  .tile { gap: 3px; padding: 6px; }
  .tile svg { width: 22px; height: 22px; }
  .tile-label { font-size: .6rem; -webkit-line-clamp: 1; }
  .type-tabs { flex-wrap: nowrap; overflow-x: auto; }
  .type-tabs button { white-space: nowrap; }
}
