/* ==========================================================================
   JORIE DAILY — cycle.css · Idea 2.0 · Cycle & Wellness + Extra Love Week ♡
   Uses only the existing palette tokens (burgundy · pink · beige · cream) and
   the existing type scale. Loaded after style.css / refresh.css on Today and
   Calendar. Nothing here restyles an existing component.
   ========================================================================== */

/* ---------- Marjorie's welcome panel (reuses .scotty-hello design) ------- */
:root:not([data-admin]) #jorie-hello { display: none !important; }
.jorie-hello { text-wrap: pretty; }
.jorie-hello h2 .heart { display: inline-block; }

/* The soft inner note used in both welcome panels */
.cy-note,
.cy-love {
  position: relative;
  max-width: 640px;
  margin-top: var(--space-5);
  padding: clamp(16px, 2.4vw, 22px) clamp(16px, 2.6vw, 24px);
  border-radius: var(--radius-md);
  background: rgb(var(--white-rgb) / 0.62);
  border: 1px solid rgb(var(--burgundy-rgb) / 0.1);
  box-shadow: 0 14px 30px -26px rgb(var(--burgundy-rgb) / 0.55);
}
.cy-note[hidden], .cy-love[hidden] { display: none; }
.cy-note > * + *, .cy-love > * + * { margin-top: 8px; }
.scotty-hello .cy-note p, .scotty-hello .cy-love p { max-width: 58ch; }

.cy-note__title,
.cy-love__title {
  margin: 0;
  font: 600 clamp(1.08rem, 0.98rem + 0.5vw, 1.32rem)/1.3 var(--font-display);
  color: var(--burgundy);
}
.cy-note__body, .cy-love__body { margin: 0; font-style: italic; color: var(--ink-2); line-height: 1.6; }
.cy-love__lead { margin: 0; font-weight: 700; color: var(--burgundy); }
.cy-love__eyebrow { margin: 0 0 2px; color: var(--ink-3); }
.cy-love__day { font-weight: 400; font-style: italic; }
.cy-note__care { margin: 0; font-size: var(--fs-sm); color: var(--ink-2); line-height: 1.6; padding-left: 12px; border-left: 2px solid rgb(var(--pink-rgb) / 0.9); }
.cy-note__fine, .cy-card__fine { margin: 10px 0 0; font-size: var(--fs-xs); color: var(--ink-3); line-height: 1.5; }

.cy-note--wellness { background: linear-gradient(135deg, rgb(var(--white-rgb) / 0.7), rgb(var(--pink-rgb) / 0.35)); }
.cy-note--due, .cy-note--overdue { border-color: rgb(var(--burgundy-rgb) / 0.16); }
.cy-love { border-left: 3px solid rgb(var(--pink-rgb) / 1); }
.cy-love--late { border-left-style: dashed; }

.cy-note__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px !important; }
.cy-note__status:empty, .cy-card__status:empty { display: none; }
.cy-note__status, .cy-card__status { margin: 8px 0 0; font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); }
.cy-note__status.is-busy::before, .cy-card__status.is-busy::before {
  content: ""; display: inline-block; width: 0.8em; height: 0.8em; margin-right: 8px; vertical-align: -0.08em;
  border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent;
  animation: cySpin 0.8s linear infinite;
}
.cy-note__status.is-error, .cy-card__status.is-error { color: var(--burgundy); }
.cy-note__status.is-error::before, .cy-card__status.is-error::before { content: "! "; font-weight: 800; }
.cy-card__status.is-ok { color: var(--ink); }
.cy-note__saved { margin: 0; font-weight: 600; color: var(--burgundy); }
.cy-note__saved span { display: inline-grid; place-items: center; width: 1.4em; height: 1.4em; margin-right: 6px; border-radius: 50%; background: var(--pink); font-size: 0.8em; }

.cy-date { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; margin-top: 12px !important; }
.cy-date__field { flex: 0 1 220px; }
.cy-date__btns { display: flex; flex-wrap: wrap; gap: 10px; }

.cy-near { margin-top: 12px !important; padding: 12px 14px; border-radius: var(--radius-sm); background: rgb(var(--pink-rgb) / 0.32); }
.cy-near p { margin: 0 0 10px; font-size: var(--fs-sm); }
.cy-near .btn { margin: 0 6px 6px 0; }

/* Gentle reveal for new content (disabled with reduced motion) */
.cy-enter { animation: cyIn 460ms var(--ease-out) both; }
@keyframes cyIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes cySpin { to { transform: rotate(360deg); } }

/* ---------- Calendar marker: a small M, bottom-right of the cell -------- */
.cal-day .cy-mark {
  position: absolute;
  right: 5px;
  bottom: 4px;
  pointer-events: none;
}
.cy-mark {
  font: 600 0.62rem/1 var(--font-body);
  letter-spacing: 0.02em;
  font-variant-numeric: normal;
}
.cy-mark--predicted { color: rgb(var(--burgundy-rgb) / 0.5); }
.cy-mark--unconfirmed { color: rgb(var(--burgundy-rgb) / 0.38); font-style: italic; }
.cy-mark--confirmed { color: var(--burgundy); font-weight: 800; }
/* inside highlighted cells, follow the cell's own ink so it stays legible */
.cal-day.is-today .cy-mark, .cal-day[aria-pressed="true"] .cy-mark { color: currentColor; }
.cal-day.is-today .cy-mark--predicted, .cal-day[aria-pressed="true"] .cy-mark--predicted { opacity: 0.62; }
.cal-day.is-today .cy-mark--unconfirmed, .cal-day[aria-pressed="true"] .cy-mark--unconfirmed { opacity: 0.48; }
.cal-day.is-outside .cy-mark { opacity: 0.45; }
/* Keep the M clear of the existing markers and labels:
   small screens lift the centred cell content a touch; wide screens reserve
   room at the end of the foot row so long labels truncate before the M. */
@media (max-width: 899.98px) {
  /* compact cells: the M sits in the free lower-right space just above the
     marker row, so it never covers workout/event dots or counts */
  .cal-day .cy-mark { right: 5px; bottom: auto; top: 52%; transform: translateY(-50%); font-size: 0.58rem; }
}
@media (min-width: 600px) and (max-width: 899.98px) {
  .cal-day .cy-mark { top: auto; bottom: 7px; right: 9px; transform: none; font-size: 0.64rem; }
}
@media (min-width: 900px) {
  .cal-day .cy-mark { right: 10px; bottom: 9px; font-size: 0.72rem; }
  .cal-day.has-cycle .cal-day__foot { padding-right: 18px; }
}

.cy-mark--legend { display: inline-grid; place-items: center; width: 14px; height: 14px; font-size: 0.7rem; }
.cy-legend { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Calendar: private Cycle & wellness card ---------------------- */
.cy-card .cal-acc__count { white-space: nowrap; }
.cy-loading { color: var(--ink-3); }
.cy-card__summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.cy-stat { display: grid; gap: 4px; align-content: start; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--surface-sunk); border: 1px solid var(--line); }
.cy-stat strong { font: 600 1.05rem/1.3 var(--font-display); color: var(--ink); }
.cy-stat__sub { font-size: var(--fs-xs); color: var(--ink-3); line-height: 1.45; }
.cy-stat__sub--plain { font-size: var(--fs-sm); color: var(--ink-2); }
.cy-card__section { margin-top: var(--space-5); padding-top: var(--space-4); border-top: 1px solid var(--line); }
.cy-card__h { margin: 0 0 4px; font: 600 1.02rem/1.3 var(--font-display); color: var(--ink); }
.cy-card__hint { display: block; margin: 0; font-size: var(--fs-xs); color: var(--ink-3); line-height: 1.5; font-weight: 400; }

.cy-hist { list-style: none; margin: 8px 0 0; padding: 0; }
.cy-hist__item { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cy-hist__item:last-child { border-bottom: 0; }
.cy-hist__item.is-editing { display: block; }
.cy-hist__date { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.cy-hist__tools { display: inline-flex; gap: 6px; }

.cy-settings__mode { margin: 12px 0 0; padding: 0; border: 0; display: grid; gap: 8px; }
.cy-radio { display: inline-flex; align-items: center; gap: 10px; min-height: 32px; cursor: pointer; }
.cy-radio input { width: 18px; height: 18px; accent-color: var(--burgundy); }
.cy-settings__nums { display: flex; flex-wrap: wrap; gap: 14px 24px; margin-top: 14px; }
.cy-settings__nums .input--num { width: 96px; }
.cy-settings > .btn { margin-top: 16px; }

.cy-switch { position: relative; display: flex; align-items: flex-start; gap: 12px; margin-top: 18px; cursor: pointer; }
.cy-switch input { position: absolute; opacity: 0; width: 44px; height: 26px; margin: 0; cursor: pointer; }
.cy-switch__track { flex: none; position: relative; width: 44px; height: 26px; border-radius: 999px; background: var(--line-2); transition: background-color var(--dur-2) ease; }
.cy-switch__knob { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); box-shadow: 0 2px 6px rgb(var(--burgundy-rgb) / 0.25); transition: transform var(--dur-2) var(--ease-out); }
.cy-switch input:checked + .cy-switch__track { background: var(--burgundy); }
.cy-switch input:checked + .cy-switch__track .cy-switch__knob { transform: translateX(18px); background: var(--pink); }
.cy-switch input:focus-visible + .cy-switch__track { outline: 2px solid var(--focus-ring); outline-offset: 3px; }
.cy-switch strong { display: block; font-weight: 600; }

/* ---------- Dark theme --------------------------------------------------- */
:root[data-theme="dark"] .cy-note,
:root[data-theme="dark"] .cy-love { background: rgb(var(--pink-rgb) / 0.08); border-color: rgb(var(--pink-rgb) / 0.16); box-shadow: none; }
:root[data-theme="dark"] .cy-note--wellness { background: linear-gradient(135deg, rgb(var(--pink-rgb) / 0.08), rgb(var(--pink-rgb) / 0.16)); }
:root[data-theme="dark"] .cy-note__title,
:root[data-theme="dark"] .cy-love__title,
:root[data-theme="dark"] .cy-love__lead,
:root[data-theme="dark"] .cy-note__saved,
:root[data-theme="dark"] .cy-note__status.is-error,
:root[data-theme="dark"] .cy-card__status.is-error { color: #f3d6dc; }
:root[data-theme="dark"] .cy-note__saved span { color: var(--burgundy); }
:root[data-theme="dark"] .cy-near { background: rgb(var(--pink-rgb) / 0.12); }
:root[data-theme="dark"] .cy-mark--predicted { color: rgb(var(--pink-rgb) / 0.62); }
:root[data-theme="dark"] .cy-mark--unconfirmed { color: rgb(var(--pink-rgb) / 0.45); }
:root[data-theme="dark"] .cy-mark--confirmed { color: var(--pink); }
:root[data-theme="dark"] .cal-day.is-today .cy-mark,
:root[data-theme="dark"] .cal-day[aria-pressed="true"] .cy-mark { color: currentColor; }
:root[data-theme="dark"] .cy-radio input { accent-color: var(--pink); }
:root[data-theme="dark"] .cy-switch input:checked + .cy-switch__track { background: var(--pink); }
:root[data-theme="dark"] .cy-switch input:checked + .cy-switch__track .cy-switch__knob { background: var(--burgundy); }

/* ---------- Small screens & motion -------------------------------------- */
@media (max-width: 560px) {
  .cy-note__actions .btn, .cy-date__btns .btn { flex: 1 1 auto; }
  .cy-date__field { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .cy-enter { animation: none; }
  .cy-note__status.is-busy::before, .cy-card__status.is-busy::before { animation: none; }
  .cy-switch__track, .cy-switch__knob { transition: none; }
}

/* Phase 29.8's prelaunch margin on #jorie-hello is now provided by the Today
   page gap in profile.css (Next Phase spacing system), for every date. */
