/* Shared public month-calendar presentation.

   Both the current mobile-first layout and the cookie-selected legacy layout
   use this product-token-backed module. Keep selectors beneath
   `.public-calendar` so calendar component names cannot leak into other pages. */

.public-calendar {
  color: var(--product-text);
  font-family: "Inter", sans-serif;
}

.public-calendar > h1 {
  margin-bottom: 1rem;
  color: var(--product-text);
  text-align: center;
}

.public-calendar .calendar-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  text-align: center;
}

.public-calendar .calendar-nav a,
.public-calendar #year-view-btn,
.public-calendar #return-new-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 1px solid transparent;
  border-radius: 0.65rem;
  background: var(--product-action-bg);
  color: var(--product-on-action);
  font-weight: 600;
  line-height: 1.25;
  text-decoration: none;
  transition: background-color 0.2s ease, box-shadow 0.2s ease,
    transform 0.2s ease;
}

.public-calendar .calendar-nav a,
.public-calendar #year-view-btn {
  padding: 0.5rem 0.85rem;
}

.public-calendar .calendar-nav a:hover,
.public-calendar #year-view-btn:hover,
.public-calendar #return-new-btn:hover {
  background: var(--product-action-hover);
  color: var(--product-on-action);
}

.public-calendar a:focus-visible,
.public-calendar button:focus-visible {
  outline: 3px solid var(--product-primary-strong);
  outline-offset: 3px;
}

.public-calendar .calendar-grid {
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--product-border);
  border-radius: 0.75rem;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  background: var(--product-surface);
  box-shadow: var(--product-shadow);
}

.public-calendar .calendar-grid th,
.public-calendar .calendar-grid td {
  width: 14.285%;
  text-align: center;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.public-calendar .calendar-grid th {
  padding: 0.6rem 0.2rem;
  background: var(--product-action-bg);
  color: var(--product-on-action);
  font-size: 0.875rem;
  font-weight: 700;
}

.public-calendar .calendar-grid td {
  position: relative;
  min-height: 5rem;
  padding: 0.35rem;
  border-right: 1px solid var(--product-border);
  border-bottom: 1px solid var(--product-border);
  background: var(--product-surface-muted);
}

.public-calendar .calendar-grid td:last-child {
  border-right: 0;
}

.public-calendar .calendar-grid tr:last-child td {
  border-bottom: 0;
}

.public-calendar .calendar-grid td strong {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--product-primary-strong);
}

.public-calendar .calendar-grid td ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.public-calendar .demo-cell {
  display: block;
  margin-bottom: 0.2rem;
  overflow: hidden;
  border-radius: 0.35rem;
  padding: 0.2rem 0.3rem;
  background: var(--product-action-bg);
  color: var(--product-on-action);
  font-size: 0.75rem;
  line-height: 1.25;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.public-calendar .demo-cell:hover {
  background: var(--product-action-hover);
  color: var(--product-on-action);
}

.public-calendar #demo-preview {
  position: absolute;
  z-index: 9999;
  display: none;
  max-width: min(18.75rem, calc(100vw - 2rem));
  border: 1px solid var(--product-border);
  border-radius: 0.75rem;
  padding: 0.75rem;
  background: var(--product-surface);
  color: var(--product-text);
  box-shadow: var(--product-shadow);
}

.public-calendar #demo-preview img {
  max-width: 100%;
  margin-bottom: 0.4rem;
  border-radius: 0.4rem;
}

.public-calendar #demo-preview p:last-child {
  margin-bottom: 0;
}

.public-calendar .mobile-list-view,
.public-calendar .mobile-new-view-switch {
  display: none;
}

.public-calendar .mobile-day-card {
  margin-bottom: 1rem;
  border: 1px solid var(--product-border);
  border-left: 0.25rem solid var(--product-primary);
  border-radius: 0.75rem;
  padding: 1rem;
  background: var(--product-surface);
  color: var(--product-text);
  box-shadow: var(--product-shadow);
}

.public-calendar .mobile-day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.65rem;
  border-bottom: 1px solid var(--product-border);
  padding-bottom: 0.65rem;
}

.public-calendar .mobile-day-number {
  color: var(--product-primary-strong);
  font-size: 1.5rem;
  font-weight: 700;
}

.public-calendar .mobile-day-name,
.public-calendar .mobile-demo-desc,
.public-calendar .mobile-empty-day,
.public-calendar .loading {
  color: var(--product-text-muted);
}

.public-calendar .mobile-day-name {
  font-size: 0.875rem;
  font-weight: 500;
}

.public-calendar .event-count {
  color: var(--product-primary-strong);
  font-weight: 600;
  text-align: end;
}

.public-calendar .mobile-demo-item {
  display: block;
  margin-bottom: 0.5rem;
  border: 1px solid var(--product-border);
  border-radius: 0.6rem;
  padding: 0.75rem;
  background: var(--product-surface-muted);
  color: var(--product-text);
  text-decoration: none;
  transition: background-color 0.2s ease, border-color 0.2s ease,
    transform 0.2s ease;
}

.public-calendar .mobile-demo-item:hover,
.public-calendar .mobile-demo-item:active {
  border-color: var(--product-primary);
  background: var(--product-primary-soft);
  color: var(--product-text);
  transform: translateX(0.3rem);
}

.public-calendar .mobile-demo-title {
  margin-bottom: 0.3rem;
  color: var(--product-primary-strong);
  font-weight: 700;
}

.public-calendar .mobile-demo-desc {
  font-size: 0.8125rem;
  line-height: 1.45;
}

.public-calendar .mobile-demo-image {
  width: 100%;
  height: 9.375rem;
  margin-top: 0.5rem;
  border-radius: 0.4rem;
  object-fit: cover;
}

.public-calendar .mobile-empty-day {
  padding: 1.25rem 0;
  text-align: center;
}

.public-calendar .loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 1rem;
  font-size: 1rem;
  animation: public-calendar-fade-in 0.3s ease-in-out;
}

.public-calendar .loading.hidden {
  display: none;
}

.public-calendar .to-old {
  position: relative;
  max-width: 31.25rem;
  overflow: hidden;
  margin: 1rem auto;
  border: 1px solid var(--product-primary);
  border-radius: 1rem;
  padding: 1.5rem;
  background: var(--product-action-bg);
  color: var(--product-on-action);
  text-align: center;
  box-shadow: var(--product-shadow);
  animation: public-calendar-slide-down 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.public-calendar .to-old::before {
  position: absolute;
  inset: -50%;
  background: radial-gradient(
    circle,
    color-mix(in srgb, var(--product-on-action) 14%, transparent) 0%,
    transparent 70%
  );
  content: "";
  pointer-events: none;
}

.public-calendar .to-old-content {
  position: relative;
  z-index: 1;
}

.public-calendar .banner-icon {
  display: inline-flex;
  width: 3rem;
  height: 3rem;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
  border-radius: 50%;
  background: color-mix(in srgb, var(--product-on-action) 18%, transparent);
}

.public-calendar .to-old i.fa-flask {
  color: var(--product-on-action);
  font-size: 1.5rem;
}

.public-calendar .banner-title {
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
  font-weight: 700;
}

.public-calendar .banner-subtitle {
  margin-bottom: 1rem;
  font-size: 0.9rem;
  line-height: 1.5;
}

.public-calendar .to-old button:not(.dismiss-btn) {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--product-on-action);
  border-radius: 0.75rem;
  padding: 0.75rem 1.5rem;
  background: var(--product-surface);
  color: var(--product-primary-strong);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 700;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.public-calendar .to-old button:not(.dismiss-btn):hover {
  box-shadow: 0 0.4rem 1.25rem color-mix(in srgb, var(--product-text) 20%, transparent);
  transform: translateY(-2px);
}

.public-calendar .dismiss-btn {
  position: absolute;
  z-index: 2;
  top: 0.75rem;
  right: 0.75rem;
  display: inline-flex;
  width: 2rem;
  height: 2rem;
  align-items: center;
  justify-content: center;
  border: 1px solid color-mix(in srgb, var(--product-on-action) 45%, transparent);
  border-radius: 50%;
  background: color-mix(in srgb, var(--product-on-action) 15%, transparent);
  color: var(--product-on-action);
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.public-calendar .dismiss-btn:hover {
  background: color-mix(in srgb, var(--product-on-action) 25%, transparent);
  transform: rotate(90deg);
}

.public-calendar .to-old.dismissed {
  animation: public-calendar-slide-up 0.3s cubic-bezier(0.4, 0, 1, 1) forwards;
}

.public-calendar #return-new-btn {
  padding: 0.65rem 1.25rem;
  cursor: pointer;
  font-size: 0.95rem;
}

.public-calendar #return-new-btn:hover {
  transform: translateY(-2px);
}

.public-calendar #return-new-btn i {
  transition: transform 0.3s ease;
}

.public-calendar #return-new-btn:hover i {
  transform: rotate(180deg);
}

@keyframes public-calendar-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes public-calendar-slide-down {
  from {
    opacity: 0;
    transform: translateY(-1.25rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes public-calendar-slide-up {
  to {
    max-height: 0;
    margin: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
    transform: translateY(-1.25rem);
  }
}

@media (min-width: 769px) {
  .public-calendar .calendar-grid th,
  .public-calendar .calendar-grid td {
    padding: 0.35rem;
    font-size: 0.75rem;
  }

  .public-calendar .demo-cell {
    font-size: 0.6875rem;
  }
}

@media (max-width: 768px) {
  .public-calendar .calendar-grid {
    display: none;
  }

  .public-calendar .mobile-list-view,
  .public-calendar--current .mb-only,
  .public-calendar--legacy .mobile-new-view-switch {
    display: block;
  }

  .public-calendar--current > h1,
  .public-calendar--current .calendar-nav {
    display: none;
  }

  .public-calendar--legacy .calendar-nav {
    flex-wrap: nowrap;
  }

  .public-calendar .calendar-nav a,
  .public-calendar #year-view-btn {
    flex: 1 1 0;
    padding: 0.55rem 0.65rem;
    font-size: 0.875rem;
  }

  .public-calendar .mobile-new-view-switch {
    margin-bottom: 1rem;
    text-align: center;
  }

  .public-calendar .to-old {
    margin: 1rem 0;
    padding: 1.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .public-calendar *,
  .public-calendar *::before,
  .public-calendar *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
