/* ============================================
   Calendario Lunare — La Tua Luna
   ============================================ */

/* Section wrapper */
.calendar-section {
  background-color: var(--color-bg-primary);
  padding: var(--section-padding) 1.5rem;
}

.calendar-section__inner {
  max-width: 720px;
  margin: 0 auto;
}

.calendar-section__title {
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 3.5vw, 2.25rem);
  font-weight: 500;
  color: var(--color-text-primary);
  text-align: center;
  margin-bottom: 3rem;
}

/* ------------------------------------------
   Navigation (month selector)
------------------------------------------ */
.lcal__nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 2rem;
}

.lcal__nav-title {
  font-family: var(--font-serif);
  font-size: 1.375rem;
  font-weight: 500;
  color: var(--color-text-primary);
  min-width: 180px;
  text-align: center;
}

.lcal__nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: border-color 0.3s ease, color 0.3s ease;
}

.lcal__nav-btn:hover:not(:disabled) {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.lcal__nav-btn--disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

/* ------------------------------------------
   Grid
------------------------------------------ */
.lcal__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  touch-action: pan-y; /* allow vertical scroll, let JS handle horizontal swipe */
}

/* Slide-in animations after a horizontal swipe (mobile). */
.lcal__grid--slide-next {
  animation: lcalSlideFromRight 200ms ease-out;
}

.lcal__grid--slide-prev {
  animation: lcalSlideFromLeft 200ms ease-out;
}

@keyframes lcalSlideFromRight {
  from { transform: translateX(24px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

@keyframes lcalSlideFromLeft {
  from { transform: translateX(-24px); opacity: 0; }
  to   { transform: translateX(0);     opacity: 1; }
}

/* Weekday header */
.lcal__weekday {
  text-align: center;
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-secondary);
  padding-bottom: 0.75rem;
}

/* ------------------------------------------
   Day cell
------------------------------------------ */
.lcal__cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 0.25rem;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  min-height: 80px;
  justify-content: center;
  gap: 3px;
}

.lcal__cell--empty {
  min-height: 0;
}

.lcal__day-num {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-primary);
  line-height: 1;
}

.lcal__moon-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.lcal__illum {
  font-family: var(--font-sans);
  font-size: 0.625rem;
  color: var(--color-text-secondary);
  line-height: 1;
}

/* States */
.lcal__cell--available {
  cursor: pointer;
  background-color: #1e1e28;
  border-radius: 8px;
}

.lcal__cell--available:hover {
  background-color: #2a2a35;
  border-color: var(--color-accent);
}

.lcal__cell--selected {
  background-color: var(--color-bg-card);
  border-color: var(--color-accent);
  box-shadow: 0 0 16px rgba(201, 168, 76, 0.15);
}

.lcal__cell--selected .lcal__day-num {
  color: var(--color-accent);
}

.lcal__cell--past {
  opacity: 0.25;
}

.lcal__cell--dark {
  opacity: 0.35;
  cursor: not-allowed;
}

.lcal__cell--blocked {
  position: relative;
  opacity: 0.45;
  cursor: not-allowed;
}

.lcal__blocked-dash {
  display: block;
  width: 16px;
  height: 2px;
  background-color: #8a8a95;
  border-radius: 1px;
  margin: -2px auto 0;
}

.lcal__cell--dark .lcal__day-num {
  text-decoration: line-through;
  text-decoration-color: var(--color-text-secondary);
}

/* ------------------------------------------
   Legend
------------------------------------------ */
.lcal__legend {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}

.lcal__legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--color-text-secondary);
}

.lcal__legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.lcal__legend-dot--available {
  background-color: var(--color-text-secondary);
  border: 1px solid var(--color-text-secondary);
}

.lcal__legend-dot--selected {
  background-color: var(--color-accent);
}

.lcal__legend-dot--dark {
  background-color: var(--color-bg-card);
  border: 1px solid var(--color-border);
}

.lcal__legend-dot--blocked {
  position: relative;
  background-color: var(--color-text-secondary);
  opacity: 0.45;
}

.lcal__legend-dot--blocked::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 6px;
  height: 1.5px;
  background-color: #8a8a95;
  border-radius: 1px;
}

/* ------------------------------------------
   Calendar hint (contextual, CTA-triggered)
------------------------------------------ */
.calendar-hint {
  text-align: center;
  margin-bottom: 20px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.5s ease, transform 0.5s ease;
  pointer-events: none;
}

.calendar-hint.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.calendar-hint__link {
  color: #8a8a95;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  text-decoration: none;
  transition: color 0.3s ease;
}

.calendar-hint__link:hover {
  color: var(--color-text-primary, #e8e6e1);
}

.calendar-hint__arrow {
  display: inline-block;
  animation: hintBounce 1.8s ease-in-out infinite;
}

@keyframes hintBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(4px); }
}

/* ------------------------------------------
   Detail panel overlay (mobile)
------------------------------------------ */
.lcal__overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 899;
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}

.lcal__overlay--visible {
  opacity: 1;
  pointer-events: auto;
}

/* ------------------------------------------
   Detail panel
------------------------------------------ */
.lcal__detail {
  margin-top: 1.5rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background-color: var(--color-bg-secondary);
  overflow: hidden;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.lcal__detail--visible {
  opacity: 1;
  transform: translateY(0);
}

/* Handle bar — hidden on desktop */
.lcal__detail-handle {
  display: none;
}

.lcal__detail-inner {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 2rem;
}

.lcal__detail-moon {
  flex-shrink: 0;
  line-height: 0;
}

.lcal__detail-info {
  flex: 1;
  min-width: 0;
}

.lcal__detail-date {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--color-text-primary);
  margin-bottom: 0.25rem;
}

.lcal__detail-phase {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.9375rem;
  color: var(--color-accent);
  margin-bottom: 1rem;
}

.lcal__detail-data {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-bottom: 1.25rem;
}

.lcal__detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  max-width: 260px;
}

.lcal__detail-row span:last-child {
  color: var(--color-text-primary);
  font-weight: 500;
}

.lcal__detail-day {
  /* Same color as the row label (#8a8a95) and same font-size, per spec. */
  color: var(--color-text-secondary);
  font-weight: 400;
  margin-left: 0.25rem;
}

.lcal__detail-cta {
  font-size: 0.75rem;
  padding: 0.75rem 1.75rem;
}

/* ------------------------------------------
   Responsive
------------------------------------------ */
@media (max-width: 768px) {
  .lcal__cell {
    min-height: 64px;
    padding: 0.35rem 0.15rem;
    gap: 2px;
  }

  .lcal__moon-icon svg {
    width: 22px;
    height: 22px;
  }

  .lcal__day-num {
    font-size: 0.6875rem;
  }

  .lcal__illum {
    font-size: 0.5625rem;
  }

  .lcal__legend {
    gap: 1rem;
    flex-wrap: wrap;
  }

  /* Detail as bottom sheet */
  .lcal__detail {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0;
    border-radius: 16px 16px 0 0;
    border: none;
    border-top: 1px solid var(--color-border);
    z-index: 900;
    max-height: 55vh;
    overflow-y: auto;
    transform: translateY(100%);
    opacity: 1;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .lcal__detail--visible {
    transform: translateY(0);
  }

  /* Handle bar */
  .lcal__detail-handle {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 12px 0 4px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .lcal__detail-handle-bar {
    display: block;
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background-color: #8a8a95;
  }

  .lcal__detail-inner {
    flex-direction: column;
    text-align: center;
    padding: 0.75rem 1.5rem 1.5rem;
  }

  .lcal__detail-data {
    align-items: center;
  }

  .lcal__detail-row {
    gap: 2rem;
  }

  .lcal__detail-cta {
    width: 100%;
    text-align: center;
  }
}
