/* Hardware (/hardware/): the repo's Doc 9 PCB viewer full-screen, a glass
   panel over it, then the runbooks. pcb.css (the viewer's own styles) loads
   first; this file supplies the notebook tokens it expects and strips the
   viewer down to the board. */

.el-hw {
  --el-bg-0: #000000; --el-bg-1: #0F0D0B; --el-bg-2: #17140F; --el-bg-deep: #0B0A08;
  --el-ink: #F2EEE6; --el-ink-2: #C9C1B2; --el-ink-3: #9C937F; --el-ink-4: #6E6759;
  --el-line: rgba(242, 238, 230, 0.10); --el-line-2: rgba(242, 238, 230, 0.20);
  --el-amber: #E2A24C; --el-amber-hi: #EFBC77; --el-amber-soft: rgba(226, 162, 76, 0.14); --el-amber-glow: rgba(226, 162, 76, 0.10);
  --el-ice: #D6E5F4; --el-ice-soft: rgba(214, 229, 244, 0.14); --el-paper: #FFFFFF;
  --el-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --el-track-chrome: 0.12em; --el-track-ui: 0.08em;
  --el-sp-1: 4px; --el-sp-2: 8px; --el-sp-3: 12px; --el-sp-4: 16px; --el-sp-6: 24px; --el-sp-8: 32px; --el-sp-12: 48px; --el-sp-16: 64px;
  --el-r-0: 0; --el-r-pill: 999px;
  --el-ease: cubic-bezier(0.65, 0, 0.35, 1); --el-dur-fast: 120ms; --el-dur: 220ms;
  --md-default-bg-color: #000000;
  font-size: 16px; color: var(--fg-0); background: #000000;
}
.el-hw .md-typeset button, .el-hw .md-typeset input { font: inherit; color: inherit; }

/* ---- First screen: the board fills the viewport ---- */
.hw-hero { position: relative; height: 100svh; min-height: 600px; overflow: hidden; background: #000000; }
.hw-board { position: absolute; inset: 0; display: flex; flex-direction: column; }
.hw-board .md-typeset { flex: 1; display: flex; flex-direction: column; min-height: 0; color: var(--el-ink); }
.el-hw .el-pcb { margin: 0; height: 100%; display: flex; flex-direction: column; border-top: 0; border-bottom: 0; }
.el-hw .el-pcb .el-pcb-stage { flex: 1 1 auto; min-height: 0; height: auto !important; }
.el-hw .el-pcb .el-pcb-canvas { height: 100%; min-height: 360px; }
.el-hw .el-pcb-fallback { padding: 120px var(--gutter) 24px; max-width: 640px; color: var(--fg-2); }
@media (max-width: 899px) { .el-hw .el-pcb .el-pcb-canvas { height: 64svh; } }

/* Board only: no viewer chrome on this page. */
.el-hw.is-minimal .el-pcb { border: 0; background: transparent; }
.el-hw.is-minimal .el-pcb-head,
.el-hw.is-minimal .el-pcb-toolbar,
.el-hw.is-minimal .el-pcb-caption,
.el-hw.is-minimal .el-pcb-side,
.el-hw.is-minimal .el-pcb-legend { display: none !important; }
.el-hw.is-minimal .el-pcb-stage { grid-template-columns: minmax(0, 1fr) !important; }
.el-hw.is-minimal .el-pcb-canvas { background: transparent; }
.el-hw.is-minimal .el-pcb-canvas:focus-visible { outline: 0; }

/* Hover summary: large and readable on the full-screen board. */
.el-hw.is-minimal .el-pcb-tip {
  pointer-events: none; z-index: 5; border-radius: 0;
  font-family: var(--sans); font-size: 15px !important; line-height: 1.5; color: var(--fg-1);
  max-width: min(380px, calc(100% - 32px)) !important; padding: 14px 16px !important;
  background: rgba(0, 0, 0, 0.72); border: 1px solid var(--edge);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.el-hw.is-minimal .el-pcb-tip strong { display: block; margin-bottom: 4px; font-size: 18px; font-weight: 500; letter-spacing: -0.01em; color: var(--fg-0); }
.el-hw.is-minimal .el-pcb-tip-meta { font-family: var(--mono); font-size: 12px !important; letter-spacing: 0.12em; color: var(--fg-2); }
.el-hw.is-minimal .el-pcb-tip-actions { display: none; }

/* Part references in the panel; the viewer turns them into buttons. */
.el-hw .el-pcb-ref {
  font-family: var(--mono); font-size: 0.92em; color: var(--el-amber); background: none; border: 0; padding: 0;
  cursor: pointer; text-decoration: underline; text-decoration-color: rgba(226, 162, 76, 0.4); text-underline-offset: 3px;
}
.el-hw .el-pcb-ref:hover { color: var(--el-amber-hi); }

/* ---- Chrome over the board ---- */
.hw-head { position: absolute; top: 0; left: 0; right: 0; z-index: 2; pointer-events: none; }
.hw-head > * { pointer-events: auto; }

/* The liquid-glass panel. */
.hw-copy {
  position: absolute; left: var(--gutter); bottom: clamp(28px, 5vh, 64px); z-index: 2;
  width: min(460px, 40vw); display: flex; flex-direction: column; gap: 24px; padding: 24px;
  background: var(--glass); border: 1px solid var(--edge); border-radius: 0;
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  pointer-events: none;
}
.hw-copy h1 { margin: 0; font-weight: 500; font-size: clamp(32px, 3vw, 46px); line-height: 1; letter-spacing: -0.025em; color: var(--fg-0); text-wrap: balance; }
.hw-unlocks { display: flex; flex-direction: column; gap: 12px; }
.hw-list { margin: 0; padding: 0; list-style: none; border-bottom: 1px solid rgba(255, 255, 255, 0.1); }
.hw-list li {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: baseline; gap: 12px;
  padding: 12px 0; border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.hw-list__n { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; color: var(--fg-3); }
.hw-list__text { display: flex; flex-direction: column; gap: 2px; }
.hw-list__name { font-size: 16px; font-weight: 500; line-height: 1.3; color: var(--fg-0); }
.hw-list__desc { font-size: 14px; line-height: 1.45; color: var(--fg-2); }
.hw-list__refs { display: flex; gap: 8px; pointer-events: auto; }
.hw-closing { margin: 4px 0 0; font-size: 16px; line-height: 1.45; color: var(--fg-1); text-wrap: pretty; }
.hw-cta { display: flex; flex-wrap: wrap; gap: 10px; pointer-events: auto; }

.hw-ctrl { position: absolute; right: var(--gutter); bottom: clamp(28px, 5vh, 64px); z-index: 2; display: flex; align-items: center; gap: 8px; }
.hw-ctrl__btn {
  min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.16);
  background: var(--glass); color: var(--fg-1); cursor: pointer;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
}
.hw-ctrl__btn:hover { background: rgba(255, 255, 255, 0.08); }

/* ---- Runbooks ---- */
.runbooks { padding: clamp(72px, 7vw, 112px) var(--gutter) 0; }
.runbooks__head {
  display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px 16px;
  padding-bottom: 16px; border-bottom: 1px solid var(--edge);
}
.runbooks__head h2 { margin: 0; font-weight: 500; font-size: clamp(28px, 3vw, 44px); line-height: 1.05; letter-spacing: -0.02em; color: var(--fg-0); }
.runbooks__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 0 40px; }
.runbooks__group { display: flex; flex-direction: column; padding-top: 28px; }
.runbooks__group h3 { margin: 0 0 10px; font-family: var(--mono); font-weight: 400; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--fg-2); }
.runbook {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: baseline; gap: 12px;
  padding: 14px 0; border-bottom: 1px solid var(--line); color: var(--fg-0);
}
.runbook:hover { background: rgba(255, 255, 255, 0.04); }
.runbook__n { font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; color: var(--fg-3); }
.runbook__text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.runbook__title { font-size: 16px; font-weight: 500; line-height: 1.3; }
.runbook__desc { font-size: 14px; line-height: 1.45; color: var(--fg-2); text-wrap: pretty; }
.runbook__arrow { color: var(--fg-3); }

/* ---- Small screens: the summary of a tapped part is the only readout ---- */
@media (max-width: 720px) {
  .el-hw.is-minimal .el-pcb-tip { display: flex !important; left: 12px !important; right: 12px !important; top: auto !important; bottom: 12px !important; max-width: none !important; transform: none !important; }
  .el-hw.is-minimal .el-pcb-tip[hidden] { display: none !important; }
}

/* Phones: board first at full width, then the glass panel in normal flow. */
@media (max-width: 720px) {
  .hw-hero { height: auto; min-height: 0; overflow: visible; display: flex; flex-direction: column; }
  .hw-board { position: relative; inset: auto; height: 56svh; margin-top: 128px; }
  .hw-board .el-pcb-canvas { height: 100% !important; min-height: 0 !important; }
  .hw-ctrl { top: calc(128px + 56svh - 48px); bottom: auto; right: 16px; }
  .hw-ctrl__btn { min-height: 44px; }
  .hw-copy { position: relative; left: auto; bottom: auto; width: auto; margin: 24px 16px 0; padding: 20px; }
  .hw-head { padding-top: 20px; row-gap: 4px; }
  .hw-head .site-nav { gap: 18px; }
}

/* The glass panel stays below the 72px header on short screens, and the board
   is framed to the right of it so nothing covers the board. */
@media (min-width: 721px) {
  .hw-board { left: calc(var(--gutter) + min(460px, 40vw)); }
  .hw-copy {
    max-height: calc(100svh - 88px - clamp(28px, 5vh, 64px)); overflow-y: auto; overscroll-behavior: contain;
    pointer-events: auto; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
  }
}
@media (min-width: 721px) and (max-height: 860px) {
  .hw-copy { gap: 16px; padding: 20px; }
  .hw-copy h1 { font-size: clamp(26px, 2.4vw, 34px); }
  .hw-list li { padding: 8px 0; }
  .hw-list__desc { font-size: 13px; line-height: 1.4; }
}
@media (min-width: 721px) and (max-height: 620px) {
  .hw-list__desc { display: none; }
}
