/* Two halves. Day: cool star-chart paper for work, study and projects. Night: a neutral
   darkroom charcoal, chosen so photographs keep the sky colour they were processed with
   (a navy frame made neutral skies look grey-green). Accents are the two narrowband lines
   astrophotographers live by, H-alpha red and OIII teal. */
:root {
  --paper: #eef1f5;
  --paper-tint: #e3e8ef;
  --ink: #172033;
  --ink-soft: #4a5568;
  --rule: #c7cfda;
  --ha: #b3303c;
  --oiii: #1d7471;

  --night: #111110;
  --night-raise: #1b1b19;
  --night-line: #2d2d2a;
  --night-ink: #e6e5e1;
  --night-soft: #a3a29c;
  --ha-lit: #f26d76;
  --oiii-lit: #62cfca;

  --chart-temp: #b3303c;
  --chart-press: #008c84;

  --sans: "Chivo", system-ui, sans-serif;
  --serif: "Literata", Georgia, serif;

  --gutter: clamp(1rem, 4vw, 2.5rem);
  --wide: 76rem;
  --measure: 38rem;
  --bar-h: 3.5rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #171716;
    --paper-tint: #1d1d1b;
    --ink: #e6e5e1;
    --ink-soft: #a6a59f;
    --rule: #33332f;
    --ha: #f07a83;
    --oiii: #62c7c2;
    --night: #0b0b0a;
    --night-raise: #161615;
    --night-line: #292926;
    --chart-temp: #e0505e;
    --chart-press: #14a89e;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: var(--bar-h); -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.125rem/1.7 var(--serif);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }

a { color: var(--ha); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 2px solid var(--oiii); outline-offset: 3px; border-radius: 2px; }

h1, h2, h3 { font-family: var(--sans); margin: 0; text-wrap: balance; }
/* The name is the one big typographic moment; section titles stay well below it. */
h2 { font-size: clamp(1.875rem, 3.2vw, 2.5rem); font-weight: 300; line-height: 1.1; letter-spacing: -0.02em; }
h3 { font-size: 1.1875rem; font-weight: 600; line-height: 1.3; }
p { margin: 0 0 1.1em; text-wrap: pretty; }

.skip {
  position: absolute; left: 1rem; top: -4rem; z-index: 30;
  padding: 0.5rem 1rem; background: var(--paper); color: var(--ink); font-family: var(--sans);
}
.skip:focus { top: 1rem; }

.wrap { max-width: var(--wide); margin: 0 auto; }
.prose > :last-child { margin-bottom: 0; }
.lead { font-size: 1.3125rem; line-height: 1.55; }
.meta { font: 400 0.9375rem/1.4 var(--sans); color: var(--oiii); margin-bottom: 0.9rem; }

/* ---------- The bar ---------- */

.bar {
  position: fixed; inset: 0 0 auto; z-index: 20;
  display: flex; align-items: center; gap: 2rem;
  height: var(--bar-h);
  padding: 0 var(--gutter);
  border-bottom: 1px solid transparent;
  font: 400 0.9375rem/1 var(--sans);
  transition: background-color 0.25s ease, border-color 0.25s ease;
}
.bar.is-solid {
  background: rgb(17 17 16 / 0.9);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom-color: var(--night-line);
}
@media (prefers-reduced-motion: reduce) { .bar { transition: none; } }

.bar a { color: rgb(255 255 255 / 0.82); text-decoration: none; }
.bar a:hover { color: #fff; }
.bar__name { color: #fff; font-weight: 500; white-space: nowrap; }
.bar__links { display: flex; gap: 1.75rem; margin-left: auto; }
.bar__links a { white-space: nowrap; padding: 1.15rem 0 calc(1.15rem - 2px); border-bottom: 2px solid transparent; }
.bar__links a[aria-current="true"] { color: #fff; border-bottom-color: var(--ha-lit); }
.bar :focus-visible { outline-color: var(--oiii-lit); outline-offset: -2px; }
@media (max-width: 560px) {
  .bar__name { display: none; }
  .bar__links { margin: 0 auto; gap: 1.5rem; }
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  align-content: end;
  padding: calc(var(--bar-h) + 1.5rem) var(--gutter) clamp(1.75rem, 4vw, 3rem);
  background: radial-gradient(ellipse at 60% 40%, #262624 0%, var(--night) 70%);
  color: var(--night-ink);
  overflow: hidden;
  isolation: isolate;
}

.hero__sky { position: absolute; inset: 0; z-index: -1; }
/* Neutral shade only: darkens the bottom for the text and the top for the bar,
   without tinting the photograph. */
.hero__sky::after {
  content: "";
  position: absolute; inset: 0;
  background:
    linear-gradient(to top, rgb(10 10 9 / 0.9) 0%, rgb(10 10 9 / 0.55) 26%, rgb(10 10 9 / 0) 50%),
    linear-gradient(to bottom, rgb(10 10 9 / 0.6) 0%, rgb(10 10 9 / 0) 16%);
}

.hero__img { width: 100%; height: 100%; object-fit: cover; object-position: 55% 45%; }

/* The one orchestrated moment: the image "integrates" in, like a stack of sub-exposures. */
.hero__img.is-exposing { animation: expose 2.4s cubic-bezier(0.2, 0.6, 0.2, 1) both; }
@keyframes expose {
  from { filter: brightness(0.08) blur(10px); transform: scale(1.03); }
  60%  { filter: brightness(0.75) blur(1px); }
  to   { filter: none; transform: none; }
}
@media (prefers-reduced-motion: reduce) { .hero__img.is-exposing { animation: none; } }

/* Everything sits along the bottom edge, in the darkest part of the frame and clear of
   the image's centre: the name and a one-line introduction on the left, the two live
   captions in a column on the right, both resting on the same baseline. */
.hero__foot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(13rem, 17rem);
  align-items: end;
  gap: 2rem clamp(2rem, 5vw, 4rem);
  width: 100%;
  max-width: 104rem;
  margin: 0 auto;
}

.hero h1 {
  font-size: clamp(3rem, 8vw, 8rem);
  font-weight: 200;
  line-height: 0.92;
  letter-spacing: -0.035em;
  color: #fff;
  text-wrap: initial;
}

.hero__intro {
  margin: 1.1rem 0 0;
  font-size: clamp(1.125rem, 1.9vw, 1.375rem);
  line-height: 1.45;
  color: var(--night-ink);
}

.hero__intro span { display: block; }

.hero__captions { display: grid; gap: 1.1rem; padding-bottom: 0.3rem; }

.hero__caption {
  display: grid;
  align-content: start;
  gap: 0.1rem;
  padding: 0 0 0 0.9rem;
  border: 0;
  border-left: 2px solid var(--ha-lit);
  background: none;
  color: var(--night-soft);
  font: 400 0.875rem/1.45 var(--sans);
  text-align: left;
  cursor: pointer;
}
.hero__caption[hidden] { display: none; }
.hero__caption-kicker { color: var(--ha-lit); }
.hero__caption-title { color: #fff; font-size: 1.0625rem; font-weight: 600; }
.hero__caption-title,
.hero__caption-meta,
.hero__intro span { text-wrap: balance; }
.hero__caption:hover .hero__caption-title { text-decoration: underline; text-underline-offset: 0.25em; }

@media (max-width: 860px) {
  .hero__foot { grid-template-columns: minmax(0, 1fr); gap: 1.75rem; }
  .hero__captions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 1.1rem 2.5rem; }
  .hero__captions > * { max-width: 20rem; }
}

/* ---------- Bands ---------- */

.band { padding: clamp(4rem, 9vw, 7rem) var(--gutter); }
.band--tint { background: var(--paper-tint); }

.head { max-width: 44rem; margin-bottom: clamp(2.25rem, 4.5vw, 3.25rem); }
.head h2 { margin-bottom: 1rem; }
.head .lead { margin: 0; }

/* ---------- About ---------- */

#about h2 { margin-bottom: clamp(1.75rem, 3.5vw, 2.5rem); }

.about {
  display: grid;
  grid-template-columns: minmax(0, var(--measure)) minmax(17rem, 25rem);
  justify-content: space-between;
  gap: 3rem clamp(3rem, 8vw, 7rem);
}
@media (max-width: 900px) { .about { grid-template-columns: minmax(0, 1fr); } }

/* A real sequence, so it gets a real timeline: one line, one mark per step, the
   current role marked in H-alpha red. */
.timeline h3 { font-size: 1rem; margin-bottom: 1.25rem; }
.timeline ol { list-style: none; margin: 0; padding: 0; }
.timeline li {
  position: relative;
  padding: 0 0 1.5rem 1.5rem;
  border-left: 1px solid var(--rule);
}
.timeline li:last-child { padding-bottom: 0; border-left-color: transparent; }
.timeline li::before {
  content: "";
  position: absolute; left: -5px; top: 0.3rem;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--paper); border: 1.5px solid var(--ink-soft);
}
.timeline li.is-now::before { background: var(--ha); border-color: var(--ha); }
.timeline li > * { margin: 0; }
.timeline__when { font: 400 0.875rem/1.4 var(--sans); color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.timeline .timeline__what { margin-top: 0.2rem; font: 600 1rem/1.35 var(--sans); }
.timeline__where { font: 400 0.9375rem/1.4 var(--sans); color: var(--ink-soft); }
.timeline .timeline__note { margin-top: 0.35rem; font-size: 0.9375rem; line-height: 1.5; color: var(--ink-soft); }
.timeline__more { margin: 1.5rem 0 0; font: 400 0.9375rem/1.5 var(--sans); }
.timeline__footnote { margin: 1.5rem 0 0; font: 400 0.8125rem/1.5 var(--sans); color: var(--ink-soft); }
.timeline__more + .timeline__footnote { margin-top: 0.5rem; }

/* ---------- Projects ---------- */

.features {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(2.5rem, 5vw, 4rem) clamp(2rem, 4vw, 3.5rem);
}
@media (max-width: 900px) { .features { grid-template-columns: minmax(0, 1fr); } }

.feature__art {
  margin: 0 0 1.75rem;
  padding: clamp(1rem, 3vw, 1.75rem);
  background: var(--night);
}
.feature__art svg { display: block; width: 100%; height: auto; }
.feature h3 { font-size: 1.5rem; margin-bottom: 0.35rem; }
.feature__body > :last-child { margin-bottom: 0; }

/* Line drawings share the night palette so they read as one set. */
.art-line { fill: none; stroke: #8d8c86; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.art-line--thin { stroke-width: 1.25; stroke: #5f5e59; }
.art-accent { fill: none; stroke: var(--oiii-lit); stroke-width: 2; stroke-linecap: round; }
.art-dot { fill: var(--ha-lit); }
.art-dot--dim { fill: var(--oiii-lit); }
.art-title { font: 600 16px var(--sans); fill: #fff; }
.art-label { font: 400 15px var(--sans); fill: #b4b3ad; }
.art-note { font: 400 14px var(--sans); fill: var(--oiii-lit); }
.art-out { font: 400 16px var(--sans); fill: #e6e5e1; }
.art-out--lit { fill: var(--ha-lit); }

.minor {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2.5rem clamp(1.5rem, 3vw, 2.5rem);
  margin-top: clamp(3.5rem, 7vw, 5rem);
}
@media (max-width: 1100px) { .minor { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .minor { grid-template-columns: minmax(0, 1fr); } }
.minor article { padding-top: 1.25rem; border-top: 2px solid var(--ink); }
.minor h3 { margin-bottom: 0.3rem; }
.minor p { font-size: 1rem; line-height: 1.6; }
.minor p:last-child { margin-bottom: 0; }

/* ---------- Night: tonight, the gallery, contact ---------- */

.band--night {
  /* Re-point the shared tokens so charts, tables and links drawn with them come out
     in night colours without extra rules. */
  --ink: var(--night-ink);
  --ink-soft: var(--night-soft);
  --rule: var(--night-line);
  --paper: var(--night);
  --paper-tint: var(--night);
  --ha: var(--ha-lit);
  --oiii: var(--oiii-lit);
  --chart-temp: #f26d76;
  --chart-press: #4cc3bb;
  background: var(--night);
  color: var(--night-ink);
  color-scheme: dark;
}
.band--night h2 { color: #fff; }
.night > section + section {
  margin-top: clamp(4.5rem, 10vw, 7.5rem);
  padding-top: clamp(3.5rem, 7vw, 5.5rem);
  border-top: 1px solid var(--night-line);
}

.deck {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: 1.5rem clamp(1.5rem, 4vw, 3rem);
  margin-bottom: 2.5rem;
}
@media (max-width: 900px) { .deck { grid-template-columns: minmax(0, 1fr); } }

.tonight {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  gap: 1.5rem;
  align-items: center;
  padding: 1.75rem;
  background: var(--night-raise);
  border: 1px solid var(--night-line);
}
.tonight__moon { width: 5.5rem; height: 5.5rem; }
.tonight__moon-dark { fill: #23231f; stroke: #3a3a35; stroke-width: 1; }
.tonight h3 { color: #fff; font-size: 1.25rem; }
.tonight__times { margin: 0.25rem 0 0; font: 400 0.9375rem/1.5 var(--sans); color: var(--night-soft); }
.tonight__times:empty { display: none; }
.tonight__verdict { margin: 0.85rem 0 0; font-style: italic; font-size: 1.0625rem; line-height: 1.5; }
.tonight__verdict:empty { display: none; }
@media (max-width: 480px) {
  .tonight { grid-template-columns: 4rem minmax(0, 1fr); gap: 1rem; padding: 1.25rem; }
  .tonight__moon { width: 4rem; height: 4rem; }
}

.conditions { align-self: center; }
.now { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 1.5rem; margin-bottom: 1.25rem; }
.now__temp { margin: 0; font: 200 clamp(3.25rem, 6vw, 4.5rem)/1 var(--sans); letter-spacing: -0.03em; color: #fff; }
.now__range { margin: 0; max-width: 30ch; font: 400 0.9375rem/1.5 var(--sans); color: var(--ink-soft); }

.readings {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem 1.5rem;
  margin: 0;
  padding-top: 1.1rem;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
}
.readings dt { font-size: 0.8125rem; line-height: 1.35; color: var(--ink-soft); }
.readings dd { margin: 0.2rem 0 0; font-size: 1.0625rem; line-height: 1.35; }
@media (max-width: 640px) { .readings { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.chart { margin: 0 0 1.5rem; }
.chart figcaption { margin-bottom: 0.4rem; font: 600 0.9375rem/1.4 var(--sans); }
.chart__plot { position: relative; touch-action: pan-y; }
.chart__plot:focus-visible { outline-offset: 6px; }
.chart__plot svg { display: block; width: 100%; overflow: visible; }
.chart__plot .gridline { stroke: var(--rule); stroke-width: 1; shape-rendering: crispEdges; }
.chart__plot .tick { font: 400 12px var(--sans); font-variant-numeric: tabular-nums; fill: var(--ink-soft); }
.chart__plot .series { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart__plot .dot { stroke: var(--paper-tint); stroke-width: 2; }
.chart__plot .value-label { font: 500 13px var(--sans); fill: var(--ink); }
.chart__plot .extreme-label { font: 400 12px var(--sans); fill: var(--ink-soft); }
.chart__plot .crosshair { stroke: var(--ink-soft); stroke-width: 1; shape-rendering: crispEdges; }

.chart__tip {
  position: absolute;
  padding: 0.3rem 0.55rem;
  background: var(--ink);
  color: var(--paper);
  font: 400 0.8125rem/1.3 var(--sans);
  white-space: nowrap;
  pointer-events: none;
  transform: translate(-50%, -100%);
}
.chart__tip strong { font-weight: 600; margin-right: 0.4rem; }
.chart__tip[hidden] { display: none; }

.chart__note { margin: -0.5rem 0 1rem; font: 400 0.8125rem/1.5 var(--sans); color: var(--ink-soft); }
.chart__note:empty { display: none; }

.chart__table { margin-bottom: 1rem; font: 400 0.9375rem/1.5 var(--sans); }
.chart__table summary { cursor: pointer; color: var(--ha); }
.chart__table table { margin-top: 0.75rem; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.chart__table th,
.chart__table td { padding: 0.3rem 1.75rem 0.3rem 0; border-bottom: 1px solid var(--rule); text-align: left; }
.chart__table th { font-weight: 500; color: var(--ink-soft); }

.weather__status { margin: 0; font: 400 0.875rem/1.5 var(--sans); color: var(--ink-soft); }
.weather__status:empty { display: none; }

/* Gallery */

.astro-summary { margin: 1rem 0 0; color: var(--night-soft); }
.astro-summary:empty { display: none; }

.rig { margin: 0 0 clamp(2rem, 4vw, 3rem); font: 400 0.9375rem/1.5 var(--sans); }
.rig[hidden] { display: none; }
.rig__title { margin: 0 0 0.9rem; font-size: 1rem; color: #fff; }
.rig__list { display: flex; flex-wrap: wrap; gap: 1.25rem clamp(2rem, 5vw, 4rem); margin: 0; }
.rig dt { color: var(--night-soft); margin-bottom: 0.15rem; }
.rig dd { margin: 0; color: #fff; }

.gallery__status { margin: 0; color: var(--night-soft); font-family: var(--sans); }
.gallery[data-state="ready"] > .gallery__status { display: none; }

/* Most-liked mosaic: one large frame and two beside it. */
.mosaic {
  display: grid;
  grid-template-columns: 2fr 1fr;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  aspect-ratio: 16 / 7.4;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}
.mosaic li { position: relative; min-height: 0; }
.mosaic li:first-child { grid-row: span 2; }
.mosaic button { width: 100%; height: 100%; }
@media (max-width: 720px) {
  .mosaic { grid-template-columns: 1fr 1fr; grid-template-rows: auto auto; aspect-ratio: auto; }
  .mosaic li:first-child { grid-column: span 2; grid-row: auto; aspect-ratio: 16 / 10; }
  .mosaic li { aspect-ratio: 4 / 3; }
}

.gallery-caption {
  margin: 0 0 clamp(3rem, 6vw, 4.5rem);
  font: 400 0.875rem/1.5 var(--sans);
  color: var(--night-soft);
}

.year {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr);
  gap: 1.5rem;
  margin-top: 2.5rem;
}
.year:first-of-type { margin-top: 0; }
.year h3 {
  font-size: 1rem; font-weight: 400;
  color: var(--night-soft);
  font-variant-numeric: tabular-nums;
  padding-top: 0.15rem;
}
@media (max-width: 640px) { .year { grid-template-columns: minmax(0, 1fr); gap: 0.75rem; } }

/* Justified rows: each tile grows in proportion to its aspect ratio, so rows
   stay flush while images keep their true shape and chronological order. */
.tiles { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
.tiles::after { content: ""; flex-grow: 999; }
.tile { flex: var(--ar) 1 calc(var(--ar) * var(--row-h, 14rem)); position: relative; }
.tiles--small .tile { --row-h: 9rem; }
/* Phones: an even two-up grid (three-up for earlier work) instead of long single-image rows. */
@media (max-width: 640px) {
  .tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.4rem; }
  .tiles--small { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tiles::after { content: none; }
  .tile .frame { aspect-ratio: 4 / 3; }
}

.frame {
  display: block; width: 100%; height: 100%;
  padding: 0; border: 0; background: var(--night-raise);
  cursor: zoom-in;
  overflow: hidden;
}
.tile .frame { aspect-ratio: var(--ar); }
.frame img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.frame:hover img { transform: scale(1.02); }
@media (prefers-reduced-motion: reduce) { .frame img { transition: none; } .frame:hover img { transform: none; } }

.frame__label {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: grid; gap: 0.1rem;
  padding: 2rem 0.9rem 0.7rem;
  background: linear-gradient(to top, rgb(10 10 9 / 0.88), rgb(10 10 9 / 0));
  color: #fff;
  font: 500 0.875rem/1.3 var(--sans);
  text-align: left;
  pointer-events: none;
}
.frame__label small { font-size: 0.8125rem; font-weight: 400; color: var(--night-soft); }
.tile .frame__label { opacity: 0; transition: opacity 0.2s; }
.tile .frame:hover .frame__label,
.tile .frame:focus-visible .frame__label { opacity: 1; }
@media (hover: none) { .tile .frame__label { opacity: 1; } }
.mosaic li:first-child .frame__label { padding: 3rem 1.25rem 1rem; font-size: 1.125rem; }

.earlier { margin-top: 3rem; border-top: 1px solid var(--night-line); }
.earlier summary { cursor: pointer; padding: 1.25rem 0; font: 500 1rem/1.4 var(--sans); color: var(--night-ink); }
.earlier summary span { color: var(--night-soft); font-weight: 400; }
.earlier[open] summary { margin-bottom: 0.5rem; }

.gallery__more { margin: 2.5rem 0 0; font: 500 1rem/1.4 var(--sans); text-align: right; }

/* Contact closes the night half. */
.contact h2 { margin-bottom: 1rem; }
.contact__intro { margin: 0 0 0.5rem; color: var(--night-soft); }
.contact__email {
  margin: 0 0 1.5rem;
  font: 200 clamp(1.75rem, 5vw, 3.25rem)/1.15 var(--sans);
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}
.contact__email a { color: #fff; text-decoration-color: var(--ha-lit); text-decoration-thickness: 1px; text-underline-offset: 0.14em; }
.contact__email a:hover { text-decoration-thickness: 2px; }
.contact__links {
  display: flex; flex-wrap: wrap; gap: 0.5rem 2.5rem;
  margin: 0; padding: 0; list-style: none;
  font: 400 1rem/1.5 var(--sans); color: var(--night-soft);
}

.footer { padding: 0 var(--gutter); background: var(--night); color: var(--night-soft); }
.footer__inner {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 2rem;
  padding: 2rem 0 3rem;
  border-top: 1px solid var(--night-line);
  font: 400 0.875rem/1.5 var(--sans);
}
.footer p { margin: 0; }

/* ---------- Image viewer ---------- */

.viewer {
  width: 100vw; height: 100dvh;
  max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0;
  background: rgb(8 8 7 / 0.97);
  color: var(--night-ink);
  color-scheme: dark;
}
.viewer[open] { display: grid; grid-template-columns: minmax(0, 1fr) 20rem; grid-template-rows: minmax(0, 1fr); }
.viewer::backdrop { background: rgb(8 8 7 / 0.9); }
.viewer a { color: var(--ha-lit); }

.viewer__frame { display: grid; place-items: center; padding: 1.5rem; min-height: 0; }
.viewer__img { max-width: 100%; max-height: 100%; object-fit: contain; }

.viewer__info { padding: 5rem 1.75rem 2rem; overflow-y: auto; border-left: 1px solid var(--night-line); font-family: var(--sans); }
.viewer__info h3 { font-size: 1.375rem; color: #fff; }
.viewer__date { color: var(--night-soft); margin: 0.35rem 0 1.5rem; font-size: 0.9375rem; }
.viewer__gear { margin: 0 0 1.75rem; font-size: 0.9375rem; line-height: 1.5; }
.viewer__gear dt { color: var(--night-soft); }
.viewer__gear dd { margin: 0 0 0.8rem; }

.viewer__controls { position: fixed; top: 1rem; right: 1rem; display: flex; gap: 0.5rem; }
.viewer__controls button {
  width: 2.75rem; height: 2.75rem;
  border: 1px solid #3a3a35; border-radius: 50%;
  background: rgb(27 27 25 / 0.85); color: #fff;
  font: 300 1.6rem/1 var(--sans);
  cursor: pointer;
}
.viewer__controls button:hover { background: #2d2d2a; }

@media (max-width: 800px) {
  .viewer[open] { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .viewer__frame { padding: 4.5rem 0.5rem 0.5rem; }
  .viewer__info { border-left: 0; border-top: 1px solid var(--night-line); padding: 1rem 1.25rem 1.5rem; max-height: 40dvh; }
}
