/* Scoped to .pcbclip so the tool can be embedded in a raydiy.de page.
   Fonts: raydiy.de serves Titillium and PT Sans locally under these names; standalone it falls back. */
.pcbclip {
  --blue: #4b91fa;
  --blue-dark: #3273d5;
  --blue-soft: rgba(75, 145, 250, 0.1);
  --mint: #14d3a2;
  --mint-dark: #0fb88c;
  --red: #ff383e;
  --ink: #222;
  --muted: #6b7280;
  --line: #e5e7eb;
  --card: #fff;
  --radius: 14px;
  --font-head: 'titillium-local', 'Titillium Web', system-ui, sans-serif;
  --font-body: 'pt-sans-local', 'PT Sans', system-ui, sans-serif;
  font-family: var(--font-body);
  color: var(--ink);
  line-height: 1.45;
  background: #f5f7fb;
  padding-bottom: 2rem;
}

.pcbclip *, .pcbclip *::before, .pcbclip *::after { box-sizing: border-box; }

/* Hero, like the article header on raydiy.de */
.pc-hero {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%);
  color: #fff;
  padding: 2.5rem 1.25rem 5.5rem;
}
.pc-hero-inner { max-width: 1160px; margin: 0 auto; }
.pc-tags { display: flex; gap: 0.4rem; margin-bottom: 0.9rem; }
.pc-tag {
  background: var(--mint);
  color: #000;
  font-family: var(--font-head);
  font-size: 0.8rem;
  padding: 0.15rem 0.7rem;
  border-radius: 25px;
}
.pc-hero h1 {
  color: #fff;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: clamp(1.9rem, 4vw, 2.7rem);
  line-height: 1.15;
  margin: 0 0 0.6rem;
}
.pc-hero p { color: #fff; margin: 0; max-width: 46rem; font-size: 1.08rem; opacity: 0.92; }

/* Without hero (e.g. inside a WordPress page that has its own header): no own background,
   width and outer spacing, so the surrounding page builder section decides. */
.pcbclip.pc-no-hero { background: transparent; padding: 0; }
.pc-no-hero .pc-hero { display: none; }
.pc-no-hero .pc-layout { max-width: none; margin-top: 0; padding: 0; }
.pc-no-hero .pc-footer { max-width: none; padding: 0; }

/* Layout: cards overlap the hero */
.pc-layout {
  max-width: 1160px;
  margin: -4rem auto 0;
  padding: 0 1.25rem;
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}
.pc-panel, .pc-viewer {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(30, 60, 120, 0.12), 0 1px 3px rgba(0, 0, 0, 0.06);
}
.pc-panel { padding: 0.5rem; }
.pc-stage { position: sticky; top: 1rem; } /* no effect where html/body have overflow hidden, e.g. Pro */

/* Intro: three measurements */
.pc-intro {
  grid-column: 1 / -1;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(30, 60, 120, 0.12), 0 1px 3px rgba(0, 0, 0, 0.06);
  padding: 1.25rem 1.25rem 1.1rem;
}
.pc-intro-head h2 { color: var(--ink); font-family: var(--font-head); font-weight: 700; font-size: 1.45rem; margin: 0 0 0.2rem; }
.pc-intro-head p { margin: 0 0 1rem; color: var(--muted); }
.pc-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.9rem; }
.pc-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  text-align: left;
  font: inherit;
  color: inherit;
  background: #fafbfd;
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 0.6rem 0.8rem 0.85rem;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.pc-card:hover { border-color: var(--blue); transform: translateY(-2px); }
.pc-card:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.pc-card.is-active { border-color: var(--blue); box-shadow: 0 0 0 4px var(--blue-soft); background: #fff; }
.pc-sketch { width: 100%; height: auto; display: block; }
.pc-card-title { display: flex; align-items: center; gap: 0.45rem; font-family: var(--font-head); font-weight: 700; font-size: 1.1rem; }
.pc-card-text { color: var(--muted); font-size: 0.88rem; line-height: 1.35; }
.pcbclip .pc-badge {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 1.3rem;
  height: 1.3rem;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.78rem;
  line-height: 1;
}
.pc-field-head label { display: inline-flex; align-items: center; gap: 0.45rem; }

/* Sketch colours */
.s-pcb { fill: #1f8f6a; }
.s-pcb-dark { fill: #17704f; }
.s-module { fill: #d6dce4; stroke: #9aa5b4; stroke-width: 1; }
.s-can { fill: #edf0f4; stroke: #9aa5b4; stroke-width: 1; }
.s-antenna { fill: none; stroke: #d4a72c; stroke-width: 2; stroke-linejoin: round; }
.s-pin { fill: #d4a72c; }
.s-pin-line { stroke: #d4a72c; stroke-width: 3; stroke-linecap: round; }
.s-header { fill: #2b2f36; }
.s-steel { fill: #c9d0da; stroke: #6b7686; stroke-width: 1; stroke-linejoin: round; }
.s-steel-dark { fill: #8f9aaa; stroke: #5b6575; stroke-width: 1; }
.s-window { fill: #f5f7fb; }
.s-tick { stroke: #5b6575; stroke-width: 1; }
.s-dim { fill: var(--red); }
.s-dim-line { stroke: var(--red); stroke-width: 2; }
.s-ext { stroke: #9aa5b4; stroke-width: 1; stroke-dasharray: 3 3; }
.s-ground { stroke: #6b7686; stroke-width: 2; }
.s-hatch { stroke: #9aa5b4; stroke-width: 1; }
.s-badge { fill: var(--red); }
.s-badge-text { fill: #fff; font-family: var(--font-head); font-weight: 700; font-size: 13px; text-anchor: middle; }

/* Collapsible sections */
.pc-section { border-radius: 10px; transition: background 0.2s; }
.pc-section + .pc-section { margin-top: 0.25rem; }
.pc-section[open] { background: #fafbfd; }
.pc-section summary {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.85rem 0.9rem;
  cursor: pointer;
  list-style: none;
  border-radius: 10px;
  user-select: none;
}
.pc-section summary::-webkit-details-marker { display: none; }
.pc-section summary:hover { background: var(--blue-soft); }
.pc-section summary:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.pc-step {
  flex: none;
  width: 1.6rem;
  height: 1.6rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue-dark);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.9rem;
}
.pc-section[open] .pc-step { background: var(--blue); color: #fff; }
.pc-section.has-error .pc-step { background: var(--red); color: #fff; }
.pc-section-title { font-family: var(--font-head); font-weight: 700; font-size: 1.1rem; }
.pc-summary {
  margin-left: auto;
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pc-section[open] .pc-summary { display: none; }
.pc-section[open] .pc-chevron { margin-left: auto; }
.pc-chevron {
  flex: none;
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.2s;
}
.pc-section[open] .pc-chevron { transform: rotate(225deg) translateY(-2px); }

.pc-fields { padding: 0.2rem 0.9rem 1rem; }
.pc-field { margin-bottom: 1.1rem; }
.pc-field:last-child { margin-bottom: 0; }
.pc-field-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.pc-field-head label { font-weight: 700; }
.pc-field small { display: block; color: var(--muted); font-size: 0.82rem; margin-top: 0.25rem; }
.pc-field small:empty, .pc-info:empty { display: none; }
.pcbclip .pc-error { color: var(--red); font-weight: 700; }

/* Number field with unit inside */
.pc-num {
  display: inline-flex;
  align-items: center;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 0 0.6rem 0 0;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.pc-num:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.pc-num:has(input[aria-invalid="true"]) { border-color: var(--red); }
.pc-num input {
  width: 4.6rem;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 0.4rem 0.3rem 0.4rem 0.6rem;
  font: inherit;
  font-weight: 700;
  text-align: right;
  -moz-appearance: textfield;
}
.pc-num input::-webkit-inner-spin-button, .pc-num input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.pc-num span { color: var(--muted); font-size: 0.85rem; }

/* Slider */
.pcbclip input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  margin: 0.7rem 0 0.2rem;
  border-radius: 3px;
  background: linear-gradient(to right, var(--blue) var(--fill, 0%), var(--line) var(--fill, 0%));
  cursor: pointer;
}
.pcbclip input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--blue);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.1s;
}
.pcbclip input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.15); }
.pcbclip input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--blue);
}

.pc-info {
  margin: 0 0 1rem;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  background: var(--blue-soft);
  font-size: 0.88rem;
}
.pc-fields > .pc-info:last-child { margin: 1rem 0 0; }

/* Download */
.pc-download { padding: 0.75rem 0.9rem 0.9rem; border-top: 1px solid var(--line); margin-top: 0.5rem; }
.pc-download button {
  width: 100%;
  border: 0;
  border-radius: 10px;
  padding: 0.8rem 1rem;
  background: var(--mint);
  color: #000;
  cursor: pointer;
  font: inherit;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  box-shadow: 0 4px 14px rgba(20, 211, 162, 0.35);
}
.pc-download button span { display: block; font-family: var(--font-head); font-weight: 700; font-size: 1.2rem; }
.pc-download button small { display: block; font-size: 0.82rem; }
.pc-download button:hover { background: var(--mint-dark); }
.pc-download button:active { transform: translateY(1px); }
.pc-download button:disabled { background: var(--line); color: var(--muted); box-shadow: none; cursor: not-allowed; }
.pc-filename {
  display: block;
  margin-top: 0.55rem;
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
  word-break: break-all;
}

/* Viewer */
.pc-viewer {
  position: relative;
  aspect-ratio: 4 / 3;
  max-height: 78vh;
  overflow: hidden;
  touch-action: none;
  background: radial-gradient(ellipse at 50% 35%, #fff 0%, #eef2f8 75%);
}
.pc-viewer canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.pc-chips {
  position: absolute;
  top: 0.9rem;
  left: 0.9rem;
  right: 0.9rem;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  pointer-events: none;
}
.pc-chip {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  border-radius: 25px;
  padding: 0.2rem 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.pc-chip b { color: var(--ink); font-family: var(--font-head); }
.pc-hint {
  position: absolute;
  bottom: 0.7rem;
  left: 0;
  right: 0;
  z-index: 1;
  margin: 0;
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
  pointer-events: none;
}

.pc-footer { max-width: 1160px; margin: 1.5rem auto 0; padding: 0 1.25rem; color: var(--muted); font-size: 0.95rem; }
.pc-footer a { color: #007ed5; }
.pc-footer .pc-version { margin-top: 0.5rem; font-size: 0.8rem; opacity: 0.7; }

@media (max-width: 820px) {
  .pc-hero { padding: 1.75rem 1rem 4.5rem; }
  .pc-layout { grid-template-columns: minmax(0, 1fr); margin-top: -3.5rem; padding: 0 0.75rem; }
  .pc-intro { order: -2; padding: 1rem 0 1rem 1rem; }
  .pc-intro-head { padding-right: 1rem; }
  .pc-cards {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding: 0 1rem 0.4rem 0;
    gap: 0.7rem;
  }
  .pc-card { flex: 0 0 78%; scroll-snap-align: start; }
  .pc-card:hover { transform: none; }
  .pc-stage { position: static; order: -1; }
  .pc-panel { order: 0; }
  .pc-chip { font-size: 0.75rem; padding: 0.1rem 0.55rem; }
}
