/**
 * 30 Days Closer to God — September challenge.
 * Uses Grounded's Today palette + surface tokens (cream / blush / dusty rose /
 * burgundy). No new fonts. Honors reduced-motion and safe-area insets.
 */

/* ─── challenge action color ───
   Matches Grounded's Guidance center-btn blush (#CFAFA3) with dark burgundy
   labels (#5A3A30 at 4.95:1). Theme-independent — both soft and neutral use
   the same challenge controls. Scoped --sc-* names; nothing else in the app
   reads them. */
:root {
  --sc-rose: #CFAFA3; /* primary fill — matches .bottom-nav .nav-item.center-btn */
  --sc-rose-deep: #C6A89C; /* completed fill — slightly deeper blush, 4.55:1 text */
  --sc-rose-tint: rgba(207, 175, 163, 0.18); /* completed day-cell wash */
}

.sc-visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ─── shared type ─── */
.sc-eyebrow {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-strong, #d4b5ad);
  opacity: 0.9;
  margin: 0 0 6px;
}

/* ─── compact Today card ─── */
.sc-card-section {
  padding: 0 clamp(14px, 3.5vw, 22px);
}
.sc-card {
  border: 1px solid rgba(234, 208, 204, 0.4);
  border-radius: var(--radius-lg, 22px);
  background: linear-gradient(
    165deg,
    rgba(255, 252, 249, 0.98) 0%,
    rgba(252, 244, 238, 0.96) 48%,
    rgba(247, 235, 228, 0.94) 100%
  );
  box-shadow: 0 8px 28px rgba(90, 74, 66, 0.07), 0 2px 10px rgba(90, 74, 66, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.82);
  padding: 16px 18px 18px;
  box-sizing: border-box;
}
.sc-card-title {
  font-size: 18px;
  font-weight: 500;
  color: var(--text, #5a4a42);
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}
.sc-card-meta {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12px;
  color: var(--text-light, #8a7a72);
  margin: 0 0 14px;
}
.sc-card-history {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-light, #8a7a72);
  margin: 0 0 14px;
}

.sc-seg-label {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-strong, #d4b5ad);
  opacity: 0.8;
  margin: 0 0 8px;
}
.sc-day-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin: 0 0 16px;
}
.sc-day {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 44px;
  padding: 6px 0;
  border-radius: 12px;
  border: 1px solid rgba(212, 181, 173, 0.35);
  background: rgba(255, 252, 249, 0.6);
  color: var(--text, #5a4a42);
  font-family: 'Inter', system-ui, sans-serif;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.sc-day-num {
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
}
.sc-day-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #5a3a30;
}
.sc-check {
  font-size: 11px;
  line-height: 1;
  color: currentColor;
}
.sc-day--today {
  background: var(--sc-rose);
  border-color: var(--sc-rose);
  color: #5a3a30;
  font-weight: 600;
}
.sc-day--completed {
  background: var(--sc-rose-tint);
  border-color: rgba(158, 98, 89, 0.4);
  color: #5a3a30;
}
.sc-day--available {
  border-style: dashed;
}
.sc-day--locked {
  opacity: 0.42;
  cursor: not-allowed;
}
.sc-day:focus-visible,
.sc-cal-tile:focus-visible,
.sc-btn-primary:focus-visible,
.sc-btn-secondary:focus-visible,
.sc-btn-ghost:focus-visible,
.sc-link:focus-visible,
.sc-sheet-close:focus-visible {
  outline: 2px solid #5a3a30;
  outline-offset: 2px;
}

.sc-card-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ─── understated invite strip ─── */
.sc-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid rgba(234, 208, 204, 0.4);
  border-radius: var(--radius, 18px);
  background: rgba(255, 252, 249, 0.7);
  padding: 12px 14px;
}
.sc-strip-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.sc-strip-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 14px;
  color: var(--text, #5a4a42);
}
.sc-strip-cta {
  flex-shrink: 0;
}

/* ─── buttons ─── */
.sc-btn-primary,
.sc-btn-secondary,
.sc-btn-ghost {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 500;
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
  border: 1px solid transparent;
  text-align: center;
  min-height: 44px;
  box-sizing: border-box;
}
.sc-btn-primary {
  background: var(--sc-rose);
  color: #5a3a30;
}
.sc-btn-secondary {
  background: rgba(255, 252, 249, 0.9);
  color: #5a3a30;
  border-color: rgba(158, 98, 89, 0.4);
}
.sc-btn-ghost {
  background: transparent;
  color: var(--text-light, #8a7a72);
}
/* Completed day: inert by design (no second completion, no undo in this
   version). Kept solid rather than greyed out, in a slightly deeper blush
   than the active CTA so "done" reads as settled — still rose, never grey. */
.sc-btn-done {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 600;
  border-radius: 999px;
  padding: 12px 18px;
  min-height: 44px;
  box-sizing: border-box;
  border: 1px solid var(--sc-rose-deep);
  background: var(--sc-rose-deep);
  color: #5a3a30;
  cursor: default;
  opacity: 1;
  -webkit-text-fill-color: #5a3a30;
  position: relative;
  overflow: visible;
}
.sc-btn-done .sc-check {
  color: #5a3a30;
  font-size: 13px;
  line-height: 1;
}
.sc-btn-done--celebrate {
  animation: sc-blush-glow 1.05s ease-out;
}
.sc-check--draw {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sc-check--draw svg {
  display: block;
}
.sc-check--draw path {
  stroke-dasharray: 22;
  stroke-dashoffset: 22;
  animation: sc-check-draw 0.42s ease-out 0.08s forwards;
}
.sc-sparkle {
  position: absolute;
  left: 50%;
  top: 42%;
  width: 4px;
  height: 4px;
  margin: 0;
  border-radius: 50%;
  background: var(--sc-hue, #d4b5ad);
  pointer-events: none;
  transform: translateX(var(--sc-sx, 0px));
  animation: sc-sparkle-rise 0.95s ease-out var(--sc-delay, 0s) forwards;
  box-shadow: 0 0 6px rgba(201, 163, 106, 0.45);
}
.sc-sparkle--lg {
  width: 5px;
  height: 5px;
}
.sc-sheet-celebrate-line {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 15px;
  font-weight: 500;
  color: #5a3a30;
  margin: 14px 0 0;
}
.sc-link {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: #5a3a30;
  background: transparent;
  border: 0;
  padding: 8px 4px;
  cursor: pointer;
  min-height: 44px;
}

/* ─── backdrop + dialogs ─── */
.sc-backdrop[hidden] {
  display: none !important;
}
.sc-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10260;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right))
    max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  background: var(--overlay-bg, rgba(90, 74, 66, 0.3));
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  box-sizing: border-box;
}
.sc-backdrop--sheet {
  align-items: flex-end;
  padding: 0;
}
.sc-modal {
  width: 100%;
  max-width: 360px;
  background: var(--card, #fff);
  border: 1px solid var(--paper-border, rgba(234, 208, 204, 0.25));
  border-radius: var(--radius-lg, 22px);
  box-shadow: var(--shadow-lg, 0 6px 20px rgba(90, 74, 66, 0.08));
  padding: 24px 22px 20px;
  box-sizing: border-box;
  animation: sc-modal-in 0.24s ease;
}
.sc-modal-title {
  font-size: 22px;
  font-weight: 500;
  color: var(--text, #5a4a42);
  margin: 0 0 10px;
  letter-spacing: -0.01em;
}
.sc-modal-body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text, #5a4a42);
  margin: 0 0 14px;
}
.sc-modal-q {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 15px;
  color: var(--text, #5a4a42);
  margin: 0 0 16px;
}
.sc-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* bottom sheet */
.sc-sheet {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  max-height: 88vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--card, #fff);
  border-radius: var(--radius-lg, 22px) var(--radius-lg, 22px) 0 0;
  box-shadow: 0 -8px 30px rgba(90, 74, 66, 0.16);
  padding: 10px 20px calc(24px + env(safe-area-inset-bottom));
  box-sizing: border-box;
  position: relative;
  animation: sc-sheet-in 0.26s ease;
}
.sc-sheet-grabber {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: rgba(138, 114, 104, 0.3);
  margin: 4px auto 12px;
}
.sc-sheet-close {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  line-height: 1;
  color: var(--text-light, #8a7a72);
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.sc-sheet-title {
  font-size: 20px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--text, #5a4a42);
  margin: 4px 0 6px;
}
.sc-sheet-theme-line {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12.5px;
  font-style: italic;
  color: var(--text-light, #8a7a72);
  margin: 0 0 12px;
}
.sc-sheet-copy {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text, #5a4a42);
  margin: 0 0 14px;
}
.sc-sheet-hint {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-light, #8a7a72);
  margin: 0 0 14px;
}
.sc-sheet-done-note {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12.5px;
  color: #5a3a30;
  margin: 12px 0 0;
}
.sc-prompt {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text, #5a4a42);
  border-left: 2px solid var(--accent-strong, #d4b5ad);
  padding: 4px 0 4px 14px;
  margin: 0 0 12px;
}
.sc-note-label {
  display: block;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 11px;
  color: var(--text-light, #8a7a72);
  margin: 0 0 6px;
}
.sc-note-input {
  width: 100%;
  box-sizing: border-box;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text, #5a4a42);
  background: var(--input-bg, #fff2ef);
  border: 1px solid var(--border, rgba(234, 208, 204, 0.45));
  border-radius: var(--radius-sm, 14px);
  padding: 10px 12px;
  margin: 0 0 14px;
  resize: vertical;
}
.sc-sheet-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ─── full calendar ─── */
.sc-sheet--calendar {
  background: linear-gradient(
    180deg,
    rgba(255, 252, 249, 0.98) 0%,
    rgba(252, 244, 238, 0.96) 100%
  );
}
.sc-sheet--calendar .sc-cal-week {
  margin: 18px 0 0;
  border-radius: 16px;
  border: 1px solid rgba(234, 208, 204, 0.35);
  background: rgba(255, 248, 244, 0.72);
  overflow: hidden;
}
.sc-sheet--calendar .sc-cal-week-head {
  padding: 12px 14px 10px;
  background: rgba(252, 236, 230, 0.55);
  border-bottom: 1px solid rgba(234, 208, 204, 0.28);
}
.sc-cal-week-num {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-strong, #d4b5ad);
  margin: 0 0 4px;
}
.sc-cal-group-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 16px;
  font-weight: 500;
  color: var(--text, #5a4a42);
  margin: 0;
}
.sc-cal-group-line {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12px;
  font-style: italic;
  line-height: 1.45;
  color: var(--text-light, #8a7a72);
  margin: 4px 0 0;
}
.sc-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  padding: 12px 10px 14px;
}
.sc-cal-grid--final {
  padding-top: 10px;
}
.sc-cal-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 52px;
  padding: 5px 2px 6px;
  border-radius: 11px;
  border: 1px solid rgba(212, 181, 173, 0.35);
  background: rgba(255, 252, 249, 0.75);
  color: #5a3a30;
  font-family: 'Inter', system-ui, sans-serif;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.sc-cal-tile-num {
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}
.sc-cal-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  color: rgba(158, 98, 89, 0.82);
}
.sc-cal-icon svg {
  width: 14px;
  height: 14px;
  display: block;
}
.sc-cal-tile .sc-check {
  position: absolute;
  top: 3px;
  right: 4px;
  font-size: 9px;
  line-height: 1;
  color: #5a3a30;
}
.sc-cal-today-mark {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #5a3a30;
}
.sc-cal-tile--today {
  background: var(--sc-rose);
  border-color: var(--sc-rose);
  font-weight: 600;
}
.sc-cal-tile--completed {
  background: var(--sc-rose-tint);
  border-color: rgba(158, 98, 89, 0.4);
}
.sc-cal-tile--locked {
  opacity: 0.42;
  cursor: not-allowed;
}
.sc-cal-week--final .sc-cal-week-head {
  padding-bottom: 8px;
}
.sc-cal-week--final .sc-cal-tile[data-sc-cal-day='29'] {
  grid-column: 3;
}
.sc-cal-week--final .sc-cal-tile[data-sc-cal-day='30'] {
  grid-column: 4;
}

/* ─── motion ─── */
@keyframes sc-modal-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes sc-sheet-in {
  from {
    transform: translateY(16px);
    opacity: 0.7;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
@keyframes sc-blush-glow {
  0% {
    box-shadow: 0 0 0 0 rgba(207, 175, 163, 0);
  }
  28% {
    box-shadow: 0 0 22px 6px rgba(207, 175, 163, 0.5);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(207, 175, 163, 0);
  }
}
@keyframes sc-check-draw {
  to {
    stroke-dashoffset: 0;
  }
}
@keyframes sc-sparkle-rise {
  0% {
    opacity: 0.9;
    transform: translateX(var(--sc-sx, 0px)) translateY(6px) scale(0.6);
  }
  70% {
    opacity: 0.85;
  }
  100% {
    opacity: 0;
    transform: translateX(var(--sc-sx, 0px)) translateY(-28px) scale(1);
  }
}
@media (prefers-reduced-motion: reduce) {
  .sc-modal,
  .sc-sheet,
  .sc-btn-done--celebrate,
  .sc-check--draw path,
  .sc-sparkle {
    animation: none;
  }
  .sc-day,
  .sc-btn-primary,
  .sc-btn-secondary,
  .sc-btn-ghost {
    transition: none;
  }
}

html.sc-modal-open,
html.sc-modal-open body {
  overflow: hidden;
}
