/* HagAstro: dark, image-first. Colors are tokens; images do the talking. */
:root {
  --bg: #06070a;
  --bg-2: #0d0f14;
  --line: #1c2029;
  --text: #d9dde6;
  --muted: #8a92a3;
  --accent: #e8a75c;        /* warm star-gold */
  --accent-2: #5cc8c8;      /* OIII teal */
  --radius: 6px;
  --gutter: clamp(16px, 3vw, 40px);
  --maxw: 1500px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
main { min-height: 70vh; }
h1, h2, h3 { font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; }
.eyebrow {
  margin: 0 0 .4em;
  font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
}

/* ---- header / footer */
.site-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px var(--gutter);
  background: rgba(6, 7, 10, .82);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex; align-items: center; gap: 10px;
  color: var(--text); font-size: 20px; letter-spacing: .04em; font-weight: 300;
}
.brand b { font-weight: 700; color: var(--accent); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 14px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle, #fff 0 18%, var(--accent) 40%, transparent 72%);
  box-shadow: 0 0 12px var(--accent);
}
.site-nav { display: flex; gap: clamp(14px, 3vw, 28px); }
.site-nav a { color: var(--muted); font-size: 15px; }
.site-nav a[aria-current="page"], .site-nav a:hover { color: var(--text); text-decoration: none; }
.site-footer {
  margin-top: 80px; padding: 32px var(--gutter) 48px;
  border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; text-align: center;
}
.site-footer p { margin: .3em 0; }

/* ---- hero */
.hero { position: relative; max-height: 82vh; overflow: hidden; background: #000; }
.hero-img img { width: 100%; height: 82vh; object-fit: cover; object-position: center 40%; opacity: .92; }
.hero-text {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 80px var(--gutter) 28px;
  background: linear-gradient(transparent, rgba(0,0,0,.85));
}
.hero-text h1 { margin: 0; font-size: clamp(26px, 4.5vw, 52px); font-family: var(--serif); font-weight: 500; }
.hero-text h1 a { color: #fff; }
.hero-text p { margin: .3em 0 0; color: #b9c0cc; }

/* phones: show the whole hero image (no crop), text below it, so the gallery starts sooner */
@media (max-width: 700px) {
  .hero { max-height: none; }
  .hero-img img { height: auto; max-height: 70vh; object-fit: contain; opacity: 1; }
  .hero-text { position: static; padding: 14px var(--gutter) 4px; background: none; }
}

.intro { max-width: var(--maxw); margin: 0 auto; padding: 28px var(--gutter) 8px; color: var(--muted); }
.intro p { margin: 0; max-width: 70ch; }
.stat { display: block; margin-top: 6px; color: var(--accent-2); font-size: 14px; letter-spacing: .04em; }

/* ---- gallery: justified rows, each tile grows by its aspect ratio */
.gallery-section { max-width: var(--maxw); margin: 0 auto; padding: 16px var(--gutter); }
.gallery-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 16px;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: inherit; font-size: 14px; color: var(--muted);
  background: transparent; border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 14px; cursor: pointer;
}
.chip:hover { color: var(--text); border-color: #333a47; }
.chip[aria-pressed="true"] { color: #111; background: var(--accent); border-color: var(--accent); }
.toggle { color: var(--muted); font-size: 14px; display: flex; gap: 6px; align-items: center; cursor: pointer; }
.toggle input { accent-color: var(--accent); }

.grid { display: flex; flex-wrap: wrap; gap: 6px; }
.grid::after { content: ""; flex-grow: 999; }   /* keep the last row from stretching */
.tile {
  position: relative; overflow: hidden; background: var(--bg-2); border-radius: 3px;
  flex-grow: var(--ar); flex-basis: calc(var(--ar) * 250px);
  aspect-ratio: var(--ar);
}
.tile img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease, opacity .3s; }
.tile:hover img { transform: scale(1.035); }
.tile-cap {
  position: absolute; inset: auto 0 0 0; padding: 30px 12px 10px;
  background: linear-gradient(transparent, rgba(0,0,0,.88));
  display: flex; flex-direction: column; opacity: 0; transition: opacity .25s;
}
.tile:hover .tile-cap, .tile:focus-visible .tile-cap { opacity: 1; }
.tile:hover { text-decoration: none; }
.tile-title { color: #fff; font-size: 14px; font-weight: 600; line-height: 1.3; }
.tile-meta { color: #aab2c0; font-size: 12px; }
@media (hover: none) { .tile-cap { opacity: 1; padding-top: 22px; } }
.grid .tile[hidden] { display: none; }
/* No JS: earlier versions stay hidden, filters do nothing */
.grid .tile[data-primary="false"] { display: none; }
.grid.show-all .tile[data-primary="false"]:not([hidden]) { display: block; }
.grid-small .tile { flex-basis: calc(var(--ar) * 260px); max-width: 520px; }
.grid-small .tile[data-primary="false"] { display: block; }

/* ---- image page */
.image-page {
  max-width: var(--maxw); margin: 0 auto; padding: 24px var(--gutter) 0;
  display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 40px; align-items: start;
}
.viewer { margin: 0; }
.viewer-btn { display: block; width: 100%; padding: 0; border: 0; background: #000; cursor: zoom-in; }
.viewer-btn img { margin: 0 auto; max-height: calc(100vh - 120px); width: auto; }
.viewer.animation { margin-top: 28px; }
.viewer video { display: block; width: 100%; height: auto; background: #000; }
.viewer figcaption { margin-top: 8px; color: var(--muted); font-size: 12px; text-align: center; }
.image-info { position: sticky; top: 80px; }
.image-nav {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 0 0 18px; padding-bottom: 12px; border-bottom: 1px solid var(--line); font-size: 14px;
}
.image-nav a { color: var(--accent); }
.image-nav .off { color: #3a404c; }
.image-nav .count { color: var(--muted); font-size: 12px; letter-spacing: .06em; }
.hint-touch { display: none; }
@media (hover: none) and (pointer: coarse) { .hint-mouse { display: none; } .hint-touch { display: inline; } }
.image-info h1 { margin: 0 0 .6em; font-family: var(--serif); font-weight: 500; font-size: 30px; }
.blurb { color: #c3c9d4; }
.notes { color: var(--muted); font-style: italic; }
.facts {
  margin: 24px 0 0; padding: 18px 0 0; border-top: 1px solid var(--line);
  display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; font-size: 14px;
}
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.facts ul { margin: 0; padding-left: 1.1em; }
.related { margin-top: 20px; font-size: 14px; }
.versions { max-width: var(--maxw); margin: 48px auto 0; padding: 0 var(--gutter); }
.versions h2, .latest-posts h2 { font-size: 18px; color: var(--muted); font-weight: 500; }
.pager {
  max-width: var(--maxw); margin: 48px auto 0; padding: 20px var(--gutter);
  display: flex; justify-content: space-between; gap: 16px; border-top: 1px solid var(--line); font-size: 14px;
}
@media (max-width: 960px) {
  .image-page { grid-template-columns: 1fr; gap: 20px; }
  .image-info { position: static; }
  .viewer-btn img { max-height: 75vh; }
}

/* ---- full-screen viewer */
.lightbox {
  position: fixed; inset: 0; z-index: 100; background: #000;
  display: none; overflow: hidden; touch-action: none; cursor: zoom-in;
}
.lightbox.open { display: block; }
.lightbox img {
  position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0;
  user-select: none; -webkit-user-drag: none;
}
.lightbox.zoomed { cursor: grab; }
.lightbox.dragging { cursor: grabbing; }
.lb-ui {
  position: absolute; top: 12px; right: 12px; display: flex; gap: 8px; z-index: 2;
}
.lb-ui button {
  font: inherit; font-size: 13px; color: #ddd; background: rgba(20,22,28,.75);
  border: 1px solid #333; border-radius: var(--radius); padding: 6px 12px; cursor: pointer;
}
.lb-hint {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  color: #888; font-size: 12px; background: rgba(0,0,0,.6); padding: 4px 10px; border-radius: 99px;
}

/* ---- blog */
.page-head { max-width: 900px; margin: 0 auto; padding: 48px var(--gutter) 8px; }
.page-head h1 { font-family: var(--serif); font-weight: 500; font-size: 40px; margin: 0 0 .2em; }
.page-head p { color: var(--muted); margin: 0; }
.latest-posts { max-width: var(--maxw); margin: 56px auto 0; padding: 0 var(--gutter); }
.post-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 20px; }
.post-list-full { max-width: 900px; margin: 24px auto; padding: 0 var(--gutter); grid-template-columns: 1fr; }
.post-card {
  display: flex; flex-direction: column; background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; color: var(--text);
}
.post-card:hover { text-decoration: none; border-color: #2c3240; }
.post-card img { width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.post-card-text { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px 18px; }
.post-card-title { font-size: 19px; font-weight: 600; line-height: 1.3; }
.post-card-sum { color: var(--muted); font-size: 14px; }
.post-list-full .post-card { flex-direction: row; }
.post-list-full .post-card img { width: 42%; aspect-ratio: auto; min-height: 180px; }
@media (max-width: 640px) {
  .post-list-full .post-card { flex-direction: column; }
  .post-list-full .post-card img { width: 100%; aspect-ratio: 16/9; min-height: 0; }
}
.more { display: inline-block; margin-top: 16px; }

.post { max-width: 760px; margin: 0 auto; padding: 48px var(--gutter) 0; }
.post h1 { font-family: var(--serif); font-weight: 500; font-size: clamp(30px, 5vw, 44px); margin: 0 0 .3em; }
.lede { font-size: 19px; color: #b9c0cc; margin: 0 0 1.5em; }
.draft { color: #111; background: var(--accent); padding: 1px 6px; border-radius: 3px; letter-spacing: .1em; }
.prose { font-size: 17px; line-height: 1.75; color: #cfd4de; }
.prose h2 { margin-top: 2em; font-size: 24px; color: var(--text); }
.prose h3 { margin-top: 1.6em; font-size: 19px; color: var(--text); }
.prose code { font-size: .9em; background: var(--bg-2); border: 1px solid var(--line); padding: 1px 5px; border-radius: 4px; }
.prose blockquote { margin: 1.5em 0; padding: 4px 20px; border-left: 3px solid var(--accent); color: var(--muted); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.5em 0; }
.prose li { margin: .3em 0; }
.post-figure { margin: 2em calc(-1 * min(120px, var(--gutter))); }
.post-figure img { margin: 0 auto; max-height: 85vh; width: auto; }
.post-figure figcaption { margin-top: 8px; text-align: center; color: var(--muted); font-size: 13px; }
.back { margin-top: 3em; }

/* ---- gear drawing (About page): inline SVG + parts list. Colors/fonts are theme
   variables: blueprint by default, .drawing.vintage for the engraved-paper look. */
.drawing {
  --dw-bg: #07121c; --dw-sheet: url(#bp-major); --dw-fill: #07121c; --dw-border: #16314a;
  --dw-ink: #7cd6dc; --dw-dim: #3f8a92; --dw-center: #2f6f77;
  --dw-text: #cfe9ee; --dw-engrave: #5fb4bb; --dw-small: #6aa7ae; --dw-cap: #9fd3d8;
  --dw-mark: #e8a75c; --dw-title: var(--accent);
  --dw-font: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --dw-list: #c3c9d4; --dw-list-b: var(--text);
  margin: 2em calc(-1 * min(120px, var(--gutter))); padding: 0;
  background: var(--dw-bg); border: 1px solid var(--dw-border); border-radius: var(--radius); overflow: hidden;
}
.drawing.vintage {
  --dw-bg: #d8c69e; --dw-sheet: url(#vt-paper); --dw-fill: url(#vt-hatch); --dw-border: #a88f63;
  --dw-ink: #3a2c1d; --dw-dim: #8a7556; --dw-center: #9a8562;
  --dw-text: #3a2c1d; --dw-engrave: #5e4a31; --dw-small: #6b5538; --dw-cap: #4a3826;
  --dw-mark: #7a2e1a; --dw-title: #3a2c1d;
  --dw-font: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --dw-list: #4a3826; --dw-list-b: #241a10;
}
.drawing-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.drawing svg { display: block; width: 100%; height: auto; }
.bp-sheet { fill: var(--dw-sheet); }
.vt-only { display: none; }
.vintage .vt-only { display: inline; }
.bp-l { fill: none; stroke: var(--dw-ink); stroke-width: 1.6; stroke-linejoin: round; }
.bp-thin { stroke-width: 1; }
.bp-fill { fill: var(--dw-fill); }
.bp-dim { stroke: var(--dw-dim); }
.bp-hidden { stroke-dasharray: 7 5; stroke: var(--dw-dim); }
.bp-center { fill: none; stroke: var(--dw-center); stroke-width: 1; stroke-dasharray: 16 4 3 4; }
.bp-dot { fill: var(--dw-ink); }
.bp-arrowhead { fill: var(--dw-ink); }
.bp-leg-o { stroke: var(--dw-ink); stroke-width: 11; }
.bp-leg-i { stroke: var(--dw-bg); stroke-width: 8; }
.bp-leg-o.bp-leg-sm { stroke-width: 9; }
.bp-leg-i.bp-leg-sm { stroke-width: 6; }
.bp-t { fill: var(--dw-text); font: 12px/1 var(--dw-font); letter-spacing: .08em; }
.bp-engrave { fill: var(--dw-engrave); font-size: 11px; }
.bp-big { font-size: 22px; font-weight: 700; letter-spacing: .2em; fill: var(--dw-title); }
.bp-small { font-size: 9px; fill: var(--dw-small); }
.bp-cap { font-size: 13px; fill: var(--dw-cap); }
.bp-leaders path { fill: none; stroke: var(--dw-mark); stroke-width: 1; }
.bp-leaders circle { fill: var(--dw-mark); }
.bp-balloons circle { fill: var(--dw-bg); stroke: var(--dw-mark); stroke-width: 1.6; }
.bp-balloons text { fill: var(--dw-mark); font: 700 15px/1 var(--dw-font); text-anchor: middle; dominant-baseline: central; }
/* vintage: only the drawing is mounted like a framed print (dark mat + shadow);
   the parts list sits on the page like the rest of the About text */
.drawing.vintage { padding: 0; background: transparent; border: 0; border-radius: 0; overflow: visible; }
.vintage .drawing-scroll {
  padding: 14px; background: #16181d; border: 1px solid #2a2e37; border-radius: var(--radius);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .55);
}
.vintage .drawing-scroll svg { box-shadow: 0 2px 10px rgba(0, 0, 0, .5); }
.vintage .bom {
  --dw-cap: var(--muted); --dw-list: #c3c9d4; --dw-list-b: var(--text); --dw-mark: var(--accent);
  --dw-font: var(--font); --dw-border: var(--line);
  padding: 22px 4px 0; border-top: 0; background: none;
}
.vintage .bom-head { font-weight: 600; }
/* list numbers drawn as small copies of the drawing's balloons */
.vintage .bom ol { list-style: none; padding-left: 0; counter-reset: bom calc(var(--start, 1) - 1); }
.vintage .bom li { counter-increment: bom; position: relative; padding-left: 40px; min-height: 30px; margin: .45em 0; }
.vintage .bom li::before {
  content: counter(bom); position: absolute; left: 0; top: .05em;
  width: 28px; height: 28px; border-radius: 50%; box-sizing: border-box;
  display: grid; place-items: center;
  background: #f3e9cf; border: 2px solid #8c2412; color: #8c2412;
  font: 700 13px/1 "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}
/* balloons: lighter disc, heavier ring, bigger and bolder numbers */
.vintage .bp-balloons circle { r: 19px; fill: #f3e9cf; stroke: #8c2412; stroke-width: 2.4; }
.vintage .bp-balloons text { fill: #8c2412; font-size: 17px; font-weight: 700; font-style: normal; }
.vintage .bp-leaders path { stroke: #8c2412; stroke-width: 1.3; }
.vintage .bp-leaders circle { fill: #8c2412; r: 3px; }
.vintage .bp-t { letter-spacing: .05em; }
.vintage .bp-big { letter-spacing: .14em; font-variant: small-caps; }
.bom {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px 32px;
  padding: 18px 24px 8px; border-top: 1px solid var(--dw-border); font-size: 15px; line-height: 1.5;
}
.bom-head { margin: 0 0 6px; font: 600 12px/1.4 var(--dw-font); letter-spacing: .12em; text-transform: uppercase; color: var(--dw-cap); }
.bom ol { margin: 0 0 12px; padding-left: 2.2em; }
.bom-c { grid-column: 1 / -1; justify-self: center; width: 100%; max-width: 620px; padding-top: 14px; border-top: 1px dashed var(--dw-border); }
.bom li { margin: .25em 0; color: var(--dw-list); }
.bom li::marker { color: var(--dw-mark); font-family: var(--dw-font); }
.bom b { color: var(--dw-list-b); font-weight: 600; }
@media (max-width: 720px) { .bom { grid-template-columns: 1fr; padding: 16px; } }

/* phones: the whole drawing fits the screen; balloons grow so the numbers stay readable */
@media (max-width: 700px) {
  .drawing.vintage, .drawing { margin-left: 0; margin-right: 0; }
  .vintage .drawing-scroll { padding: 6px; }
  .drawing .bp-balloons circle, .vintage .bp-balloons circle { r: 30px; stroke-width: 3; }
  .drawing .bp-balloons text, .vintage .bp-balloons text { font-size: 32px; }
}

/* ---- feedback form */
.fb-form { display: grid; gap: 16px; margin-top: 8px; }
.fb-form label { display: grid; gap: 6px; font-size: 15px; color: var(--text); }
.fb-form .opt { color: var(--muted); font-size: 13px; }
.fb-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 600px) { .fb-row { grid-template-columns: 1fr; } }
.fb-form input, .fb-form select, .fb-form textarea {
  font: inherit; font-size: 16px; color: var(--text); background: var(--bg-2);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; width: 100%;
}
.fb-form textarea { resize: vertical; min-height: 140px; }
.fb-form input:focus, .fb-form select:focus, .fb-form textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.fb-trap { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.fb-send {
  justify-self: start; font: inherit; font-weight: 600; color: #111; background: var(--accent);
  border: 0; border-radius: 999px; padding: 10px 22px; cursor: pointer;
}
.fb-send:disabled { opacity: .5; cursor: default; }
.fb-status { margin: 0; min-height: 1.5em; color: var(--muted); }
.fb-status.ok { color: var(--accent-2); }
.fb-status.err { color: #e87a6e; }
.fb-alt { margin-top: 2em; color: var(--muted); font-size: 14px; }
.related.ask a { color: var(--muted); }
.related.ask a:hover { color: var(--accent); }

/* narrow phones: fit the brand and four menu items on one line */
@media (max-width: 440px) {
  .site-header { padding-left: 14px; padding-right: 14px; gap: 10px; }
  .brand { font-size: 18px; gap: 8px; }
  .site-nav { gap: 13px; }
  .site-nav a { font-size: 14px; }
}
@media (max-width: 350px) { .brand-mark { display: none; } .site-nav { gap: 10px; } }
