/* cut+paste — Calendar
   Three months abreast >=768px, agenda list <768px. One data source, two
   views. The strip is capped in height so the whole thing fits one screen
   however many events a month carries. */

.cal {
  position: relative;
}

/* ==================== BAR ==================== */
/* Month names live in the column heads now, so the bar is only controls. */

.cal__bar[hidden] {
  display: none;
}

.cal__bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: clamp(0.85rem, 1.8vw, 1.35rem);
}

.cal__range {
  margin-right: auto;
  color: var(--ink-60);
  font-variant-numeric: tabular-nums;
}

.cal__nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border: var(--rule) solid var(--ink);
  border-radius: 50%;
  background: transparent;
  font-size: 0.9rem;
  transition: transform 0.18s var(--ease-snap), background-color 0.18s linear,
    color 0.18s linear;
}

.cal__nav:hover {
  background: var(--ink);
  color: var(--paper);
  transform: rotate(calc(var(--tilt-hard) * -1));
}

.cal__today {
  padding: 0.65em 1.1em;
  border: var(--rule) solid var(--ink);
  border-radius: 9999px;
  background: transparent;
  transition: transform 0.18s var(--ease-snap), background-color 0.18s linear,
    color 0.18s linear;
}

.cal__today:hover {
  background: var(--ink);
  color: var(--paper);
  transform: rotate(var(--tilt-soft));
}

/* ==================== MONTH STRIP ==================== */
/* Gap reveals the container's black ground = exposed structural grid, same
   device the old day grid used. The active month is wider and set larger. */

.cal__strip {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: var(--rule);
  background: var(--ink);
  border: var(--rule) solid var(--ink);
}

/* Pinned rather than auto-placed: the detail is a definitely-positioned item
   in the same row, and an auto-placed column would be pushed past it into an
   implicit track instead of sitting under it. */
.mcol:nth-child(1) { grid-column: 1; }
.mcol:nth-child(2) { grid-column: 2; }
.mcol:nth-child(3) { grid-column: 3; }

.mcol {
  grid-row: 1;
  background: var(--paper);
  padding: clamp(0.9rem, 1.8vw, 1.4rem);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-width: 0;
}

.mcol__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.6rem;
  border-bottom: var(--rule) solid var(--ink);
}

.mcol__name {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.1rem, 2vw, 1.6rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
  text-transform: lowercase;
  margin: 0;
}

.mcol__year {
  margin: 0;
  color: var(--ink-35);
  font-variant-numeric: tabular-nums;
}

/* The active month runs a step up across the board. */
.mcol.is-active .mcol__name {
  font-size: clamp(1.6rem, 3.4vw, 2.6rem);
}

.mcol__empty {
  margin: 0;
  color: var(--ink-35);
  padding-block: 1.25rem;
}

/* A month with a dozen events scrolls inside its own column rather than
   pushing the strip past the fold. */
.mcol__list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-height: clamp(15rem, 38vh, 24rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--ink-35) transparent;
  /* A scroll container clips on both axes -- overflow-y: auto forces
     overflow-x to compute to auto -- so the room a card needs to grow into on
     hover has to live inside the box. Padding provides it; the matching
     negative margin keeps the visible column edge where it was. 14px covers the
     resting tilt plus the 1.04 hover scale on the active column at --maxw,
     and still sits inside .mcol's own padding at the 768px breakpoint. */
  padding: 14px;
  margin: -14px;
}

/* ==================== EVENT (strip) ==================== */
/* Each event is a piece of colored paper, laid down slightly crooked. */

.mev {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  width: 100%;
  text-align: left;
  background: var(--c, var(--ink));
  color: var(--on-c, var(--paper));
  border: var(--rule-hair) solid var(--ink);
  padding: 0.5em 0.6em;
  cursor: pointer;
  transform: rotate(var(--r, 0deg));
  transition: transform 0.18s var(--ease-snap), filter 0.18s linear;
}

.mev:hover {
  transform: rotate(0deg) scale(1.04);
  filter: saturate(1.2);
}

/* A date that has been and gone stays in the month, spent. */
.mev--past {
  opacity: 0.42;
  filter: saturate(0.5);
}

.mev--past:hover {
  opacity: 1;
  filter: saturate(1);
}

.mev.is-open {
  transform: rotate(0deg);
  outline: var(--rule) solid var(--ink);
  outline-offset: 2px;
}

.mev__day {
  font-family: var(--mono);
  font-size: var(--step-nano);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.85;
  font-variant-numeric: tabular-nums;
}

.mev__title {
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.9375rem;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.mcol.is-active .mev__title {
  font-size: 1.0625rem;
}

.mev__meta {
  font-family: var(--mono);
  font-size: var(--step-nano);
  letter-spacing: 0.06em;
  opacity: 0.8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==================== DETAIL ==================== */
/* A grid item in the same row spanning columns 2-3, so it lays over the two
   months to the right of the active one with no positioning arithmetic. */

.cal__detail {
  --detail-pad: clamp(1.25rem, 2.6vw, 2rem);
  grid-row: 1;
  grid-column: 2 / -1;
  position: relative;
  background: var(--paper);
  padding: var(--detail-pad);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  animation: detail-in 0.22s var(--ease-out) both;
}

@keyframes detail-in {
  from {
    opacity: 0;
    transform: translateX(10px);
  }
}

.cal__detail-bar {
  height: 14px;
  margin-right: calc(1.9rem + 0.6rem);
  background: var(--c, var(--ink));
  border: var(--rule) solid var(--ink);
  margin-bottom: 0.5rem;
}

.cal__detail-city {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  margin: 0;
  font-family: var(--mono);
  font-size: var(--step-nano);
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.cal__detail-city::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--c, var(--ink));
  border: var(--rule-hair) solid var(--ink);
  flex: none;
}

.cal__detail-title {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.4rem, 2.8vw, 2.1rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin: 0;
  max-width: 22ch;
}

.cal__detail-when,
.cal__detail-where {
  margin: 0;
  font-family: var(--mono);
  font-size: var(--step-micro);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1.6;
}

.cal__detail-where {
  color: var(--ink-60);
}

.cal__detail-blurb {
  margin: 0.35rem 0 0;
  font-size: var(--step-body);
  line-height: 1.5;
  max-width: 46ch;
}

.cal__detail-rsvp {
  align-self: flex-start;
  margin-top: 0.85rem;
}

.cal__detail-close {
  position: absolute;
  top: calc(var(--detail-pad) + 7px - 0.95rem);
  right: var(--detail-pad);
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  border: var(--rule) solid var(--ink);
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  line-height: 1;
  background: var(--white);
}

.cal__detail-close:hover {
  background: var(--ink);
  color: var(--paper);
}

/* ==================== AGENDA (mobile) ==================== */

.agenda {
  display: none;
  flex-direction: column;
  gap: 0.85rem;
}

.agenda__item {
  border: var(--rule) solid var(--ink);
  background: var(--paper);
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: stretch;
  transform: rotate(var(--r, 0deg));
}

/* Date block — the flyer's angled outlined date box, made structural */
.agenda__date {
  background: var(--c, var(--ink));
  color: var(--on-c, var(--paper));
  border-right: var(--rule) solid var(--ink);
  padding: 0.85rem 0.9rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  min-width: 4.5rem;
}

.agenda__dow {
  font-family: var(--mono);
  font-size: var(--step-nano);
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.agenda__dnum {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.75rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.agenda__body {
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.agenda__title {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.0625rem;
  line-height: 1.15;
  margin: 0;
}

.agenda__meta {
  font-family: var(--mono);
  font-size: var(--step-nano);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-60);
}

.agenda__blurb {
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--ink-60);
}

.agenda__city {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-family: var(--mono);
  font-size: var(--step-nano);
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.agenda__city::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c, var(--ink));
  border: var(--rule-hair) solid var(--ink);
  flex: none;
}

/* ==================== STATUS ==================== */

.cal__status {
  margin-top: 1rem;
  color: var(--ink-60);
  min-height: 1.2em;
}

.cal__status.is-bad {
  color: var(--red);
  font-weight: 700;
}

/* ==================== HERO EVENT ==================== */
/* A featured event takes the whole strip: 300px, the photo run through the
   same .frame treatment as every other image, and the details on a paper
   panel so nothing type-set lands on the photograph. */

.cal__strip--hero {
  display: block;
  height: 300px;
  padding: 0;
  border: 0;
}

.cal__hero {
  display: block;
  height: 100%;
  text-decoration: none;
  color: inherit;
}

.cal__hero-img {
  height: 100%;
  width: 100%;
  object-fit: cover;
}

/* Logo and details sit on the photograph itself, centred in the strip. The
   duotone plate multiplies at 0.62, which is dark enough to carry white type. */
.cal__hero-body {
  position: absolute;
  z-index: 3;
  inset: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: clamp(1.25rem, 3.5vw, 3rem);
  padding-inline: 1.5rem;
}

/* The logo is artwork, not a photograph -- it takes none of the frame's
   grayscale, and none of its 100% width. One third of the strip's height.
   Two classes deep to outrank `.frame img { width: 100% }`.

   Both axes are maxima, never fixed sizes. The reset's `img { max-width: 100% }`
   clamps the width at narrow viewports; against a fixed `height` that squashes
   the mark (3.43:1 against a native 4.33:1 at 390px). With both auto and both
   capped, whichever bound binds first scales the other and the ratio holds. */
.cal__hero-body .cal__hero-logo {
  filter: none;
  flex: none;
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 33.333%;
}

.cal__hero-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.9rem;
}

.cal__hero-when {
  margin: 0;
  color: var(--white);
  font-size: var(--step-body);
}

/* White label, orange stroke. Orange type sits at mid-luminance and cannot
   reach 4.5:1 against a photograph at any plate darkening; white clears it. */
.cal__hero-cta {
  color: var(--white);
}

.cal__hero:hover .cal__hero-cta {
  background: var(--orange);
  color: var(--ink);
  transform: rotate(var(--tilt-soft)) scale(1.02);
}

@media (max-width: 767.98px) {
  .cal__strip--hero {
    height: 380px;
  }
  .cal__hero-body {
    flex-direction: column;
    gap: 1.5rem;
  }
  .cal__hero-meta {
    align-items: center;
  }
  .cal__hero-when {
    text-align: center;
  }
}

/* ==================== NOTHING SCHEDULED ==================== */
/* The columns fall back to a ghost of themselves and the note sits centred on
   top of them, rather than three repeats of "nothing scheduled". */

.cal__stripwrap {
  position: relative;
}

/* The whole strip -- black ground, rules and all -- drops back to a ghost.
   The note is a sibling, not a child, so the fade never reaches it. */
.cal__strip--muted {
  opacity: 0.05;
  pointer-events: none;
}

.cal__note {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(52ch, calc(100% - 3rem));
  z-index: 2;
  margin: 0;
  text-align: center;
  color: var(--ink);
}

/* ==================== VIEW SWAP ==================== */

@media (max-width: 1024px) {
  .cal__strip {
    grid-template-columns: 1.35fr 1fr 1fr;
  }
}

@media (max-width: 767.98px) {
  .cal__strip {
    display: none;
  }
  /* The hero is the whole calendar at this width, so it is the one strip
     state that stays on screen alongside the agenda. */
  .cal__strip--hero {
    display: block;
  }
  /* No strip to overlay below the agenda breakpoint, so the note simply
     takes its place in flow. */
  .cal__note {
    position: static;
    transform: none;
    width: auto;
    text-align: left;
  }
  .agenda {
    display: flex;
  }
  /* The agenda rolls forward continuously, so month nav has nothing to act on */
  .cal__bar {
    display: none;
  }
}

