/* FIG. 5 dial widget (js/widgets/dial.js). Every selector is scoped under .w-dial and uses the
   core tokens only, so the day and night sets need no widget code.
   Narrow containers stack (phone artboard); from 460px the face sits beside the controls
   (desktop artboard). */

.w-dial { container: w-dial / inline-size; position: relative; color: var(--ink); }

.w-dial .wd-body { display: grid; gap: 12px; }
.w-dial .wd-panel { display: flex; flex-direction: column; gap: 10px; min-width: 0; }

/* the round display */
.w-dial .wd-face { display: block; width: 220px; max-width: 100%; height: auto; margin: 0 auto; -webkit-user-select: none; user-select: none; }
.w-dial .wd-arc { fill: none; stroke: var(--pending); stroke-width: 9px; }
.w-dial .wd-arc.is-past { stroke: var(--ink); }
.w-dial .wd-arc.is-cur { stroke: var(--accent); stroke-width: 13px; }
.w-dial .wd-arc.is-edit { stroke-dasharray: 10 4; }
.w-dial .wd-disc { fill: var(--face); }
.w-dial .wd-prog { fill: none; stroke: var(--accent-face); stroke-width: 3px; stroke-linecap: round; }
.w-dial .wd-prog.is-empty { opacity: 0; }
/* no tracking on the small lines: "SEGMENT 2 / 5 · EDIT" would otherwise touch the rim */
.w-dial .wd-t-top,
.w-dial .wd-t-bottom { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0; fill: var(--face-ink-2); }
/* a face-coloured halo keeps the small lines clear where the progress ring passes behind them */
.w-dial .wd-t-top,
.w-dial .wd-t-bottom { paint-order: stroke; stroke: var(--face); stroke-width: 4px; stroke-linejoin: round; }
.w-dial .wd-t-name { font-family: var(--font-narrow); font-size: 26px; font-weight: 700; letter-spacing: 1px; fill: var(--face-ink); }
.w-dial .wd-t-time { font-family: var(--font-mono); font-size: 26px; font-weight: 600; fill: var(--accent-face); }

/* status row and readouts */
.w-dial .wd-lbl { font-family: var(--font-mono); font-size: 12px; line-height: 1.4; letter-spacing: .08em; color: var(--ink-2); }
.w-dial .wd-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 8px; }
.w-dial .wd-status {
  padding: 3px 7px; border: 1.5px solid var(--ink); white-space: nowrap;
  font-family: var(--font-mono); font-size: 12px; font-weight: 600; line-height: 1.3; letter-spacing: .06em;
}
.w-dial .wd-temps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.w-dial .wd-temp { padding: 6px 8px; border: 1px solid var(--line); min-width: 0; }
.w-dial .wd-read { font-family: var(--font-mono); font-size: 16px; font-weight: 600; line-height: 1.35; white-space: nowrap; }

/* knob: turn left, press, turn right */
.w-dial .wd-knob-row { display: flex; align-items: center; justify-content: center; gap: 28px; -webkit-user-select: none; user-select: none; }
.w-dial .wd-turn,
.w-dial .wd-knob,
.w-dial .wd-start { touch-action: manipulation; }
.w-dial .wd-turn {
  flex: none; display: flex; align-items: center; justify-content: center; width: 48px; height: 48px; padding: 0;
  border: 1.5px solid var(--ink); border-radius: 0; background: transparent; color: var(--ink);
}
.w-dial .wd-turn svg { display: block; }
.w-dial .wd-turn path { fill: none; stroke: currentColor; stroke-width: 1.5px; }
.w-dial .wd-knob {
  flex: none; display: flex; align-items: center; justify-content: center; width: 76px; height: 76px; padding: 0;
  border: 2px solid var(--ink); border-radius: 50%; background: var(--face);
}
.w-dial .wd-knob-cap {
  position: relative; display: block; width: 54px; height: 54px; border-radius: 50%;
  border: 1px solid var(--face-ink-2); background: var(--tile);
}
.w-dial .wd-knob-mark { position: absolute; top: 5px; left: 50%; width: 4px; height: 16px; margin-left: -2px; background: var(--accent-face); }

.w-dial .wd-press { text-align: center; font-family: var(--font-mono); font-size: 12px; line-height: 1.4; letter-spacing: .06em; color: var(--ink-2); }

.w-dial .wd-start {
  width: 100%; min-height: 44px; padding: 0 14px; border: 1.5px solid var(--ink); border-radius: 0;
  background: var(--ink); color: var(--sheet);
  font-family: var(--font-narrow); font-size: 16px; font-weight: 700; line-height: 1.2; letter-spacing: .08em;
}

/* copy under the figure */
.w-dial .wd-intro,
.w-dial .wd-note { font-size: 15px; line-height: 1.55; }
.w-dial .wd-intro { margin-top: 14px; }
.w-dial .wd-note { margin-top: 8px; padding-left: 10px; border-left: 3px solid var(--line); color: var(--ink-2); }
.w-dial .wd-note.is-lit { border-left-color: var(--accent); color: var(--ink); }

.w-dial .wd-vh {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* hover only where a pointer can hover, so a tapped button does not stay lit on touch screens */
@media (hover: hover) {
  .w-dial .wd-turn:hover { background: var(--hover); }
  .w-dial .wd-knob:hover { border-color: var(--accent); }
  .w-dial .wd-start:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
}

/* face beside the controls, as on the desktop artboard */
@container w-dial (min-width: 460px) {
  .w-dial .wd-body { grid-template-columns: 220px minmax(0, 340px); gap: 18px; align-items: start; }
  .w-dial .wd-face { margin: 0; }
  .w-dial .wd-knob-row { justify-content: space-between; gap: 10px; padding: 2px 6px; }
  .w-dial .wd-turn { width: 44px; height: 44px; }
}
/* a roomy figure (the project page's drawing field on desktop): the face draws larger, never smaller than 1:1 */
@container w-dial (min-width: 560px) {
  .w-dial .wd-body { grid-template-columns: 260px minmax(0, 340px); gap: 28px; align-items: center; }
  .w-dial .wd-face { width: 260px; }
}

@media (prefers-reduced-motion: no-preference) {
  .w-dial .wd-knob-cap { transition: transform .2s ease; }
  .w-dial .wd-knob:active { transform: scale(.97); }
  .w-dial .wd-turn,
  .w-dial .wd-start { transition: background-color .16s ease, color .16s ease, border-color .16s ease; }
}

@media (forced-colors: active) {
  .w-dial .wd-knob-mark { forced-color-adjust: none; background: CanvasText; }
  .w-dial .wd-arc.is-cur { stroke: Highlight; }
}
