/* /foundry: the Hybrid Enclosure Foundry. */
.fd-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 22px; align-items: start; }
.fd-controls { position: sticky; top: calc(var(--header-h, 64px) + 16px); display: grid; gap: 12px; }
.fd-controls h2, .fd-view h2, .fd-specs h2 { margin: 0; font-size: 1.15rem; }
.fd-fields { display: flex; flex-wrap: wrap; gap: 10px 14px; }
.fd-fields label { display: flex; align-items: center; gap: 6px; font-size: 13.5px; }
.fd-fields input { width: 78px; }
.fd-slider { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; font-size: 13.5px; }
.fd-slider input { accent-color: var(--teal); }
.fd-slider output { font-family: var(--font-mono); font-size: 12.5px; color: var(--muted-dark); min-width: 46px; text-align: right; }
.fd-select { display: grid; gap: 4px; font-size: 13.5px; }
.fd-warn { margin: 0; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, #e0a33a 18%, var(--carbon)); border: 1px solid #e0a33a; font-size: 13.5px; }
.fd-more summary { cursor: pointer; font-size: 13.5px; color: var(--muted-dark); }
.fd-more .hint { font-size: 12.5px; }
.fd-view { display: grid; gap: 16px; }
.fd-view .row-title, .fd-specs .row-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.fd-explode { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted-dark); }
.fd-explode input { width: 160px; accent-color: var(--teal); }
.fd-stage { margin-top: 10px; border-radius: 12px; background: var(--carbon-3); padding: 10px; }
.fd-svg { width: 100%; height: auto; max-height: 460px; display: block; }
.fd-face, .fd-block, .fd-fan { stroke-linejoin: round; }
.fd-panel .fd-face { fill: rgba(232, 226, 207, .22); stroke: rgba(232, 226, 207, .75); stroke-width: .6; }
.fd-panel .fd-face.fd-top { fill: rgba(232, 226, 207, .3); }
.fd-panel .fd-face.fd-side { fill: rgba(232, 226, 207, .14); }
.fd-block { fill: #a8f0d0; stroke: #1e2326; stroke-width: .5; }
.fd-block.fd-front { fill: #8dd8b6; }
.fd-block.fd-side { fill: #6fbf9c; }
.fd-fix { fill: #f0c46a; stroke: #1e2326; stroke-width: .5; }
.fd-fan { fill: rgba(30, 35, 38, .5); stroke: #a8f0d0; stroke-width: .8; stroke-dasharray: 3 2; }
.fd-legend { display: flex; gap: 16px; flex-wrap: wrap; margin: 10px 0 0; font-size: 12.5px; color: var(--muted-dark); }
.fd-legend span { display: inline-flex; align-items: center; gap: 6px; }
.fd-key { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.fd-key-panel { background: rgba(232, 226, 207, .3); border: 1px solid rgba(232, 226, 207, .75); }
.fd-key-block { background: #a8f0d0; }
.fd-key-fix { background: #f0c46a; border-radius: 50%; }
.fd-3d { margin-top: 10px; aspect-ratio: 16 / 9; border-radius: 12px; background: var(--carbon-3); overflow: hidden; }
.fd-3d canvas { width: 100%; height: 100%; display: block; }
.fd-specs { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; }
.fd-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 14px; }
.fd-table th { text-align: left; font: 500 10.5px/1 var(--font-mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted-dark); padding: 6px 8px; }
.fd-table td { padding: 7px 8px; border-top: 1px solid var(--line-dark); }
.fd-table td:nth-child(2) { font-family: var(--font-mono); font-size: 13px; white-space: nowrap; }
.fd-bom { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.fd-bom li { display: flex; gap: 10px; align-items: baseline; font-size: 14px; }
.fd-bom b { font-family: var(--font-mono); color: var(--teal-text); min-width: 44px; }
.fd-bom small { display: block; color: var(--muted-dark); font-size: 12.5px; }
.fd-tag { font: 600 10px/1 var(--font-mono); text-transform: uppercase; letter-spacing: .06em; padding: 3px 6px; border-radius: 5px; background: color-mix(in srgb, #a8f0d0 22%, transparent); color: #a8f0d0; font-style: normal; margin-left: 4px; }
@media (max-width: 900px) { .fd-layout { grid-template-columns: 1fr; } .fd-controls { position: static; } .fd-specs { grid-template-columns: 1fr; } }
.fd-select[hidden], .fd-legend span[hidden], .fd-view .actions-row[hidden] { display: none; }
/* The settings never run off the bottom of the screen: they scroll in their own column, beside the model. */
@media (min-width: 901px) { .fd-controls { max-height: calc(100dvh - var(--header-h, 64px) - 32px); overflow-y: auto; scrollbar-width: thin; } }
/* Phones: the box ("How it goes together") comes first and stays pinned under the header while the settings
   scroll beneath it; the printed parts, cut list and parts list follow. */
@media (max-width: 900px) {
  .fd-layout { display: flex; flex-direction: column; }
  .fd-view { display: contents; }
  .fd-view > .panel-lite:first-child { order: -1; position: sticky; top: var(--header-h, 64px); z-index: 5; background: var(--page, var(--carbon)); box-shadow: 0 10px 18px -12px rgb(0 0 0 / 0.5); }
  .fd-view > .panel-lite:first-child .fd-stage { max-height: 34dvh; }
  .fd-view > .panel-lite:first-child .fd-legend { display: none; }
  .fd-controls { order: 0; }
  .fd-view > .panel-lite:not(:first-child), .fd-specs { order: 1; }
}

/* The Foundry console: the same language as the Tectonic Deck and Deck Foundry (tectonic.css,
   deck-foundry.css): a black grid, gunmetal panels, one hot orange, condensed capitals, mono labels. */
.fd-console { --hot: #ff6a1f; --hot-soft: rgba(255, 106, 31, 0.14); --display: 'Saira Semi Condensed', 'Arial Narrow', sans-serif; }
:root:not([data-theme="light"]) .fd-console {
  --carbon: #08090a; --carbon-2: #121416; --carbon-3: #15181b; --line-dark: rgba(255, 255, 255, 0.08); --text: #f2efea; --muted-dark: #9a9ca1;
  background: linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px) 0 0 / 48px 48px, linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px) 0 0 / 48px 48px, #08090a; color: var(--text);
}
.fd-console h2 { font-family: var(--display); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.fd-hero { position: relative; padding: clamp(48px, 7vw, 92px) 0 0; border-bottom: 1px solid var(--line-dark);
  background: radial-gradient(55% 80% at 85% 40%, rgba(255, 106, 31, 0.16), transparent 62%), radial-gradient(40% 60% at 0% 100%, rgba(255, 106, 31, 0.06), transparent 70%); }
.fd-hero-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: clamp(20px, 4vw, 48px); align-items: center; }
.fd-hero-art { position: relative; }
.fd-hero-art .fd-svg { max-height: 520px; filter: drop-shadow(0 30px 50px rgba(0, 0, 0, 0.6)); }
@media (max-width: 900px) { .fd-hero-grid { grid-template-columns: 1fr; } .fd-hero-art { max-width: 520px; } }
.fd-tag { display: inline-flex; align-items: center; gap: 10px; margin: 0 0 18px; font: 500 11px/1.4 var(--font-mono, ui-monospace, monospace); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted-dark); }
.fd-led { width: 7px; height: 7px; border-radius: 50%; background: var(--hot); box-shadow: 0 0 12px rgba(255, 106, 31, 0.9); }
.fd-hero h1 { margin: 0; font-family: var(--display); font-weight: 700; font-size: clamp(40px, 5.4vw, 78px); line-height: 0.98; letter-spacing: 0.04em; text-transform: uppercase; }
.fd-hero h1 span { display: block; color: var(--hot); }
.fd-hero .lede { max-width: 44rem; margin-top: 20px; color: var(--muted-dark); }
.fd-hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.fd-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 20px; border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 4px; background: rgba(255, 255, 255, 0.03); color: var(--text); font: 600 13px/1 var(--display); letter-spacing: 0.12em; text-transform: uppercase; text-decoration: none; transition: border-color .2s, background .2s; }
.fd-btn:hover { border-color: var(--hot); background: var(--hot-soft); }
.fd-btn-hot { background: var(--hot); border-color: var(--hot); color: #140700; box-shadow: 0 10px 34px rgba(255, 106, 31, 0.28); }
.fd-btn-hot:hover { background: #ff7d3a; color: #140700; }
.fd-hud { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin: clamp(36px, 5vw, 60px) auto 0; border-top: 1px solid var(--line-dark); }
.fd-hud div { padding: 16px 14px; border-left: 1px solid var(--line-dark); }
.fd-hud div:first-child { border-left: 0; }
.fd-hud dt { font: 500 10.5px/1.3 var(--font-mono, ui-monospace, monospace); letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted-dark); }
.fd-hud dd { margin: 6px 0 0; font: 700 17px/1.2 var(--display); letter-spacing: 0.06em; text-transform: uppercase; }
.fd-console .fd-controls { padding: 18px; border: 1px solid var(--line-dark); border-radius: 6px; background: var(--carbon-2); }
.fd-console .fd-slider input, .fd-console .fd-explode input { accent-color: var(--hot); }
.fd-console .fd-stage { position: relative; border-radius: 6px; border: 1px solid var(--line-dark);
  background: radial-gradient(55% 60% at 50% 55%, rgba(255, 106, 31, 0.12), transparent 65%), linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px) 0 0 / 32px 32px, linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px) 0 0 / 32px 32px, #0b0c0e; }
.fd-console .fd-stage::before, .fd-console .fd-stage::after { content: ''; position: absolute; width: 20px; height: 20px; border: 2px solid var(--hot); pointer-events: none; }
.fd-console .fd-stage::before { top: 8px; left: 8px; border-right: 0; border-bottom: 0; }
.fd-console .fd-stage::after { right: 8px; bottom: 8px; border-left: 0; border-top: 0; }
.fd-console .btn:not(.btn-ghost):not(.btn-outline) { --bg: var(--hot); --fg: #140700; }
:root[data-theme="light"] .fd-console .fd-stage { background: radial-gradient(55% 60% at 50% 55%, rgba(255, 106, 31, 0.1), transparent 65%), var(--carbon-3); }
@media (max-width: 700px) { .fd-hud { grid-template-columns: repeat(2, minmax(0, 1fr)); } .fd-hud div { border-left: 0; border-top: 1px solid var(--line-dark); } }
/* In the console, the printed parts glow orange like the deck's receiver. */
.fd-console .fd-block { fill: #ff7a35; }
.fd-console .fd-block.fd-front { fill: #e8611f; }
.fd-console .fd-block.fd-side { fill: #c24f17; }
.fd-console .fd-fan { stroke: var(--hot); }
.fd-console .fd-key-block { background: #ff7a35; }
