/* handwriting for the scribbled callouts: Caveat, SIL Open Font License (fonts/OFL-Caveat.txt) */
@font-face {
  font-family: 'Caveat';
  src: url('fonts/caveat-latin.woff2') format('woff2');
  font-weight: 500 700;
  font-display: swap;
}

.pcb-hero {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  --paper: #f4efe4;
  --ink: #26221f;
  --ink-soft: #5b5650;
  /* a crisp paper edge round handwriting that sits on the board */
  --outline: 1.5px 0 var(--paper), -1.5px 0 var(--paper), 0 1.5px var(--paper), 0 -1.5px var(--paper),
    1.1px 1.1px var(--paper), -1.1px 1.1px var(--paper), 1.1px -1.1px var(--paper), -1.1px -1.1px var(--paper);
  background: var(--paper);
  color: var(--ink);
  font-family: inherit;
}

/* optional faded image centred behind the board (opts.backdrop) */
.pcb-hero__backdrop {
  position: absolute;
  pointer-events: none;
  background: center / contain no-repeat;
  opacity: 0.075;
}

.pcb-hero__canvas,
.pcb-hero__ink,
.pcb-hero__leaders {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.pcb-hero__canvas,
.pcb-hero__ink { opacity: 0; transition: opacity 600ms ease; }
.pcb-hero__ink { pointer-events: none; }
.pcb-hero.is-ready .pcb-hero__canvas,
.pcb-hero.is-ready .pcb-hero__ink { opacity: 1; }

.pcb-hero__leaders { pointer-events: none; overflow: visible; }
.pcb-hero__leaders path {
  fill: none;
  stroke: color-mix(in srgb, var(--accent) 70%, var(--ink));
  stroke-width: 1.25;
  opacity: 0.55;
  transition: opacity 250ms ease, stroke-width 250ms ease;
}
.pcb-hero__leaders path.is-active { opacity: 1; stroke-width: 2; }
.pcb-hero__leaders path.is-dim { opacity: 0.15; }

.pcb-hero__labels {
  list-style: none;
  margin: 0;
  padding: 0;
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.pcb-hero__label {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: auto;
  cursor: default;
  padding: 0.35rem 0 0.35rem 0.75rem;
  border-left: 2px solid var(--accent);
  opacity: 0;
  transition: opacity 300ms ease, border-color 250ms ease;
  outline: none;
}
.pcb-hero.is-ready .pcb-hero__label { opacity: 0.9; }
.pcb-hero.is-ready .pcb-hero__label.is-active { opacity: 1; }
.pcb-hero.is-ready .pcb-hero__label.is-dim { opacity: 0.45; }
.pcb-hero__label:focus-visible { box-shadow: -2px 0 0 0 var(--accent), 0 0 0 1px rgba(38, 34, 31, 0.3); }

.pcb-hero__cu {
  display: block;
  font: 500 0.68rem/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.06em;
  color: color-mix(in srgb, var(--accent) 60%, var(--ink));
}
.pcb-hero__name {
  display: block;
  font-weight: 700;
  font-size: 1.15rem;
  line-height: 1.25;
  letter-spacing: 0.01em;
}
.pcb-hero__text {
  display: block;
  font-size: 0.85rem;
  line-height: 1.35;
  color: var(--ink-soft);
  max-width: 26ch;
}
.pcb-hero__name { justify-self: start; width: fit-content; padding: 0 0.15em; margin-left: -0.15em; }
/* the active layer gets a swipe of highlighter */
.pcb-hero__label.is-active .pcb-hero__name {
  background: linear-gradient(176deg, transparent 52%, color-mix(in srgb, var(--accent) 55%, transparent) 52% 90%, transparent 90%);
}
.pcb-hero__label.is-active .pcb-hero__text { color: var(--ink); }

/* callouts that float with the scene: holograms, uplink, cluster */
.pcb-hero__tags { position: absolute; inset: 0; pointer-events: none; }
.pcb-hero__tag {
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
  visibility: hidden;
  white-space: nowrap;
  text-align: center;
}
.pcb-hero__tag-name {
  display: block;
  font: 700 1.3rem/1 'Caveat', cursive;
  color: color-mix(in srgb, var(--accent) 62%, var(--ink));
  text-shadow: var(--outline);
}
.pcb-hero__tag-text {
  display: block;
  font: 600 1.08rem/1.1 'Caveat', cursive;
  color: var(--ink);
  text-shadow: var(--outline);
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 250ms ease, opacity 250ms ease;
}
.pcb-hero__tag.is-active .pcb-hero__tag-text { max-height: 2.4em; opacity: 1; }
.pcb-hero__tag.is-app .pcb-hero__tag-text { white-space: normal; width: 9rem; margin: 0 auto; }
.pcb-hero__tag.is-cluster .pcb-hero__tag-text { white-space: normal; width: 12rem; margin: 0 auto; }
.pcb-hero__tag.is-uplink .pcb-hero__tag-name { font-size: 1.55rem; }
.pcb-hero__tag.is-uplink .pcb-hero__tag-text { white-space: normal; width: 9.5rem; margin: 0 auto; }
.pcb-hero__tag.is-cluster .pcb-hero__tag-name { font-size: 1.6rem; }
.pcb-hero__tag.is-node .pcb-hero__tag-name {
  font: 500 0.66rem/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.03em;
  color: color-mix(in srgb, var(--accent) 60%, var(--ink));
  text-shadow: var(--outline);
}

/* Without WebGPU: show the layers as a plain list */
.pcb-hero.is-fallback .pcb-hero__canvas,
.pcb-hero.is-fallback .pcb-hero__leaders,
.pcb-hero.is-fallback .pcb-hero__tags { display: none; }
.pcb-hero.is-fallback .pcb-hero__labels {
  position: static;
  display: grid;
  gap: 1rem;
  padding: 2rem;
}
.pcb-hero.is-fallback .pcb-hero__label { position: static; opacity: 1; transform: none !important; width: auto !important; }

/* narrow: only the active layer shows its description */
.pcb-hero.is-narrow .pcb-hero__name { font-size: 0.95rem; }
.pcb-hero.is-narrow .pcb-hero__text { display: none; font-size: 0.75rem; }
.pcb-hero.is-narrow .pcb-hero__label.is-active .pcb-hero__text { display: block; }
.pcb-hero__tag.is-cluster { text-align: right; }
.pcb-hero__tag.is-cluster .pcb-hero__tag-text { margin: 0 0 0 auto; }
.pcb-hero__tag.is-app,
.pcb-hero__tag.is-slot { pointer-events: auto; cursor: default; }
.pcb-hero__tag.is-slot .pcb-hero__tag-name { font-size: 1.2rem; }
.pcb-hero__tag-name:empty { display: none; }
/* handwriting on the plates: black marker on the middle layers, white paint pen on the outer ones */
.pcb-hero__tag.is-marker .pcb-hero__tag-name,
.pcb-hero__tag.is-marker .pcb-hero__tag-text { color: var(--ink); }
.pcb-hero__tag.is-pen .pcb-hero__tag-name,
.pcb-hero__tag.is-pen .pcb-hero__tag-text {
  color: #fbfaf2;
  --outline-c: #1f3a29;
  text-shadow: 1.5px 0 var(--outline-c), -1.5px 0 var(--outline-c), 0 1.5px var(--outline-c), 0 -1.5px var(--outline-c),
    1.1px 1.1px var(--outline-c), -1.1px 1.1px var(--outline-c), 1.1px -1.1px var(--outline-c), -1.1px -1.1px var(--outline-c);
}
.pcb-hero__tag.is-art .pcb-hero__tag-text { font-size: 1.25rem; }
/* hovering a slot or a layer note grows a white card behind it, so the handwriting reads */
.pcb-hero__tag.is-slot,
.pcb-hero__tag.is-art { isolation: isolate; }
.pcb-hero__tag.is-active { z-index: 1; }
.pcb-hero__tag.is-slot::before,
.pcb-hero__tag.is-art::before {
  content: '';
  position: absolute;
  inset: -0.45rem -0.85rem;
  z-index: -1;
  border-radius: 1.3rem;
  background: #fffdf8;
  box-shadow: 2px 3px 0 rgba(38, 34, 31, 0.2);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 180ms ease, transform 260ms cubic-bezier(0.3, 1.4, 0.5, 1);
}
.pcb-hero__tag.is-slot.is-active::before,
.pcb-hero__tag.is-art.is-active::before { opacity: 1; transform: scale(1); }
.pcb-hero__tag.is-slot.is-active .pcb-hero__tag-name,
.pcb-hero__tag.is-slot.is-active .pcb-hero__tag-text,
.pcb-hero__tag.is-art.is-active .pcb-hero__tag-text { color: var(--ink); text-shadow: none; }
.pcb-hero__tag.is-slot .pcb-hero__tag-text { white-space: normal; width: 11rem; margin: 0 auto; }
.pcb-hero.is-narrow .pcb-hero__tag-text { display: none; }
/* small screens: smaller handwriting, and project names only for the tapped sticker */
.pcb-hero.is-narrow .pcb-hero__tag-name { font-size: 1.05rem; }
.pcb-hero.is-narrow .pcb-hero__tag.is-uplink .pcb-hero__tag-name,
.pcb-hero.is-narrow .pcb-hero__tag.is-cluster .pcb-hero__tag-name { font-size: 1.2rem; }
.pcb-hero.is-narrow .pcb-hero__tag.is-app:not(.is-active) { opacity: 0 !important; }
.pcb-hero__tag.is-art .pcb-hero__tag-text { white-space: normal; width: 11rem; margin: 0 auto; }

/* reduced motion: no animated transitions in the overlay either */
.pcb-hero.is-still .pcb-hero__canvas,
.pcb-hero.is-still .pcb-hero__label,
.pcb-hero.is-still .pcb-hero__leaders path,
.pcb-hero.is-still .pcb-hero__tag-text,
.pcb-hero.is-still .pcb-hero__tag::before { transition: none; }

/* --- the live demo ------------------------------------------------------------------------- */

/* "Try Me": a paper sign beside the board; a marker arrow (drawn with the board) points from it
   at one of the board's buttons */
.pcb-hero__try {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  padding: 0.3rem 0.95rem 0.4rem;
  border: 2px solid var(--ink);
  border-radius: 0.5rem 0.75rem 0.55rem 0.8rem;
  background: #fffdf7;
  box-shadow: 3px 4px 0 rgba(38, 34, 31, 0.28);
  color: var(--ink);
  font: 700 1.75rem/1 'Caveat', cursive;
  white-space: nowrap;
  cursor: pointer;
  opacity: 0;
  transition: opacity 300ms ease, background-color 150ms ease, box-shadow 150ms ease;
}
.pcb-hero.is-ready .pcb-hero__try { opacity: 1; }
.pcb-hero__try:hover,
.pcb-hero__try:focus-visible { background: #d9ff3a; box-shadow: 4px 6px 0 rgba(38, 34, 31, 0.32); outline: none; }
.pcb-hero__try:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.pcb-hero.is-narrow .pcb-hero__try { font-size: 1.35rem; padding: 0.2rem 0.7rem 0.3rem; }
.pcb-hero.is-demo .pcb-hero__try { opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 180ms ease, visibility 0s 180ms; }

/* everything explanatory leaves when the demo starts */
.pcb-hero__backdrop,
.pcb-hero__labels,
.pcb-hero__leaders { transition: opacity 250ms ease, visibility 0s; }
.pcb-hero.is-demo .pcb-hero__backdrop,
.pcb-hero.is-demo .pcb-hero__labels,
.pcb-hero.is-demo .pcb-hero__leaders { opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 250ms ease, visibility 0s 250ms; }
.pcb-hero.is-demo .pcb-hero__tags { pointer-events: none; }
.pcb-hero.is-demo .pcb-hero__tags * { pointer-events: none; }

/* controls over the board once it lies flat: its buttons, and the sensor's reading */
.pcb-hero__controls { position: absolute; inset: 0; pointer-events: none; visibility: hidden; opacity: 0; transition: opacity 250ms ease, visibility 0s 250ms; }
.pcb-hero.is-live .pcb-hero__controls { visibility: visible; opacity: 1; transition: opacity 250ms ease; }
.pcb-hero__button {
  position: absolute;
  top: 0;
  left: 0;
  padding: 0;
  border: 2px dashed color-mix(in srgb, var(--paper) 80%, transparent);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
.pcb-hero__button:hover { border-style: solid; background: rgba(255, 253, 247, 0.16); }
.pcb-hero__button.is-down { border-style: solid; border-color: #d9ff3a; background: rgba(217, 255, 58, 0.22); }
.pcb-hero__button:focus-visible { outline: 2px solid #d9ff3a; outline-offset: 2px; }

.pcb-hero__sensor {
  position: absolute;
  top: 0;
  left: 0;
  padding: 0.3rem 0.6rem 0.4rem;
  border-radius: 0.6rem;
  background: #fffdf7;
  box-shadow: 2px 3px 0 rgba(38, 34, 31, 0.25);
  color: var(--ink);
  pointer-events: auto;
}
.pcb-hero__sensor label { display: grid; grid-template-columns: auto auto; column-gap: 0.6rem; align-items: baseline; }
.pcb-hero__sensor-name { font: 700 1.2rem/1 'Caveat', cursive; }
.pcb-hero__sensor output { font: 600 0.8rem/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; text-align: right; font-variant-numeric: tabular-nums; }
.pcb-hero__sensor input { grid-column: 1 / -1; width: 8.5rem; margin: 0.3rem 0 0; accent-color: var(--ink); }
.pcb-hero.is-fallback .pcb-hero__controls { display: none; }
.pcb-hero.is-fallback .pcb-hero__try { position: static; opacity: 1; margin: 0 2rem 2rem; }
.pcb-hero.is-still .pcb-hero__try,
.pcb-hero.is-still .pcb-hero__controls { transition: none; }

/* the card under the storage chip: what firmware runs, and the demo's update buttons */
.pcb-hero__storage {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.3rem 0.45rem;
  max-width: min(24rem, calc(100% - 8px));
  box-sizing: border-box;
  padding: 0.35rem 0.6rem 0.45rem;
  border-radius: 0.6rem;
  background: #fffdf7;
  box-shadow: 2px 3px 0 rgba(38, 34, 31, 0.25);
  color: var(--ink);
  pointer-events: auto;
}
.pcb-hero__storage:empty { display: none; }
/* a tick up to the chip */
.pcb-hero__storage::before {
  content: '';
  position: absolute;
  left: var(--tick, 50%);
  top: -9px;
  width: 2px;
  height: 9px;
  background: var(--ink);
  opacity: 0.6;
}
.pcb-hero__storage-title { flex: 1 0 100%; text-align: center; font: 700 1.2rem/1.1 'Caveat', cursive; }
.pcb-hero__storage-note { flex: 1 0 100%; text-align: center; font: 500 0.7rem/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--ink-soft); }
.pcb-hero__storage-note:empty { display: none; }
.pcb-hero__storage button {
  padding: 0.22rem 0.6rem 0.26rem;
  border: 1.5px solid var(--ink);
  border-radius: 1rem;
  background: transparent;
  color: var(--ink);
  font: 600 0.74rem/1.2 inherit;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}
.pcb-hero__storage button.is-primary { background: var(--ink); color: #fffdf7; }
.pcb-hero__storage button:hover, .pcb-hero__storage button:focus-visible { background: #d9ff3a; color: var(--ink); outline: none; }
.pcb-hero__storage button:disabled { opacity: 0.4; cursor: default; background: transparent; color: var(--ink); }
.pcb-hero.is-narrow .pcb-hero__storage { padding: 0.25rem 0.45rem 0.35rem; }
.pcb-hero.is-narrow .pcb-hero__storage-title { font-size: 1.05rem; }
