/* Letters configurator - scoped under .p3d-letters, reuses the shared
   .p3d-field/.p3d-colors/.p3d-summary styles from style.css. */
.p3d-letters { --_line: var(--p3d-line, #2B333E); --_muted: var(--p3d-muted, #98A2AC); }

.p3d-letters input[type="text"] {
  width: 100%; max-width: 320px; font-size: 16px;
}
/* structure-type cards: a picture of the result on top, a short name and one
   line under it. The radio itself is hidden - the whole card is the control
   (keyboard focus ring: style.css, :has(input:focus-visible)). */
.p3d-typecards {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px; margin-top: 4px; align-items: stretch;
}
@media (max-width: 560px) { .p3d-typecards { grid-template-columns: 1fr; } .p3d-typeart { aspect-ratio: 64 / 22; } }
.p3d-typecard {
  position: relative; display: flex; flex-direction: column; gap: 10px;
  border: 1px solid var(--_line); border-radius: 8px;
  padding: 8px 8px 12px; cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.p3d-typecard:hover { border-color: var(--p3d-accent, #F5A02D); }
.p3d-typecard input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.p3d-typecard:has(input:checked) {
  border-color: var(--p3d-accent, #F5A02D);
  background: color-mix(in srgb, var(--p3d-accent, #F5A02D) 9%, transparent);
  box-shadow: inset 0 0 0 1px var(--p3d-accent, #F5A02D);
}
/* thumbnail of the finished result on a wall (p3d_letters_type_art) */
.p3d-typeart { display: block; width: 100%; height: auto; aspect-ratio: 64 / 34; border-radius: 5px; }
.p3d-typeart rect { fill: #0E1216; }
.p3d-typeart text { font: 800 30px/1 system-ui, -apple-system, "Segoe UI", Arial, sans-serif; }
.p3d-ta-solid { fill: var(--p3d-accent, #F5A02D); }
.p3d-ta-shadow { fill: #000; opacity: .55; transform: translate(1.5px, 2px); }
.p3d-ta-lit { fill: #FFF3DC; }
.p3d-ta-glow { fill: #FFE9C8; filter: blur(4px); }
.p3d-ta-dark { fill: #2B333E; }
.p3d-ta-halo { fill: #FFE9C8; filter: blur(5px); }
.p3d-ta-line { fill: none; stroke: #FFF3DC; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 2.5px #FFE9C8); }
.p3d-typecard-body { display: flex; flex-direction: column; gap: 3px; padding: 0 4px; }
.p3d-typecard-body strong { font-size: 15px; }
.p3d-typecard-body span { font-size: 12.5px; color: var(--_muted); line-height: 1.35; }

/* segmented control (front style) - two equal, clearly-toggleable cards */
.p3d-seg {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px;
  max-width: 620px; margin-top: 4px;
}
.p3d-seg label[hidden] { display: none; }
.p3d-seg label {
  display: grid; grid-template-columns: auto 1fr; align-items: center;
  column-gap: 8px; row-gap: 1px;
  border: 1px solid var(--_line); border-radius: 6px;
  padding: 11px 13px; cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.p3d-seg label:hover { border-color: var(--p3d-accent, #F5A02D); }
.p3d-seg input { accent-color: var(--p3d-accent, #F5A02D); grid-row: 1 / 3; }
.p3d-seg-t { font-size: 14px; font-weight: 600; }
.p3d-seg-s { grid-column: 2; font-size: 12px; color: var(--_muted); }
.p3d-seg label:has(input:checked) {
  border-color: var(--p3d-accent, #F5A02D);
  background: color-mix(in srgb, var(--p3d-accent, #F5A02D) 10%, transparent);
}

.p3d-front-field[hidden], .p3d-wall-field[hidden], .p3d-sum-facerow[hidden], .p3d-sum-wallrow[hidden], .p3d-sum-stitchrow[hidden], .p3d-led-note[hidden], .p3d-stitch-note[hidden], .p3d-letters-get[hidden] { display: none; }
.p3d-stitch-note { display: block; margin-top: 6px; color: var(--p3d-accent, #F5A02D); }
/* the one-sentence "what you get" under the preview */
.p3d-letters-get {
  margin: 0 0 6px; padding: 10px 14px; font-size: 14.5px; line-height: 1.45;
  border-left: 3px solid var(--p3d-accent, #F5A02D);
  background: color-mix(in srgb, var(--p3d-accent, #F5A02D) 7%, transparent);
}

.p3d-letters-preview {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  min-height: 340px; margin: 20px 0 10px; padding: 24px;
  border: 1px solid var(--_line); border-radius: 4px; overflow: hidden;
  background:
    radial-gradient(120% 120% at 50% 40%, rgba(255,255,255,.02), transparent 60%),
    repeating-linear-gradient(180deg, transparent 0 7px, rgba(233, 236, 239, .03) 7px 8px),
    #0E1216;
}
.p3d-letters-canvas { display: none; position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.p3d-rotate-hint {
  display: none; position: absolute; right: 12px; bottom: 10px;
  font-size: 11px; letter-spacing: .04em; color: var(--_muted);
  background: rgba(0,0,0,.35); padding: 3px 9px; border-radius: 20px; pointer-events: none;
}
/* when the 3D preview mounts, it replaces the flat text fallback */
.p3d-has3d .p3d-letters-canvas { display: block; }
.p3d-has3d .p3d-rotate-hint { display: block; }
.p3d-has3d .p3d-letters-text { display: none; }
.p3d-letters-text {
  font-weight: 700; line-height: 1.1; white-space: nowrap;
  color: var(--_muted); transform-origin: center;
  text-shadow: 0 4px 0 rgba(0, 0, 0, .35), 0 6px 14px rgba(0, 0, 0, .35); /* hints at depth */
}
.p3d-letters-text.p3d-lit { transition: text-shadow .2s ease, color .2s ease; }
.p3d-letters-dims { font-variant-numeric: tabular-nums; }

.p3d-led-note { color: var(--p3d-accent, #F5A02D) !important; }

/* in-preview LED explainer (channel/halo): a small chip that spells out the
   translucent front + the LED cavity, so the lit types read clearly */
.p3d-led-legend {
  position: absolute; left: 12px; bottom: 10px; max-width: min(78%, 460px);
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; line-height: 1.35; color: #E9ECEF;
  background: rgba(0, 0, 0, .42); backdrop-filter: blur(2px);
  padding: 6px 11px; border-radius: 8px; pointer-events: none;
}
.p3d-led-legend[hidden] { display: none; }
.p3d-led-legend i {
  flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%;
  background: #FFF3DC; box-shadow: 0 0 7px 1px rgba(255, 243, 220, .9);
}
.p3d-has3d .p3d-rotate-hint { bottom: 10px; }

/* "see inside" toggle - lifts the translucent/perforated front off the LED cavity */
.p3d-open-face {
  position: absolute; right: 12px; top: 12px; z-index: 2;
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 600; color: #E9ECEF; cursor: pointer;
  background: rgba(0, 0, 0, .5); border: 1px solid var(--_line);
  padding: 7px 13px; border-radius: 20px; backdrop-filter: blur(2px);
  transition: border-color .15s ease, background .15s ease;
}
.p3d-open-face[hidden] { display: none; }
.p3d-open-face:hover { border-color: var(--p3d-accent, #F5A02D); }
.p3d-open-face::before {
  content: ""; width: 9px; height: 9px; border-radius: 50%;
  background: #FFF3DC; box-shadow: 0 0 7px 1px rgba(255, 243, 220, .9);
}
.p3d-open-face[aria-pressed="true"] {
  border-color: var(--p3d-accent, #F5A02D);
  background: color-mix(in srgb, var(--p3d-accent, #F5A02D) 22%, rgba(0, 0, 0, .5));
}

.p3d-border-toggle { display: flex; align-items: center; gap: 8px; font-size: 14.5px; cursor: pointer; }
.p3d-border-toggle input { accent-color: var(--p3d-accent, #F5A02D); width: 17px; height: 17px; }
.p3d-bcolors, .p3d-faces { margin-top: 10px; }
.p3d-bcolors[hidden] { display: none; }

.p3d-letters input[type="range"] { width: 160px; accent-color: var(--p3d-accent, #F5A02D); vertical-align: middle; }
.p3d-bwidth-row { display: block; margin-top: 10px; }
.p3d-bwidth-row[hidden] { display: none; }
.p3d-bwidth-row label { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--_muted); }

/* face swatches want a light border since they're pale */
.p3d-face { border: 2px solid var(--_line); }
