/* Sukhdeep Singh Gill · Cosmology
   Layout: one centred column (1160px), sticky header, sections divided by hairline rules.
   Look: night-sky ink ground; amber marks galaxy work, blue marks 21-cm work. */

:root {
  --ink: #0A0F1C;
  --panel: #10172A;
  --panel-hi: #141C30;
  --rule: #232C44;
  --rule-hi: #3A4566;
  --star: #ECE7DC;
  --dim: #A9B2C6;
  --blue: #8EC9F2;
  --amber: #F2B766;

  --serif: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  --sans: 'IBM Plex Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --math: 'STIX Two Text', Cambria, 'Times New Roman', serif;

  --ease: cubic-bezier(.2, .7, .2, 1);
  --wrap: 1160px;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; scroll-padding-top: 96px; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--star);
  font: 400 17px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--amber); text-decoration: none; transition: color .3s ease; }
a:hover { color: var(--star); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 4px; border-radius: 3px; }
h1, h2, h3, p, ul, ol, dl, dd, figure, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }

.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 50;
  padding: 10px 16px; border-radius: 8px; background: var(--amber); color: var(--ink); font-weight: 600;
}
.skip-link:focus { top: 12px; color: var(--ink); }

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(10, 15, 28, .84);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--rule);
  view-transition-name: site-header;
}
.site-header .wrap {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px 32px; padding-block: 16px;
}
.brand { display: flex; align-items: baseline; gap: 12px; color: var(--star); }
.brand:hover { color: var(--star); }
.brand-name { font-family: var(--serif); font-size: 27px; line-height: 1; }
.brand-tag { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--dim); }

.nav { display: flex; flex-wrap: wrap; gap: 2px 26px; font-size: 15px; }
.nav a { position: relative; display: inline-block; padding: 8px 0; color: var(--dim); white-space: nowrap; }
.nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 3px; height: 1px;
  background: var(--amber); transform: scaleX(0); transform-origin: left;
  transition: transform .45s var(--ease);
}
.nav a:hover, .nav a[aria-current="page"] { color: var(--star); }
.nav a:hover::after, .nav a[aria-current="page"]::after { transform: scaleX(1); }

@media (max-width: 720px) {
  .site-header .wrap { padding-block: 12px 4px; }
  .nav {
    width: 100%; flex-wrap: nowrap; overflow-x: auto; gap: 22px;
    scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent);
    mask-image: linear-gradient(90deg, #000 88%, transparent);
  }
  .nav::-webkit-scrollbar { display: none; }
}

/* ---------- Type ---------- */
.eyebrow { font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: var(--blue); }
.display {
  font-family: var(--serif); font-weight: 400; font-size: clamp(48px, 7vw, 84px);
  line-height: 1; letter-spacing: -.01em; text-wrap: balance;
}
.lead {
  font-family: var(--serif); font-style: italic; font-size: clamp(22px, 2.5vw, 29px);
  line-height: 1.32; text-wrap: balance; max-width: 36ch;
}
.intro-text { max-width: 60ch; color: var(--dim); }
.h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(34px, 4vw, 46px); line-height: 1.1; text-wrap: balance; }
.h3 { font-family: var(--serif); font-weight: 400; font-size: 30px; line-height: 1.15; }
.h3-sans { font-size: 21px; font-weight: 600; line-height: 1.3; }
.muted { color: var(--dim); }
.small { font-size: 15px; }
.prose { max-width: 66ch; display: flex; flex-direction: column; gap: 20px; }
.prose p { color: var(--dim); }
.prose p a { text-decoration: underline; text-decoration-color: rgba(242, 183, 102, .4); text-underline-offset: 3px; }

/* ---------- Layout ---------- */
.section { border-top: 1px solid var(--rule); }
.section > .wrap { padding-block: 72px; }
.page-intro > .wrap { padding-block: 72px 48px; display: flex; flex-direction: column; gap: 22px; }
.stack { display: flex; flex-direction: column; gap: var(--gap, 16px); }
.section-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 32px; }
.section-head .stack { --gap: 12px; }
.split { display: flex; flex-wrap: wrap; gap: 48px 64px; }
.split > .main { flex: 999 1 520px; min-width: 0; }
.split > .side { flex: 1 1 340px; min-width: 0; align-self: flex-start; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--min, 300px)), 1fr)); }
.grid.fill { grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--min, 300px)), 1fr)); }

/* ---------- Buttons, chips, links ---------- */
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 22px;
  border-radius: 999px; font-weight: 600; font-size: 15px;
  transition: transform .3s ease, filter .3s ease, border-color .3s ease, color .3s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn-solid { background: var(--amber); color: var(--ink); }
.btn-solid:hover { color: var(--ink); filter: brightness(1.1); }
.btn-ghost { border: 1px solid var(--rule-hi); color: var(--star); font-weight: 500; }
.btn-ghost:hover { border-color: var(--amber); color: var(--amber); }

.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px;
  border: 1px solid var(--rule); border-radius: 999px; color: var(--dim); font-size: 14px;
  transition: border-color .3s ease, color .3s ease, background-color .3s ease;
}
.chip:hover { border-color: var(--amber); color: var(--star); background: var(--panel-hi); }

.arrow { display: inline-block; transition: transform .3s ease; }
a:hover .arrow { transform: translateX(5px); }
a:hover .arrow.ne { transform: translate(3px, -3px); }
.more { font-size: 15px; font-weight: 500; }
.inline-links { display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: 14px; }

/* ---------- Cards ---------- */
.card {
  display: flex; flex-direction: column; gap: 10px; padding: 26px;
  border: 1px solid var(--rule); border-radius: 14px; background: var(--panel); color: var(--star);
}
.card.plain { background: transparent; padding: 30px; gap: 12px; }
.card-link { transition: transform .45s var(--ease), border-color .45s ease, background-color .45s ease; }
.card-link:hover { transform: translateY(-4px); border-color: var(--amber); background: var(--panel-hi); color: var(--star); }
.card-title { font-family: var(--serif); font-size: 26px; line-height: 1.15; }
.card .grow { flex: 1 1 auto; }

.tag { display: flex; align-items: center; gap: 8px; font-size: 12.5px; letter-spacing: .13em; text-transform: uppercase; color: var(--dim); }
.tag.amber { color: var(--amber); }
.tag.blue { color: var(--blue); }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; display: inline-block; background: var(--star); }
.dot.amber { background: var(--amber); }
.dot.blue { background: var(--blue); }
.key { display: flex; flex-wrap: wrap; gap: 8px 24px; font-size: 14px; color: var(--dim); }
.key li { display: flex; align-items: center; gap: 8px; }

/* ---------- Hero ---------- */
.hero > .wrap { padding-block: 72px 56px; display: flex; flex-wrap: wrap; align-items: center; gap: 48px; }
.hero-text { flex: 1 1 460px; min-width: 0; display: flex; flex-direction: column; gap: 22px; }
.hero-art { flex: 1 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.hero-art svg { width: 100%; height: auto; display: block; }
.hero-art figcaption { font-size: 13px; color: var(--dim); text-align: right; }

/* ---------- Facts panel ---------- */
.facts { border: 1px solid var(--rule); border-radius: 14px; background: var(--panel); overflow: hidden; }
.facts .portrait { aspect-ratio: 4 / 5; border-bottom: 1px solid var(--rule); background: var(--ink); }
.facts .portrait img { width: 100%; height: 100%; object-fit: cover; }
.facts dl > div { padding: 18px 22px; border-bottom: 1px solid var(--rule); }
.facts dl > div:last-child { border-bottom: 0; }
.facts dt { font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); }
.facts dd { margin-top: 4px; font-size: 15px; line-height: 1.5; }

/* ---------- Ruled lists ---------- */
.rows > li { border-top: 1px solid var(--rule); }
.rows > li:last-child { border-bottom: 1px solid var(--rule); }
.pub-row { display: flex; flex-wrap: wrap; gap: 6px 32px; padding: 22px 0; }
.pub-row .yr { flex: 0 0 64px; font-size: 15px; color: var(--dim); font-variant-numeric: tabular-nums; }
.pub-row .body { flex: 1 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.pub-row .body a { color: var(--star); font-size: 19px; font-weight: 500; line-height: 1.4; }
.pub-row .body a:hover { color: var(--amber); }

.link-row {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px;
  padding: 18px 0; transition: background-color .35s ease, padding .35s var(--ease);
}
.link-row:hover { background: var(--panel); padding-left: 14px; padding-right: 14px; }
.link-row > span { flex: 1 1 460px; min-width: 0; }
.link-row a { font-size: 15px; white-space: nowrap; }

.subject-row { display: flex; flex-wrap: wrap; gap: 8px 32px; padding: 20px 0; }
.subject-row h3 { flex: 0 0 220px; font-size: 13px; letter-spacing: .16em; text-transform: uppercase; font-weight: 500; color: var(--blue); padding-top: 4px; }
.subject-row ul { flex: 1 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.subject-row em { font-style: italic; }

/* ---------- Timeline of contributions ---------- */
.contrib { display: flex; flex-wrap: wrap; gap: 8px 40px; padding: 28px 0; }
.contrib .yr { flex: 0 0 100px; font-family: var(--serif); font-size: 34px; line-height: 1; color: var(--dim); font-variant-numeric: tabular-nums; }
.contrib .body { flex: 1 1 560px; min-width: 0; max-width: 72ch; display: flex; flex-direction: column; gap: 10px; }
.contrib .body p { color: var(--dim); }

/* ---------- Publications ---------- */
.year-group { display: flex; flex-wrap: wrap; gap: 12px 40px; padding: 36px 0; border-top: 1px solid var(--rule); }
.year-group:last-child { border-bottom: 1px solid var(--rule); }
.year-group > h2 { flex: 0 0 120px; font-family: var(--serif); font-weight: 400; font-size: 48px; line-height: 1; color: var(--dim); font-variant-numeric: tabular-nums; }
.year-group > .papers { flex: 1 1 640px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.paper {
  display: flex; flex-direction: column; gap: 10px; padding: 24px; border: 1px solid transparent; border-radius: 14px;
  transition: border-color .45s ease, background-color .45s ease, transform .45s var(--ease);
}
.paper:hover { border-color: var(--rule-hi); background: var(--panel); transform: translateX(4px); }
.paper h3 { font-size: 21px; font-weight: 500; line-height: 1.35; }
.paper h3 a { color: var(--star); }
.paper h3 a:hover { color: var(--amber); }
.paper .authors, .paper .venue { font-size: 15px; color: var(--dim); }
.paper .venue { font-style: italic; }
.me { color: var(--star); font-weight: 600; }
.paper .chips { padding-top: 4px; gap: 8px; }

/* ---------- Papers with summaries and figures ---------- */
[hidden] { display: none !important; }
.filters { display: flex; flex-direction: column; gap: 10px; padding-top: 6px; }
button.chip { background: transparent; font: inherit; font-size: 14px; cursor: pointer; }
.chip[aria-pressed="true"] { border-color: var(--amber); color: var(--star); background: var(--panel-hi); }
.paper.has-fig { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); column-gap: 32px; row-gap: 20px; align-items: start; }
.paper.has-fig:hover { transform: none; }
.paper .text { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.summary { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.summary p, .summary-line { font-size: 15.5px; line-height: 1.6; color: var(--dim); }
.summary .lbl { color: var(--star); font-weight: 600; }
.paper .fig { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.fig-frame { border: 1px solid var(--rule); border-radius: 12px; background: var(--panel); padding: 10px; overflow: hidden; }
.fig-frame img, .fig-frame svg { display: block; width: 100%; height: auto; }
.fig-frame.light { background: #fff; border-color: #fff; padding: 12px; }
.paper .fig figcaption { font-size: 13.5px; line-height: 1.55; color: var(--dim); }
.fig-kind { display: inline-block; margin-right: 8px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--blue); }
.nw { white-space: nowrap; }
.ss { display: inline-flex; flex-direction: column; vertical-align: 0.32em; font-size: .68em; line-height: 1.05; margin-left: 1px; }
.chart .pt { cursor: default; }
.chart .pt:hover > circle:not(:last-child), .chart .pt:hover > path:not(:first-of-type) { stroke: #ECE7DC; }
@media (max-width: 960px) { .paper.has-fig { grid-template-columns: 1fr; } }
.fig-frame.scroll { overflow-x: auto; }
@media (max-width: 600px) { .fig-frame.scroll .chart { min-width: 520px; } }

/* ---------- Math ---------- */
.math { font-family: var(--math); }
.eq { overflow-x: auto; }
.eq p { font-family: var(--math); font-size: 19px; line-height: 1.6; color: var(--star); }
.eq .nw { white-space: nowrap; }
.eq.big p { white-space: nowrap; }
.eq.big p { font-size: 26px; }
.frac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; line-height: 1.2; }
.frac > span { padding: 0 4px; }
.frac > span + span { border-top: 1px solid currentColor; }
.panel { display: flex; flex-direction: column; gap: 18px; padding: 30px; border: 1px solid var(--rule); border-radius: 16px; background: var(--panel); }
.panel .note { font-size: 14px; color: var(--dim); }
.panel .note.ruled { border-top: 1px solid var(--rule); padding-top: 16px; }
.panel svg { width: 100%; max-width: 300px; height: auto; align-self: center; display: block; }

/* ---------- Cosmic timeline ---------- */
.cosmic-timeline { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); margin-top: 40px; }
.cosmic-timeline li { display: flex; flex-direction: column; gap: 8px; padding: 0 16px 24px 0; border-top: 2px solid var(--rule); }
.cosmic-timeline .pt { width: 12px; height: 12px; margin-top: -7px; border-radius: 50%; background: var(--star); }
.cosmic-timeline .pt.blue { background: var(--blue); }
.cosmic-timeline .pt.amber { background: var(--amber); }
.cosmic-timeline .when { font-size: 14px; color: var(--dim); }
.cosmic-timeline .what { font-weight: 600; font-size: 16px; line-height: 1.3; }
.cosmic-timeline .why { font-size: 14px; color: var(--dim); line-height: 1.5; }

/* ---------- Figures ---------- */
.gallery { --min: 330px; row-gap: 32px; column-gap: 20px; }
.gallery figure { display: flex; flex-direction: column; gap: 14px; }
.frame {
  aspect-ratio: 4 / 3; max-width: 100%; border: 1px solid var(--rule); border-radius: 12px;
  background: var(--panel); overflow: hidden; display: flex; align-items: center; justify-content: center;
}
.frame img { width: 100%; height: 100%; object-fit: cover; }
.frame svg { width: 100%; height: 100%; display: block; padding: 12px; }
.gallery figcaption { font-size: 15px; line-height: 1.6; color: var(--dim); }
.gallery figcaption strong { color: var(--star); font-weight: 600; }
.gallery figure.wide { grid-column: 1 / -1; }
.frame.auto { aspect-ratio: auto; }
.frame.auto img { height: auto; }

/* ---------- Code page ---------- */
.repo { gap: 14px; padding: 30px; }
.repo .name { font-family: var(--serif); font-size: 40px; line-height: 1; }
.repo .full { font-size: 14px; color: var(--dim); letter-spacing: .02em; }
.io { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 15px; padding: 14px 0; border-block: 1px solid var(--rule); }
.io dt { color: var(--dim); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; padding-top: 3px; }
.io dd { color: var(--star); }

/* ---------- Reports & surveys ---------- */
.report { min-height: 180px; justify-content: space-between; gap: 28px; }
.name-sm { font-family: var(--serif); font-weight: 400; font-size: 34px; line-height: 1; }
button.btn { border: 1px solid var(--rule-hi); }

/* ---------- Contact ---------- */
.big-line { font-family: var(--serif); font-size: clamp(24px, 2.6vw, 30px); line-height: 1.2; overflow-wrap: anywhere; }
.contact-list li { padding: 12px 0; border-bottom: 1px solid var(--rule); }
.contact-list li:last-child { border-bottom: 0; }
.contact-list a { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 32px; color: var(--star); font-size: 18px; }
.contact-list a:hover { color: var(--amber); }
.contact-list .arrow { color: var(--amber); }
address { font-style: normal; display: flex; flex-direction: column; gap: 2px; }

/* ---------- Quote ---------- */
.quote > figure { max-width: 900px; margin: 0 auto; padding: 88px max(20px, env(safe-area-inset-right, 0px)) 88px max(20px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 18px; text-align: center; }
.quote blockquote { font-family: var(--serif); font-style: italic; font-size: clamp(28px, 3.6vw, 42px); line-height: 1.25; text-wrap: balance; }
.quote figcaption { font-size: 13px; letter-spacing: .2em; text-transform: uppercase; color: var(--dim); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--rule); }
.site-footer .wrap { padding-block: 36px 48px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px 32px; font-size: 14px; color: var(--dim); }

/* ---------- Motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes twinkle { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }
@keyframes drift { from { transform: translate(0, 0); } to { transform: translate(-12px, 8px); } }

.rise { animation: rise .9s var(--ease) both; }
.d1 { animation-delay: .1s; } .d2 { animation-delay: .2s; } .d3 { animation-delay: .3s; } .d4 { animation-delay: .4s; }
.tw1 { animation: twinkle 4.5s ease-in-out infinite; }
.tw2 { animation: twinkle 6s ease-in-out 1.5s infinite; }
.drift { animation: drift 22s ease-in-out infinite alternate; }

/* Scroll reveal: only hidden once the page script has confirmed it can reveal them */
.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.js .reveal.in { opacity: 1; transform: none; }

/* Smooth cross-fade between pages (Chrome, Edge, Safari 18.2+; other browsers just load normally) */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vt-out .28s var(--ease) both; }
::view-transition-new(root) { animation: vt-in .5s var(--ease) both; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-8px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(14px); } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .reveal { opacity: 1; transform: none; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
