/* =============================================================================
   ShiftHawk — "Settings that shape your swaps" interactive component
   Self-contained, dependency-free. Mounts into #determinants-mount.
   All classes prefixed .dt-. Tokens consumed from styles.css (:root vars).
   Phosphor (ph-duotone) loaded globally; fonts loaded by the page.
   ========================================================================== */

.dt-root {
  display: grid;
  /* compact list column · panel takes the clear majority of the width */
  grid-template-columns: minmax(196px, 240px) minmax(0, 2.6fr);
  gap: var(--s-5);
  align-items: start;
  font-family: var(--font-body);
  color: var(--text-1);
  width: 100%;
}

/* On narrow widths, stack: list on top, panel below (calendar scales full width) */
@media (max-width: 760px) {
  .dt-root { grid-template-columns: 1fr; gap: var(--s-4); }
}

/* ---------------------------------------------------------------- List ---- */
.dt-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  min-width: 0;
}

.dt-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  width: 100%;
  text-align: left;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: .9rem;
  color: var(--text-1);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-2);
  padding: 10px 11px;
  min-height: 48px;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .2s ease, border-color .2s ease, background .2s ease;
}
.dt-row:hover { border-color: var(--primary-tint); background: var(--primary-soft); }
.dt-row:active { transform: translateY(1px); }
.dt-row:focus-visible {
  outline: 3px solid var(--primary-bright);
  outline-offset: 2px;
}
.dt-row[aria-selected="true"] {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: var(--shadow-sm), inset 3px 0 0 var(--primary);
}

.dt-row__icon {
  flex: none;
  display: grid; place-items: center;
  width: 30px; height: 30px;
  border-radius: var(--r-1);
  background: var(--surface-2);
  color: var(--primary-deep);
  font-size: 1.2rem;
}
.dt-row[aria-selected="true"] .dt-row__icon {
  background: var(--primary);
  color: #fff;
}
.dt-row__name { flex: 1 1 auto; min-width: 0; }

.dt-note {
  margin-top: var(--s-3);
  font-size: .86rem;
  line-height: 1.45;
  color: var(--text-2);
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-2);
}
.dt-note .ph { color: var(--primary); font-size: 1rem; vertical-align: -2px; margin-right: 4px; }

/* --------------------------------------------------------------- Panel ---- */
.dt-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-4);
  padding: var(--s-6, 32px);
  box-shadow: var(--shadow-md, var(--shadow-sm));
  min-width: 0;
}
.dt-panel__head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
}
.dt-panel__icon {
  flex: none;
  display: grid; place-items: center;
  width: 52px; height: 52px;
  border-radius: var(--r-2);
  background: var(--primary-soft);
  color: var(--primary-deep);
  border: 1px solid var(--primary-tint);
  font-size: 2rem;
}
.dt-panel__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.6rem;
  letter-spacing: -.02em;
  color: var(--text-1);
  line-height: 1.12;
}
.dt-panel__def {
  font-size: 1.12rem;
  line-height: 1.6;
  color: var(--text-2);
  max-width: 62ch;
  margin: 0 0 var(--s-5);
}

/* ------------------------------------------------------------ Calendar ---- */
.dt-cal {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-3);
  padding: var(--s-4);
}
.dt-cal svg { width: 100%; height: auto; display: block; }

/* ----------------------------------------------------------- Caption ----- */
.dt-caption {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-top: var(--s-4);
  min-height: 40px;
  font-size: 1rem;
  line-height: 1.45;
  color: var(--text-2);
}
.dt-caption__dot {
  flex: none;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--primary);
}
.dt-caption strong { color: var(--text-1); font-weight: 700; }

/* legend chips below the calendar */
.dt-legend {
  display: flex; flex-wrap: wrap; gap: var(--s-2);
  margin-top: var(--s-3);
}
.dt-legend__item {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-mono);
  font-size: .8rem; font-weight: 600;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 4px 11px; border-radius: var(--r-pill);
}
.dt-legend__swatch { width: 10px; height: 10px; border-radius: 2px; flex: none; }

/* ------------------------------------------------- Animated SVG helpers --- */
/* Day-number / shift-label text in the calendar uses mono. */
.dt-cal .dt-num { font-family: var(--font-mono); font-weight: 600; font-size: 13px; }
.dt-cal .dt-dow { font-family: var(--font-mono); font-weight: 700; font-size: 11px; letter-spacing: .04em; }
.dt-cal .dt-lbl { font-family: var(--font-mono); font-weight: 700; font-size: 10px; }
.dt-cal .dt-tag { font-family: var(--font-mono); font-weight: 700; font-size: 9.5px; }

/* keyframes — all transform/opacity only (GPU friendly) */
@keyframes dt-pulse  { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes dt-flash  { 0%,100% { opacity: 1; } 50% { opacity: .25; } }
@keyframes dt-pop    { 0% { transform: scale(.4); opacity: 0; } 60% { transform: scale(1.12); } 100% { transform: scale(1); opacity: 1; } }
@keyframes dt-fade   { 0% { opacity: 0; } 100% { opacity: 1; } }
@keyframes dt-fadeout{ 0% { opacity: 1; } 100% { opacity: 0; } }
@keyframes dt-slidex { 0% { transform: translateX(var(--dt-from, 0)); } 100% { transform: translateX(var(--dt-to, 0)); } }
@keyframes dt-grow   { 0% { transform: scaleX(0); } 100% { transform: scaleX(1); } }
@keyframes dt-dash   { 0% { stroke-dashoffset: var(--dt-dashlen, 100); } 100% { stroke-dashoffset: 0; } }
@keyframes dt-spin   { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* animation utility classes applied to SVG groups via JS */
.dt-anim-pulse  { animation: dt-pulse 1.6s ease-in-out infinite; }
.dt-anim-flash  { animation: dt-flash .7s ease-in-out 3; }
.dt-anim-pop    { animation: dt-pop .45s cubic-bezier(.34,1.56,.64,1) both; transform-box: fill-box; transform-origin: center; }
.dt-anim-fade   { animation: dt-fade .5s ease both; }
.dt-anim-grow   { animation: dt-grow .55s ease both; transform-box: fill-box; transform-origin: left center; }
.dt-anim-dash   { animation: dt-dash 1s ease forwards; }
.dt-anim-spin   { animation: dt-spin 24s linear infinite; transform-box: fill-box; transform-origin: center; }

/* Reduced motion: freeze everything at the explanatory end state. */
@media (prefers-reduced-motion: reduce) {
  .dt-anim-pulse, .dt-anim-flash, .dt-anim-pop, .dt-anim-fade,
  .dt-anim-grow, .dt-anim-dash, .dt-anim-spin {
    animation: none !important;
  }
}
