/* ============================================================
   CKB-WEB-MOBILE-RESPONSIVE-R2
   Navigation + Calendar + Core Detail Mobile Review
   Parent: CKB-WEB-MOBILE-RESPONSIVE-R1-R1A

   Scope:
   - Preserve the R1-R1A Gallery model and all protected desktop visuals.
   - Make compact Navigation state legible and consistent across pages.
   - Improve Calendar selected-day feedback, month controls and mobile detail flow.
   - Refine Event Detail and service/form readability on phone/tablet.
   ============================================================ */

/* ------------------------------------------------------------
   1) Compact Navigation: current-section cue + safer long labels.
   ------------------------------------------------------------ */
@media (max-width: 1240px) {
  .mobile-root-nav > button,
  .mobile-root-nav > a {
    position: relative;
    padding-right: 42px !important;
  }

  .mobile-root-nav > button.is-current::after,
  .mobile-root-nav > a.is-current::after {
    content: "";
    position: absolute;
    right: 2px;
    top: 50%;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #fff;
    transform: translateY(-50%);
  }

  .nav-curtain-inner {
    padding-bottom: max(34px, env(safe-area-inset-bottom)) !important;
  }

  .curtain-link,
  .curtain-primary-link {
    overflow-wrap: anywhere;
  }
}

@media (max-width: 640px) {
  .curtain-mode { white-space: nowrap; }
  .mobile-root-nav > button,
  .mobile-root-nav > a {
    font-size: clamp(29px, 9vw, 40px) !important;
    line-height: 1.02 !important;
  }
  .curtain-link {
    font-size: clamp(22px, 6.5vw, 25px) !important;
  }
  .mobile-root-meta { padding-top: 20px !important; }
}

/* ------------------------------------------------------------
   2) Calendar: selected-day state, non-clipping month title and
      stronger task hierarchy on phone/tablet.
   ------------------------------------------------------------ */
.day.has-event.is-selected {
  background: var(--curtain-bg) !important;
  color: #fff !important;
  outline: 1px solid var(--curtain-bg) !important;
  outline-offset: -1px;
}
.day.has-event.is-selected i { background: #fff !important; }
.day.has-event.is-selected small { color: rgba(255,255,255,.76) !important; }
.day.has-event.is-selected.is-today > span {
  background: #fff !important;
  color: var(--curtain-bg) !important;
}

@media (max-width: 860px) {
  .calendar-title-cluster h1 {
    font-size: clamp(24px, 6.8vw, 34px) !important;
    overflow: visible !important;
    text-overflow: initial !important;
  }

  .calendar-quick-controls {
    grid-template-columns: minmax(72px, auto) minmax(0, 1fr) !important;
  }

  .ongoing-item span {
    font-size: 11px !important;
    line-height: 1.35 !important;
    letter-spacing: .055em !important;
  }

  .calendar-day-panel .section-heading h2 {
    font-size: clamp(30px, 8.5vw, 38px) !important;
    line-height: 1 !important;
  }

  .calendar-day-event small {
    font-size: 11.5px !important;
    line-height: 1.4 !important;
    letter-spacing: .055em !important;
  }
}

@media (max-width: 360px) {
  .calendar-main { width: calc(100vw - 16px) !important; }
  .calendar-title-cluster {
    grid-template-columns: 36px minmax(0,1fr) 36px !important;
    column-gap: 6px !important;
  }
  .calendar-title-cluster .month-controls button {
    width: 36px !important;
    min-width: 36px !important;
  }
  .calendar-title-cluster h1 { font-size: 24px !important; }
  .weekday { padding-inline: 2px !important; }
  .day { padding-inline: 3px !important; }
}

/* ------------------------------------------------------------
   3) Event Detail: mobile facts and registration remain readable;
      tablet avoids a cramped two-column content split.
   ------------------------------------------------------------ */
@media (min-width: 861px) and (max-width: 1100px) {
  .detail-main { width: calc(100vw - 40px) !important; padding-top: 46px; }
  .detail-hero { grid-template-columns: 96px minmax(0,1fr); }
  .detail-hero h1 { font-size: clamp(48px, 6.4vw, 68px) !important; }
  .detail-facts { gap: 24px 34px; }
  .detail-media-copy { grid-template-columns: 1fr !important; gap: 34px !important; }
  .detail-copy { max-width: 760px; }
}

@media (max-width: 640px) {
  .detail-back {
    margin-bottom: 28px !important;
    font-size: 13px !important;
    letter-spacing: .06em !important;
  }
  .detail-facts span { font-size: 11px !important; letter-spacing: .1em !important; }
  .detail-facts small { font-size: 15px !important; line-height: 1.45 !important; }
  .registration-panel { margin-top: 34px !important; }
  .registration-panel h2 { font-size: 28px !important; line-height: 1.04 !important; }
  .registration-body { font-size: 16px !important; line-height: 1.55 !important; }
  .detail-cta { font-size: 13px !important; }
}

.detail-error {
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--hairline);
  padding: 34px 0 48px;
}
.detail-error h1 {
  margin: 12px 0 18px;
  font-size: clamp(42px, 8vw, 76px);
  line-height: .98;
  letter-spacing: -.045em;
  font-weight: 600;
}
.detail-error p:last-child { max-width: 680px; font-size: 17px; line-height: 1.55; }

/* ------------------------------------------------------------
   4) Service + lightweight forms: touch and keyboard readability.
   Backend semantics remain unchanged (mailto prototype only).
   ------------------------------------------------------------ */
@media (max-width: 640px) {
  .service-form { padding-top: 32px !important; }
  .form-grid label { font-size: 12px !important; letter-spacing: .075em !important; }
  .form-actions p { font-size: 14px !important; line-height: 1.55 !important; }
  .primary-button {
    min-height: 52px !important;
    padding: 15px 16px !important;
    line-height: 1.25;
  }
  .service-block a[href^="tel:"],
  .service-block a[href^="mailto:"] {
    display: inline-block;
    padding: 5px 0;
  }
}

/* Dynamic participation states must stay authoritative over touch-target display rules. */
.detail-cta[hidden],
.registration-deadline[hidden] {
  display: none !important;
}

/* Keep event cells on the same grid-border system as non-button days. */
.day.has-event {
  border-top: 0 !important;
  border-left: 0 !important;
}

@media (max-width: 860px) {
  .calendar-day-event {
    grid-template-columns: 74px minmax(0,1fr) 22px !important;
    gap: 5px 12px !important;
  }
  .calendar-day-event > span {
    white-space: nowrap;
    font-size: 14px !important;
  }
}
