/* An isolated interactive example, using the marketing site's light/dark tokens. */
#factory-plan { padding-top: 0; }
.factory-plan-heading { display: grid; grid-template-columns: 1.15fr 1fr; gap: 28px 64px; align-items: end; margin-bottom: 32px; }
.factory-plan-heading .label { margin-bottom: 18px; }
.factory-plan-heading .h2 { font-size: clamp(28px, 3.3vw, 42px); max-width: 19ch; }
.factory-plan-heading .lead { font-size: 17px; }
.factory-map {
  --map-running: #18824a;
  --map-stopped: #cb3d42;
  --map-setup: #a76a09;
  display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr);
  border: 1px solid var(--line-2); border-radius: 16px; overflow: hidden;
  background: var(--bg); box-shadow: 0 15px 45px -28px #102c4d66;
}
html.dark .factory-map { --map-running: #62d99b; --map-stopped: #ff8e93; --map-setup: #e9b95f; }
.factory-plan-board { min-width: 0; display: flex; flex-direction: column; justify-content: center; background: var(--bg-2); }
.factory-plan-surface { position: relative; width: 100%; aspect-ratio: 760 / 520; }
.factory-plan-drawing { display: block; width: 100%; height: 100%; }
.factory-grid-line { fill: none; stroke: var(--line); stroke-width: .6; }
.factory-zone { fill: var(--bg); stroke: var(--line-2); stroke-width: 3; transition: stroke .18s; }
.factory-walkway { fill: none; stroke: var(--line-2); stroke-width: 2; stroke-dasharray: 7 9; }
.factory-equipment { fill: var(--bg-3); stroke: var(--line-2); stroke-width: 2; }
.factory-rack-cell { fill: var(--bg-3); stroke: var(--line-2); stroke-width: 1.4; }
.factory-door { fill: var(--bg-2); stroke: var(--line-2); stroke-width: 3; }
.factory-view-cone { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1; stroke-dasharray: 5 6; opacity: .15; transition: opacity .18s; }
.factory-map[data-area="production"] .factory-zone--production,
.factory-map[data-area="packing"] .factory-zone--packing,
.factory-map[data-area="warehouse"] .factory-zone--warehouse { stroke: var(--accent); }
.factory-map[data-area="production"] .factory-view-cone--production,
.factory-map[data-area="packing"] .factory-view-cone--packing,
.factory-map[data-area="warehouse"] .factory-view-cone--warehouse { opacity: .8; }
.factory-area-label { position: absolute; font-size: clamp(11px, 1.1vw, 14px); font-weight: 500; color: var(--muted); text-align: right; max-width: 31%; pointer-events: none; }
.factory-area-label--production { right: 47.7%; top: 12%; }
.factory-area-label--packing { right: 5%; top: 12%; }
.factory-area-label--warehouse { right: 5%; top: 50%; }
.factory-plan-entry { position: absolute; left: 7%; bottom: 5%; color: var(--muted); font-size: 11px; }
.factory-hotspot {
  position: absolute; left: calc(var(--x) * 1%); top: calc(var(--y) * 1%);
  transform: translate(-50%, -50%); display: flex; align-items: center; justify-content: center;
  min-width: 44px; min-height: 44px; border: 1px solid var(--line-2); background: var(--bg);
  color: var(--ink); cursor: pointer; text-decoration: none;
  box-shadow: 0 3px 7px #102c4d14; transition: border-color .15s, box-shadow .15s;
}
.factory-hotspot b { font: 500 12px/1 var(--mono); }
.factory-hotspot:hover, .factory-hotspot[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.factory-hotspot:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.factory-machine { gap: 6px; border-radius: 8px; width: 68px; height: 48px; }
.factory-status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; background: currentColor; flex: 0 0 auto; }
.factory-machine--running .factory-status-dot, .factory-status-dot--running { color: var(--map-running); }
.factory-machine--stopped .factory-status-dot, .factory-status-dot--stopped { color: var(--map-stopped); }
.factory-machine--setup .factory-status-dot, .factory-status-dot--setup { color: var(--map-setup); }
.factory-camera { flex-direction: column; gap: 3px; width: 48px; height: 48px; border-radius: 50%; color: var(--accent-ink); }
.factory-camera svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.factory-camera b { font-size: 9px; }
.factory-map-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 24px; padding: 14px 18px; border-top: 1px solid var(--line); background: var(--bg); margin-top: auto; }
.factory-map-legend > span { display: inline-flex; gap: 7px; align-items: center; color: var(--ink-2); font-size: 12px; }
.factory-preview { min-width: 0; border-left: 1px solid var(--line-2); background: var(--bg); }
.factory-preview-panel { display: none; height: 100%; scroll-margin-top: 90px; }
.factory-preview-panel.is-active { display: block; }
/* Direct links provide a useful selection fallback when scripting is disabled. */
.factory-map:not(.is-ready) .factory-preview:has(:target) .factory-preview-panel { display: none; }
.factory-map:not(.is-ready) .factory-preview .factory-preview-panel:target { display: block; }
.factory-preview-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 24px; min-height: 65px; border-bottom: 1px solid var(--line); }
.factory-preview-code { font: 500 16px/1 var(--mono); }
.factory-example-tag { color: var(--muted); font-size: 12px; text-align: right; }
.factory-preview-image { width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; background: var(--bg-3); }
.factory-preview-copy, .factory-machine-detail { padding: 24px; }
.factory-overline { color: var(--muted); font: 500 11px/1.4 var(--mono); letter-spacing: .05em; text-transform: uppercase; margin-bottom: 10px; }
.factory-preview h3 { font-size: 23px; line-height: 1.2; }
.factory-preview-copy > p:last-child, .factory-machine-detail > p:not(.factory-overline) { color: var(--muted); font-size: 14px; line-height: 1.5; margin-top: 12px; }
.factory-state { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--bg-2); font-weight: 500; }
.factory-state--running { color: var(--map-running); }
.factory-state--stopped { color: var(--map-stopped); }
.factory-state--setup { color: var(--map-setup); }
.factory-machine-detail dl { margin-top: 24px; }
.factory-machine-detail dl > div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); font-size: 13px; }
.factory-machine-detail dt { color: var(--muted); }
.factory-machine-detail dd { text-align: right; font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.factory-progress-copy { display: flex; justify-content: space-between; gap: 12px; margin-top: 15px; font-size: 12px; color: var(--ink-2); }
.factory-progress-copy b { font-family: var(--mono); font-weight: 500; }
.factory-progress { height: 5px; border-radius: 3px; background: var(--bg-3); margin-top: 10px; overflow: hidden; }
.factory-progress span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.factory-machine-detail > .factory-machine-note { padding-top: 15px; font-size: 12px; }
.factory-map-note { margin-top: 14px; color: var(--muted); font-size: 12px; line-height: 1.5; }
@media (max-width: 900px) {
  .factory-plan-heading { grid-template-columns: 1fr; gap: 18px; }
  .factory-plan-heading .h2 { max-width: 25ch; }
  .factory-plan-heading .lead { max-width: 55ch; }
  .factory-map { grid-template-columns: minmax(0, 1.3fr) minmax(270px, 1fr); }
  .factory-machine { width: 52px; height: 44px; gap: 4px; }
  .factory-machine b { font-size: 11px; }
  .factory-preview-top, .factory-preview-copy, .factory-machine-detail { padding: 18px; }
  .factory-map-legend { gap: 8px 15px; }
}
@media (max-width: 680px) {
  .factory-map { grid-template-columns: minmax(0, 1fr); }
  .factory-preview { border-left: 0; border-top: 1px solid var(--line-2); }
  .factory-area-label { font-size: 11px; }
  .factory-preview-image { aspect-ratio: 16 / 9; }
  .factory-machine { width: 44px; height: 44px; gap: 3px; }
  .factory-machine b { font-size: 10px; }
  .factory-machine .factory-status-dot { width: 5px; height: 5px; }
  .factory-camera { width: 44px; height: 44px; }
  .factory-plan-entry { font-size: 10px; }
  .factory-map-legend { padding: 12px; gap: 10px 18px; }
  .factory-map-legend > span { font-size: 11px; }
  .factory-preview h3 { font-size: 21px; }
  .factory-preview-top { min-height: 58px; }
  .factory-preview-copy { min-height: 140px; }
}
@media (prefers-reduced-motion: reduce) {
  .factory-map *, .factory-map *::before, .factory-map *::after { transition: none; }
}
