/* ── Page styles: mediapipe-touchdesigner.html ──────────────────────────
   Deep dive: hand detection with MediaPipe inside TouchDesigner.
   Shared comic tokens come from comic.css; everything here is page-only. */

body {
  font-family: 'Comic Neue', cursive;
  color: var(--ink);
  background-color: var(--paper);
  background-image: radial-gradient(var(--ink) 0.5px, transparent 0.6px);
  background-size: 14px 14px;
  background-attachment: fixed;
  line-height: 1.65;
}

.panel {
  border: 4px solid var(--ink); border-radius: 6px;
  box-shadow: 7px 7px 0 var(--ink);
  background: var(--paper); padding: 28px 32px; margin-bottom: 32px;
}
h2 { font-family: 'Bangers', cursive; font-size: 2.4rem; letter-spacing: 2px; margin-bottom: 16px; line-height: 1; }
h3 { font-family: 'Bangers', cursive; font-size: 1.6rem; letter-spacing: 1px; margin-bottom: 12px; }
h4 { font-family: 'Bangers', cursive; font-size: 1.2rem; letter-spacing: 1px; margin-bottom: 8px; }
p  { margin-bottom: 14px; font-size: 1.05rem; }
p:last-child { margin-bottom: 0; }
ul, ol { padding-left: 22px; margin-bottom: 14px; }
li { margin-bottom: 6px; font-size: 1rem; }
code { font-family: 'Space Mono', monospace; font-size: .85em; background: var(--paper2); padding: 1px 5px; border-radius: 3px; }

.section-head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.section-num {
  font-family: 'Bangers', cursive; font-size: 1.1rem; letter-spacing: 2px;
  background: var(--purple); color: #fff; padding: 4px 14px;
  border-radius: 4px; border: 2px solid var(--ink); box-shadow: 2px 2px 0 var(--ink);
}

.chip {
  display: inline-block; font-family: 'Bangers', cursive; font-size: .85rem;
  letter-spacing: 1.5px; padding: 3px 12px; border-radius: 4px;
  border: 2px solid var(--ink); margin-right: 6px; margin-bottom: 6px; vertical-align: middle;
}
.chip-purple { background: var(--purple); color: #fff; }
.chip-green  { background: var(--green);  color: #fff; }
.chip-blue   { background: var(--blue);   color: #fff; }

.hbox {
  border: 3px solid var(--ink); border-radius: 5px; padding: 18px 22px;
  margin: 16px 0; position: relative;
}
.hbox-label {
  font-family: 'Bangers', cursive; font-size: .9rem; letter-spacing: 2px;
  position: absolute; top: -14px; left: 16px; padding: 2px 12px;
  border: 2px solid var(--ink); border-radius: 4px;
}
.hbox-orange { background: rgba(255,140,66,.1); border-color: var(--orange); }
.hbox-orange .hbox-label { background: var(--orange); color: #fff; }
.hbox-red { background: rgba(230,57,70,.08); border-color: var(--red); }
.hbox-red .hbox-label { background: var(--red); color: #fff; }
.hbox-green { background: rgba(63,163,77,.1); border-color: var(--green); }
.hbox-green .hbox-label { background: var(--green); color: #fff; }
.hbox-blue { background: rgba(29,111,184,.1); border-color: var(--blue); }
.hbox-blue .hbox-label { background: var(--blue); color: #fff; }
.hbox-yellow { background: rgba(255,210,63,.15); border-color: var(--yellow); }
.hbox-yellow .hbox-label { background: var(--yellow); color: var(--ink); }
.hbox-purple { background: rgba(138,79,255,.1); border-color: var(--purple); }
.hbox-purple .hbox-label { background: var(--purple); color: #fff; }

.data-table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: .93rem; }
.data-table th {
  font-family: 'Bangers', cursive; font-size: 1rem; letter-spacing: 1px;
  background: var(--ink); color: #fff; padding: 10px 14px; text-align: left; border: 2px solid var(--ink);
}
.data-table td { padding: 10px 14px; border: 2px solid var(--ink); vertical-align: top; }
.data-table tr:nth-child(odd)  td { background: var(--paper2); }
.data-table tr:nth-child(even) td { background: var(--paper); }
.table-scroll { overflow-x: auto; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 16px 0; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; margin: 16px 0; }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.card {
  border: 3px solid var(--ink); border-radius: 5px;
  box-shadow: 4px 4px 0 var(--ink); padding: 18px; background: var(--paper);
}
.card-head { font-family: 'Bangers', cursive; font-size: 1.1rem; letter-spacing: 1px; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 2px solid var(--ink); }

.sfx-row { display: flex; gap: 16px; flex-wrap: wrap; margin: 20px 0; }
.sfx {
  font-family: 'Bangers', cursive; font-size: 1.8rem; letter-spacing: 3px;
  color: var(--ink); text-shadow: 3px 3px 0 var(--yellow); transform: rotate(-2deg); display: inline-block;
}
.sfx:nth-child(even) { transform: rotate(2deg); text-shadow: 3px 3px 0 var(--purple); }

.chapter-divider { text-align: center; margin: 40px 0 28px; position: relative; }
.chapter-divider::before { content: ''; position: absolute; top: 50%; left: 0; right: 0; height: 3px; background: var(--ink); }
.chapter-divider span { position: relative; background: var(--paper); font-family: 'Bangers', cursive; font-size: 1rem; letter-spacing: 3px; padding: 0 16px; }

.lc { width: 20px; height: 20px; vertical-align: middle; stroke-width: 2; display: inline-block; }

/* code blocks */
.code-block {
  font-family: 'Space Mono', monospace; font-size: .85rem; line-height: 1.55;
  background: #201d17; color: #f2ead8; border: 3px solid var(--ink);
  border-radius: 6px; box-shadow: 5px 5px 0 var(--ink);
  padding: 18px 20px; margin: 16px 0; overflow-x: auto; white-space: pre;
}
.code-block .cm { color: #8f8878; }
.code-block .kw { color: #c9a6ff; }
.code-block .st { color: #a7d98c; }
.code-block .nb { color: #ffc46b; }
.code-title {
  display: inline-block; font-family: 'Bangers', cursive; font-size: .9rem; letter-spacing: 2px;
  background: var(--purple); color: #fff; border: 2px solid var(--ink); border-radius: 4px 4px 0 0;
  padding: 3px 14px; margin: 12px 0 -14px 10px; position: relative; z-index: 1;
}

/* pipeline infographic */
.pipe-flow { display: flex; align-items: stretch; gap: 0; flex-wrap: wrap; row-gap: 18px; margin: 20px 0; }
.pipe-node {
  flex: 1 1 130px; min-width: 120px; border: 3px solid var(--ink); border-radius: 6px;
  background: var(--paper); box-shadow: 4px 4px 0 var(--ink);
  padding: 14px 12px; text-align: center; position: relative;
}
.pipe-node .pn-step {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  font-family: 'Bangers', cursive; font-size: .78rem; letter-spacing: 1px;
  background: var(--yellow); color: var(--ink); border: 2px solid var(--ink);
  border-radius: 4px; padding: 1px 9px; white-space: nowrap;
}
.pipe-node .pn-name { font-family: 'Bangers', cursive; font-size: 1rem; letter-spacing: 1px; margin: 8px 0 4px; }
.pipe-node .pn-desc { font-size: .82rem; line-height: 1.4; }
.pipe-node .lc { width: 26px; height: 26px; color: var(--purple); }
.pipe-arrow { display: flex; align-items: center; padding: 0 4px; flex-shrink: 0; }
.pipe-arrow-line { height: 3px; background: var(--ink); width: 26px; position: relative; }
.pipe-arrow-line::after {
  content: ''; position: absolute; right: -1px; top: 50%; transform: translateY(-50%);
  border-top: 6px solid transparent; border-bottom: 6px solid transparent; border-left: 9px solid var(--ink);
}
@media (max-width: 720px) {
  .pipe-flow { flex-direction: column; }
  .pipe-arrow { justify-content: center; padding: 4px 0; }
  .pipe-arrow-line { width: 3px; height: 22px; }
  .pipe-arrow-line::after {
    right: 50%; top: auto; bottom: -1px; transform: translateX(50%);
    border-left: 6px solid transparent; border-right: 6px solid transparent;
    border-top: 9px solid var(--ink); border-bottom: none;
  }
}

/* moving packet dot on the pipeline */
@keyframes pipe-pulse {
  0%   { transform: scale(.7); opacity: .4; }
  50%  { transform: scale(1);  opacity: 1; }
  100% { transform: scale(.7); opacity: .4; }
}
.pipe-node.pulse { animation: pipe-pulse 2.4s ease-in-out infinite; animation-delay: var(--pd, 0s); }
@media (prefers-reduced-motion: reduce) {
  .pipe-node.pulse { animation: none; }
}

/* TouchDesigner mock screenshots (inline SVG wrappers) */
.td-shot {
  border: 3px solid var(--ink); border-radius: 6px; box-shadow: 5px 5px 0 var(--ink);
  overflow: hidden; margin: 18px 0; background: #262626;
}
.td-shot svg { display: block; width: 100%; height: auto; }
.td-shot-caption {
  font-family: 'Comic Neue', cursive; font-weight: 700; font-size: .88rem;
  background: var(--yellow); color: var(--ink); border-top: 3px solid var(--ink);
  padding: 8px 14px;
}

/* hand landmark explorer + gesture lab */
.hand-stage {
  border: 3px solid var(--ink); border-radius: 6px; background: #201d17;
  box-shadow: 5px 5px 0 var(--ink); padding: 10px; margin: 16px 0;
}
.hand-stage svg { display: block; width: 100%; max-width: 380px; height: auto; margin: 0 auto; }
.hand-bone { stroke: #f2ead8; stroke-width: 3; stroke-linecap: round; }
.hand-dot  { fill: var(--purple); stroke: #fff; stroke-width: 2; cursor: pointer; }
.hand-dot.hot { fill: var(--orange); }
.hand-dot:hover, .hand-dot:focus { fill: var(--yellow); outline: none; stroke: var(--yellow); stroke-width: 1; r: 9; }
.lm-readout {
  font-family: 'Space Mono', monospace; font-size: .85rem; color: #f2ead8;
  background: #14120e; border: 2px solid #f2ead8; border-radius: 4px;
  padding: 8px 12px; margin: 10px auto 2px; max-width: 380px; min-height: 38px;
}

.gesture-btns { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0; }
.gesture-btn {
  font-family: 'Bangers', cursive; font-size: 1.05rem; letter-spacing: 2px;
  background: var(--paper); color: var(--ink); border: 3px solid var(--ink);
  border-radius: 5px; box-shadow: 3px 3px 0 var(--ink); padding: 7px 18px; cursor: pointer;
  transition: transform .1s ease, box-shadow .1s ease;
}
.gesture-btn:hover { transform: translate(-1px,-1px); box-shadow: 4px 4px 0 var(--ink); }
.gesture-btn:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.gesture-btn[aria-pressed="true"] { background: var(--purple); color: #fff; }
@media (prefers-reduced-motion: reduce) {
  .gesture-btn { transition: none; }
}

.lab-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 20px; align-items: start; }
@media (max-width: 760px) { .lab-grid { grid-template-columns: 1fr; } }
.lab-output {
  border: 3px solid var(--ink); border-radius: 6px; background: #14120e;
  box-shadow: 5px 5px 0 var(--ink); padding: 10px; text-align: center;
}
.lab-output svg { display: block; width: 100%; max-width: 340px; height: auto; margin: 0 auto; }
.lab-channels {
  font-family: 'Space Mono', monospace; font-size: .82rem; text-align: left;
  color: #a7d98c; background: #14120e; padding: 10px 12px; margin-top: 8px;
  border-top: 2px dashed #4a453b;
}
.lab-channels b { color: #ffc46b; font-weight: 700; }
