/* ============================================================
   GRID+CLUB calendar (scripts/gccal.js)

   The OFF+GRID glass month, made portable: it brings its own dark
   ground so it reads the same on every world, and takes only the
   accent from the page, so it is volt on GRID+CLUB, pink on
   GIRL+GRID, orange on TGC and tape yellow on OFF+GRID.
   ============================================================ */
.gcal-sec {
  position: relative;
  padding-block: var(--space-section, clamp(4.5rem, 2.5rem + 8vw, 11rem));
  background: #0a0a0a;
  color: #f4f4ed;
}

.gcal {
  --gc-accent: var(--accent, #d4ff00);
  --gc-accent-ink: var(--accent-ink, #0a0a0a);
  --gc-ink: #f4f4ed;
  --gc-soft: rgb(255 255 255 / 0.62);
  --gc-line: rgb(255 255 255 / 0.14);
  max-width: 820px; margin-inline: auto;
  padding: clamp(1.1rem, 2.6vw, 2rem);
  border-radius: 22px;
  border: 1px solid rgb(255 255 255 / 0.16);
  background: rgb(18 18 18 / 0.78);
  color: var(--gc-ink);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.26), 0 40px 90px -40px rgb(0 0 0 / 0.95);
  font-family: var(--font-body, system-ui, sans-serif);
}
@supports (backdrop-filter: blur(1px)) {
  .gcal { background: rgb(255 255 255 / 0.07); backdrop-filter: blur(22px) saturate(1.25); }
}
.gcal .mono { font-family: var(--font-mono, ui-monospace, monospace); letter-spacing: 0.1em; text-transform: uppercase; }

.gcal__head {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap;
  padding-bottom: clamp(0.9rem, 2vw, 1.3rem);
  border-bottom: 1px solid var(--gc-line);
}
.gcal__eyebrow { font-size: 0.62rem; color: var(--gc-soft); }
.gcal__month {
  font-family: "Archivo Black", var(--font-display, sans-serif);
  text-transform: uppercase; letter-spacing: -0.01em;
  font-size: clamp(1.3rem, 0.8rem + 2vw, 2.4rem); line-height: 1; margin: 0.5rem 0 0;
}
.gcal__nav { display: flex; gap: 0.4rem; }
.gcal__arrow {
  width: 2.6rem; height: 2.6rem; border-radius: 50%;
  border: 1px solid rgb(255 255 255 / 0.25); background: rgb(255 255 255 / 0.04);
  color: var(--gc-ink); font-size: 1.4rem; line-height: 1; cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}
.gcal__arrow:hover { background: rgb(255 255 255 / 0.12); border-color: rgb(255 255 255 / 0.5); }
.gcal__arrow:active { transform: scale(0.94); }

.gcal__grid {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: clamp(2px, 0.5vw, 5px);
  padding-block: clamp(0.8rem, 2vw, 1.2rem);
}
.gcal__dow { text-align: center; font-size: 0.55rem; color: rgb(255 255 255 / 0.4); padding-bottom: 0.3rem; }
.gcal__cell {
  position: relative; min-height: clamp(40px, 6.4vw, 62px);
  display: grid; gap: 0.15rem; align-content: start; text-align: left;
  padding: 0.28rem 0.3rem; border-radius: 7px; border: 0;
  background: rgb(255 255 255 / 0.04); color: inherit; font: inherit;
  overflow: hidden;
}
button.gcal__cell { cursor: pointer; transition: transform 0.2s, filter 0.2s; }
button.gcal__cell:hover { transform: translateY(-2px); filter: brightness(1.12); }
.gcal__cell--pad { background: none; }
.gcal__date { font-size: 0.6rem; color: var(--gc-soft); font-weight: 400; }
.gcal__cell[data-state="race"] { background: var(--gc-accent); }
.gcal__cell[data-state="race"] .gcal__date, .gcal__cell[data-state="race"] .gcal__tag { color: var(--gc-accent-ink); }
.gcal__cell[data-state="event"] { background: rgb(255 255 255 / 0.16); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--gc-accent) 70%, transparent); }
.gcal__cell[data-today="true"]::after {
  content: ""; position: absolute; inset: 0; border: 1.5px solid var(--gc-ink); border-radius: inherit; pointer-events: none;
}
.gcal__cell[aria-pressed="true"] { outline: 2px solid var(--gc-ink); outline-offset: 2px; }
.gcal__tag {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.47rem; letter-spacing: 0.06em; text-transform: uppercase; line-height: 1.15;
  color: var(--gc-ink);
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

.gcal__key { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; font-size: 0.58rem; color: rgb(255 255 255 / 0.6); margin: 0; }
.gcal__key b { width: 9px; height: 9px; display: inline-block; border-radius: 2px; }
.gcal__key b[data-k="race"] { background: var(--gc-accent); }
.gcal__key b[data-k="event"] { background: rgb(255 255 255 / 0.3); box-shadow: inset 0 0 0 1px var(--gc-accent); }
.gcal__key b[data-k="today"] { border: 1.5px solid var(--gc-ink); }
.gcal__key b + * { margin-right: 0.6rem; }

.gcal__upnext { margin-top: clamp(1rem, 2.4vw, 1.6rem); padding-top: clamp(0.9rem, 2vw, 1.2rem); border-top: 1px solid var(--gc-line); }
.gcal__listhead { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; font-size: 0.62rem; color: var(--gc-soft); }
.gcal__clear { background: none; border: 0; color: var(--gc-accent); cursor: pointer; font-size: 0.62rem; padding: 0.3rem 0; }
.gcal__list { list-style: none; margin: 0.6rem 0 0; padding: 0; display: grid; gap: 0.5rem; }
.gcal__empty { color: var(--gc-soft); margin: 0.8rem 0 0; }

/* Compact list: one slim row per night, details slide open (scripts/gccal.js). */
.gcal__ev {
  --gc-ease: cubic-bezier(0.16, 1, 0.3, 1);
  position: relative; border-radius: 12px; overflow: hidden;
  background: rgb(255 255 255 / 0.04); border: 1px solid rgb(255 255 255 / 0.07);
  scroll-margin-block: 6rem;
  transition: background 0.3s, border-color 0.3s;
  animation: gcalIn 0.6s var(--gc-ease) both; animation-delay: calc(var(--i, 0) * 55ms);
}
@keyframes gcalIn { from { opacity: 0; transform: translateY(10px); } }
/* accent edge: a sliver at rest, full height when the night is open */
.gcal__ev::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--gc-accent);
  transform: scaleY(0.35); transform-origin: top; opacity: 0.5;
  transition: transform 0.5s var(--gc-ease), opacity 0.3s;
}
.gcal__ev[data-race="0"]::before { background: rgb(255 255 255 / 0.4); }
.gcal__ev[data-open] { background: rgb(255 255 255 / 0.07); border-color: rgb(255 255 255 / 0.14); }
.gcal__ev[data-open]::before { transform: none; opacity: 1; }
.gcal__ev:target { border-color: var(--gc-accent); }
.gcal__row {
  width: 100%; display: grid; grid-template-columns: 3.4rem minmax(0, 1fr) auto; align-items: center; gap: 0.9rem;
  padding: 0.6rem 0.85rem 0.6rem 0.95rem; background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.gcal__row:hover .gcal__title { color: var(--gc-accent); }
.gcal__day { display: grid; justify-items: center; gap: 0.15rem; }
.gcal__day b { font-family: "Archivo Black", var(--font-display, sans-serif); font-size: 1.35rem; line-height: 1; }
.gcal__day span { font-size: 0.5rem; color: var(--gc-soft); white-space: nowrap; }
.gcal__name { min-width: 0; display: grid; justify-items: start; gap: 0.25rem; }
.gcal__name .gcal__title { margin: 0; font-size: clamp(0.98rem, 0.9rem + 0.35vw, 1.12rem); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; transition: color 0.2s; }
.gcal__when { display: flex; align-items: center; gap: 0.6rem; font-size: 0.58rem; color: var(--gc-soft); white-space: nowrap; }
.gcal__when i { width: 0.5rem; height: 0.5rem; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translateY(-2px); transition: transform 0.35s var(--gc-ease); }
.gcal__ev[data-open] .gcal__when i { transform: rotate(225deg) translateY(-2px); }
.gcal__more { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.45s var(--gc-ease); }
.gcal__ev[data-open] .gcal__more { grid-template-rows: 1fr; }
.gcal__body { min-width: 0; overflow: hidden; padding-left: calc(3.4rem + 1.85rem); padding-right: 0.85rem; }
.gcal__body > :last-child { margin-bottom: 0.85rem; }
.gcal__more .gcal__body > * { opacity: 0; transform: translateY(-4px); transition: opacity 0.3s, transform 0.4s var(--gc-ease); }
.gcal__ev[data-open] .gcal__more .gcal__body > * { opacity: 1; transform: none; transition-delay: 0.08s; }
/* Rows clip so they can slide shut, which also clipped the "Add to calendar" menu. Open it inside the row instead:
   the row grows to fit, nothing is cut off. */
.gcal__ev .gcal__add { flex-basis: 100%; }
.gcal__ev .gcal__menu { position: static; margin-top: 0.4rem; min-width: 0; max-width: 20rem; box-shadow: none; animation: gcalMenu 0.3s var(--gc-ease) both; }
@keyframes gcalMenu { from { opacity: 0; transform: translateY(-4px); } }
.gcal__div {
  display: inline-block; font-size: 0.55rem; padding: 0.2rem 0.5rem; border-radius: 999px;
  background: rgb(255 255 255 / 0.1); color: var(--gc-ink);
}
.gcal__div[data-div="tgc"] { background: #ff4d00; color: #050505; }
.gcal__div[data-div="girl"] { background: #ff1568; color: #0b0b12; }
.gcal__div[data-div="off"] { background: #ffe600; color: #0c0c0c; }
.gcal__title { font-size: clamp(1.05rem, 0.95rem + 0.5vw, 1.3rem); line-height: 1.15; margin: 0.45rem 0 0.25rem; letter-spacing: -0.01em; }
.gcal__list { gap: 0.35rem; }
.gcal__cell { min-height: clamp(34px, 5vw, 50px); }
.gcal__meta { font-size: 0.6rem; color: var(--gc-soft); margin: 0; line-height: 1.6; }
.gcal__details { font-size: 0.92rem; color: rgb(255 255 255 / 0.82); margin: 0.5rem 0 0; max-width: 60ch; }
.gcal__acts { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; align-items: flex-start; }

.gcal__btn {
  display: inline-flex; align-items: center; gap: 0.4rem; min-height: 2.5rem;
  padding: 0.55rem 1rem; border-radius: 999px;
  border: 1px solid rgb(255 255 255 / 0.28); background: transparent; color: var(--gc-ink);
  font: 600 0.82rem/1 var(--font-body, system-ui, sans-serif); text-decoration: none; cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}
.gcal__btn:hover { background: rgb(255 255 255 / 0.1); border-color: rgb(255 255 255 / 0.55); }
.gcal__btn:active { transform: scale(0.97); }
.gcal__btn--go { background: var(--gc-accent); color: var(--gc-accent-ink); border-color: var(--gc-accent); }
.gcal__btn--go:hover { background: var(--gc-accent); filter: brightness(1.08); }
.gcal a:focus-visible, .gcal button:focus-visible, .gcal summary:focus-visible { outline: 2px solid var(--gc-accent); outline-offset: 2px; }

.gcal__add { position: relative; }
.gcal__add > summary { list-style: none; }
.gcal__add > summary::-webkit-details-marker { display: none; }
.gcal__add > summary::after { content: "+"; font-weight: 400; }
.gcal__add[open] > summary::after { content: "\2212"; }
.gcal__menu {
  position: absolute; z-index: 5; top: calc(100% + 0.4rem); left: 0; min-width: 14rem;
  display: grid; padding: 0.35rem; border-radius: 14px;
  background: #161616; border: 1px solid rgb(255 255 255 / 0.18);
  box-shadow: 0 24px 50px -20px rgb(0 0 0 / 0.9);
}
.gcal__menu a { padding: 0.7rem 0.8rem; border-radius: 9px; color: var(--gc-ink); text-decoration: none; font-size: 0.88rem; }
.gcal__menu a:hover { background: rgb(255 255 255 / 0.08); }

.gcal__foot {
  display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center;
  margin-top: clamp(1rem, 2.4vw, 1.5rem); padding-top: clamp(0.9rem, 2vw, 1.2rem);
  border-top: 1px solid var(--gc-line);
}
.gcal__fine { font-size: 0.55rem; color: rgb(255 255 255 / 0.45); flex-basis: 100%; }

@media (max-width: 520px) {
  .gcal__row { grid-template-columns: 2.8rem minmax(0, 1fr) auto; gap: 0.6rem; }
  .gcal__body { padding-left: 0.95rem; }
  .gcal__when { font-size: 0.52rem; }
  .gcal__tag { display: none; }
  .gcal__cell { min-height: 36px; }
  .gcal__menu { position: static; margin-top: 0.4rem; }
}
@media (prefers-reduced-motion: reduce) {
  .gcal__arrow, button.gcal__cell, .gcal__btn, .gcal__more, .gcal__ev::before, .gcal__more .gcal__body > * { transition: none; }
  .gcal__ev { animation: none; }
  button.gcal__cell:hover { transform: none; }
}
