/* /events dashboard shell: layout only. Visual primitives (tile, orb, glass, tabs, rows, menu) live in base.css. */

body.ev-page { background: var(--near-black); min-height: 100svh; }

/* ---------- Backdrop: GrainGradient wave + 40px hard-light flutes ---------- */
.wave {
  position: fixed; inset: 0 0 auto 0; height: 100svh; z-index: 0; pointer-events: none;
  transition: opacity .45s var(--ease);
  -webkit-mask-image: linear-gradient(to bottom, black 0%, black 42%, transparent 92%);
          mask-image: linear-gradient(to bottom, black 0%, black 42%, transparent 92%);
}
.wave.is-dim { opacity: .4; }
.wave-field {
  position: absolute; inset: 0;
  /* CSS fallback when WebGL2 is unavailable: soft bands in the wave palette */
  background:
    radial-gradient(120% 60% at 30% 0%, rgb(var(--accent-rgb) / .38), transparent 60%),
    radial-gradient(90% 55% at 80% 8%, rgb(var(--light-rgb) / .22), transparent 62%),
    radial-gradient(140% 80% at 50% 20%, rgb(var(--light-base-rgb) / .7), transparent 70%),
    linear-gradient(to bottom, var(--deep), var(--near-black));
}
.wave .flutes-wave { position: absolute; inset: 0; }

/* ---------- Top bar of orbs (no bar background) ---------- */
.ev-top {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  max-width: 1480px; margin: 0 auto; padding: 14px clamp(16px, 3vw, 36px);
  pointer-events: none;
}
.ev-top > * { pointer-events: auto; }
.menu-wrap { position: relative; flex: none; }
.menu-wrap .menu { top: calc(100% + 8px); left: 0; }
.menu-sep { height: 1px; margin: 5px 8px; background: var(--glass-line); }
.ev-brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: none; }
.ev-brand .logo-mark { width: 40px; height: 40px; }
.ev-brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.ev-brand-name { --rond: var(--rond-heading); font-size: 15px; font-weight: 500; }
.ev-brand-sub { --rond: var(--rond-label); font-size: 12.5px; color: var(--muted); }
.area-btn { padding: 0 14px 0 18px; cursor: pointer; font-size: 14.5px; font-weight: 560; --rond: var(--rond-button); white-space: nowrap; }
.area-btn .chev { opacity: .7; font-size: 12px; }
.area-menu { max-height: min(60svh, 420px); overflow-y: auto; }
.ev-spacer { flex: 1; min-width: 0; }
.ev-search { width: 260px; flex: none; }
.ev-search svg { color: var(--muted); }
.ev-search input::-webkit-search-cancel-button { filter: invert(1) opacity(.6); }
@keyframes ev-spin { to { transform: rotate(360deg); } }
.is-spinning svg { animation: ev-spin .9s linear infinite; }

/* ---------- Shell ---------- */
.ev-shell { position: relative; z-index: 1; max-width: 1480px; margin: 0 auto; padding: 8px clamp(16px, 3vw, 36px) 64px; }

/* ---------- Hero band ---------- */
.ev-hero { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 20px 32px; padding: 26px 0 30px; animation: fade .6s var(--ease) both; }
.date-capsule { display: inline-flex; align-items: center; gap: 14px; padding: 6px 24px 6px 6px; border-radius: 999px; }
.date-orb {
  display: grid; place-items: center; width: 60px; height: 60px; border-radius: 50%;
  background: var(--light); color: var(--on-light); font-size: 28px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
}
.date-lines { display: flex; flex-direction: column; font-size: 17px; line-height: 1.2; }
.date-lines span + span { color: var(--muted); }
.ev-greet { display: flex; flex-direction: column; align-items: flex-end; gap: 16px; text-align: right; min-width: 0; }
.ev-greeting {
  --rond: var(--rond-display); font-weight: 560; font-size: clamp(1.9rem, 3.6vw, 3.1rem); line-height: 1.04;
  letter-spacing: -0.01em; text-shadow: 0 2px 24px rgb(var(--deep-rgb) / .6);
}
.ev-greeting span { display: block; }
.ev-greeting .soft { opacity: .72; }
.ev-controls { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px 28px; text-shadow: 0 1px 14px rgb(var(--deep-rgb) / .85); }
.date-lines { text-shadow: 0 1px 14px rgb(var(--deep-rgb) / .6); }
.ev-controls .tabs { gap: 16px; }
.ev-controls .tab { white-space: nowrap; }  /* "Any length" stays on one line */
@media (max-width: 420px) { .ev-controls .tabs { gap: 12px; } }
.ev-free { --rond: var(--rond-button); display: inline-flex; align-items: center; gap: 8px; font-size: 14.5px; color: var(--muted); cursor: pointer; }
.ev-free input { width: 16px; height: 16px; margin: 0; }

/* ---------- Bento ---------- */
.bento { display: grid; grid-template-columns: 64px repeat(23, minmax(0, 1fr)); gap: 14px; }
.bento.is-entering > * { animation: rise .9s var(--ease) both; animation-delay: calc(min(var(--i, 0), 14) * 40ms); }

.t-rail { grid-column: span 1; min-height: 0; padding: 9px; align-items: center; gap: 10px; }
.t-rail .orb[disabled] { opacity: .4; cursor: not-allowed; }
.t-lead { grid-column: span 7; }
.t-weekend { grid-column: span 6; }
.t-week { grid-column: span 4; }
.t-sources { grid-column: span 6; }
.t-empty { grid-column: span 17; }
.t-error { grid-column: 2 / -1; min-height: 0; }

/* Lead "Next up" */
.t-lead { gap: 10px; }
.lead-label { display: flex; gap: 8px; flex-wrap: wrap; }
.lead-title {
  --rond: var(--rond-display); font-size: 2rem; font-weight: 600; line-height: 1.08; letter-spacing: -0.01em;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.lead-meta { display: flex; flex-direction: column; gap: 2px; font-size: 15px; }
.lead-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 18px; margin-top: auto; padding-top: 8px; }
.lead-actions > * { position: relative; z-index: 1; }

/* Whole-tile link overlay */
.tile-link { color: inherit; }
.tile-link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: 0; }
.tile-link:focus-visible { outline: none; }
.tile:has(.tile-link:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Weekend rows */
.t-weekend .rows { margin: 2px -8px 0; }
.row-day { --rond: var(--rond-label); font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.tile-empty-note { margin-top: auto; font-size: 14.5px; color: var(--muted); }

/* Light "Per week" */
.week-num { --rond: var(--rond-display); font-size: 3.4rem; font-weight: 340; line-height: 1; letter-spacing: -0.015em; }
.week-sub { font-size: 14px; }
.spark { width: 100%; height: 64px; margin-top: auto; overflow: visible; }
.spark-line { fill: none; stroke: var(--on-light); stroke-width: 2.5; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.spark-fill { fill: rgb(var(--on-light-rgb) / .12); stroke: none; }

/* Sources */
.src-row { cursor: default; }
.src-row .status { white-space: nowrap; }
.src-when { margin-top: auto; }

/* Day headers */
.day-head {
  grid-column: 1 / -1; display: flex; align-items: baseline; gap: 8px;
  padding: 18px 4px 0; font-size: 13px;
}
.day-head strong { --rond: var(--rond-heading); font-weight: 560; color: var(--light); font-size: 14.5px; }

/* Event tiles */
.ev-tile { grid-column: span 6; gap: 6px; padding: 12px 12px 16px; }
.ev-thumb { position: relative; aspect-ratio: 16 / 9; border-radius: 16px; overflow: hidden; margin-bottom: 6px;
  background: linear-gradient(160deg, rgb(var(--light-rgb) / .10), rgb(var(--light-rgb) / .03)); }
.ev-thumb img { width: 100%; height: 100%; object-fit: cover; opacity: .92; }
.ev-tile > :not(.ev-thumb) { padding: 0 6px; }
.ev-when { --rond: var(--rond-label); font-size: 12.5px; color: var(--muted); }
.is-soon { color: var(--accent); }
.ev-title {
  --rond: var(--rond-heading); font-size: 18px; font-weight: 600; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ev-place { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-foot { display: flex; align-items: baseline; gap: 6px 10px; flex-wrap: wrap; margin-top: auto; padding-top: 4px; }
.ev-foot .push { margin-left: auto; }
.ev-tile > .ev-save { position: absolute; top: 20px; right: 20px; z-index: 2; padding: 0; }

/* Suggest tile */
.t-suggest {
  grid-column: var(--fill-wide, span 24);
  border: 1px dashed rgb(var(--light-rgb) / .3); background: rgb(var(--near-black-rgb) / .5); box-shadow: none;
}
.t-suggest:hover { border-color: rgb(var(--light-rgb) / .45); }
.suggest-h { --rond: var(--rond-heading); font-size: 20px; font-weight: 600; }
.suggest-form { display: flex; flex-wrap: wrap; gap: 10px; margin-top: auto; }
.suggest-form .input { flex: 1 1 220px; width: auto; }

/* Empty / error */
.t-empty { justify-content: center; align-items: flex-start; gap: 12px; }
.empty-h { --rond: var(--rond-heading); font-size: 24px; font-weight: 600; }
.empty-actions { display: flex; flex-wrap: wrap; gap: 10px; }
/* The empty tile is the group's one light tile: keep quiet buttons legible on paper. */
.is-light .btn.is-quiet { color: var(--on-light-muted); background: transparent; border-color: transparent; }
.is-light .btn:hover { background: rgb(var(--on-light-rgb) / .09); } /* base .is-light .btn otherwise masks .btn:hover */
.is-light .btn.is-quiet:hover { color: var(--on-light); background: rgb(var(--on-light-rgb) / .06); }
.t-error { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 12px; }
.t-error .notice { flex: 1 1 260px; }

/* Skeleton */
.sk-line { height: 14px; }
.sk-line.w40 { width: 40%; } .sk-line.w60 { width: 60%; } .sk-line.w80 { width: 80%; }
.sk-big { height: 34px; width: 85%; border-radius: 10px; }
.sk-thumb { aspect-ratio: 16 / 9; border-radius: 16px; }
.sk-orb { width: 44px; height: 44px; border-radius: 50%; }
.is-light .skeleton { background: rgb(var(--on-light-rgb) / .1); }

/* ---------- Drawer ---------- */
.drawer-scrim { position: fixed; inset: 0; z-index: 60; background: rgb(var(--near-black-rgb) / .45); animation: fade .3s var(--ease) both; }
.drawer-scrim[hidden], .drawer[hidden] { display: none; }
.drawer {
  position: fixed; right: 12px; bottom: 12px; z-index: 61;
  width: min(440px, calc(100vw - 24px)); height: min(680px, calc(100svh - 96px));
  display: flex; flex-direction: column; padding: 16px; border-radius: 28px;
  background: linear-gradient(180deg, rgb(var(--base-rgb) / .9), rgb(var(--near-black-rgb) / .95));
  border: 1px solid var(--glass-edge);
  -webkit-backdrop-filter: blur(26px) saturate(150%); backdrop-filter: blur(26px) saturate(150%);
  box-shadow: 0 40px 90px -30px rgba(0,0,0,.85), inset 0 1px 0 rgba(255,255,255,.14), inset 0 -1px 0 rgba(0,0,0,.4);
  animation: open .45s var(--ease) both;
}
.drawer-close { position: absolute; top: 24px; right: 24px; z-index: 2; }
.drawer-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 14px; padding: 0 2px 4px; }
.drawer-cover { aspect-ratio: 16 / 9; border-radius: 16px; overflow: hidden; flex: none;
  background: linear-gradient(160deg, rgb(var(--light-rgb) / .10), rgb(var(--light-rgb) / .03)); }
.drawer-cover img { width: 100%; height: 100%; object-fit: cover; }
.drawer-head { display: flex; flex-direction: column; gap: 6px; padding: 0 6px; }
.drawer-title { --rond: var(--rond-display); font-size: 1.6rem; font-weight: 600; line-height: 1.1; padding-right: 8px; }
.drawer-facts { display: flex; flex-direction: column; padding: 0 6px; }
.fact { display: flex; gap: 12px; padding: 10px 0; font-size: 14.5px; }
.fact + .fact { box-shadow: 0 -1px 0 var(--glass-line); }
.fact > svg { margin-top: 2px; color: var(--muted); }
.fact-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.fact a { text-decoration: underline; text-decoration-color: rgb(var(--light-rgb) / .35); text-underline-offset: 3px; }
.fact a:hover { color: var(--accent); }
.drawer-desc { display: flex; flex-direction: column; gap: 10px; padding: 0 6px; font-size: 15px; color: rgb(var(--light-rgb) / .9); overflow-wrap: anywhere; }
.drawer-also { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 0 6px; }
.drawer-also a { font-size: 14px; }
.drawer-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 16px; padding: 14px 6px 2px; border-top: 1px solid var(--glass-line); }
.drawer-actions .btn[aria-pressed="true"] svg { color: var(--accent); } /* active icon only: the accent button here is "Register" */

/* ---------- Responsive ---------- */
@media (max-width: 1240px) {
  .bento { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .t-rail { grid-column: 1 / -1; flex-direction: row; justify-content: flex-start; padding: 9px; }
  .t-lead { grid-column: span 7; }
  .t-weekend { grid-column: span 5; }
  .t-week { grid-column: span 5; }
  .t-sources { grid-column: span 7; }
  .ev-tile { grid-column: span 6; }
  .t-suggest { grid-column: var(--fill-mid, span 12); }
  .t-empty, .t-error { grid-column: 1 / -1; }
  .t-empty ~ .t-sources { grid-column: 1 / -1; }
  .ev-search { width: 220px; }
}
@media (max-width: 900px) {
  .ev-top { flex-wrap: wrap; }
  .ev-spacer { display: none; }
  .ev-search { order: 10; flex: 1 1 100%; width: auto; }
}
@media (max-width: 760px) {
  .bento { grid-template-columns: minmax(0, 1fr); }
  .bento > * { grid-column: 1 / -1 !important; min-height: 0; }
  .t-rail { flex-direction: row; }
  .ev-greet { align-items: flex-start; text-align: left; }
  .ev-controls { justify-content: flex-start; }
  .ev-hero { align-items: flex-start; padding: 14px 0 22px; }
  .ev-brand-sub { display: none; }
  .lead-title { font-size: 1.6rem; }
  .t-week .spark { height: 56px; }
  .drawer { right: 12px; left: 12px; width: auto; height: min(680px, calc(100svh - 72px)); }
}
@media (max-width: 420px) {
  .ev-top { gap: 8px; }
  .area-btn { padding: 0 12px 0 14px; }
  .ev-brand-text { display: none; }
}

/* ---------------------------------------------------------------- account control (account-orb.js) */
.acct-slot { display: flex; align-items: center; flex: none; min-width: 44px; min-height: 44px; }
.acct-signin {
  --rond: var(--rond-button);
  display: inline-flex; align-items: center; justify-content: center; height: 44px; padding: 0 16px;
  font-size: 14.5px; font-weight: 560; white-space: nowrap; color: var(--light);
  transition: transform .25s var(--ease), background-color .2s var(--ease);
}
.acct-signin:hover { transform: translateY(-2px); }
.acct-signin:active { transform: scale(.97); }
.acct-orb { overflow: hidden; --rond: var(--rond-button); font-size: 14px; font-weight: 600; letter-spacing: .02em; }
.acct-orb[aria-expanded="true"] { background: rgb(var(--light-rgb) / .14); }
.acct-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.acct .acct-menu { left: auto; right: 0; top: calc(100% + 8px); min-width: 220px; max-width: min(300px, calc(100vw - 32px)); }
.acct-head { display: flex; flex-direction: column; gap: 1px; padding: 8px 12px 6px; min-width: 0; }
.acct-name, .acct-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-name { --rond: var(--rond-heading); font-size: 14.5px; font-weight: 560; }
.acct-email { --rond: var(--rond-label); font-size: 12.5px; color: var(--muted); }
.acct-sep { height: 1px; margin: 5px 8px; background: var(--glass-line); }
@media (max-width: 420px) {
  .acct-signin { padding: 0 12px; font-size: 14px; }
  #refreshBtn { display: none; }   /* the rail carries refresh on phones; keeps the bar on one line */
}

/* ---------------------------------------------------------------- registration (drawer + tiles) */
.status.is-ok, .status .is-ok { color: var(--green); }
.lead-status { margin-top: 2px; }
.ev-status { margin-top: auto; }
.ev-status + .ev-foot { margin-top: 0; }
.ev-tile > .ev-save.is-locked { color: var(--green); }

.drawer-reg { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 0 6px; }
.drawer-reg:empty { display: none; }
.drawer-reg .notice { align-self: stretch; }
.reg-prompt { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; font-size: 14px; color: var(--muted); }
.reg-prompt .text-link, .reg-reopen { font-size: 14px; }
.reg-sub { font-size: 13.5px; }
.reg-sub .text-link { display: inline; font-size: 13.5px; text-decoration: underline; text-decoration-color: rgb(var(--light-rgb) / .35); text-underline-offset: 3px; }
.reg-quiet { display: flex; flex-wrap: wrap; gap: 6px; margin-left: -12px; }
.reg-copy-toggle { margin-left: -12px; }
.copy-panel {
  align-self: stretch; display: flex; flex-direction: column; padding: 4px; border-radius: 16px;
  border: 1px solid var(--glass-line); background: rgb(var(--near-black-rgb) / .35);
}
.copy-row { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 6px 6px 6px 10px; border-radius: 12px; }
.copy-row + .copy-row { box-shadow: 0 -1px 0 var(--glass-line); }
.copy-k { --rond: var(--rond-label); flex: 0 0 104px; font-size: 12.5px; color: var(--muted); }
.copy-v { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.copy-btn { flex: none; }
.drawer-actions .status { display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 420px) { .copy-k { flex-basis: 84px; } }
.drawer-reg:focus { outline: none; }
.copy-v::selection { background: rgb(var(--accent-rgb) / .35); }
