@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --bg: #14181c;
  --panel: #1b2126;
  --panel-raised: #212830;
  --border: #2c363d;
  --text: #e7ecee;
  --text-muted: #8b98a3;
  --accent: #c89b3c;
  --accent-dim: #6b5726;
  --warn: #d97b3f;
  --font-sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SFMono-Regular', Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.5;
}

/* ---------- Header ---------- */

.page-header {
  border-bottom: 1px solid var(--border);
  padding: 2rem 1.5rem 1.75rem;
}

.header-inner {
  max-width: 1080px;
  margin: 0 auto;
}

.back-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  display: inline-block;
  margin-bottom: 1rem;
}

.back-link:hover { color: var(--text); }

.page-header h1 {
  margin: 0 0 0.5rem;
  font-size: 1.65rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Links between the builder pages (make_pages.py writes it once there are two or more). */
.tool-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.25rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.tool-nav a { color: var(--text-muted); text-decoration: none; }
.tool-nav a:hover { color: var(--text); }
.tool-nav [aria-current="page"] { color: var(--accent); }

/* ---------- Shared panel box ---------- */

.panel-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.75rem;
}

.box-title {
  margin: 0 0 1.25rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}

/* ---------- Decode panel ---------- */

.decode-row {
  display: flex;
  gap: 0.6rem;
}

#pinInput {
  flex: 1;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background: var(--panel-raised);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.6rem 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: normal;
}

#pinInput::placeholder {
  color: var(--text-muted);
}

#pinInput:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

#decodeBtn {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background: var(--accent);
  color: var(--bg);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 0.6rem 1.1rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
}

#decodeBtn:hover {
  background: #dcae52;
  border-color: #dcae52;
}

#decodeBtn:active {
  background: var(--accent-dim);
  border-color: var(--accent-dim);
}

#decodeBtn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#decode-note {
  margin: 0.6rem 0 0;
  font-size: 0.8rem;
}

#decode-note.error { color: var(--warn); }
#decode-note.success { color: var(--accent); }
#decode-note:empty { display: none; }

/* ---------- Layout ---------- */

.builder-layout {
  max-width: 1080px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Its own grid, separate from the accessories panel below - a single row, so the result
   panel's sticky containing block is exactly this row's height (the "build a new part
   number" box). Nesting it this way (rather than a shared grid with grid-row: span) is
   what makes the sticky panel release right at this box's bottom instead of riding along
   through the accessories panel below it. */
.builder-top {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem 2.5rem;
  align-items: start;
}

/* Grid items default to min-width: auto, which floors each 1fr track at its content's
   min-content width. Without this, a wide unbreakable string (e.g. the decode input's
   placeholder) stops the track from shrinking to fit, and the whole page gains
   horizontal scroll on narrow viewports. */
.left-column,
.builder-result {
  min-width: 0;
}

.left-column {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Same width as .builder-top's left column (1fr of a 1fr 1fr grid with a 2.5rem gap),
   without putting it back in that grid - doing that would widen its sticky containing
   block again (see the comment on .builder-top above). */
.accessories-panel {
  max-width: calc((100% - 2.5rem) / 2);
}

@media (max-width: 800px) {
  .accessories-panel {
    max-width: none;
  }

  .builder-top {
    grid-template-columns: 1fr;
  }
}

/* ---------- Form ---------- */

.field-group {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.field-group:last-child { border-bottom: none; padding-bottom: 0.25rem; }
.field-group:first-child { padding-top: 0.25rem; }

.field-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text);
}

select {
  width: 100%;
  background: var(--panel-raised);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.6rem 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
                     linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) center, calc(100% - 13px) center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

select:disabled {
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.6;
}

select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.field-note {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  color: var(--warn);
}

.field-note:empty { display: none; }

.field-hint {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ---------- Insert arrangement picker button ---------- */

.arrangement-picker-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  appearance: none;
  -webkit-appearance: none;
  background: var(--panel-raised);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.6rem 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
}

.arrangement-picker-btn::after {
  content: '';
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-right: 1.5px solid var(--text-muted);
  border-bottom: 1.5px solid var(--text-muted);
  transform: rotate(45deg) translateY(-2px);
}

.arrangement-picker-btn:hover {
  border-color: var(--accent-dim);
}

.arrangement-picker-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.arrangement-diagram-id {
  margin: 0.75rem 0 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.arrangement-diagram-id:empty { display: none; }

.arrangement-diagram {
  margin-top: 0.75rem;
  display: flex;
  justify-content: center;
}

/* Up to 300px wide (shrinks with the column on narrow screens). A PNG, not an SVG - see
   generate_diagrams.py's module docstring for why (contact coordinates as scrapeable
   markup vs. pixels), rendered at 640px so it stays sharp on retina screens too. */
.arrangement-diagram img {
  width: 100%;
  max-width: 300px;
  height: auto;
  aspect-ratio: 1 / 1;
}

.arrangement-diagram:empty { display: none; }

.arrangement-legend {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.3rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.arrangement-legend:empty { display: none; }

.arrangement-legend li {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.legend-swatch {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.legend-swatch circle {
  fill: var(--accent);
  stroke: var(--bg);
  stroke-width: 0.75;
}

.legend-swatch circle.ring { fill: none; }

.keyway-diagram {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

.keyway-diagram svg {
  width: 150px;
  height: 150px;
}

.keyway-diagram svg.insert-position-svg {
  width: 190px;
  height: 190px;
}

.keyway-diagram-caption {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.keyway-diagram:empty { display: none; }

/* ---------- Result panel ---------- */

.builder-result {
  position: sticky;
  top: 1.5rem;
}

/* Not sticky once the layout stacks, or it would slide over the accessories panel below it. */
@media (max-width: 800px) {
  .builder-result { position: static; }
}

.pin-display {
  border: 1px solid var(--accent-dim);
  border-radius: 4px;
  padding: 1.25rem 1rem;
  text-align: center;
  margin-bottom: 1.5rem;
  background: linear-gradient(180deg, rgba(200, 155, 60, 0.06), transparent);
}

.pin-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.pin-value {
  display: block;
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.02em;
  word-break: break-all;
}

.pin-value.complete {
  color: var(--accent);
}

.pin-value.incomplete {
  color: var(--text-muted);
  font-weight: 400;
}

/* ---------- Parts list checkbox and Newark link ---------- */

.pin-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.4rem 1.25rem;
  margin-top: 0.75rem;
}

.pin-actions:empty { display: none; }

.part-check {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.part-check:hover { color: var(--text); }

.part-check input[type="checkbox"] {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  margin: 0;
  cursor: pointer;
  flex-shrink: 0;
}

.buy-link {
  color: var(--accent);
  font-size: 0.8rem;
  text-decoration: none;
  white-space: nowrap;
}

.buy-link:hover { text-decoration: underline; }

/* .copy-link-btn is a <button> reusing .buy-link's look - reset the button chrome only. */
.copy-link-btn {
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  cursor: pointer;
}

.buy-link:focus-visible,
.part-check input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.pin-breakdown {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.pin-breakdown td {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.pin-breakdown tr:last-child td { border-bottom: none; }

.pin-breakdown td:first-child {
  color: var(--text-muted);
  padding-right: 1rem;
  white-space: nowrap;
  width: 40%;
}

.pin-breakdown td:nth-child(2) {
  font-family: var(--font-mono);
  color: var(--text);
  padding-right: 0.75rem;
  overflow-wrap: break-word;
}

.pin-breakdown td:last-child {
  color: var(--text-muted);
}

/* ---------- Contacts ---------- */

.contacts-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.contacts-section[hidden] { display: none; }

.contacts-title {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.contacts-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.contacts-table th {
  text-align: left;
  font-weight: 500;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 0 0.75rem 0.4rem 0;
  border-bottom: 1px solid var(--border);
}

.contacts-table td {
  padding: 0.45rem 0.75rem 0.45rem 0;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--text-muted);
}

.contacts-table tr:last-child td { border-bottom: none; }

/* Columns: parts-list checkbox, Qty, Part number, Contact, Newark link. */
.contacts-table td:nth-child(2),
.contacts-table td:nth-child(3) {
  font-family: var(--font-mono);
  color: var(--text);
  white-space: nowrap;
}

.contacts-table th:first-child,
.contacts-table td:first-child {
  width: 1.5rem;
  padding-right: 0.25rem;
}

.contacts-table td:last-child {
  padding-right: 0;
  text-align: right;
}

/* Five columns on a phone: tighter gaps, so the table fits the panel. */
@media (max-width: 600px) {
  .contacts-table th,
  .contacts-table td {
    padding-right: 0.4rem;
  }
}

.contacts-note {
  margin: 0.6rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.contacts-note:empty { display: none; }

/* ---------- Backshell orientation ---------- */

.orientation-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.orientation-section[hidden] { display: none; }

.orientation-title {
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.orientation-desc {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Site-theme line art (grey lines, accent dimension), no background rect of its own -
   sits on the page background like the keyway and arrangement diagrams. */
.orientation-img {
  display: block;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
}

.orientation-note {
  margin: 0.6rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

/* ---------- Mating connectors ---------- */

.mating-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.mating-title {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin-bottom: 0.9rem;
}

.plating-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.plating-check input[type="checkbox"] {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.mating-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 260px;
  overflow-y: auto;
  /* Scroll still works (wheel/touch/keyboard) - just no visible track, so it can't overlap
     the right-justified descriptor text. */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* legacy Edge */
}

.mating-list::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Chromium Edge */
}

.mating-list li {
  font-size: 0.85rem;
  color: var(--text);
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  cursor: pointer;
}

.mating-list li:hover {
  color: var(--accent);
}

.mating-list li:last-child { border-bottom: none; }

.mating-list .mating-pin {
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.mating-list .part-check {
  align-self: center;
}

/* After the descriptor, at the right edge. The descriptor gives up width first. */
.mating-list .buy-link {
  flex-shrink: 0;
}

.mating-list .review-flag {
  color: var(--warn);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  flex-shrink: 0;
}

/* Brief "shell style, contact type" descriptor, right-justified. min-width: 0 lets it
   shrink below its content's natural width, which flex children default out of - without
   it, a long descriptor would push the list wider instead of eliding. */
.mating-list .mating-descriptor {
  flex: 1 1 auto;
  min-width: 0;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.mating-empty {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.mating-empty:empty { display: none; }

.disclaimer {
  margin: 1.5rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ---------- Accessories panel ---------- */

.accessory-context {
  margin: 0 0 0.25rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

select optgroup {
  font-style: normal;
  font-weight: 600;
  color: var(--text-muted);
}

select option {
  font-weight: 400;
  color: var(--text);
}

select option:disabled {
  color: var(--text-muted);
}

/* One subsection per accessory type (Backshells, Shrink Boots, ...). */
.accessory-section {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.accessory-subtitle {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.accessory-unavailable {
  margin: 0.5rem 0 0;
  padding: 0 0 0 1.1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.accessory-unavailable li + li { margin-top: 0.3rem; }

/* The field selects follow the "Accessory type" group, so they keep the normal top padding. */
.accessory-fields .field-group:first-child { padding-top: 1rem; }

.accessory-result {
  margin-top: 1.25rem;
}

.accessory-result[hidden] { display: none; }

.accessory-pin-display {
  margin-bottom: 1rem;
}

.accessory-info {
  width: 100%;
  margin-top: 1rem;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.accessory-info td {
  padding: 0.35rem 0;
  border-top: 1px solid var(--border);
  vertical-align: top;
}

.accessory-info td:first-child {
  color: var(--text-muted);
  padding-right: 1rem;
  width: 55%;
}

.accessory-info td:last-child {
  font-family: var(--font-mono);
  color: var(--text);
}

.accessory-info:empty,
.accessory-info tbody:empty { display: none; }

.accessory-notes {
  margin: 1rem 0 0;
  padding: 0 0 0 1.1rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.accessory-notes:empty { display: none; }

.accessory-notes li + li { margin-top: 0.3rem; }

.accessory-notes li.warn {
  color: var(--warn);
  list-style: none;
  margin-left: -1.1rem;
}

.accessory-source {
  margin: 1rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ---------- Insert arrangement picker overlay ---------- */

.arrangement-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.arrangement-modal[hidden] { display: none; }

.arrangement-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 13, 16, 0.7);
}

.arrangement-modal-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 900px;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

.arrangement-modal-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.arrangement-modal-header h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  flex: 1;
}

.arrangement-modal-filter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.arrangement-modal-filter label {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.arrangement-modal-filter select {
  width: auto;
  min-width: 9rem;
  padding: 0.4rem 1.6rem 0.4rem 0.6rem;
  font-size: 0.85rem;
}

.arrangement-modal-close {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  color: var(--text-muted);
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
}

.arrangement-modal-close:hover {
  color: var(--text);
  background: var(--panel-raised);
}

.arrangement-modal-body {
  overflow-y: auto;
  padding: 1.5rem;
}

.arrangement-modal-loading {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 2rem 0;
}

.arrangement-modal-section + .arrangement-modal-section {
  margin-top: 1.75rem;
}

.arrangement-modal-section-title {
  margin: 0 0 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.arrangement-modal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.75rem;
}

.arrangement-card {
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  background: var(--panel-raised);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem 0.5rem 0.6rem;
  cursor: pointer;
  color: var(--text);
  text-align: center;
}

.arrangement-card:hover {
  border-color: var(--accent-dim);
}

.arrangement-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.arrangement-card.selected {
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(200, 155, 60, 0.12), var(--panel-raised));
}

.arrangement-card-diagram {
  width: 84px;
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.arrangement-card-diagram img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
/* Thumbnail PNGs are rendered without labels (see generate_diagrams.py's render_png
   show_labels arg) - they'd be unreadable at this size and turn dense layouts into grey
   speckle; the main diagram shows them. */

.arrangement-card-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.arrangement-card-no {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
}

.arrangement-card-contacts {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.arrangement-card-sizes {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
}

.arrangement-card-flag {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.arrangement-card-flag.warn {
  color: var(--warn);
}

/* Shell style picker: wide isometric images, labeled by style only. */
.arrangement-modal-grid.shell-style-grid {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.shell-style-card-img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: contain;
  border-radius: 4px;
}

.arrangement-card:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.arrangement-card:disabled:hover {
  border-color: var(--border);
}

.shell-style-card-name {
  font-size: 0.85rem;
  font-weight: 600;
}

@media (max-width: 600px) {
  .arrangement-modal-header {
    flex-wrap: wrap;
  }

  .arrangement-modal-grid.shell-style-grid {
    grid-template-columns: 1fr;
  }

  .arrangement-modal-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }
}

/* ---------- Parts list panel ---------- */

.parts-list-hint,
.parts-list-note {
  margin: 0 0 0.9rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.parts-list-note { margin: 0.9rem 0 0; }
.parts-list-note:empty { display: none; }

.parts-list-empty {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.parts-list-empty[hidden] { display: none; }

/* The table scrolls sideways inside the panel on a narrow screen, never the page. */
.parts-list-wrap {
  overflow-x: auto;
}

.parts-list-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.parts-list-table th {
  text-align: left;
  font-weight: 500;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 0 0.75rem 0.4rem 0;
  border-bottom: 1px solid var(--border);
}

.parts-list-table td {
  padding: 0.4rem 0.75rem 0.4rem 0;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-muted);
}

.parts-list-table tr:last-child td { border-bottom: none; }

.parts-list-table td:nth-last-child(-n + 2) {
  width: 1%;
  white-space: nowrap;
}

.parts-list-table td:last-child { padding-right: 0; }

.parts-list-table .parts-pn {
  font-family: var(--font-mono);
  color: var(--text);
  white-space: nowrap;
}

.parts-qty {
  width: 5.5rem;
  appearance: textfield;
  -moz-appearance: textfield;
  background: var(--panel-raised);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.3rem 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.parts-qty:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.parts-remove {
  appearance: none;
  background: none;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.15rem 0.45rem;
  cursor: pointer;
}

.parts-remove:hover {
  color: var(--warn);
  border-color: var(--border);
}

.parts-remove:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.parts-list-summary {
  margin: 0.9rem 0 0;
  font-size: 0.85rem;
  color: var(--text);
}

.parts-list-summary:empty { display: none; }

.parts-list-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1rem;
}

.parts-btn {
  appearance: none;
  background: var(--panel-raised);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.5rem 0.9rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  cursor: pointer;
}

.parts-btn:hover:not(:disabled) { border-color: var(--accent-dim); }

.parts-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.parts-btn:disabled {
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.6;
}

.parts-list-status {
  font-size: 0.8rem;
  color: var(--accent);
}

/* ---------- Privacy and terms page, site footer ---------- */

.legal-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  font-size: 0.95rem;
}

.legal-page section + section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.legal-page h2 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.legal-page p,
.legal-page li {
  color: var(--text-muted);
}

.legal-page p { margin: 0 0 0.75rem; }
.legal-page p:last-child { margin-bottom: 0; }

.legal-page ul {
  margin: 0 0 0.75rem;
  padding-left: 1.2rem;
}

.legal-page li + li { margin-top: 0.35rem; }

.legal-page strong { color: var(--text); }

.legal-page a,
.site-footer a,
.parts-list-note a {
  color: var(--accent);
}

.legal-page a:hover,
.site-footer a:hover,
.parts-list-note a:hover {
  color: #dcae52;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.25rem 1.5rem 4.5rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.site-footer a + a { margin-left: 1.5rem; }

/* ---------- Home (intro) page, root index.html ---------- */

.intro-page {
  max-width: 820px;
  margin: 0 auto;
  padding: 4.5rem 1.5rem 3rem;
}

.intro-hero {
  text-align: center;
  padding-bottom: 0.5rem;
}

.brand {
  margin: 0;
  font-size: clamp(1.9rem, 8vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.brand::after {
  content: '';
  display: block;
  width: 64px;
  height: 3px;
  margin: 1.25rem auto 0;
  border-radius: 2px;
  background: var(--accent);
}

.intro-tagline {
  max-width: 34rem;
  margin: 1.25rem auto 0;
  font-size: 1.2rem;
  color: var(--text);
}

.intro-hero .cta-btn { margin-top: 2rem; }

.cta-btn {
  display: inline-block;
  background: var(--accent);
  color: var(--bg);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 0.7rem 1.4rem;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
}

.cta-btn:hover { background: #dcae52; border-color: #dcae52; }

.cta-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.intro-section {
  margin-top: 2.5rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.95rem;
}

.intro-section h2 {
  margin: 0 0 0.75rem;
  font-size: 1.25rem;
  font-weight: 600;
}

.intro-section h3 {
  margin: 0 0 0.4rem;
  font-size: 1rem;
  font-weight: 600;
}

.intro-section h4 {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.intro-section p,
.intro-section li { color: var(--text-muted); }

.intro-section strong { color: var(--text); }

.intro-section p { margin: 0 0 0.75rem; }
.intro-section p:last-child { margin-bottom: 0; }

.intro-section ul,
.intro-section ol {
  margin: 0;
  padding-left: 1.2rem;
}

.intro-section li + li { margin-top: 0.4rem; }

.intro-section a:not(.cta-btn) { color: var(--accent); }
.intro-section a:not(.cta-btn):hover { color: #dcae52; }

/* Principles: a grid of small cards. */
.intro-points {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: 0.75rem;
}

.intro-point {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.1rem;
}

.intro-point p { font-size: 0.9rem; }

/* One card per tool; a planned tool gets a dashed border, like the series list. */
.intro-tool {
  background: var(--panel);
  border: 1px solid var(--accent-dim);
  border-radius: 6px;
  padding: 1.5rem;
}

.intro-tool + .intro-tool { margin-top: 0.75rem; }

.intro-tool.planned { border: 1px dashed var(--border); }

.intro-tool-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.75rem;
  margin-bottom: 0.5rem;
}

.intro-tool-head h3 {
  margin: 0;
  font-size: 1.15rem;
}

.intro-tool-status {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.1rem 0.45rem;
  border-radius: 3px;
  color: var(--bg);
  background: var(--accent);
}

.intro-tool.planned .intro-tool-status {
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border);
}

.intro-tool-block { margin-top: 1.25rem; }

.intro-coverage {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: 1.25rem 2rem;
}

@media (max-width: 600px) {
  .intro-page { padding-top: 3rem; }
  .intro-tool { padding: 1.1rem; }
}

/* ---------- Feedback box (tool/js/feedback.js) ---------- */

/* Below the picker overlays (z-index 100), so it never sits on top of one. */
.feedback-fab {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 50;
  appearance: none;
  -webkit-appearance: none;
  background: var(--panel-raised);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.5rem 1rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.feedback-fab:hover { border-color: var(--accent); color: var(--accent); }

.feedback-fab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.feedback-panel { max-width: 480px; }

.feedback-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.feedback-form textarea {
  display: block;
  width: 100%;
  resize: vertical;
  min-height: 7rem;
  appearance: none;
  -webkit-appearance: none;
  background: var(--panel-raised);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.6rem 0.7rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  line-height: 1.45;
}

.feedback-form textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.feedback-count {
  margin: 0.35rem 0 0.9rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: right;
}

.feedback-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 1rem;
}

.feedback-send {
  appearance: none;
  -webkit-appearance: none;
  background: var(--accent);
  color: var(--bg);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 0.5rem 1.2rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.feedback-send:hover { background: #dcae52; border-color: #dcae52; }

.feedback-send:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.feedback-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.75rem;
  margin-top: 0.75rem;
}

.feedback-status[hidden] { display: none; }
.feedback-status .field-hint { flex: 1 1 100%; margin: 0; }

@media (max-width: 600px) {
  .feedback-fab { right: 0.75rem; bottom: 0.75rem; padding: 0.45rem 0.85rem; }
}

/* ---------- Series list (/tool/), guides hub, guide pages, home page cards ---------- */

/* /tool/ and /guides/. These rules were inline in the series list page until the guides
   hub needed the same cards. */
.home { max-width: 880px; margin: 0 auto; padding: 4rem 1.5rem; }
.home h1 { font-size: 1.75rem; margin-bottom: 0.5rem; }
.home p.lead { color: var(--text-muted); margin-bottom: 2.5rem; max-width: 46rem; }
.home p.lead a { color: var(--accent); }
.home p.lead a:hover { color: #dcae52; }

.tool-group { margin-bottom: 2.25rem; }
.tool-group h2 {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(190px, 45%), 1fr));
  gap: 0.75rem;
}
.tool-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.1rem;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s ease;
}
.tool-card.live { border-color: var(--accent-dim); }
.tool-card.live:hover { border-color: var(--accent); }
.tool-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tool-card-title { font-size: 1.05rem; font-weight: 600; }
.tool-card p { margin: 0; color: var(--text-muted); font-size: 0.85rem; }
.tool-card-status {
  align-self: flex-start;
  margin-top: auto;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.1rem 0.45rem;
  border-radius: 3px;
}
.tool-card.live .tool-card-status { color: var(--bg); background: var(--accent); }
.tool-card.planned { border-style: dashed; cursor: default; }
.tool-card.planned .tool-card-title { color: var(--text-muted); }
.tool-card.planned .tool-card-status { color: var(--text-muted); border: 1px solid var(--border); }

/* The same cards inside a home page section, whose own link and paragraph colors would
   otherwise win. */
.intro-section a.tool-card,
.intro-section a.tool-card:hover { color: var(--text); }
.intro-section .tool-card p { margin: 0; color: var(--text-muted); font-size: 0.85rem; }

/* Breadcrumb: Home / Guides / this page. */
.breadcrumb { margin-bottom: 1rem; font-size: 0.875rem; }
.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--text-muted);
}
.breadcrumb li + li::before { content: "/"; margin: 0 0.5rem; color: var(--border); }
.breadcrumb a { color: var(--text-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb [aria-current="page"] { color: var(--text); }

/* Series pills: a link to a builder, or (planned) a note that it is coming. */
.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
/* Beats the list padding and margins that the home page and guide sections give a <ul>. */
.intro-section .pill-row,
.guide-page .pill-row { margin: 0; padding: 0; }
.pill-row > li + li,
.pill-row > li { margin: 0; }
.pill-row .pill {
  display: inline-block;
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--accent-dim);
  border-radius: 999px;
  background: var(--panel-raised);
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.4;
  text-decoration: none;
}
.pill-row a.pill { color: var(--text); }
.pill-row a.pill:hover { border-color: var(--accent); color: var(--accent); }
.pill-row a.pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pill-row span.pill.planned { border-style: dashed; border-color: var(--border); background: none; color: var(--text-muted); }

/* Home page: one card per connector family. */
.family-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}
.family-card {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  background: var(--panel);
  border: 1px solid var(--accent-dim);
  border-radius: 6px;
  padding: 1.1rem 1.25rem;
}
.intro-section .family-card h3 { margin: 0; font-size: 1.05rem; }
.intro-section .family-card p { margin: 0; font-size: 0.88rem; }
.intro-section .family-card .pill-row { margin-top: auto; }
.intro-section p.family-guide { font-size: 0.85rem; }
.intro-section p.family-soon { margin-top: 0.9rem; font-size: 0.85rem; }
.intro-section p.guides-all { margin-top: 1rem; }
.intro-section > p + .family-grid,
.intro-section > p + .tool-grid { margin-top: 1rem; }

/* The guide strip under a builder page's subtitle. */
.series-guides {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.series-guides a { color: var(--accent); text-decoration: none; }
.series-guides a:hover { color: #dcae52; text-decoration: underline; }

/* Guide pages, guides/<slug>.html. */
.guide-page { max-width: 820px; margin: 0 auto; padding: 2rem 1.5rem 3rem; font-size: 0.95rem; }
.guide-page h2 {
  margin: 2.25rem 0 0.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 1.25rem;
  font-weight: 600;
}
.guide-page h3 { margin: 1.75rem 0 0.5rem; font-size: 1.05rem; font-weight: 600; }
.guide-page p { margin: 0 0 0.9rem; max-width: 72ch; }
.guide-page ul,
.guide-page ol { margin: 0 0 1rem; padding-left: 1.3rem; }
.guide-page li { max-width: 72ch; }
.guide-page li + li { margin-top: 0.4rem; }
.guide-page strong { color: var(--text); }
.guide-page a { color: var(--accent); }
.guide-page a:hover { color: #dcae52; }
.guide-page code {
  padding: 0.05rem 0.3rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--panel-raised);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.88em;
}

.table-wrap {
  overflow-x: auto;
  margin: 0 0 1.25rem;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.guide-page table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.guide-page th,
.guide-page td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.guide-page th {
  background: var(--panel);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.guide-page tbody tr:last-child td { border-bottom: 0; }
.guide-page th.num,
.guide-page td.num { text-align: right; }

.guide-figure { margin: 1.25rem 0 1.5rem; }
.guide-figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
}

/* "Open the builder": the link from a guide into the tool. */
.guide-box {
  margin: 1.5rem 0;
  padding: 1.1rem 1.25rem;
  background: var(--panel);
  border: 1px solid var(--accent-dim);
  border-radius: 6px;
}
.guide-page .guide-box h2 { margin: 0 0 0.4rem; padding: 0; border: 0; font-size: 1rem; }
.guide-box p { margin: 0 0 0.75rem; }
.guide-page .guide-box p.guide-box-more { margin: 0.75rem 0 0; font-size: 0.85rem; }

.guide-related { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.guide-page .guide-related h2 { margin: 0 0 0.75rem; padding: 0; border: 0; font-size: 1.15rem; }
.guide-related ul { margin: 0; padding: 0; list-style: none; }
.guide-related li { max-width: none; margin: 0 0 0.6rem; }
.guide-related li + li { margin-top: 0; }
.guide-related li span { display: block; color: var(--text-muted); font-size: 0.85rem; }

@media (max-width: 600px) {
  .home { padding-top: 2.5rem; }
  .guide-page { padding: 1.5rem 1.25rem 2.5rem; }
}
