/* ==========================================================================
   Juice Wine Bar - events calendar
   Linked only from /calendar. Everything here is scoped to the calendar page
   so main.css stays the shared sheet. Tokens (plum, cream, sand, pink, berry,
   mauve, green, serif, sans, ease, wrap, gutter) come from main.css.
   Sections: page / toolbar / month grid / chips / list / static agenda /
   weekly band / modal / responsive
   ========================================================================== */

/* 1. Page shell */
.cal-page { padding: 80px 0 40px; }
.cal-page .page-head .lede-sm { margin-top: 20px; }

.cal-wrap { max-width: 1160px; margin: 0 auto; padding: 0 var(--gutter); }

/* The pre-rendered agenda is the no-JavaScript view. calendar.js sets
   .has-cal-js on <html> before paint and swaps in the interactive calendar.
   If the script throws, it drops the class again and this comes back. */
.cal-app { display: none; }
.has-cal-js .cal-app { display: block; }
.has-cal-js .cal-static { display: none; }

/* 2. Toolbar */
.cal-toolbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin: 48px 0 0; padding-bottom: 22px; border-bottom: 1px solid var(--plum-line-2);
}
.cal-month {
  margin: 0; font-family: var(--serif); font-weight: 400; letter-spacing: -.02em;
  font-size: clamp(30px, 3.4vw, 44px); line-height: 1; min-width: 5.6em; text-align: center;
}
.cal-nav {
  width: 46px; height: 46px; flex: none; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; border: 1.5px solid var(--plum-line-2); background: transparent; color: var(--plum);
  cursor: pointer; transition: background .25s, border-color .25s, color .25s, transform .25s var(--ease);
}
.cal-nav:hover { background: var(--plum); border-color: var(--plum); color: var(--cream); transform: translateY(-2px); }
.cal-nav svg { width: 16px; height: 16px; }
.cal-today {
  margin-left: 2px; padding: 11px 18px; border-radius: 999px; border: 1.5px solid var(--plum-line-2);
  background: transparent; color: var(--plum); font-size: 13px; font-weight: 700; cursor: pointer;
  transition: background .25s, border-color .25s, color .25s;
}
.cal-today:hover { background: var(--pink); border-color: var(--pink); }
.cal-views { margin-left: auto; display: flex; gap: 4px; padding: 5px; border-radius: 999px; background: var(--sand); }
.cal-view {
  border: 0; cursor: pointer; padding: 10px 22px; border-radius: 999px; background: transparent;
  color: var(--plum); font-size: 14px; font-weight: 700; transition: background .3s, color .3s;
}
.cal-view[aria-pressed="true"] { background: var(--plum); color: var(--cream); }
.cal-weekstart { width: 100%; margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--mauve); }

/* 3. Month grid */
.cal-view-panel[hidden] { display: none; }
.cal-grid { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; margin-top: 26px; }
.cal-grid th {
  padding: 0 0 12px; font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  color: var(--mauve); text-align: left;
}
.cal-grid th abbr { text-decoration: none; border: 0; }
.cal-grid td {
  vertical-align: top; height: 132px; padding: 10px 10px 12px; border-top: 1px solid var(--plum-line);
  border-left: 1px solid var(--plum-line); background: transparent;
}
.cal-grid tr td:last-child { border-right: 1px solid var(--plum-line); }
.cal-grid tr:last-child td { border-bottom: 1px solid var(--plum-line); }
.cal-grid tr:first-child td:first-child { border-top-left-radius: 18px; }
.cal-grid tr:first-child td:last-child { border-top-right-radius: 18px; }
.cal-grid tr:last-child td:first-child { border-bottom-left-radius: 18px; }
.cal-grid tr:last-child td:last-child { border-bottom-right-radius: 18px; }

.cal-cell.is-out { background: rgba(43, 18, 48, .03); }
.cal-cell.is-out .cal-daynum { color: rgba(43, 18, 48, .3); }
.cal-cell.is-past .cal-daynum { color: rgba(43, 18, 48, .4); }
.cal-cell.is-past .cal-chip { opacity: .55; }
.cal-cell.is-past .cal-chip:hover, .cal-cell.is-past .cal-chip:focus-visible { opacity: 1; }
.cal-cell.is-today { background: rgba(255, 175, 179, .18); }

.cal-daynum {
  font-family: var(--serif); font-size: 22px; line-height: 1; color: var(--plum);
  display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px;
  border-radius: 999px; padding: 0 6px;
}
.cal-cell.is-today .cal-daynum { background: var(--plum); color: var(--cream); }
.cal-closed { display: block; margin-top: 8px; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: rgba(43, 18, 48, .38); }
.cal-chips { display: flex; flex-direction: column; gap: 5px; margin-top: 7px; }
.cal-dots { display: none; }

/* 4. Chips */
.cal-chip {
  display: block; width: 100%; text-align: left; cursor: pointer; border: 1.5px solid transparent;
  border-radius: 9px; padding: 6px 8px; font-family: var(--sans); font-size: 12px; line-height: 1.25;
  color: var(--plum); background: var(--pink); transition: transform .25s var(--ease), box-shadow .25s, opacity .25s;
}
.cal-chip:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(43, 18, 48, .16); }
.cal-chip .t { display: block; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-chip .h { display: block; margin-top: 2px; font-size: 11px; font-weight: 600; opacity: .78; }

.cal-chip.tag-free, .cal-chip.tag-weekly { background: var(--pink); color: var(--plum); }
.cal-chip.tag-workshop, .cal-chip.tag-market { background: var(--sand); color: var(--plum); }
.cal-chip.tag-brunch { background: var(--sand-2); color: var(--plum); }
.cal-chip.tag-ticketed { background: var(--cream); color: var(--plum); border-color: var(--plum); }
.cal-chip.tag-drag { background: var(--berry); color: var(--cream); }
.cal-chip.tag-live-music { background: var(--green); color: var(--cream); }

/* The same palette as a small inline badge, used in the modal and the list */
.cal-tag {
  display: inline-flex; align-items: center; padding: 6px 13px; border-radius: 999px;
  border: 1.5px solid transparent; font-size: 12px; font-weight: 700; letter-spacing: .04em;
  background: var(--pink); color: var(--plum); white-space: nowrap;
}
.cal-tag.tag-workshop, .cal-tag.tag-market { background: var(--sand); }
.cal-tag.tag-brunch { background: var(--sand-2); }
.cal-tag.tag-ticketed { background: transparent; border-color: var(--plum); }
.cal-tag.tag-drag { background: var(--berry); color: var(--cream); }
.cal-tag.tag-live-music { background: var(--green); color: var(--cream); }
.cal-flag {
  display: inline-flex; align-items: center; padding: 6px 13px; border-radius: 999px;
  border: 1.5px dashed var(--mauve); font-size: 12px; font-weight: 700; color: var(--mauve); white-space: nowrap;
}

/* 5. List view and the pre-rendered agenda share the .event row from main.css */
.cal-list { margin-top: 30px; }
.cal-daygroup + .cal-daygroup { margin-top: 34px; }
.cal-dayhead {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  margin: 0 0 4px; font-family: var(--serif); font-weight: 400; font-size: 26px; line-height: 1.1;
}
.cal-dayhead .when { font-family: var(--sans); font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--mauve); }
.cal-daygroup { border-bottom: 1px solid var(--plum-line-2); }
.cal-list .event, .cal-static .event { grid-template-columns: 124px 1fr auto; padding: 26px 0; }
.cal-list .event-when, .cal-static .event-when { white-space: nowrap; }
.cal-list .event-day, .cal-static .event-day { font-size: 42px; }
.cal-list .event h4, .cal-static .event h4 { margin: 0; font-size: 21px; font-weight: 600; letter-spacing: -.01em; }
.cal-list .event p, .cal-static .event p { margin: 8px 0 0; font-size: 15px; line-height: 1.55; color: var(--ink-2); }
.cal-listrow {
  display: grid; width: 100%; text-align: left; cursor: pointer;
  background: transparent; font-family: inherit; color: inherit;
  border: 0; border-top: 1px solid var(--plum-line-2);
}
.cal-listrow:hover { padding-left: 16px; }
.cal-rowmeta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.cal-empty { margin: 40px 0 0; padding: 34px 28px; border-radius: 20px; background: var(--sand); font-family: var(--serif); font-style: italic; font-size: 24px; color: var(--mauve); }

.cal-static { margin-top: 48px; }
.cal-static .cal-statichead { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; flex-wrap: wrap; border-bottom: 2px solid var(--plum); padding-bottom: 14px; }
.cal-static .cal-statichead h2 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 38px; line-height: 1; }
.cal-static .cal-statichead .menu-note { font-family: var(--serif); font-style: italic; font-size: 18px; color: var(--mauve); }
.cal-static .cal-list { margin-top: 22px; }

/* 6. Every week band */
.weekly-band { background: var(--sand); padding: 90px 0; margin-top: 90px; }
.weekly-band .display { max-width: 620px; }
.weekly-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 32px; flex-wrap: wrap; }
.weekly-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 44px; }
.weekly-item { background: var(--cream); border-radius: 18px; padding: 24px 24px 26px; display: flex; flex-direction: column; gap: 10px; }
.weekly-item .d { font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--mauve); }
.weekly-item h3 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 27px; line-height: 1.05; }
.weekly-item .h { font-size: 14px; font-weight: 700; }
.weekly-item p { margin: 0; font-size: 15px; line-height: 1.55; color: var(--ink-2); }

.host-band { padding: 90px var(--gutter) 110px; }
.host-band .dark-card { max-width: 1160px; margin: 0 auto; }

/* 7. Event modal */
html.cal-open, html.cal-open body { overflow: hidden; }
.cal-modal {
  border: 0; padding: 0; background: transparent; color: var(--plum);
  width: min(560px, calc(100vw - 32px)); max-width: min(560px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px); overflow: auto; border-radius: 28px; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: rgba(43, 18, 48, .28) transparent;
}
.cal-modal::backdrop { background: rgba(43, 18, 48, .6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.cal-modal[open] { animation: cal-rise .4s var(--ease) both; }
.cal-modal-inner { position: relative; background: #fff; border-radius: 28px; padding: 40px 36px; box-shadow: 0 30px 80px rgba(43, 18, 48, .18); }
.cal-modal-close {
  position: absolute; top: 16px; right: 16px; width: 44px; height: 44px; display: flex; align-items: center;
  justify-content: center; padding: 0; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--cream); color: var(--plum); transition: background .25s, color .25s;
}
.cal-modal-close:hover { background: var(--plum); color: var(--cream); }
.cal-modal-meta { display: flex; flex-wrap: wrap; gap: 8px; padding-right: 52px; }
.cal-modal h2 { margin: 18px 0 0; font-family: var(--serif); font-weight: 400; font-size: clamp(32px, 4.4vw, 42px); line-height: 1.02; }
.cal-modal .cal-modal-when { margin: 14px 0 0; font-size: 15px; font-weight: 700; }
.cal-modal .cal-modal-partner { margin: 6px 0 0; font-size: 14px; font-weight: 600; color: var(--mauve); }
.cal-modal .cal-modal-blurb { margin: 16px 0 0; font-size: 16px; line-height: 1.6; color: var(--ink-2); }
.cal-modal .cal-modal-price { margin: 18px 0 0; font-family: var(--serif); font-size: 28px; line-height: 1; }
.cal-modal-note { margin: 18px 0 0; padding: 12px 16px; border-radius: 12px; background: var(--sand); font-size: 13px; font-weight: 600; color: var(--mauve); }
.cal-modal-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.cal-modal-actions .btn { font-size: 14px; padding: 14px 24px; }
.cal-ics { display: inline-flex; align-items: center; padding: 4px 0; border-bottom: 1.5px solid var(--plum); font-size: 14px; font-weight: 700; margin-top: 18px; transition: color .25s, border-color .25s; }
.cal-ics:hover { color: var(--berry); border-color: var(--berry); }
@keyframes cal-rise { from { opacity: 0; transform: translateY(24px) scale(.985); } to { opacity: 1; transform: none; } }

/* 8. Responsive */
@media (max-width: 1000px) {
  .weekly-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .cal-page { padding: 56px 0 30px; }
  .cal-grid td { height: 108px; padding: 8px 7px 10px; }
  .cal-chip { padding: 5px 7px; font-size: 11px; }
}
@media (max-width: 700px) {
  /* Compact strip: the cell keeps the day number and shows one dot per event.
     List view is the default at this width, so the grid is the scan tool. */
  .cal-toolbar { gap: 10px; padding-bottom: 16px; }
  .cal-month { font-size: 26px; min-width: 0; flex: 1 1 auto; }
  .cal-nav { width: 40px; height: 40px; }
  .cal-today { display: none; }
  .cal-views { margin-left: 0; width: 100%; justify-content: center; }
  .cal-view { flex: 1; padding: 10px 12px; }
  .cal-grid { margin-top: 18px; }
  .cal-grid th { font-size: 10px; letter-spacing: .1em; text-align: center; padding-bottom: 8px; }
  .cal-grid td { height: 62px; padding: 6px 2px; text-align: center; }
  .cal-daynum { font-size: 16px; min-width: 24px; height: 24px; padding: 0 4px; }
  .cal-closed { display: none; }
  .cal-chips { display: none; }
  .cal-dots { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; margin-top: 5px; }
  .cal-dot { width: 7px; height: 7px; padding: 0; border: 0; border-radius: 999px; background: var(--pink); cursor: pointer; }
  .cal-dot.tag-workshop, .cal-dot.tag-market { background: #D8B48C; }
  .cal-dot.tag-brunch { background: #E6B98A; }
  .cal-dot.tag-ticketed { background: transparent; border: 1.5px solid var(--plum); }
  .cal-dot.tag-drag { background: var(--berry); }
  .cal-dot.tag-live-music { background: var(--green); }
  .cal-list .event, .cal-static .event { grid-template-columns: 72px 1fr; }
  .cal-list .event-time, .cal-static .event-time { grid-column: 2; justify-self: start; }
  .cal-list .event-day, .cal-static .event-day { font-size: 34px; }
  .weekly-band { padding: 64px 0; margin-top: 64px; }
  .weekly-grid { grid-template-columns: 1fr; gap: 14px; }
  .host-band { padding: 64px var(--gutter) 80px; }
  .cal-modal-inner { padding: 32px 22px; border-radius: 24px; }
  .cal-modal-actions .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .cal-modal[open] { animation: none; }
  .cal-chip:hover, .cal-nav:hover { transform: none; }
}
