/* What a console is made of: the list, and the studio beside it.

   On top of the designs' stylesheet (designs.css), which gives the night, the type, the
   bar, the choice of board and the studio's grey. The window is split: the list scrolls
   down the left, and the studio stays put at the right with the Arcade Wedge in it. On a
   narrow screen the studio stays at the top and the list goes by under it. Without WebGL
   or JavaScript the studio holds a still picture and the list is a plain table. */

.bom { display: grid; grid-template-columns: minmax(0, 47fr) minmax(0, 53fr); grid-template-areas: 'head studio' 'list studio'; grid-template-rows: auto 1fr; padding-top: var(--bar); }
.bom-page .bar { padding-inline: clamp(1.25rem, 4vw, 3.5rem) 1.5rem; }
.bom-head { grid-area: head; display: grid; gap: 1.1rem; padding: 3.5rem 2.75rem 0.5rem clamp(1.25rem, 4vw, 3.5rem); }
.bom-head h1 { font: 400 clamp(1.9rem, 3.4vw, 3rem)/1.1 var(--plate); letter-spacing: -0.01em; text-wrap: balance; }
.bom-head .lede { font-size: 1.125rem; }
.with-3d { display: none; }
html.is-3d .with-3d { display: inline; }
.bom-list { grid-area: list; padding: 0 2.75rem 4rem clamp(1.25rem, 4vw, 3.5rem); }

/* ------------------------------------------------------------------ the list */

.bom-table { width: 100%; border-collapse: collapse; font-size: 1rem; }
.bom-table th, .bom-table td { padding: 0.85rem 0.75rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); font-weight: 400; }
.bom-table thead th { padding-block: 2rem 0.5rem; font-size: 0.8125rem; color: var(--dim); white-space: nowrap; }
.bom-table .group th { padding: 2.4rem 0.75rem 0.7rem; font: 400 1.0625rem/1.3 var(--plate); color: var(--accent); white-space: normal; }
.bom-table .group small { display: block; margin-top: 0.5rem; font: 400 0.9375rem/1.5 var(--text); color: var(--dim); text-wrap: pretty; }
.bom-table .group small a { color: var(--ink); }
.bom-table .qty { width: 3.4rem; color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bom-table .qty .sw { width: 0.9rem; height: 0.9rem; vertical-align: -0.1em; }
.bom-table tbody th { white-space: normal; }
.name { display: block; font-weight: 500; color: var(--ink); }
.where { display: block; margin-top: 0.2rem; font-size: 0.9375rem; color: var(--dim); text-wrap: pretty; }
.where em { font-style: normal; color: var(--ink); }
.buy { width: 10.5rem; }
.buy a { display: block; width: fit-content; color: var(--ink); font-weight: 500; }
.buy a + a { margin-top: 0.3rem; }
.buy a::after { content: '\2197'; margin-left: 0.3em; font-size: 0.8em; color: var(--dim); text-decoration: none; display: inline-block; }
.buy a:hover, .buy a:hover::after { color: var(--accent); }
.buy small { display: block; margin-top: 0.1rem; font-size: 0.8125rem; color: var(--dim); }
.buy small + a { margin-top: 0.55rem; }

/* A row can be chosen once there is a model to find its part in. */
.pick { display: block; width: 100%; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; }
html.is-3d tr[data-part] { cursor: pointer; scroll-margin-top: calc(var(--bar) + 1rem); }
html.is-3d tr[data-part]:hover, tr[data-part].is-near { background: var(--fill); }
tr[data-part].is-on, html.is-3d tr[data-part].is-on:hover { background: rgba(255, 162, 58, 0.13); }
tr[data-part].is-on > :first-child { box-shadow: inset 3px 0 0 var(--accent); }
tr[data-part].is-on .where { color: var(--ink); }

.bom-notes { display: grid; gap: 2rem; margin-top: 3.5rem; }
.bom-notes h2 { margin-bottom: 0.5rem; font: 400 1.0625rem/1.3 var(--plate); color: var(--accent); }
.bom-notes p { max-width: 38rem; font-size: 0.9375rem; color: var(--dim); text-wrap: pretty; }
.bom-notes p + p { margin-top: 0.6rem; }
.bom-notes a { color: var(--ink); }

/* ---------------------------------------------------------------- the studio */

.studio { grid-area: studio; position: sticky; top: var(--bar); align-self: start; height: calc(100svh - var(--bar)); min-height: 26rem; overflow: hidden;
  color: var(--studio-ink); background: radial-gradient(120% 90% at 52% 40%, var(--studio-lit), var(--studio) 52%, var(--studio-deep) 100%); }
.studio :focus-visible { outline-color: var(--studio-ink); }
.studio .still { position: absolute; inset: 4.5rem 1.5rem 2rem; width: calc(100% - 3rem); height: calc(100% - 6.5rem); object-fit: contain; }
.studio .still { border-radius: 14px; }
.studio-top { position: absolute; inset: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.25rem 1.5rem 0.75rem; pointer-events: none; }
.studio-name { font: 400 0.9375rem/1.3 var(--plate); }
.studio-name span { display: block; margin-top: 0.15rem; font: 400 0.8125rem/1.3 var(--text); color: var(--studio-dim); }
#view, .marks, .apart, .studio-foot { display: none; }

html.is-3d .studio .still { display: none; }
html.is-3d #view { display: block; position: absolute; inset: 0; width: 100%; height: 100%; touch-action: pan-y; cursor: grab; outline-offset: -4px; }
html.is-3d.is-turning #view { cursor: grabbing; }
html.is-3d .marks { display: block; position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.marks circle { fill: none; stroke: var(--studio-ink); stroke-width: 1.5; }
html.is-3d .apart { display: block; pointer-events: auto; padding: 0.45rem 1rem; border: 0; border-radius: 999px; cursor: pointer; white-space: nowrap;
  background: rgba(25, 23, 28, 0.1); color: var(--studio-ink); font-size: 0.875rem; font-weight: 500; }
html.is-3d .apart:hover { background: rgba(25, 23, 28, 0.17); }
html.is-3d .apart[aria-pressed='true'] { background: var(--studio-ink); color: var(--studio-lit); }
html.is-3d .studio-foot { display: block; position: absolute; inset: auto 0 0; padding: 2.5rem 1.5rem 1.4rem; pointer-events: none;
  background: linear-gradient(to top, rgba(205, 200, 196, 0.9) 45%, rgba(205, 200, 196, 0)); }
.caption { max-width: 32rem; min-height: 2.9rem; font-size: 0.9375rem; line-height: 1.45; color: var(--studio-dim); text-wrap: pretty; }
.caption strong { font-weight: 700; font-size: 1.0625rem; color: var(--studio-ink); }
.caption .n { margin-left: 0.5rem; color: var(--studio-dim); }
.caption .where { margin-top: 0.15rem; font-size: 0.9375rem; color: var(--studio-dim); }

@media (max-width: 58rem) {
  .bom { display: block; }
  .bom-head { padding: 2.25rem 1.25rem 1.5rem; }
  .bom-head h1 { font-size: clamp(1.6rem, 7vw, 2.2rem); }
  .bom-head .lede { font-size: 1rem; }
  .bom-list { padding: 0 1.25rem 3rem; }
  .studio { z-index: 5; height: auto; min-height: 0; }
  .studio .still { position: static; display: block; width: 100%; height: auto; padding: 3.25rem 1rem 1rem; }
  html.is-3d .studio { height: 42svh; min-height: 15.5rem; box-shadow: 0 10px 24px rgba(8, 7, 10, 0.5); }
  .studio-top { padding: 0.75rem 1rem 0.5rem; }
  .studio-name span { display: none; }
  html.is-3d .apart { padding: 0.35rem 0.85rem; font-size: 0.8125rem; }
  html.is-3d .studio-foot { padding: 0.5rem 1rem 0.7rem; }
  .caption { min-height: 2.5rem; font-size: 0.8125rem; line-height: 1.35; }
  .caption strong { font-size: 0.9375rem; }
  .caption .where { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-size: 0.8125rem; }

  /* a row becomes a block: how many and what, then where to buy it */
  .bom-table thead { display: none; }
  .bom-table tr { display: grid; grid-template-columns: 2.4rem minmax(0, 1fr); padding: 0.85rem 0.5rem; border-bottom: 1px solid var(--line); }
  .bom-table th, .bom-table td { padding: 0; border: 0; }
  .bom-table .group { padding: 2rem 0.5rem 0.6rem; }
  .bom-table .group th { grid-column: 1 / -1; padding: 0; }
  .bom-table .qty { width: auto; }
  .buy { grid-column: 2; width: auto; display: flex; flex-wrap: wrap; gap: 0.3rem 1.1rem; margin-top: 0.55rem; }
  .buy a + a { margin-top: 0; }
  .buy small { flex-basis: 100%; margin-top: 0; }
  /* a row found from the model comes to rest under the studio, not behind it */
  html.is-3d tr[data-part] { scroll-margin-top: calc(var(--bar) + max(42svh, 15.5rem) + 0.75rem); }
  tr[data-part].is-on > :first-child { box-shadow: none; }
  tr[data-part].is-on { box-shadow: inset 3px 0 0 var(--accent); }
  .bom-notes { margin-top: 2.75rem; }
}

@media (prefers-reduced-motion: no-preference) {
  .apart, tr[data-part] { transition: background-color 0.15s; }
  .marks circle { transition: opacity 0.2s; }
}
