/* ═══ THE ISLAND FEED — CALENDAR VIEW REDESIGN ═══ */

/* ── DESIGN TOKENS ── */
:root {
  --bg: #F6F1E8;
  --paper: #FBF7F0;
  --ink: #171713;
  --muted: #7E7A73;
  --line: #D8D0C4;

  --green-strong: #2F5E47;
  --green-mid:    #6E936B;
  --green-soft:   #DDE8DF;

  --rust:      #BF7A30;
  --warm-gray: #8E8A83;

  --cat-market:     #6C8B6B;
  --cat-music:      #B57A4B;
  --cat-sport:      #6A7C52;
  --cat-arts:       #8A7A94;
  --cat-food:       #B98163;
  --cat-community:  #7E8E98;
  --cat-kids:       #9E8A6E;
  --cat-nature:     #5A7A52;
  --cat-motorsport: #9E6A42;
  --cat-nightlife:  #7A6A94;

  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   18px;
  --radius-pill: 999px;

  --font-ui:    "DM Sans", Arial, sans-serif;
  --font-serif: "Cormorant Garamond", Georgia, serif;
}

/* ── GLOBAL FONT OVERRIDE ── */
body { font-family: var(--font-ui); }

/* ── TOOLBAR ── */
.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--bg);
}

.calendar-toolbar__left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.calendar-toolbar__right {
  display: flex;
  align-items: center;
}

.month-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 2rem;
  font-weight: 800;
  color: var(--ink);
  margin: 0;
  line-height: 1;
  white-space: nowrap;
  min-width: 220px;
  text-align: center;
}

.nav-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-size: 1.1rem;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease;
  flex-shrink: 0;
  line-height: 1;
}

.nav-btn:hover {
  background: var(--green-soft);
  border-color: var(--green-mid);
}
.nav-btn:active { background: var(--green-soft); border-color: var(--green-mid); }
@media (hover: none) { .nav-btn:hover { background: var(--paper); border-color: var(--line); } }

.today-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 140ms ease, color 140ms ease;
}

.today-btn:hover {
  background: var(--ink);
  color: var(--paper);
}

/* ── VIEW TOGGLE ── */
.view-toggle {
  display: flex;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--line);
  overflow: hidden;
  background: var(--paper);
}

.view-toggle button {
  padding: 9px 20px;
  border: none;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease;
}

.view-toggle button.is-active {
  background: var(--green-strong);
  color: var(--paper);
}

/* ── CALENDAR VIEW LAYOUT ── */
.calendar-view {
  display: flex;
  flex-direction: column;
}

/* ── FILTER CHIPS ── */
.calendar-filters {
  display: flex;
  gap: 8px;
  padding: 8px 24px 12px;
  flex-wrap: wrap;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.filter-chip {
  padding: 6px 16px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--green-strong);
  background: var(--green-soft);
  color: var(--green-strong);
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease;
}

.filter-chip.is-active {
  background: var(--green-strong);
  color: var(--paper);
}

.filter-chip:hover:not(.is-active) {
  background: var(--green-mid);
  color: var(--paper);
}

/* ── WEEKDAY HEADER ── */
.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.calendar-weekdays > div {
  text-align: center;
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 0;
}

/* ── CALENDAR GRID OUTER ── */
.calendar-grid {
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  background: var(--bg);
  padding-bottom: 90px;
}

/* ── WEEK STRUCTURE ── */
/* style.css makes week-events-wrap a 7-col grid with week-row as display:contents.
   Override both so week-row is a block-level 7-col grid at full width.            */
.week-events-wrap {
  position: relative;
  display: block;
}

.week-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

/* ── DAY CELL ── */
.calendar-day {
  min-height: 160px;
  padding: 10px 10px 8px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: relative;
  cursor: pointer;
  transition: background-color 140ms ease;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.calendar-day:hover { background: #F1EBE1; }

.calendar-day.is-outside-month { background: var(--paper); }
.calendar-day.is-outside-month .calendar-day__date {
  color: var(--muted);
  opacity: 0.5;
}

.calendar-day.is-today { background: #BFD2BE; }
.calendar-day.is-today:hover { background: #b2c8b0; }

/* ── DAY HEADER (weather left, date right) ── */
.calendar-day__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 5px;
  flex-shrink: 0;
  min-height: 20px;
}

/* ── DATE NUMBER ── */
.calendar-day__date {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink);
  line-height: 1;
  flex-shrink: 0;
}

.calendar-day.is-today .calendar-day__date {
  background: var(--green-strong);
  color: var(--paper);
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  font-size: 0.78rem;
}

/* ── WEATHER MARKER ── */
.calendar-day__weather {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--warm-gray);
  display: flex;
  align-items: center;
  gap: 3px;
  line-height: 1;
  flex-shrink: 0;
}

/* ── EVENTS STACK ── */
.calendar-day__events {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* ── EVENT CHIP ── */
.event-chip {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 26px;
  padding: 3px 6px;
  border: none;
  border-radius: var(--radius-sm);
  background: #E7EBDD;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 500;
  text-align: left;
  overflow: hidden;
  cursor: pointer;
  transition: filter 140ms ease;
  flex-shrink: 0;
  box-sizing: border-box;
}

.event-chip:hover { filter: brightness(0.95); }

.event-chip__bar {
  width: 3px;
  align-self: stretch;
  border-radius: 999px;
  flex: 0 0 3px;
  background: var(--green-mid);
}

.event-chip__icon {
  font-size: 0.68rem;
  opacity: 0.7;
  flex-shrink: 0;
}

.event-chip__label {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  flex: 1;
}

/* ── CATEGORY CHIP TINTS + BAR COLOURS ── */
.event-chip.category-market     { background: #E5EDDF; }
.event-chip.category-market     .event-chip__bar { background: var(--cat-market); }

.event-chip.category-music      { background: #EDE7DF; }
.event-chip.category-music      .event-chip__bar { background: var(--cat-music); }

.event-chip.category-sport      { background: #E5EADE; }
.event-chip.category-sport      .event-chip__bar { background: var(--cat-sport); }

.event-chip.category-arts       { background: #EAE5EE; }
.event-chip.category-arts       .event-chip__bar { background: var(--cat-arts); }

.event-chip.category-food       { background: #EDE6DE; }
.event-chip.category-food       .event-chip__bar { background: var(--cat-food); }

.event-chip.category-community  { background: #E2E8EC; }
.event-chip.category-community  .event-chip__bar { background: var(--cat-community); }

.event-chip.category-kids       { background: #EDE8E0; }
.event-chip.category-kids       .event-chip__bar { background: var(--cat-kids); }

.event-chip.category-nature     { background: #E3EBE0; }
.event-chip.category-nature     .event-chip__bar { background: var(--cat-nature); }

.event-chip.category-motorsport { background: #EDE6E0; }
.event-chip.category-motorsport .event-chip__bar { background: var(--cat-motorsport); }

.event-chip.category-nightlife  { background: #E8E5EE; }
.event-chip.category-nightlife  .event-chip__bar { background: var(--cat-nightlife); }

/* ── MORE CHIP ── */
.more-chip {
  border: none;
  background: transparent;
  color: var(--green-strong);
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 0 0;
  text-align: left;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 140ms ease;
}

.more-chip:hover { color: var(--green-mid); }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .month-title { font-size: 1.5rem; }
  .calendar-day { min-height: 120px; padding: 7px 7px 6px; }
  .calendar-toolbar { padding: 16px 16px 12px; }
}

@media (max-width: 640px) {
  .calendar-day { min-height: 80px; padding: 4px 4px 3px; }
  .calendar-toolbar { padding: 10px 12px 8px; gap: 6px; flex-wrap: wrap; }
  .calendar-toolbar__left { gap: 8px; }
  .calendar-filters { order: 999; padding: 10px 16px 12px; flex-wrap: wrap; border-top: 1px solid var(--line); border-bottom: none; }
  .filter-chip { padding: 5px 12px; font-size: 0.8rem; }
  #cal-view { padding-bottom: 80px; }
  .calendar-weekdays > div { font-size: 0.6rem; letter-spacing: 0.05em; }
  .month-title { font-size: 1.25rem; min-width: 160px; }
  .nav-btn { width: 36px; height: 36px; font-size: 1rem; }
  .today-btn { padding: 6px 12px; font-size: 0.8rem; }
  .view-toggle button { padding: 8px 14px; font-size: 0.8rem; }
}
