/* ============================================================
   EmCee — density.css
   Per-user padding scale (issue #120): Comfy / Balanced / Compact.

   - Comfy is the default full-size look: NO data-density attribute is
     set, so rendering is pixel-identical to before this feature existed.
   - Balanced ≈ 85% and Compact ≈ 65% of the Comfy paddings below.
   - Specificity: `html[data-density="…"] .x` (0,2,1) outranks every
     single-class page rule (0,1,0) no matter the stylesheet order, so
     these win over both main/nav/profile.css AND later-injected
     per-page <style> blocks — no !important needed.
   - Touch targets are deliberately NOT shrunk on mobile-nav surfaces
     (tab bar, drawer, 44px-min buttons): density is opt-in, but tiny
     tap targets hurt everyone on phones.
   - Extending: append the new selector with balanced + compact values
     scaled from its Comfy rule. Keep min-heights where they exist.
   ============================================================ */

/* ── App shell ───────────────────────────────────────────── */
html[data-density="balanced"] .page-area { padding: 1.5rem 1.75rem; }
html[data-density="compact"] .page-area  { padding: 1rem 1.25rem; }

html[data-density="balanced"] .topbar { padding: 0 1rem; gap: 0.75rem; }
html[data-density="compact"] .topbar  { padding: 0 0.6rem; gap: 0.5rem; }

html[data-density="balanced"] .site-footer { padding: 1rem 1.75rem; }
html[data-density="compact"] .site-footer  { padding: 0.75rem 1.25rem; }

html[data-density="balanced"] .nav-item { padding: 0.3rem 0.6rem; }
html[data-density="compact"] .nav-item  { padding: 0.22rem 0.45rem; }
/* Sidebar links are indented by a margin (nav.css), so horizontal padding stays
   at the flat nav's 0.5rem here or the label/icon columns would drift. */
html[data-density="balanced"] .nav-section-btn,
html[data-density="balanced"] .nav-pinned-header,
html[data-density="balanced"] .nav-standalone { padding: 0.4rem 0.5rem; }
html[data-density="compact"] .nav-section-btn,
html[data-density="compact"] .nav-pinned-header,
html[data-density="compact"] .nav-standalone { padding: 0.3rem 0.5rem; }
html[data-density="balanced"] .nav-site-admin-btn { padding: 0.4rem 0.8rem; }
html[data-density="compact"] .nav-site-admin-btn { padding: 0.3rem 0.5rem; }
html[data-density="balanced"] .nav-items,
html[data-density="balanced"] .nav-pinned-items { padding: 0.1rem 0 0.3rem; }
html[data-density="compact"] .nav-items,
html[data-density="compact"] .nav-pinned-items { padding: 0.08rem 0 0.2rem; }
html[data-density="balanced"] .sidebar-inner { padding: 0.6rem 0 1.5rem; }
html[data-density="compact"] .sidebar-inner  { padding: 0.45rem 0 1.25rem; }

/* ── Shared buttons / cards / overlays (main.css) ────────── */
html[data-density="balanced"] .btn-primary,
html[data-density="balanced"] .btn-ghost { padding: 0.55rem 1.2rem; }
html[data-density="compact"] .btn-primary,
html[data-density="compact"] .btn-ghost { padding: 0.45rem 0.9rem; }

html[data-density="balanced"] .card { padding: 1.1rem 1.2rem 1.4rem; }
html[data-density="compact"] .card  { padding: 0.85rem 0.95rem 1.1rem; }
html[data-density="balanced"] .ui-card { padding: 1rem 1.15rem; }
html[data-density="compact"] .ui-card  { padding: 0.8rem 0.9rem; }

html[data-density="balanced"] .ui-toast { padding: 0.55rem 1rem; }
html[data-density="compact"] .ui-toast  { padding: 0.45rem 0.8rem; }
html[data-density="balanced"] .ui-confirm-modal { padding: 1.2rem; }
html[data-density="compact"] .ui-confirm-modal  { padding: 1rem; }
html[data-density="balanced"] .ui-confirm-actions button { padding: 0.5rem 1rem; }
html[data-density="compact"] .ui-confirm-actions button  { padding: 0.4rem 0.85rem; }
html[data-density="balanced"] .whats-new-header { padding: 1rem 1.2rem 0.6rem; }
html[data-density="compact"] .whats-new-header  { padding: 0.8rem 1rem 0.5rem; }
html[data-density="balanced"] .whats-new-body { padding: 0.85rem 1.2rem 1.2rem; }
html[data-density="compact"] .whats-new-body  { padding: 0.65rem 1rem 1rem; }

/* ── Profile ─────────────────────────────────────────────── */
html[data-density="balanced"] .profile-wrap { padding: 1.15rem 0.75rem; }
html[data-density="compact"] .profile-wrap  { padding: 0.9rem 0.5rem; }
html[data-density="balanced"] .avail-section,
html[data-density="balanced"] .password-section { padding: 1rem; }
html[data-density="compact"] .avail-section,
html[data-density="compact"] .password-section  { padding: 0.75rem; }
html[data-density="balanced"] .btn-schedule,
html[data-density="balanced"] .btn-ghost-header,
html[data-density="balanced"] .btn-save-header { padding: 0.6rem 1rem; }
html[data-density="compact"] .btn-schedule,
html[data-density="compact"] .btn-ghost-header,
html[data-density="compact"] .btn-save-header  { padding: 0.5rem 0.75rem; }
html[data-density="balanced"] .pw-input { padding: 0.5rem 0.7rem; }
html[data-density="compact"] .pw-input  { padding: 0.4rem 0.6rem; }
html[data-density="balanced"] .compact-date-row { padding: 0.5rem 0.6rem; }
html[data-density="compact"] .compact-date-row  { padding: 0.4rem 0.5rem; }
html[data-density="balanced"] .cycle-btn,
html[data-density="balanced"] .mini-cycle-btn { padding: 0.4rem 0.8rem; }
html[data-density="compact"] .cycle-btn,
html[data-density="compact"] .mini-cycle-btn  { padding: 0.32rem 0.6rem; }
html[data-density="balanced"] .month-chip { padding: 0.35rem 0.7rem; }
html[data-density="compact"] .month-chip  { padding: 0.28rem 0.55rem; }
html[data-density="balanced"] .schedule-card { padding: 0.8rem; }
html[data-density="compact"] .schedule-card  { padding: 0.6rem; }
html[data-density="balanced"] .ui-disclosure-head { padding: 0.75rem 0.75rem 0.55rem; }
html[data-density="compact"] .ui-disclosure-head  { padding: 0.6rem 0.75rem 0.45rem; }
html[data-density="balanced"] .ui-disclosure-body { padding: 0; }
html[data-density="compact"] .ui-disclosure-body  { padding: 0; }
html[data-density="balanced"] .special-date-row { padding: 0.5rem 0.6rem; }
html[data-density="compact"] .special-date-row  { padding: 0.4rem 0.5rem; }
html[data-density="balanced"] .status-btn { padding: 0.25rem 0.6rem; }
html[data-density="compact"] .status-btn  { padding: 0.2rem 0.5rem; }
/* .ui-row reads --row-pad-y (main.css), so density is a token here. */
html[data-density="balanced"] { --row-pad-y: 0.75rem; }
html[data-density="compact"]  { --row-pad-y: 0.55rem; }
html[data-density="balanced"] .ui-chip { padding: 0.26rem 0.5rem; min-height: 34px; }
html[data-density="compact"] .ui-chip  { padding: 0.2rem 0.42rem; min-height: 30px; }
html[data-density="balanced"] .cal-btn,
html[data-density="balanced"] .mycal-link { padding: 0.25rem 0.5rem; }
html[data-density="compact"] .cal-btn,
html[data-density="compact"] .mycal-link  { padding: 0.2rem 0.4rem; }
html[data-density="balanced"] .mycal-wrap { padding: 0.6rem 0.7rem; }
html[data-density="compact"] .mycal-wrap  { padding: 0.5rem 0.55rem; }
html[data-density="balanced"] .slot-row { padding: 0.4rem 0.2rem; }
html[data-density="compact"] .slot-row  { padding: 0.3rem 0.15rem; }
html[data-density="balanced"] .slot-value { padding: 0.3rem 0.4rem; }
html[data-density="compact"] .slot-value  { padding: 0.25rem 0.3rem; }
html[data-density="balanced"] .day-card-header { padding: 0.6rem 0.8rem; }
html[data-density="compact"] .day-card-header  { padding: 0.5rem 0.6rem; }
html[data-density="balanced"] .day-slots { padding: 0.6rem; gap: 0.6rem; }
html[data-density="compact"] .day-slots  { padding: 0.45rem; gap: 0.45rem; }

/* ── Monthly scheduler ───────────────────────────────────── */
html[data-density="balanced"] .sched-wrap { padding: 0.45rem 0.2rem 0.45rem 0.45rem; gap: 0.45rem; }
html[data-density="compact"] .sched-wrap  { padding: 0.3rem 0.15rem 0.3rem 0.3rem; gap: 0.3rem; }
html[data-density="balanced"] .sched-topbar { padding: 0.3rem 0.5rem; }
html[data-density="compact"] .sched-topbar  { padding: 0.25rem 0.4rem; }
html[data-density="balanced"] .sched-ctrl-row { gap: 1rem; }
html[data-density="compact"] .sched-ctrl-row  { gap: 0.75rem; }
html[data-density="balanced"] .btn-action { padding: 0.4rem 0.8rem; }
html[data-density="compact"] .btn-action  { padding: 0.32rem 0.6rem; }
html[data-density="balanced"] .blade-header,
html[data-density="balanced"] .blade-content { padding: 0.8rem; }
html[data-density="compact"] .blade-header,
html[data-density="compact"] .blade-content  { padding: 0.6rem; }
html[data-density="balanced"] .counts-table th,
html[data-density="balanced"] .counts-table td { padding: 0.35rem 0.5rem; }
html[data-density="compact"] .counts-table th,
html[data-density="compact"] .counts-table td  { padding: 0.28rem 0.4rem; }
html[data-density="balanced"] .modal-content { padding: 1.5rem; }
html[data-density="compact"] .modal-content  { padding: 1.1rem; }
html[data-density="balanced"] .week-card-body.open { padding: 0.8rem; }
html[data-density="compact"] .week-card-body.open  { padding: 0.6rem; }

/* ── Responsive pairings (match the base files' breakpoints) ── */
@media (max-width: 768px) {
  html[data-density="balanced"] .page-area { padding: 1rem 0.75rem calc(env(safe-area-inset-bottom, 0px) + 90px); }
  html[data-density="compact"] .page-area  { padding: 0.75rem 0.5rem calc(env(safe-area-inset-bottom, 0px) + 90px); }
  html[data-density="balanced"] .site-footer { padding: 0.85rem; }
  html[data-density="compact"] .site-footer  { padding: 0.6rem; }

  /* Profile / availability on phones (pairs profile.css + main.css mobile
     rules, which the desktop density selectors above would outrank). */
  html[data-density="balanced"] .profile-wrap { padding: 0.5rem 0.4rem 5rem; }
  html[data-density="compact"] .profile-wrap  { padding: 0.4rem 0.3rem 5rem; }
  html[data-density="balanced"] .avail-section,
  html[data-density="balanced"] .password-section { padding: 0.6rem; }
  html[data-density="compact"] .avail-section,
  html[data-density="compact"] .password-section  { padding: 0.5rem; }
  html[data-density="balanced"] { --row-pad-y: 0.45rem; }
  html[data-density="compact"]  { --row-pad-y: 0.35rem; }
}

/* Pairs nav.css's 420px topbar rule: the density selectors above would
   otherwise outrank it and bring the 320px overflow back (#166). */
@media (max-width: 420px) {
  html[data-density="balanced"] .topbar { padding: 0 0.6rem; gap: 0.5rem; }
}

@media (max-width: 600px) {
  html[data-density="balanced"] .hero { padding: 3rem 1.75rem 2.25rem; }
  html[data-density="compact"] .hero  { padding: 2.25rem 1.25rem 1.75rem; }
  html[data-density="balanced"] .cards-section { padding: 0 0.75rem 1.5rem; }
  html[data-density="compact"] .cards-section  { padding: 0 0.5rem 1.25rem; }
}
