/* PHYSIO SAMOS — admin console: writers (the list, the create/edit dialog, the photo cropper and its
   zoom slider, the hand-over dialog). Tokens only, from admin.css: every colour inverts with the theme,
   so there is no dark block. The one literal is the crop mask's ink, the same #0d1614 the dialog
   backdrop uses. */

/* ---------- avatar ---------- */
.writer-avatar { display: block; flex: none; border-radius: 50%; object-fit: cover; background: var(--bg-2); }
.writer-avatar--empty { display: grid; place-items: center; background: var(--bg-2); color: var(--ink-3); box-shadow: inset 0 0 0 1px var(--hairline); }
.writer-avatar--empty .icon { width: 56%; height: 56%; }

/* ---------- list ---------- */
.writer-rows { list-style: none; margin: 0; padding: 0; }
.writer-row {
  display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 10px 16px; align-items: center;
  padding: 14px 20px; transition: background-color 150ms ease;
}
.writer-row__body { min-width: 0; }
.writer-row__name { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.writer-row__name strong { font-size: 15.5px; font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.writer-row__name .muted { font-size: 13.5px; font-weight: 600; }
.writer-row__usage { margin-top: 3px; font-size: 13px; color: var(--ink-3); }
.writer-row__usage a { font-weight: 600; }
.writer-row__actions { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
@media (hover: hover) { .writer-row:hover { background: var(--hover); } }
@media (max-width: 640px) {
  .writer-row { grid-template-columns: 48px minmax(0, 1fr); align-items: start; }
  .writer-row__actions { grid-column: 2; justify-content: flex-start; margin-left: -11px; }
}

/* ---------- dialog ---------- */
.writer-form { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 24px 32px; align-items: start; }
.writer-form__photo { display: grid; gap: 12px; justify-items: center; align-content: start; min-width: 0; border-radius: var(--r-lg); transition: box-shadow 150ms ease; }
.writer-form__photo.is-over:not(:has(.photo-drop)) { box-shadow: 0 0 0 2px var(--sage); }
.writer-form__photo > .notice, .writer-form__photo > .hint { justify-self: stretch; }
.writer-form__photo > .hint { text-align: center; }
.writer-form__photo-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.writer-form__fields { display: grid; gap: 16px; align-content: start; min-width: 0; }
.writer-form__fields .field + .field { margin-top: 0; }
@media (max-width: 720px) {
  .writer-form { grid-template-columns: minmax(0, 1fr); }
}

.photo-drop {
  width: 100%; aspect-ratio: 1; display: grid; place-content: center; justify-items: center; gap: 10px; padding: 24px;
  border: 1px dashed var(--hairline-strong); border-radius: var(--r-lg); color: var(--ink-3); text-align: center;
  background: color-mix(in srgb, var(--bg) 55%, var(--paper)); transition: border-color 150ms ease, background-color 150ms ease;
}
.photo-drop .icon--lg { width: 44px; height: 44px; stroke-width: 1.4; margin-bottom: 4px; }
.photo-drop p { font-size: 14px; }
.photo-drop.is-over { border-color: var(--sage); border-style: solid; background: var(--scheduled-wash); }

.writer-photo-current { display: grid; justify-items: center; gap: 14px; width: 100%; }
.writer-photo-current img {
  width: min(280px, 100%); height: auto; aspect-ratio: 1; border-radius: 50%; object-fit: cover;
  background: var(--bg-2); box-shadow: 0 0 0 1px var(--hairline);
}

/* ---------- cropper ---------- */
.cropper { display: grid; gap: 10px; justify-items: center; width: 100%; }
.cropper__loading { width: min(280px, 100%); aspect-ratio: 1; display: grid; place-items: center; border-radius: var(--r); background: var(--bg-2); }
.cropper__viewport {
  position: relative; width: min(280px, 100%); aspect-ratio: 1; overflow: hidden; border-radius: var(--r);
  background: var(--bg-2); touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none;
}
.cropper__viewport.is-dragging { cursor: grabbing; }
.cropper__viewport:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: var(--r); }
.cropper__canvas { display: block; width: 100%; height: 100%; }
.cropper__mask { position: absolute; inset: 0; border-radius: 50%; pointer-events: none; box-shadow: 0 0 0 280px color-mix(in srgb, #0d1614 55%, transparent); }
.cropper__ring { position: absolute; inset: 0; border-radius: 50%; pointer-events: none; border: 1px solid var(--hairline-strong); }
.cropper__hint { max-width: 280px; text-align: center; }
.cropper__zoom { display: flex; align-items: center; gap: 4px; width: min(280px, 100%); }

/* ---------- slider (role="slider"; no native range input) ---------- */
.slider {
  flex: 1; min-width: 0; height: 32px; display: flex; align-items: center; padding: 0 10px; border-radius: var(--r-sm);
  cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none;
}
.slider__track { position: relative; flex: 1; height: 4px; border-radius: 4px; background: var(--hairline-strong); }
.slider__fill { position: absolute; left: 0; top: 0; bottom: 0; width: calc(var(--slider-f, 0) * 100%); border-radius: inherit; background: var(--sage-dark); }
.slider__thumb {
  position: absolute; top: 50%; left: calc(var(--slider-f, 0) * 100%); width: 18px; height: 18px; margin: -9px 0 0 -9px;
  border-radius: 50%; background: var(--paper); border: 2px solid var(--sage-dark); box-shadow: 0 1px 3px color-mix(in srgb, var(--ink) 25%, transparent);
  transition: box-shadow 150ms ease;
}
.slider:focus-visible { outline: none; }
.slider:focus-visible .slider__thumb { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--focus); }
.slider.is-disabled { cursor: not-allowed; opacity: 0.5; }
@media (hover: hover) { .slider:not(.is-disabled):hover .slider__thumb { box-shadow: 0 0 0 5px color-mix(in srgb, var(--sage) 20%, transparent); } }

/* ---------- preview ---------- */
.writer-preview { display: grid; gap: 12px; padding: 14px 16px; border-radius: var(--r); background: var(--bg); border: 1px solid var(--hairline); }
.writer-preview__title { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.writer-preview__row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.writer-preview__row + .writer-preview__row { padding-top: 12px; border-top: 1px solid var(--hairline); }
.writer-preview__img { display: block; flex: none; border-radius: 50%; background: var(--bg-2); }
.writer-preview__text { display: grid; min-width: 0; line-height: 1.3; }
.writer-preview__where { font-size: 12px; color: var(--ink-3); }
.writer-preview__text strong { font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.writer-preview__text strong.is-empty { color: var(--muted); font-weight: 600; }
.writer-preview__row--list strong { font-size: 13.5px; }

/* ---------- hand-over ---------- */
.writer-posts { list-style: none; margin: 0; padding: 0; max-height: 240px; overflow: auto; border: 1px solid var(--hairline); border-radius: var(--r-sm); }
.writer-posts li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; font-size: 13.5px; }
.writer-posts li + li { border-top: 1px solid var(--hairline); }
.writer-posts__title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.writer-posts__title.is-empty { color: var(--muted); font-style: italic; }

/* ---------- touch ---------- */
@media (pointer: coarse) {
  .writer-row__actions .btn, .writer-form__photo-actions .btn, .writer-photo-current .btn, .photo-drop .btn { height: 44px; }
  .cropper__zoom .btn--icon { width: 44px; height: 44px; }
  .slider { height: 44px; }
  .slider__thumb { width: 24px; height: 24px; margin: -12px 0 0 -12px; }
}
@media (prefers-reduced-motion: reduce) {
  .writer-row, .writer-form__photo, .photo-drop, .slider__thumb { transition: none; }
}
