/* Christmas ornaments configurator - scoped under .p3d-orn. Reuses the shared
   .p3d-controls / .p3d-field / .p3d-colors / .p3d-material / .p3d-summary
   styles from style.css; the segmented control and the toggle row are
   repeated from nfc-tags.css (the two stylesheets never load on one page). */
.p3d-orn { --_line: var(--p3d-line, #2B333E); --_muted: var(--p3d-muted, #98A2AC); --_accent: var(--p3d-accent, #F5A02D); }

.p3d-orn input[type="text"], .p3d-orn textarea, .p3d-orn select {
  width: 100%; max-width: 420px; font-size: 16px;
  background: var(--p3d-surface, #1B2129); color: inherit;
  border: 1px solid var(--_line); border-radius: 3px; padding: 9px 10px;
}
.p3d-orn textarea { resize: vertical; min-height: 104px; line-height: 1.45; }
.p3d-orn :is(textarea, input)::placeholder { color: var(--_muted); opacity: .55; } /* the sample names must not read as typed ones */
.p3d-orn-colors-field { grid-column: span 2; }
@media (max-width: 900px) { .p3d-orn-colors-field { grid-column: 1 / -1; } }
.p3d-orn input[type="range"] { width: 100%; max-width: 260px; accent-color: var(--_accent); display: block; margin-top: 6px; }
.p3d-orn .p3d-help.p3d-orn-warn { color: var(--_accent); }

/* shape tiles: the outline above the name, the whole tile is the control
   (focus ring: style.css, :has(input:focus-visible)) */
.p3d-orn-shapes {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-top: 4px;
}
@media (max-width: 900px) { .p3d-orn-shapes { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.p3d-orn-shape {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 14px 6px 11px; border: 1px solid var(--_line); border-radius: 8px; cursor: pointer;
  font-size: 13.5px; font-weight: 600; text-align: center;
  transition: border-color .15s ease, background .15s ease;
}
.p3d-orn-shape:hover { border-color: var(--_accent); }
.p3d-orn-shape input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.p3d-orn-shape:has(input:checked) {
  border-color: var(--_accent);
  background: color-mix(in srgb, var(--_accent) 9%, transparent);
  box-shadow: inset 0 0 0 1px var(--_accent);
}
.p3d-orn-glyph { width: 44px; height: 44px; fill: var(--_muted); stroke: var(--_muted); stroke-width: 0; transition: fill .15s ease; }
.p3d-orn-glyph .p3d-orn-glyph-k { fill: none; }
.p3d-orn-shape:has(input:checked) .p3d-orn-glyph { fill: var(--_accent); stroke: var(--_accent); }

.p3d-orn .p3d-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; max-width: 420px; margin-top: 4px; }
.p3d-orn .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: 10px 12px; cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.p3d-orn .p3d-seg label:hover { border-color: var(--_accent); }
.p3d-orn .p3d-seg input { accent-color: var(--_accent); grid-row: 1 / 3; margin: 0; }
.p3d-orn .p3d-seg-t { font-size: 14px; font-weight: 600; }
.p3d-orn .p3d-seg-s { grid-column: 2; font-size: 12px; color: var(--_muted); }
.p3d-orn .p3d-seg label:has(input:checked) { border-color: var(--_accent); background: color-mix(in srgb, var(--_accent) 10%, transparent); }
.p3d-orn-sub-label { margin-top: 16px; }

.p3d-orn .p3d-border-toggle { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 14.5px; cursor: pointer; }
.p3d-orn .p3d-border-toggle input { accent-color: var(--_accent); width: 17px; height: 17px; margin: 0; }

/* preview: the SVG fills the frame and ornaments.js fits the drawing to it,
   so the piece and the 1 cm bar stay centred; the frame's top lines up with
   the summary card */
.p3d-orn-preview {
  position: relative; aspect-ratio: 16 / 10; max-height: 520px; min-height: 260px;
  border: 1px solid var(--_line); border-radius: 6px; overflow: hidden;
  background:
    radial-gradient(70% 80% at 50% 38%, rgba(245, 160, 45, .07), transparent 70%),
    radial-gradient(90% 90% at 50% 42%, rgba(255,255,255,.035), transparent 65%),
    repeating-linear-gradient(180deg, transparent 0 7px, rgba(233, 236, 239, .03) 7px 8px),
    #0E1216;
}
@media (max-width: 600px) { .p3d-orn-preview { aspect-ratio: 1 / 1; max-height: 420px; } }
.p3d-orn-preview svg, .p3d-orn-layer { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.p3d-orn-layer { pointer-events: none; } /* body layer below, text layer on top (ornaments.js draw) */

/* name rows: text, a dot of the chosen colour, the colour select, remove */
.p3d-orn-lines { display: grid; gap: 8px; }
.p3d-orn-line { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 7px; align-items: center; max-width: 440px; }
.p3d-orn .p3d-orn-line input[type="text"] { max-width: none; }
.p3d-orn .p3d-orn-color-sel { width: 9.5em; padding: 9px 6px; font-size: 13.5px; }
.p3d-orn .p3d-orn-color-sel:disabled { opacity: .45; }
.p3d-orn-dot { width: 15px; height: 15px; border-radius: 50%; border: 1px solid var(--_line); box-shadow: inset 0 0 0 1px rgba(0,0,0,.25); }
.p3d-orn-line-del {
  width: 32px; height: 36px; padding: 0; border: 1px solid var(--_line); border-radius: 3px;
  background: none; color: var(--_muted); font-size: 18px; line-height: 1; cursor: pointer;
}
.p3d-orn-line-del:hover { border-color: var(--_accent); color: var(--_accent); }
.p3d-orn-line-add {
  margin-top: 9px; padding: 7px 13px; border: 1px dashed var(--_line); border-radius: 4px;
  background: none; color: var(--_accent); font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.p3d-orn-line-add:hover { border-color: var(--_accent); }
.p3d-orn-line-add[hidden], .p3d-orn-line-del[hidden] { display: none; }

.p3d-orn-note { margin: 10px 0 0; font-size: 13px; line-height: 1.5; color: var(--_muted); }
.p3d-orn .p3d-custom-note { margin-top: 6px; font-size: 14px; }
.p3d-orn-dims { font-variant-numeric: tabular-nums; }
.p3d-orn-dims b { font-weight: 600; color: var(--p3d-ink, #E9ECEF); }
.p3d-orn-dims em { font-style: normal; color: var(--_accent); }

.p3d-orn-qty {
  width: 5em; font-variant-numeric: tabular-nums; text-align: right;
  background: var(--p3d-surface, #1B2129); color: inherit;
  border: 1px solid var(--_line); border-radius: 3px; padding: 6px 8px;
}
.p3d-orn-each:empty { display: none; }
