/* calendar.css — the personal calendar page (calendar.html).
   Page-specific only — everything else (.bf-page/.bf-wrap/.bf-header/
   .skeleton/.empty-state) reuses briefing.css + components.css, same
   convention as collection.html. Calm almanac styling: a plain grid, one
   accent dot for "filled," no color scale, no heatmap intensity — a day
   either happened or it hasn't, never a gradient of "how much." */

/* ── Locked-month card (free tier, past a gated month) ──────────────── */
.cal-locked {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 40px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
}
.cal-locked-icon { font-size: 28px; color: var(--text-subtle); margin: 0; }
.cal-locked-title { font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; color: var(--text-primary); margin: 0; }
.cal-locked-body { color: var(--text-subtle); font-size: var(--text-base); max-width: 340px; line-height: 1.5; margin: 0 0 6px; }

/* ── Month nav ───────────────────────────────────────────────────────── */
.cal-month-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-bottom: 18px;
}
.cal-month-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  min-width: 160px;
  text-align: center;
}
.cal-nav-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-primary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: background 120ms ease, opacity 120ms ease;
}
.cal-nav-btn:hover:not(:disabled) { background: var(--surface-3); }
.cal-nav-btn:disabled { opacity: 0.35; cursor: default; }

/* ── Weekday header + grid ───────────────────────────────────────────── */
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-disabled);
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-day {
  position: relative;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 0.9rem;
  color: var(--text-muted);
  background: transparent;
}
.cal-day.is-blank { visibility: hidden; }

/* Future days — not yet happened, never styled as "missed" (there is no
   such state) — just quietly lower-contrast than a real, elapsed empty day. */
.cal-day.is-future { color: var(--text-disabled); }

/* Today — a quiet ring, not a fill (fill means "read," and today may not be
   read yet — those are two different facts and must look different). */
.cal-day.is-today { box-shadow: inset 0 0 0 1.5px var(--border-strong); font-weight: 700; color: var(--text-primary); }

/* Filled — the accumulation mark. One flat accent tone, no shading by
   correct/incorrect (a record, not a scoreboard) and no intensity scale. */
.cal-day.is-filled {
  background: var(--accent-dim);
  color: var(--text-primary);
  font-weight: 700;
  cursor: pointer;
}
.cal-day.is-filled:hover { background: var(--accent-dim-hover); }
.cal-day.is-filled:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }

/* A day with a marker (kept fact / name day) but no read record of its own
   yet — still tappable to see the marker, styled distinctly from "filled"
   (no accent wash) so it never misreads as "you read this." */
.cal-day.is-markable { cursor: pointer; }
.cal-day.is-markable:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }

.cal-day-num { position: relative; z-index: 1; }

.cal-day-badges {
  position: absolute;
  bottom: 3px;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 8px;
  line-height: 1;
}
.cal-day-badges i { color: var(--accent-ink); }
.cal-day.is-filled .cal-day-badges i { color: var(--accent-text); opacity: 0.75; }

.cal-legend {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px;
  margin: 18px 0 0;
  font-size: 0.8rem;
  color: var(--text-subtle);
}
.cal-legend-item { display: inline-flex; align-items: center; gap: 5px; }
.cal-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--accent-dim-hover); }

/* ── Day detail panel — bottom sheet on mobile, centered card on desktop ── */
.cal-detail-scrim {
  position: fixed;
  inset: 0;
  background: var(--scrim, rgba(0, 0, 0, 0.5));
  z-index: 9000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.cal-detail-panel {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 20px 20px 0 0;
  padding: 28px 22px calc(28px + var(--safe-bottom, 0px));
  width: 100%;
  max-width: 480px;
  max-height: 78vh;
  overflow-y: auto;
}
.cal-detail-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: var(--surface-2);
  border: none;
  color: var(--text-muted);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
}
.cal-detail-date {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 28px 14px 0;
}
.cal-detail-body p { color: var(--text-muted); font-size: var(--text-base); line-height: 1.5; margin: 0 0 10px; }
.cal-detail-nameday {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: 10px;
  margin-bottom: 8px;
  font-size: 0.9rem;
  color: var(--text-primary);
}
.cal-detail-nameday i { color: var(--hearts); }
.cal-detail-link { display: inline-block; margin-top: 4px; font-size: 0.9rem; color: var(--accent-ink); text-decoration: none; font-weight: 600; }
.cal-detail-link:hover { text-decoration: underline; }

/* Family dates in the day-detail — same heart-row treatment as name days
   (one visual language), plus owner Edit / Remove affordances on the right. */
.cal-detail-family-edit,
.cal-detail-family-del {
  border: none; background: transparent; cursor: pointer;
  font-family: var(--font-body); font-size: 0.78rem; font-weight: 600;
  color: var(--text-subtle); text-decoration: underline; padding: 2px 4px;
}
.cal-detail-family-edit { margin-left: auto; }
.cal-detail-family-edit:hover,
.cal-detail-family-del:hover { color: var(--text-muted); }

/* ── "Add a family date" — the universal personal-layer author surface
   (120_user_family_dates.sql). Calm, small: a label + a date, nothing more. ── */
.cal-family { margin: 16px 0 4px; }
.cal-family-add {
  border: 1px dashed var(--border-strong); background: transparent; cursor: pointer;
  width: 100%; padding: 11px 14px; border-radius: 10px;
  font-family: var(--font-body); font-size: 0.9rem; font-weight: 600; color: var(--text-muted);
}
.cal-family-add:hover { border-color: var(--text-subtle); color: var(--text-primary); }
.cal-family-add:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
.cal-family-form {
  display: flex; flex-direction: column; gap: 10px;
  padding: 14px; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface-2);
}
.cal-family-label,
.cal-family-form select,
.cal-family-year {
  font-family: var(--font-body); font-size: 0.9rem; color: var(--text-primary);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px; padding: 9px 11px;
}
.cal-family-label::placeholder,
.cal-family-year::placeholder { color: var(--text-subtle); }
.cal-family-fields { display: flex; gap: 8px; flex-wrap: wrap; }
.cal-family-month { flex: 2 1 120px; }
.cal-family-day { flex: 1 1 64px; }
.cal-family-year { flex: 1 1 96px; width: 100%; box-sizing: border-box; }
.cal-family-actions { display: flex; gap: 8px; align-items: center; }
.cal-family-save, .cal-family-cancel {
  font-family: var(--font-body); font-size: 0.82rem; font-weight: 600; cursor: pointer;
  border-radius: 8px; padding: 8px 16px;
}
.cal-family-save { border: none; background: var(--accent-ink); color: #fff; }   /* olive-ink action, calm — never raw lime */
.cal-family-save[disabled] { opacity: 0.6; cursor: default; }
.cal-family-cancel { border: 1px solid var(--border-strong); background: transparent; color: var(--text-muted); }
.cal-family-msg { font-family: var(--font-body); font-size: 0.82rem; color: var(--text-muted); margin: 2px 0 0; }
.cal-family-msg.is-error { color: var(--error-ink, #b00020); }
.cal-family-msg a { color: var(--accent-ink); text-decoration: underline; }

/* Desktop — centered card instead of a bottom sheet; wider grid breathes
   more (matches world-sweep's desktop-widen precedent on account pages). */
@media (min-width: 720px) {
  .cal-detail-scrim { align-items: center; }
  .cal-detail-panel { border-radius: 20px; max-height: 70vh; }
  .cal-day { font-size: 1rem; }
}
