/* ============================================================================
   components.css — menus, dialogs and the controls inside them.

   THE RULE THIS FILE EXISTS TO ENFORCE: a menu is the week strip rotated 90°.
   One continuous panel, items edge to edge with no separators or borders, and
   the active item lifting out as its own rounded tile. Same mechanic for
   segmented controls, steppers and scale pickers.
   ========================================================================= */

/* --- context menu --------------------------------------------------------- */

.menu {
  width: 272px;
  box-sizing: border-box;
  padding: 7px;
  background: var(--surface);
  border-radius: var(--r-strip);
  box-shadow: var(--shadow-pop);
  display: flex;
  flex-direction: column;
  font-family: var(--font-ui);
}

/* Required when the menu acts on an existing entry: without it you cannot tell
   which of two overlapping spans you are about to delete. */
.menu__subject {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px 12px;
  min-width: 0;
}

.menu__subject-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}

.menu__subject-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu__subject-meta {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  flex: none;
}

.menu__item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  height: var(--hit);
  box-sizing: border-box;
  padding: 0 12px;
  margin: 0;
  border: 0;
  border-radius: var(--r-control);
  background: none;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.menu__item:hover,
.menu__item:focus-visible {
  background: var(--hover);
  outline: none;
}

.menu__item:focus-visible {
  box-shadow: inset 0 0 0 2px var(--accent);
}

/* Delete is the ONLY colored item in a menu. All other chrome stays ink,
   because the accent means duration in the calendar and must not leak here. */
.menu__item--danger {
  color: var(--danger);
}

.menu__item-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu__shortcut {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
  flex: none;
}

.menu__icon {
  flex: none;
}

/* Same hairline that divides days. */
.menu__rule {
  display: block;
  height: 1px;
  background: var(--seam);
  margin: 7px 12px;
  border: 0;
}

/* --- dialogs -------------------------------------------------------------- */

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(28, 26, 23, 0.44);
  display: flex;
  align-items: center;
  justify-content: center;
}

.dialog {
  width: 596px;
  max-width: calc(100vw - 32px);
  box-sizing: border-box;
  padding: 30px;
  background: var(--surface);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 22px;
  font-family: var(--font-ui);
}

.dialog--narrow {
  width: 520px;
}

.dialog__title {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 31px;
  line-height: 1.05;
  font-weight: 400;
  color: var(--ink);
}

.dialog__sub {
  font-size: 13px;
  color: var(--muted);
}

.dialog__text {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--body);
}

.dialog__footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  padding-top: 2px;
}

/* A read-only restatement of what is about to be acted on. */
.summary {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  box-sizing: border-box;
  padding: 0 16px;
  border-radius: var(--r-track);
  background: var(--field);
}

.summary__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}

.summary__name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary__meta {
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  flex: none;
}

/* --- form scaffolding ----------------------------------------------------- */

.field__label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 9px;
}

.field-row {
  display: flex;
  gap: 14px;
}

.field-row > * {
  flex: 1 1 0;
  min-width: 0;
}

/* --- segmented control: the merged run, as a control ---------------------- */

.segmented {
  display: flex;
  gap: 3px;
  box-sizing: border-box;
  padding: 3px;
  background: var(--track);
  border-radius: var(--r-track);
}

.segmented__seg {
  flex: 1 1 0;
  min-width: 0;
  height: 38px;
  border: 0;
  margin: 0;
  border-radius: var(--r-seg);
  background: none;
  font: inherit;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.segmented__seg[aria-pressed="true"] {
  background: var(--surface);
  box-shadow: var(--shadow-seg);
  color: var(--ink);
  font-weight: 600;
}

.segmented__seg:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* --- stepper: the same track, three segments ------------------------------ */

.stepper {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  background: var(--track);
  border-radius: var(--r-track);
}

.stepper__btn {
  width: 38px;
  height: 38px;
  flex: none;
  border: 0;
  margin: 0;
  border-radius: var(--r-seg);
  background: var(--surface);
  box-shadow: var(--shadow-seg);
  color: var(--ink);
  font: inherit;
  font-size: 17px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.stepper__value {
  flex: 1 1 auto;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* --- chips: categories, deliberately NEUTRAL -----------------------------
   Do not give each category a hue. Color means duration in this design; a
   colored category would fight the calendar's only color rule.
   ------------------------------------------------------------------------ */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  height: 36px;
  padding: 0 15px;
  border: 0;
  margin: 0;
  border-radius: var(--r-control);
  background: var(--track);
  color: var(--body);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.chip[aria-pressed="true"] {
  background: var(--ink);
  color: var(--on-ink);
  font-weight: 600;
}

.chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* --- fields --------------------------------------------------------------- */

.field-box,
.textarea {
  width: 100%;
  box-sizing: border-box;
  border: 0;
  background: var(--field);
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  -webkit-appearance: none;
  appearance: none;
}

.field-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: var(--hit);
  padding: 0 14px;
  border-radius: var(--r-control);
  text-align: left;
  cursor: pointer;
}

.field-box__value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.field-box--static {
  cursor: default;
  justify-content: flex-start;
}

.textarea {
  padding: 12px 14px;
  border-radius: var(--r-track);
  line-height: 1.45;
  resize: none;
}

.field-box:focus-visible,
.textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* --- buttons -------------------------------------------------------------- */

.btn {
  height: var(--hit);
  padding: 0 22px;
  border: 0;
  margin: 0;
  border-radius: var(--r-control);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.btn--ghost {
  padding: 0 18px;
  background: none;
  color: var(--body);
  font-weight: 500;
}

.btn--ghost:hover {
  background: var(--hover);
}

.btn--primary {
  background: var(--ink);
  color: var(--on-ink);
}

.btn--danger {
  background: var(--danger);
  color: var(--on-danger);
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
