/* railbed.io's industries overview (/industries/): the gallery. Loaded after industries.css, by the overview only
   (scripts/industrygen.py document(hub=True)); the industry pages never load it. The markup is industrygen.py's
   render_hub and gallery_html; industries-hub.js is the finder. Colours, type and sizes are the design tokens and the
   industry pages' own (--stage-ground, --sheet-*, --eo): DESIGN.md §4, §5, §7 and §9 "Marketing site".
   The page: a short masthead, so the gallery starts on the first screen; a finder (a search field and one chip per
   field) that stays at the top of the window while the gallery scrolls; then one section per field, its heading in
   the grid's first three columns and its industries as tiles in the other nine. A tile is the industry's own hero
   scene at rest (scripts/build-industry-stills.py) on the stage's ground, its name and its line. */

/* ---------- Masthead ---------- */
.hub-mast { padding-top: 24px; }
.hub-mast__row { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 24px; align-items: end; margin-top: 56px; }
.hub-mast h1 { grid-column: 1 / 9; margin: 0; max-width: 11.5em; font: 400 clamp(40px, 5.7vw, 80px)/.98 var(--font-serif); letter-spacing: -.034em; color: var(--text-strong); text-wrap: balance; }
.hub-mast__side { grid-column: 9 / -1; padding-bottom: 6px; }
.hub-mast .ind-lead { margin: 0; font-size: 17px; line-height: 1.55; color: var(--text-body); }

/* ---------- The finder ---------- */
.hub-gallery { margin-top: 64px; }
/* One ruled bar: ink above, a hairline below. While it is held at the top of the window its paper runs the window's
   width (a shadow with no blur, clipped to the bar's own height), so tiles pass under it cleanly. */
.hub-find {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: stretch; height: 64px;
  border-top: 1px solid var(--text-strong); border-bottom: 1px solid var(--border);
  background: var(--bg-page); box-shadow: 0 0 0 100vmax var(--bg-page); clip-path: inset(-1px -100vmax);
}
.hub-find__q { flex: 0 0 calc(var(--col) * 3 - 24px); display: flex; align-items: center; gap: 10px; min-width: 0; margin-right: 24px; border-right: 1px solid var(--border); color: var(--text-muted); cursor: text; }
.hub-find__q svg { flex: none; }
.hub-find__q input { flex: 1; min-width: 0; height: 100%; margin: 0; padding: 0 12px 0 0; border: 0; border-radius: 0; background: transparent; font: 400 16px/1.2 var(--font-sans); color: var(--text-strong); appearance: none; }
.hub-find__q input::placeholder { color: var(--text-muted); opacity: 1; }
.hub-find__q input::-webkit-search-cancel-button { appearance: none; width: 18px; height: 18px; cursor: pointer; background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath d='m5 5 8 8M13 5l-8 8' stroke='%23000' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat; }
.ind .hub-find__q input:focus-visible { outline: none; }
/* The shortcut's key, shown while the field is empty and not in use, on a screen with a keyboard's width (the finder
   adds .hub-on: without it the key does nothing). */
.hub-find__key { display: none; flex: none; place-items: center; width: 22px; height: 22px; margin-right: 16px; border: 1px solid var(--border-strong); border-radius: var(--radius-xs); font: 400 14px/1 var(--font-sans); color: var(--text-muted); transition: opacity var(--dur-fast); }
@media (min-width: 1100px) and (hover: hover) and (pointer: fine) { .hub-on .hub-find__key { display: grid; } }
.hub-find__q:focus-within .hub-find__key, .hub-find__q input:not(:placeholder-shown) ~ .hub-find__key { opacity: 0; }
.hub-find__q input:not(:placeholder-shown) ~ .hub-find__key { display: none; }
.hub-find__q:focus-within { color: var(--text-strong); box-shadow: inset 0 -2px 0 var(--focus-ring); }
/* The chips: one row that scrolls sideways when the fields don't fit. The finder marks the rail while chips are out
   of sight on a side (.is-back, .is-more): that edge fades, and on a pointer screen a small button there moves the
   row along. */
.hub-find__rail { position: relative; flex: 1; min-width: 0; display: flex; }
.hub-find__fields { flex: 1; min-width: 0; display: flex; align-items: center; gap: 4px; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; }
.hub-find__fields::-webkit-scrollbar { display: none; }
.hub-find__rail.is-more .hub-find__fields { mask-image: linear-gradient(to left, transparent, var(--text-strong) 72px); }
.hub-find__rail.is-back .hub-find__fields { mask-image: linear-gradient(to right, transparent, var(--text-strong) 72px); }
.hub-find__rail.is-back.is-more .hub-find__fields { mask-image: linear-gradient(to right, transparent, var(--text-strong) 72px, var(--text-strong) calc(100% - 72px), transparent); }
.hub-find__step {
  display: none; position: absolute; top: 50%; right: 0; width: 32px; height: 32px; margin-top: -16px; padding: 0; place-items: center;
  border: 1px solid var(--border); border-radius: var(--radius-xs); background: var(--bg-page); color: var(--text-strong); cursor: pointer;
  transition: background-color var(--dur-fast);
}
.hub-find__step:hover { background: var(--bg-subtle); }
.hub-find__step--back { left: 0; right: auto; }
.hub-find__step--back svg { transform: scaleX(-1); }
@media (hover: hover) and (pointer: fine) {
  .hub-find__rail.is-more .hub-find__step:not(.hub-find__step--back), .hub-find__rail.is-back .hub-find__step--back { display: grid; }
}
.hub-chip {
  flex: none; display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px; border-radius: var(--radius-xs);
  font-size: 15px; line-height: 1; color: var(--text-body); text-decoration: none; white-space: nowrap;
  transition: background-color var(--dur-fast), color var(--dur-fast);
}
.hub-chip:hover { background: var(--bg-subtle); color: var(--text-strong); }
.hub-chip:active { transform: translateY(1px); }
.hub-chip[aria-current] { background: var(--text-strong); color: var(--bg-page); }
.hub-chip.is-empty:not([aria-current]) { color: var(--text-muted); }
.ind .hub-chip:focus-visible { outline-offset: -2px; }

/* ---------- A field: its heading in the first three columns, its tiles in the other nine ---------- */
/* A hairline stands between two fields that are showing, never under the last: the chapter after the gallery opens
   with its own rule, and two rules with nothing between them read as a mistake. */
.hub-field { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 24px; align-items: start; padding: 56px 0 72px; scroll-margin-top: 64px; }
.hub-field:not([hidden]) ~ .hub-field:not([hidden]) { border-top: 1px solid var(--border); }
.hub-field[hidden], .hub-cell[hidden] { display: none; }
.hub-field__head { grid-column: 1 / 4; position: sticky; top: 112px; padding-right: 12px; }
.hub-field__head h2 { margin: 0; font: 400 clamp(30px, 2.9vw, 40px)/1.06 var(--font-serif); letter-spacing: -.024em; color: var(--text-strong); text-wrap: balance; }
.hub-field__head p { margin: 14px 0 0; max-width: 17em; font-size: 16px; line-height: 1.5; color: var(--text-body); text-wrap: pretty; }
.hub-grid { grid-column: 4 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 44px 24px; margin: 0; padding: 0; list-style: none; }

/* ---------- A tile ---------- */
.hub-tile { display: block; color: inherit; text-decoration: none; border-radius: var(--radius-l); -webkit-tap-highlight-color: transparent; }
/* The plate is the industry pages' stage in small: the same blue-black, the same stippled light entering from the top
   right (a corner of industry-stage.webp, shifted a little from tile to tile so no two plates are lit alike) and the
   same print grain laid over the picture. */
.hub-tile__plate {
  position: relative; display: block; aspect-ratio: 440 / 380; overflow: hidden; border-radius: var(--radius-l);
  background: var(--stage-ground) url(/industry-stage.webp) var(--lx, 33%) var(--ly, 47%) / 200% auto no-repeat;
}
.hub-cell:nth-child(3n + 2) .hub-tile__plate { --lx: 27%; --ly: 52%; }
.hub-cell:nth-child(3n) .hub-tile__plate { --lx: 38%; --ly: 44%; }
.hub-cell:nth-child(4n + 1) .hub-tile__plate { --ly: 56%; }
.hub-tile__plate::after { content: ""; position: absolute; inset: 0; pointer-events: none; mix-blend-mode: soft-light; opacity: .6;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='1.9 0 0 0 -.45 1.9 0 0 0 -.45 1.9 0 0 0 -.45 0 0 0 0 1'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E") 0 0 / 240px 240px; }
.hub-tile__art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transform-origin: 50% 100%; transition: transform .7s var(--eo); }
/* Railbed's slip, as on the pages' closing panel: the page's example sale, shown while the tile is pointed at. */
.hub-tile__slip {
  position: absolute; left: 12px; bottom: 12px; z-index: 1; display: inline-flex; align-items: center; gap: 8px; max-width: calc(100% - 24px);
  height: 30px; padding: 0 10px 0 8px; border-radius: var(--radius-s); background: var(--sheet-paper); color: var(--sheet-ink);
  font-size: var(--font-size-label); line-height: 1; white-space: nowrap;
  opacity: 0; transform: translateY(6px); transition: opacity var(--dur-base), transform .45s var(--eo);
}
.hub-tile__slip b { font-weight: 500; }
.hub-tile__slip span:not(.hub-tile__tick) { overflow: hidden; text-overflow: ellipsis; color: color-mix(in srgb, var(--sheet-ink) 72%, transparent); }
.hub-tile__slip i { font: 500 var(--font-size-label)/1 var(--font-numeric); font-variant-numeric: tabular-nums lining-nums; }
.hub-tile__tick { display: grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--rb-green); color: var(--sheet-paper); }
.hub-tile__tick svg { width: 10px; height: 10px; }
.hub-tile__text { display: block; padding-top: 16px; }
.hub-tile__name { margin: 0; font: 400 24px/1.12 var(--font-serif); letter-spacing: -.02em; color: var(--text-strong); text-wrap: balance;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .2em; text-decoration-color: transparent; transition: text-decoration-color var(--dur-base); }
.hub-tile__line { display: block; margin: 8px 0 0; font-size: 15px; line-height: 1.5; color: var(--text-body); text-wrap: pretty; }
@media (hover: hover) {
  .hub-tile:hover .hub-tile__art { transform: translateY(-5px) scale(1.035); }
  .hub-tile:hover .hub-tile__slip { opacity: 1; transform: none; }
  .hub-tile:hover .hub-tile__name { text-decoration-color: var(--rb-n-400); }
}
.hub-tile:focus-visible .hub-tile__art { transform: translateY(-5px) scale(1.035); }
.hub-tile:active .hub-tile__art { transform: translateY(-2px) scale(1.015); transition-duration: .18s; }
.hub-tile:focus-visible .hub-tile__slip { opacity: 1; transform: none; }
.ind .hub-tile:focus-visible { outline-offset: 6px; }

/* ---------- Nothing matches ---------- */
.hub-none { padding: 72px 0 80px; }
.hub-none[hidden] { display: none; }
.hub-none__title { margin: 0; max-width: 18em; font: 400 clamp(28px, 2.9vw, 40px)/1.1 var(--font-serif); letter-spacing: -.024em; color: var(--text-strong); text-wrap: balance; overflow-wrap: anywhere; }
.hub-none__title q { quotes: "“" "”"; }
.hub-none__text { margin: 16px 0 0; max-width: 34em; font-size: 17px; line-height: 1.55; color: var(--text-body); text-wrap: pretty; }
.hub-none__go { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 28px; margin: 28px 0 0; }
.hub-none__go .arr { transition: transform var(--dur-slow) var(--eo); }
.hub-none__go a:hover .arr { transform: translateX(3px); }
.hub-none__clear { margin: 0; padding: 0; border: 0; background: none; font: 400 16px/1.2 var(--font-sans); color: var(--text-strong); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .2em; text-decoration-color: var(--rb-n-400); cursor: pointer; }
.hub-none__clear:hover { text-decoration-color: currentColor; }

.hub-gallery + .ind-ch { margin-top: 24px; }

/* ---------- Motion (DESIGN.md §7): the masthead settles once; each field's rule draws and its tiles rise once, in
   their row's order; a tile the finder brings back fades in. All of it sits under .rv-on, which industries.js adds
   only when motion is allowed, so nothing here hides content from a reader without scripts or with reduced motion. */
.ind-open .hub-mast .crumbs { animation: indFade .8s var(--eo) both; }
.ind-open .hub-mast h1 { animation: indSettle 1.1s var(--eo) .05s both; }
.ind-open .hub-mast__side { animation: indSettle 1s var(--eo) .2s both; }
.ind-open .hub-find { animation: indFade .9s var(--eo) .35s both; }
.rv-on .hub-field[data-rv] .hub-field__head > *, .rv-on .hub-field[data-rv] .hub-cell {
  opacity: 0; transform: translateY(16px);
  transition: opacity .8s var(--eo), transform 1s var(--eo); transition-delay: calc(var(--i, 0) * 70ms + 60ms);
}
.rv-on .hub-field[data-rv] .hub-field__head > :nth-child(2) { --i: 1; }
.rv-on .hub-field[data-rv] .hub-cell:nth-child(3n + 2) { --i: 1; }
.rv-on .hub-field[data-rv] .hub-cell:nth-child(3n) { --i: 2; }
.rv-on .hub-field[data-rv] .hub-cell:nth-child(n + 4) { transition-delay: calc(var(--i, 0) * 70ms + 180ms); }
.rv-on .hub-field[data-rv].in .hub-field__head > *, .rv-on .hub-field[data-rv].in .hub-cell { opacity: 1; transform: none; }
@keyframes hubIn { from { opacity: 0; transform: translateY(8px); } }
.rv-on .hub-cell.is-back { animation: hubIn .4s var(--eo) both; }

/* ---------- Responsive ---------- */
@media (max-width: 1099px) {
  .hub-mast h1 { grid-column: 1 / -1; }
  .hub-mast__side { grid-column: 1 / 9; margin-top: 28px; padding-bottom: 0; }
  /* The search field takes its own row; only the chips stay at the top of the window. */
  .hub-find { display: contents; }
  .hub-find__q { height: 56px; margin: 0; border-right: 0; border-top: 1px solid var(--text-strong); border-bottom: 1px solid var(--border); }
  .hub-find__rail {
    position: sticky; top: 0; z-index: 5; height: 56px; margin-inline: calc(var(--gut) * -1);
    border-bottom: 1px solid var(--border); background: var(--bg-page);
  }
  .hub-find__fields { padding-inline: var(--gut); scroll-padding-inline: var(--gut); }
  .hub-find__step { right: var(--gut); }
  .hub-find__step--back { left: var(--gut); right: auto; }
  .hub-field { display: block; padding: 44px 0 56px; scroll-margin-top: 56px; }
  .hub-field__head { position: static; padding: 0; margin-bottom: 28px; }
  .hub-field__head p { max-width: 30em; margin-top: 10px; }
  .ind-open .hub-find__q, .ind-open .hub-find__rail { animation: indFade .9s var(--eo) .35s both; }
}
@media (max-width: 799px) {
  .hub-mast__row { margin-top: 40px; }
  .hub-mast__side { grid-column: 1 / -1; margin-top: 22px; }
  .hub-gallery { margin-top: 44px; }
  .hub-grid { gap: 36px 20px; }
  .hub-tile__name { font-size: 21px; }
}
@media (max-width: 719px) {
  .hub-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rv-on .hub-field[data-rv] .hub-cell:nth-child(n) { --i: 0; }
  .rv-on .hub-field[data-rv] .hub-cell:nth-child(2n) { --i: 1; }
}
/* Phones: one industry to a row, its plate a thumbnail at the left, so the gallery stays a list to run a thumb down. */
@media (max-width: 519px) {
  .hub-mast h1 { font-size: clamp(38px, 11.4vw, 52px); }
  .hub-field { padding: 36px 0 28px; }
  .hub-field__head { margin-bottom: 8px; }
  .hub-field__head h2 { font-size: 28px; }
  .hub-field__head p { font-size: 15px; }
  .hub-grid { display: block; }
  .hub-cell + .hub-cell { border-top: 1px solid var(--border); }
  .hub-tile { display: grid; grid-template-columns: 104px minmax(0, 1fr); column-gap: 16px; align-items: center; padding: 14px 0; border-radius: 0; }
  .hub-tile__plate { border-radius: var(--radius-m); }
  .hub-tile__slip { display: none; }
  .hub-tile__text { padding: 0; }
  .hub-tile__name { font-size: 21px; line-height: 1.14; }
  .hub-tile__line { margin: 5px 0 0; font-size: var(--font-size-label); line-height: 1.45; }
  .rv-on .hub-field[data-rv] .hub-cell { transform: translateY(10px); transition-delay: 60ms; }
  .ind .hub-tile:focus-visible { outline-offset: 2px; }
  .hub-none { padding: 48px 0 56px; }
}
@media (any-pointer: coarse) {
  .hub-chip { height: 40px; }
  .hub-none__clear { min-height: var(--touch-target); }
}
@media (prefers-reduced-motion: reduce) {
  .hub-tile__art, .hub-tile__slip, .hub-chip { transition: none; }
  .hub-tile:hover .hub-tile__art, .hub-tile:focus-visible .hub-tile__art, .hub-tile:active .hub-tile__art { transform: none; }
  .hub-find__key { transition: none; }
}
@media (forced-colors: active) {
  .hub-chip[aria-current] { outline: 2px solid CanvasText; outline-offset: -2px; }
  .hub-tile__plate { border: 1px solid CanvasText; }
}
