/* MAP
 * §1 boot zero-FOUC Day Mode (html.is-day-boot)                L8-L63
 * §2 separator vectorial adaptiv (.node-divider)               L65-L70
 * §3 switch Night / Day fara rama, inalt (.horizon-slider)     L72-L164
 * §4 semnalizare auto-glide, focus & mobil (< 640px)           L166-L220
 */

/* §1 boot zero-FOUC Day Mode (inainte de primul paint, inlocuit din adopter CSS) */
html.is-day-boot {
  color-scheme: light;
  --bg: #ebe3d7;
  --bg-deep: #dfd5c6;
  --bg-alt: #e3d9ca;
  --surface: #f2ece2;
  --surface-2: #e4dbce;
  --header-bg: #e4dbce;
  --header-border: #85796c;
  --border: #786d62;
  --border-strong: #5e6c7d;
  --border-subtle: #bfb4a6;
  --grid-line: rgba(94, 108, 125, 0.24);
  --text: #141c26;
  --text-body: #232d3b;
  --text-muted: #465262;
  --text-subtle: #5c544c;
  --accent: #8c5a32;
  --accent-hover: #744724;
  --accent-soft: rgba(140, 90, 50, 0.11);
  --on-accent: #f2ece2;
  --band: #d6c8b5;
  --band-mid: #ded3c3;
  --band-end: #cbbba5;
  --on-band: #141c26;
  --plate-bg-start: #efe8dc;
  --plate-bg-end: #e3d9c9;
  --chip-bg: rgba(223, 213, 198, 0.72);
  --card-inset-bg: #f2ece2;
  --form-bg: rgba(242, 236, 226, 0.92);
  --input-bg: #ebe3d7;
  --roman-num: #5c6b7d;
  --showreel-start: rgba(224, 209, 190, 0.92);
  --showreel-end: rgba(242, 236, 226, 0.96);
  --consult-start: #dfd2c0;
  --consult-mid: #e7dccd;
  --consult-end: #dfd5c6;
  --section-ambient: rgba(188, 134, 86, 0.10);
  --shadow-heavy: rgba(28, 22, 16, 0.16);
  --gleam-core: #744724;
  --gleam-mid: rgba(140, 90, 50, 0.95);
  --gleam-tail: rgba(140, 90, 50, 0.58);
  --gleam-dim: rgba(140, 90, 50, 0.18);
  --gleam-fade: rgba(140, 90, 50, 0.30);
  --hero-top-fade: rgba(228, 219, 206, 0.78);
  --hero-top-zero: rgba(228, 219, 206, 0);
  --hero-scrim-strong: rgba(235, 227, 215, 0.94);
  --hero-scrim-mid: rgba(229, 220, 206, 0.82);
  --hero-scrim-zero: rgba(235, 227, 215, 0);
  --hero-bot-mid: rgba(223, 213, 198, 0.78);
  --hero-bot-zero: rgba(223, 213, 198, 0);
  --hero-text-shadow: rgba(235, 227, 215, 0);
  --hero-pillar-rule: rgba(94, 108, 125, 0.52);
  --day-window-veil: 1;
}

/* §2 separator vectorial adaptiv (.node-divider) */
.nd-line { stroke: var(--border); stroke-width: 1; }
.nd-line-strong { stroke: var(--border-strong); stroke-width: 1; }
.nd-node-slate { stroke: var(--border-strong); stroke-width: 1.3; fill: var(--bg); }
.nd-node-gold { stroke: var(--accent); stroke-width: 1.4; fill: var(--band); }
.nd-core { fill: var(--accent-hover); }

/* §3 switch Night / Day fara rama exterioara, mai inalt, cu etichete in interior */
.horizon-slider {
  --slider-pos: 1;
  position: relative;
  display: block;
  width: clamp(138px, 10.6vw, 156px);
  height: 36px;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  background-color: var(--input-bg);
  transition: border-color var(--dur-med) var(--ease-out);
  user-select: none;
  flex-shrink: 0;
}

.horizon-slider__track {
  position: absolute;
  inset: 0;
  border-radius: 2px;
  overflow: hidden;
  contain: layout paint;
}

.horizon-slider__fill {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(188, 134, 86, 0.08) 0%, rgba(212, 163, 118, 0.22) 100%);
  transform: scaleX(var(--slider-pos, 1));
  transform-origin: left center;
  pointer-events: none;
}

.horizon-slider__ticks {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.34;
  background: repeating-linear-gradient(90deg, transparent 0 19%, var(--border-strong) 19% calc(19% + 1px), transparent calc(19% + 1px) 20%);
  -webkit-mask: linear-gradient(180deg, transparent 74%, rgba(20, 28, 38, 1) 76%);
  mask: linear-gradient(180deg, transparent 74%, rgba(20, 28, 38, 1) 76%);
}

.horizon-slider__labels {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  pointer-events: none;
}

.horizon-slider__word {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: color var(--dur-fast) var(--ease-out);
}
.horizon-slider__word.is-pole-active {
  color: var(--text);
}

.horizon-slider__chevrons {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  color: var(--accent-hover);
  opacity: 0.2;
  pointer-events: none;
}
.horizon-slider__chevrons svg { width: 22px; height: 10px; }

.horizon-slider__rail {
  position: absolute;
  inset: 3px 31px;
  pointer-events: none;
  z-index: 2;
}
.horizon-slider__carrier {
  display: block;
  width: 100%;
  height: 100%;
  transform: translate3d(calc(var(--slider-pos, 1) * 100%), 0, 0);
  will-change: transform;
}
.horizon-slider__thumb {
  position: absolute;
  left: 0;
  top: 50%;
  width: 54px;
  height: 28px;
  transform: translate(-50%, -50%);
  border: 1.5px solid var(--accent-hover);
  border-radius: 2px;
  background: linear-gradient(180deg, var(--accent-soft) 0%, rgba(188, 134, 86, 0.18) 100%);
  box-shadow: inset 0 -2px 0 var(--accent-hover), 0 2px 6px var(--shadow-heavy);
}

.horizon-slider__input {
  position: absolute;
  inset: -6px 0;
  width: 100%;
  height: calc(100% + 12px);
  margin: 0;
  opacity: 0;
  cursor: grab;
  z-index: 4;
}
.horizon-slider__input:active { cursor: grabbing; }
.horizon-slider:has(.horizon-slider__input:focus-visible) { outline: 2px solid var(--accent-hover); outline-offset: 3px; }

/* §4 semnalizare auto-glide, focus & mobil (< 640px) */
.horizon-slider.is-gliding { border-color: var(--accent-hover); }
.horizon-slider.is-gliding::after {
  content: "";
  position: absolute;
  inset: -4px;
  border: 1.5px solid var(--accent-hover);
  border-radius: 5px;
  pointer-events: none;
  animation: slider-beacon 1.35s var(--ease-out) infinite;
}
.horizon-slider.is-gliding .horizon-slider__chevrons { opacity: 0.78; }
.horizon-slider.is-gliding .hc-1 { animation: chevron-wave 1.15s ease-in-out 0s infinite; }
.horizon-slider.is-gliding .hc-2 { animation: chevron-wave 1.15s ease-in-out 0.16s infinite; }
.horizon-slider.is-gliding .hc-3 { animation: chevron-wave 1.15s ease-in-out 0.32s infinite; }
.horizon-slider.is-gliding .horizon-slider__thumb::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 3px;
  border: 1px solid var(--accent-hover);
  opacity: 0.7;
  animation: thumb-glow 1.15s ease-in-out infinite;
}

@keyframes slider-beacon {
  0% { transform: scale(0.99, 0.97); opacity: 0.92; }
  75% { transform: scale(1.055, 1.18); opacity: 0; }
  100% { transform: scale(1.055, 1.18); opacity: 0; }
}
@keyframes chevron-wave {
  0%, 100% { opacity: 0.25; transform: translateX(1px); }
  45% { opacity: 1; transform: translateX(-1.5px); }
}
@keyframes thumb-glow {
  0%, 100% { opacity: 0.25; transform: scale(0.98); }
  50% { opacity: 0.9; transform: scale(1.05); }
}

@media (max-width: 639px) {
  .horizon-slider { width: 122px; height: 34px; }
  .horizon-slider__labels { padding: 0 9px; }
  .horizon-slider__word { font-size: 0.58rem; letter-spacing: 0.1em; }
  .horizon-slider__rail { inset: 3px 26px; }
  .horizon-slider__thumb { width: 46px; height: 26px; }
  .horizon-slider__chevrons svg { width: 16px; height: 8px; }
}
