/* tree — styles for js/features/tree.js: the painted tree, its ornaments and the "hang one" picker. */

/* ---------- The scene: a small night sky for the tree to stand in ---------- */
.tree-scene { position: relative; display: flex; justify-content: center; padding: var(--sp-3) var(--sp-3) var(--sp-2); border-radius: var(--r-card); border: 1px solid var(--line);
  background:
    radial-gradient(1.5px 1.5px at 12% 14%, var(--snow-50) 50%, transparent 51%), radial-gradient(1px 1px at 24% 38%, var(--ice-300) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 84% 10%, var(--candle-300) 50%, transparent 51%), radial-gradient(1px 1px at 91% 34%, var(--snow-50) 50%, transparent 51%),
    radial-gradient(1px 1px at 7% 62%, var(--snow-50) 50%, transparent 51%), radial-gradient(1px 1px at 76% 24%, var(--ice-300) 50%, transparent 51%),
    linear-gradient(180deg, var(--night-950), var(--night-900) 70%, var(--night-700));
  -webkit-user-select: none; user-select: none; touch-action: manipulation; }
.tree-scene.tree-scene--picking { cursor: crosshair; }
.tree-art { display: block; width: 100%; max-width: 330px; height: auto; max-height: 52dvh; overflow: visible; }

.tree-art__drift { fill: var(--ice-300); opacity: .35; }
.tree-art__snow { fill: var(--snow-50); }
.tree-art__trunk { fill: var(--bronze-400); }
.tree-art__trunk-shade { fill: var(--night-950); opacity: .5; }
.tree-art__tier { fill: var(--pine-700); stroke: var(--pine-700); stroke-width: 44; stroke-linejoin: round; }
.tree-art__lit { stop-color: var(--pine-400); }
.tree-art__dim { stop-color: var(--night-950); }
.tree-art__star { fill: var(--gold-400); stroke: var(--candle-300); stroke-width: 6; stroke-linejoin: round; filter: drop-shadow(var(--glow-gold)); animation: tree-twinkle 2.6s ease-in-out infinite alternate; }
@keyframes tree-twinkle { from { opacity: .82; } to { opacity: 1; } }

/* ---------- Ornaments (drawn around 0,0 in tree units; --tree-c is the ornament's color) ---------- */
.tree-c-red { --tree-c: var(--berry-400); }
.tree-c-gold { --tree-c: var(--gold-400); }
.tree-c-green { --tree-c: var(--pine-400); }
.tree-c-blue { --tree-c: var(--ice-300); }
.tree-c-white { --tree-c: var(--snow-50); }
.tree-c-violet { --tree-c: #b79bff; } /* no violet token yet: the one value this file names itself */

.tree-orn__fill { fill: var(--tree-c, var(--snow-50)); stroke: var(--night-950); stroke-width: 3.5; stroke-linejoin: round; paint-order: stroke; }
.tree-orn__cap { fill: var(--silver-300); stroke: var(--night-950); stroke-width: 2.5; paint-order: stroke; }
.tree-orn__shine { fill: var(--snow-50); opacity: .55; }
.tree-orn__under { fill: none; stroke: var(--night-950); stroke-width: 17; stroke-linecap: round; stroke-linejoin: round; }
.tree-orn__line { fill: none; stroke: var(--tree-c, var(--snow-50)); stroke-width: 11; stroke-linecap: round; stroke-linejoin: round; }
.tree-orn__stripe { fill: none; stroke: var(--snow-50); stroke-width: 11; stroke-dasharray: 6 9; stroke-dashoffset: 3; }
.tree-c-white .tree-orn__stripe, .tree-c-blue .tree-orn__stripe { stroke: var(--berry-500); }
.tree-orn--snowflake .tree-orn__under { stroke-width: 13; }
.tree-orn--snowflake .tree-orn__line { stroke-width: 6.5; }

/* The ring: who is being read (picked or focused), today's own, and the spot being chosen. */
.tree-orn__ring { fill: none; stroke: var(--text); stroke-width: 6; opacity: 0; }
.tree-orn--mine .tree-orn__ring { stroke: var(--you); opacity: 1; }
.tree-orn.tree-orn--picked .tree-orn__ring, .tree-orn:focus-visible .tree-orn__ring { stroke: var(--focus); opacity: 1; }
.tree-orn[role="option"] { cursor: pointer; }
.tree-orn[role="option"]:focus { outline: none; }
.tree-preview .tree-orn__ring { stroke: var(--you); stroke-dasharray: 14 10; opacity: 1; animation: tree-pulse 1s ease-in-out infinite alternate; }
@keyframes tree-pulse { from { opacity: .45; } to { opacity: 1; } }

/* ---------- Under the tree: who hung it, how many, loading and retry ---------- */
.tree-under { display: flex; flex-direction: column; align-items: center; gap: var(--sp-1); text-align: center; margin-top: calc(var(--sp-2) * -1); }
.tree-caption { min-height: 20px; color: var(--candle-300); overflow-wrap: anywhere; }
.tree-info { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--sp-2) var(--sp-3); min-height: var(--hit); }
.tree-count { font-weight: 600; color: var(--text); }

/* ---------- The picker ---------- */
.tree-picker { display: flex; flex-direction: column; gap: var(--sp-4); }
.tree-set { margin: 0; padding: 0; border: 0; min-width: 0; }
.tree-set__legend { padding: 0; margin-bottom: var(--sp-2); font-size: var(--fs-14); font-weight: 600; color: var(--text); }
.tree-chips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-2); }
.tree-chip { position: relative; display: block; cursor: pointer; }
.tree-chip__face { min-height: var(--hit); display: flex; align-items: center; justify-content: center; gap: var(--sp-2); padding: var(--sp-1) var(--sp-2);
  border-radius: var(--r-row); border: 1px solid var(--line); background: var(--bg); color: var(--text-2); font-size: var(--fs-14); font-weight: 600; line-height: 1.2; text-align: center;
  transition: background var(--dur-fast), border-color var(--dur-fast); }
.tree-chips--kind .tree-chip__face { flex-direction: column; gap: var(--sp-1); min-height: 68px; padding: var(--sp-2) var(--sp-1); }
.tree-chip:hover .tree-chip__face { border-color: var(--ice-300); }
.tree-chip input:checked + .tree-chip__face { background: var(--surface-2); border-color: var(--live); box-shadow: inset 0 0 0 1px var(--live); color: var(--text); }
.tree-chip input:focus-visible + .tree-chip__face { outline: 3px solid var(--focus); outline-offset: 2px; }
.tree-chip__ico { flex: none; width: 30px; height: 30px; overflow: visible; }
.tree-chip__dot { flex: none; width: 18px; height: 18px; border-radius: 50%; background: var(--tree-c); border: 1px solid var(--plate-line); }

.tree-spot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2) var(--sp-3); }
.tree-spot__text { flex: 1 1 140px; min-width: 0; }
.tree-auto { flex: none; }
.tree-signed { overflow-wrap: anywhere; }
.tree-hang[aria-disabled="true"] { opacity: .5; cursor: default; }

.tree-done { padding: var(--sp-4); border-radius: var(--r-row); background: var(--bg); border: 1px solid var(--live-line); font-weight: 600; text-align: center; }
.tree-status { text-align: center; } /* stays in the layout when empty: it is a live region */
.tree-status[data-tone="error"] { color: var(--danger); }
.tree-status[data-tone="hint"] { color: var(--candle-300); }

html.calm .tree-art__star, html.calm .tree-preview .tree-orn__ring { animation: none; }
html.calm .tree-chip__face { transition: none; }
@media (prefers-reduced-motion: reduce) {
  .tree-art__star, .tree-preview .tree-orn__ring { animation: none; }
  .tree-chip__face { transition: none; }
}
