/*
 * MFComfortDial — component styles
 * All rules scoped under .mf-comfort-dial — no leakage.
 *
 * Themeable CSS variables (set on .mf-comfort-dial or any ancestor):
 *   --cd-cool      cool-side tick colour        default #2f8fa6
 *   --cd-warm      warm-side tick colour         default #ee9a44
 *   --cd-needle    needle + dot colour           default #f1b968
 *   --cd-knob      knob fill (dark glass)        default color-mix(in srgb, #082b3a 55%, black)
 *   --cd-knob-stroke  knob border                default rgba(244,239,229,0.22)
 *   --cd-ring-bg   outer ring stroke             default rgba(244,239,229,0.16)
 *   --cd-paper     text + hint colour            default #f4efe5
 *   --cd-accent    decimal + settled tint        default #f1b968
 *   --cd-mono      monospace font stack          default ui-monospace, monospace
 *
 * Form is FIXED (exact Northgate dial). Only colours theme.
 */

/* ------------------------------------------------------------------ */
/* Root wrapper                                                        */
/* ------------------------------------------------------------------ */
.mf-comfort-dial {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;

  /* default token values — host overrides any of these */
  --cd-cool:         #2f8fa6;
  --cd-warm:         #ee9a44;
  --cd-needle:       #f1b968;
  --cd-knob:         color-mix(in srgb, #082b3a 55%, black);
  --cd-knob-stroke:  rgba(244, 239, 229, 0.22);
  --cd-ring-bg:      rgba(244, 239, 229, 0.16);
  --cd-paper:        #f4efe5;
  --cd-accent:       #f1b968;
  --cd-mono:         "Spline Sans Mono", ui-monospace, monospace;
}

/* ------------------------------------------------------------------ */
/* Stage (the interactive SVG + readout shell)                         */
/* ------------------------------------------------------------------ */
.mf-cd-stage {
  position: relative;
  width: clamp(190px, 22vw, 264px);
  aspect-ratio: 1;
  touch-action: none;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  /* Focus ring — visible only on keyboard nav */
  outline: none;
  border-radius: 50%;
}

.mf-cd-stage:focus-visible {
  outline: 2px solid var(--cd-accent);
  outline-offset: 6px;
}

.mf-cd-stage.mf-cd-dragging {
  cursor: grabbing;
}

.mf-cd-stage svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  display: block;
}

/* ------------------------------------------------------------------ */
/* SVG pieces                                                           */
/* ------------------------------------------------------------------ */

/* outer arc ring */
.mf-cd-ring-bg {
  fill: none;
  stroke: var(--cd-ring-bg);
  stroke-width: 1;
}

/* knob — the draggable circle */
.mf-cd-knob {
  fill:   var(--cd-knob);
  stroke: var(--cd-knob-stroke);
}

/* indicator group (needle line + tip dot) — transform applied by JS */
.mf-cd-indicator {
}

/* ------------------------------------------------------------------ */
/* Readout overlay (°C number centred on the knob)                    */
/* ------------------------------------------------------------------ */
.mf-cd-readout {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  pointer-events: none;
}

.mf-cd-temp {
  font-family:     var(--cd-mono);
  font-size:       clamp(28px, 4.1vw, 44px);
  font-weight:     500;
  color:           var(--cd-paper);
  line-height:     1;
  letter-spacing:  -0.02em;
  display:         inline-flex;
  align-items:     baseline;
}

/* decimal part — subtler, transitions to accent when settled */
.mf-cd-dec {
  font-size:    0.52em;
  opacity:      0.62;
  font-weight:  400;
  transition:   color 0.3s ease;
}

.mf-cd-stage.mf-cd-settled .mf-cd-dec {
  color:   var(--cd-accent);
  opacity: 0.8;
}

/* degree symbol */
.mf-cd-deg {
  font-size:      0.46em;
  vertical-align: baseline;
  opacity:        0.7;
  margin-left:    2px;
  align-self:     flex-start;
  margin-top:     0.18em;
}

/* ------------------------------------------------------------------ */
/* Hint label ("Drag the dial")                                        */
/* ------------------------------------------------------------------ */
.mf-cd-hint {
  font-family:     var(--cd-mono);
  font-size:       10px;
  letter-spacing:  0.18em;
  text-transform:  uppercase;
  color:           color-mix(in srgb, var(--cd-paper) 46%, transparent);
  display:         flex;
  align-items:     center;
  gap:             8px;
  transition:      opacity 0.5s ease;
}

.mf-cd-hint--hide {
  opacity: 0;
  pointer-events: none;
}

.mf-cd-hint-dot {
  width:         5px;
  height:        5px;
  border-radius: 50%;
  background:    var(--cd-accent);
  animation:     mfcd-hint-pulse 3s ease-in-out infinite;
  flex:          none;
}

@keyframes mfcd-hint-pulse {
  0%, 100% { opacity: 0.4; }
  50%       { opacity: 0.85; }
}

/* ------------------------------------------------------------------ */
/* Reduced-motion overrides                                            */
/* (tide loop is already suppressed in JS; CSS animations killed here) */
/* ------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .mf-cd-hint-dot {
    animation: none;
    opacity: 0.6;
  }
  .mf-cd-dec {
    transition: none;
  }
}
