/* ============================================================
   brianumana.com — shared styles
   One stylesheet for every page. Page-specific rules live at the
   bottom under their own headings.
   ============================================================ */

/* Self-hosted IBM Plex (SIL Open Font License), Latin subset.
   Plex Sans is a variable font, so one file covers 400 and 600. */
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
  src: url('fonts/ibm-plex-sans-var-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/ibm-plex-mono-400-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* Palette — built around the #F6F7F8 page background */
  --bg:        #F6F7F8;
  --surface:   #FFFFFF;
  --tint:      #ECEEF1;
  --ink:       #15181C;
  --ink-2:     #3F4650;   /* body copy, ~9:1 on --bg */
  --ink-3:     #5C646E;   /* labels and meta, ~5.6:1 on --bg */
  --rule:      #DCDFE3;
  --rule-2:    #C3C8CE;
  --accent:    #A8381A;   /* rust; links and small highlights, ~6:1 on --bg */
  --accent-2:  #85290F;

  --font-sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Consolas, monospace;

  --page-w:  72rem;
  --text-w:  40rem;
  --gutter:  clamp(1rem, 4vw, 2.5rem);
  --section: clamp(3rem, 7vw, 5rem);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--ink-2);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

img, svg { display: block; max-width: 100%; height: auto; }

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

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

h1, h2, h3, h4 {
  color: var(--ink);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
h1 { font-size: clamp(2rem, 1.5rem + 2.2vw, 2.875rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.375rem, 1.2rem + 0.8vw, 1.75rem); }
h3 { font-size: 1.125rem; }

p, li { max-width: var(--text-w); }
p + p { margin-top: 1em; }
strong { color: var(--ink); font-weight: 600; }
ul, ol { padding-left: 1.25rem; }
li + li { margin-top: 0.35em; }
code { font-family: var(--font-mono); font-size: 0.9em; }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--ink); color: var(--bg); padding: 0.75rem 1rem; z-index: 10;
}
.skip-link:focus { left: 0.5rem; top: 0.5rem; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* Small mono label used above headings and in fact lists */
.label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.4;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ── Layout ── */
.wrap {
  width: 100%;
  max-width: var(--page-w);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.section { padding: var(--section) 0; border-top: 1px solid var(--rule); }
.section:first-child { border-top: 0; }
.section > .wrap > .label { margin-bottom: 0.75rem; }
.section h2 { margin-bottom: 1rem; }
.section h3 { margin: 2rem 0 0.5rem; }

/* Two-column section: heading on the left, content on the right */
.split {
  display: grid;
  grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
  gap: 1.5rem 3rem;
}
.split > :first-child h2 { margin-bottom: 0; }
.split > figure, .split > .specs { margin-top: 0; }
.data-table + .data-table { margin-top: 2.25rem; }
.about-text .lede + p { margin-top: 1.25rem; }

/* ── Header ── */
.site-header { border-bottom: 1px solid var(--rule); background: var(--bg); }
.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 1.5rem;
  min-height: 4rem;
}
.site-name {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  padding: 0.75rem 0;
}
.site-name:hover { color: var(--ink); }
.site-nav ul { display: flex; flex-wrap: wrap; gap: 0 1.5rem; list-style: none; padding: 0; }
.site-nav li { margin: 0; }
.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink-2);
  font-size: 0.9375rem;
  text-decoration: none;
}
.site-nav a:hover { color: var(--ink); text-decoration: underline; }
.site-nav a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; }

/* ── Footer ── */
.site-footer { border-top: 1px solid var(--rule); padding: 2rem 0 2.5rem; font-size: 0.9375rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem 2rem; }
.site-footer ul { display: flex; flex-wrap: wrap; gap: 0 1.5rem; list-style: none; padding: 0; }
.site-footer li { margin: 0; }
.site-footer a { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink-2); }
.site-footer a:hover { color: var(--accent); }
.site-footer small { color: var(--ink-3); font-size: 0.875rem; align-self: center; }

/* ── Buttons / download links ── */
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.5rem; }
.button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.55rem 1.1rem;
  border: 1px solid var(--ink);
  border-radius: 3px;
  background: var(--ink);
  color: var(--bg);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
}
.button:hover { background: #2B3036; color: var(--bg); }
.button.secondary { background: transparent; color: var(--ink); border-color: var(--rule-2); font-weight: 400; }
.button.secondary:hover { border-color: var(--ink); color: var(--ink); }
.button .meta { font-family: var(--font-mono); font-size: 0.75rem; font-weight: 400; opacity: 0.8; }

/* ── Page header (detail pages) ── */
.page-head { padding: clamp(2.5rem, 6vw, 4rem) 0 2.5rem; }
.back { display: inline-flex; align-items: center; min-height: 44px; margin-bottom: 1rem; color: var(--ink-3); font-size: 0.9375rem; text-decoration: none; }
.back:hover { color: var(--accent); }
.page-head .label { margin-bottom: 0.75rem; }
.page-head h1 { max-width: 22ch; }
.lede { margin-top: 1rem; font-size: 1.1875rem; line-height: 1.55; color: var(--ink-2); max-width: 36rem; }

/* Fact list: label / value rows */
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0; margin-top: 2rem; border-top: 1px solid var(--rule); max-width: 48rem; }
.facts dt, .facts dd { padding: 0.6rem 0; border-bottom: 1px solid var(--rule); }
.facts dt { padding-right: 2rem; font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); padding-top: 0.8rem; }
.facts dd { color: var(--ink); }

/* Status note — used for work that is still in progress */
.status {
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  border-left: 3px solid var(--accent);
  background: var(--surface);
  max-width: var(--text-w);
}
.status .label { color: var(--accent); margin-bottom: 0.25rem; }
.status p { color: var(--ink); }

/* Spec list: term / value pairs in a ruled grid */
.specs { margin-top: 1rem; border-top: 1px solid var(--rule); max-width: 48rem; }
.specs > div { display: grid; grid-template-columns: minmax(0, 12rem) minmax(0, 1fr); gap: 0.25rem 2rem; padding: 0.75rem 0; border-bottom: 1px solid var(--rule); }
.specs dt { color: var(--ink); font-weight: 600; }
.specs dd { color: var(--ink-2); }
.specs dd small { display: block; margin-top: 0.15rem; color: var(--ink-3); font-size: 0.875rem; }

/* Data table (NASA figures). Stacks into labelled rows on narrow screens. */
.data-table { width: 100%; max-width: 60rem; margin-top: 1rem; border-collapse: collapse; font-size: 0.9375rem; }
.data-table caption { text-align: left; color: var(--ink); font-weight: 600; padding-bottom: 0.5rem; }
.data-table th, .data-table td { text-align: left; vertical-align: top; padding: 0.7rem 1rem 0.7rem 0; border-bottom: 1px solid var(--rule); }
.data-table thead th { font-family: var(--font-mono); font-size: 0.75rem; font-weight: 400; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); border-bottom-color: var(--rule-2); }
.data-table tbody th { color: var(--ink); font-weight: 600; }
.data-table td { color: var(--ink-2); }
.data-table .kind { font-family: var(--font-mono); font-size: 0.75rem; color: var(--ink-3); white-space: nowrap; }
.data-table .num { white-space: nowrap; }

/* Figures */
figure { margin-top: 1.5rem; }
figure img { border-radius: 2px; background: var(--tint); }
figcaption { margin-top: 0.6rem; color: var(--ink-3); font-size: 0.875rem; max-width: var(--text-w); }
.figure-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
.figure-pair figure { margin-top: 0; }

/* Plain entries (replaces the old boxed card grids on secondary pages) */
.detail-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); gap: 0 2.5rem; margin-top: 1rem; }
.detail-card { padding: 1rem 0 1.25rem; border-top: 1px solid var(--rule); }
.detail-card-label { display: block; font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 0.35rem; }
.detail-card-title { color: var(--ink); font-weight: 600; margin-bottom: 0.35rem; }
.detail-card-body { font-size: 0.9375rem; color: var(--ink-2); }
.detail-card-body p + p { margin-top: 0.75em; }
.detail-card-body ul { margin-top: 0.25rem; }

/* Detail-page section wrapper used by the older project pages */
.detail-section { padding: 2.5rem 0; border-top: 1px solid var(--rule); }
.detail-section h2 { margin-bottom: 1rem; }
.detail-section h3 { margin: 1.75rem 0 0.5rem; }
.detail-section ul { margin-top: 0.5rem; }
.detail-section > .label { margin-bottom: 0.75rem; }
.detail-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr)); gap: 1rem; margin-top: 1.5rem; }
.detail-gallery img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 2px; background: var(--tint); }
blockquote { margin-top: 1rem; padding-left: 1.25rem; border-left: 3px solid var(--rule-2); color: var(--ink); max-width: var(--text-w); }
details { margin-top: 1rem; max-width: 48rem; }
summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--ink); }
pre { margin-top: 0.5rem; padding: 1rem; overflow-x: auto; background: var(--surface); border: 1px solid var(--rule); font-size: 0.8125rem; line-height: 1.5; }

/* ============================================================
   Home
   ============================================================ */
.intro { padding: clamp(3rem, 8vw, 5.5rem) 0 clamp(2.5rem, 6vw, 4rem); }
.intro-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 18rem); gap: 2.5rem 4rem; align-items: end; }
.intro h1 { max-width: 18ch; }
.intro .lede { max-width: 34rem; }
.intro .facts { margin-top: 0; }

/* Work index — one row per project */
.work-list { list-style: none; padding: 0; border-top: 1px solid var(--rule); }
.work-list li { margin: 0; max-width: none; }
.work-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.25rem 2rem;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--rule);
  color: inherit;
  text-decoration: none;
}
.work-row:hover { color: inherit; }
.work-row:hover .work-title { color: var(--accent); text-decoration: underline; text-underline-offset: 0.18em; }
.work-title { color: var(--ink); font-weight: 600; font-size: 1.0625rem; }
.work-sub { grid-column: 1; color: var(--ink-2); font-size: 0.9375rem; max-width: 40rem; }
.work-meta { grid-column: 2; grid-row: 1 / span 2; text-align: right; font-family: var(--font-mono); font-size: 0.8125rem; color: var(--ink-3); white-space: nowrap; }
.work-meta .state { display: block; color: var(--accent); }

.photo-strip { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 1rem; margin-top: 1.5rem; }
.photo-strip a { display: block; }
.photo-strip img { width: 100%; height: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 2px; background: var(--tint); }
.photo-strip a:first-child img { aspect-ratio: auto; }

/* ============================================================
   About
   ============================================================ */
.about-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 20rem); gap: 2.5rem 4rem; align-items: start; }
.about-text p { font-size: 1.125rem; line-height: 1.7; max-width: 38rem; }
.about-photo img { width: 100%; border-radius: 2px; background: var(--tint); }
.about-photo figcaption { margin-top: 0.5rem; }

.timeline { list-style: none; padding: 0; border-top: 1px solid var(--rule); }
.timeline > li { display: grid; grid-template-columns: minmax(0, 11rem) minmax(0, 1fr); gap: 0.25rem 2rem; padding: 1.1rem 0; border-bottom: 1px solid var(--rule); margin: 0; max-width: none; }
.timeline .when { font-family: var(--font-mono); font-size: 0.8125rem; color: var(--ink-3); padding-top: 0.15rem; }
.timeline h3 { margin: 0; font-size: 1.0625rem; }
.timeline .org { color: var(--ink-2); }
.timeline ul { margin-top: 0.5rem; font-size: 0.9375rem; }

/* ============================================================
   Photography
   ============================================================ */
.gallery-set { padding: var(--section) 0 0; }
.gallery-set:first-of-type { padding-top: 0; }
.gallery-set:last-of-type { padding-bottom: var(--section); }
.gallery-set header { margin-bottom: 1.25rem; }
.gallery-set header p { margin-top: 0.35rem; }

/* Justified rows: each item grows in proportion to its aspect ratio
   (--ar = width / height), so nothing is cropped and rows stay level. */
.gallery { display: flex; flex-wrap: wrap; gap: 0.75rem; list-style: none; padding: 0; --row: 15rem; }
.gallery::after { content: ""; flex-grow: 999; }
.gallery li { margin: 0; max-width: none; flex-grow: var(--ar); flex-basis: calc(var(--ar) * var(--row)); }
.gallery a { display: block; position: relative; }
.gallery img { width: 100%; height: auto; background: var(--tint); }
.gallery a:hover img { opacity: 0.92; }

.lightbox {
  border: 0; padding: 0; margin: 0;
  width: 100%; max-width: 100%; height: 100%; max-height: 100%;
  background: rgba(14, 16, 19, 0.96); color: #F6F7F8;
}
.lightbox::backdrop { background: rgba(14, 16, 19, 0.96); }
.lightbox[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.lightbox-bar { display: flex; justify-content: space-between; align-items: center; padding: 0.5rem var(--gutter); font-family: var(--font-mono); font-size: 0.8125rem; color: #B9BFC6; }
.lightbox figure { margin: 0; display: flex; align-items: center; justify-content: center; min-height: 0; overflow: hidden; padding: 0 var(--gutter); }
.lightbox figure img { max-width: 100%; max-height: 100%; width: auto; height: auto; min-width: 0; min-height: 0; object-fit: contain; background: transparent; touch-action: pan-y; }
.lightbox figcaption { color: #B9BFC6; text-align: center; margin: 0 auto; padding: 0.5rem var(--gutter) 0; }
.lightbox-nav { display: flex; justify-content: center; gap: 0.75rem; padding: 0.5rem 0 1rem; }
.lightbox button {
  min-width: 44px; min-height: 44px; padding: 0.4rem 0.9rem;
  border: 1px solid #4A5059; border-radius: 3px; background: transparent; color: #F6F7F8;
  font: inherit; font-size: 0.9375rem; cursor: pointer;
}
.lightbox button:hover { border-color: #F6F7F8; }
.lightbox :focus-visible { outline-color: #F6F7F8; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 52rem) {
  .split, .intro-grid, .about-grid { grid-template-columns: minmax(0, 1fr); }
  .about-photo { max-width: 22rem; }
  .photo-strip { grid-template-columns: 1fr 1fr; }
  .photo-strip a:first-child { grid-column: 1 / -1; }
  .photo-strip a:first-child img { aspect-ratio: 3 / 2; }
}

@media (max-width: 40rem) {
  body { font-size: 1rem; }
  .lede { font-size: 1.0625rem; }
  .about-text p { font-size: 1.0625rem; }
  .site-header .wrap { padding-top: 0.25rem; padding-bottom: 0.25rem; }
  .site-name { padding-bottom: 0; }
  .site-nav ul { gap: 0 1.1rem; }
  .facts { grid-template-columns: minmax(0, 1fr); }
  .facts dt { border-bottom: 0; padding-bottom: 0; }
  .facts dd { padding-top: 0.15rem; }
  .specs > div, .timeline > li { grid-template-columns: minmax(0, 1fr); }
  .work-row { grid-template-columns: minmax(0, 1fr); }
  .work-meta { grid-column: 1; grid-row: auto; text-align: left; }
  .work-meta .state { display: inline; margin-left: 0.75rem; }
  .figure-pair { grid-template-columns: minmax(0, 1fr); }
  .gallery { --row: 13rem; gap: 0.5rem; }
  .button { flex-wrap: wrap; }

  .data-table thead { display: none; }
  .data-table caption { display: block; width: 100%; }
  .data-table, .data-table tbody, .data-table tr, .data-table th, .data-table td { display: block; width: 100%; }
  .data-table tr { padding: 0.75rem 0; border-bottom: 1px solid var(--rule); }
  .data-table th, .data-table td { border: 0; padding: 0.1rem 0; }
  .data-table td[data-label]::before { content: attr(data-label) ": "; color: var(--ink-3); font-family: var(--font-mono); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; }
  .data-table .num { white-space: normal; }
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

@media print {
  .site-header, .site-footer, .actions { display: none; }
  body { background: #fff; }
}
