/* Discover (discover.html): events table, Events x people, the event drawer,
   group setup. Builds on style.css's tokens, header, .btn, .seg and table.t. */

body {
  overflow: auto;
}
.dsc {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.dsc header.top {
  position: sticky;
  top: 0;
  z-index: 20;
  gap: 0;
  padding-right: 16px;
}
.dsc header.top .brand {
  color: inherit;
  text-decoration: none;
  border-right: 1px solid var(--line);
  padding-right: 20px;
}
.dsc .hdr-controls {
  margin-left: auto;
  border-left: 0;
}

/* The places (Discover | Analyze) and this page's tabs are the same tabs as
   Analyze's header (style.css .tabs), in one row. */
.dsc header.top {
  gap: 14px;
}
.dsc header.top .brand {
  border-right: 0;
  padding-right: 4px;
}
.subnav[hidden] {
  display: none;
}

.dsc-main {
  flex: 1;
  padding: 20px 24px 48px;
  display: grid;
  gap: 16px;
  align-content: start;
  min-width: 0;
}
.dsc-main .hint {
  color: var(--muted);
  margin: 0;
}
.dsc-title {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 14px;
}
.dsc-title h1 {
  margin: 0;
  font: 600 22px var(--font);
}
.dsc-title .lead {
  font-size: 13px;
  color: var(--muted);
}
.dsc-title .ev-legend {
  margin-left: auto;
  display: flex;
  gap: 14px;
}

/* toolbar */
.toolbar {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px 14px;
}
.fld label {
  font-size: 12px;
}
.fld input,
.fld select {
  height: 30px;
}
.toolbar .ctrl {
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  height: auto;
}
.toolbar .ctrl-lab {
  font: 600 11px var(--font);
  color: var(--hi);
  text-transform: lowercase;
  letter-spacing: 0.06em;
}
/* Filters (Show, View) as light chips rather than a boxed button group:
   each option its own rounded chip, the chosen one filled. */
.toolbar .seg,
.toolbar .status-seg {
  display: flex;
  gap: 6px;
  border: 0;
  overflow: visible;
}
.toolbar .seg button,
.toolbar .status-seg button {
  height: 28px;
  padding: 0 11px;
  font: 500 12.5px var(--font);
  white-space: nowrap;
  border: 1px solid var(--line2);
  border-radius: 999px;
}
.toolbar .seg button + button,
.toolbar .status-seg button + button {
  border-left: 1px solid var(--line2);
}
.toolbar .seg button:hover,
.toolbar .status-seg button:hover {
  color: var(--text);
  border-color: var(--muted);
}
.toolbar .seg button.on,
.toolbar .status-seg button.on {
  border-color: var(--text);
  background: var(--text);
  color: var(--bg);
}
/* Share & export: one button whose menu holds calendar, link, download and
   import. */
.more-wrap {
  position: relative;
}
#moreBtn {
  gap: 6px;
}
#moreBtn .caret {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}
.more-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 40;
  display: flex;
  flex-direction: column;
  min-width: 220px;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--line2);
  border-radius: 6px;
}
.more-menu[hidden] {
  display: none;
}
.more-menu > * {
  display: flex;
  align-items: center;
  height: 34px;
  padding: 0 10px;
  background: transparent;
  border: 0;
  border-radius: 4px;
  color: var(--muted);
  font: 500 13px var(--font);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.more-menu > *:hover {
  background: var(--panel2);
  color: var(--text);
}
.more-menu > [hidden] {
  display: none;
}
.toolbar .actions {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.toolbar .btn,
.dsc-main .btn {
  height: 30px;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.dsc .btn[hidden] {
  display: none;
}

/* events table */
.tbl-wrap {
  overflow-x: auto;
  border-top: 1px solid var(--line);
}
.ev th.sortable {
  cursor: pointer;
  user-select: none;
}
.ev th.sortable:hover {
  color: var(--text);
}
.ev th .arrow {
  color: var(--hi);
  margin-left: 4px;
}
.ev td {
  height: 34px;
}
.ev tr.month td {
  height: 28px;
  background: var(--panel);
  color: var(--hi);
  font: 600 11px var(--mono);
  text-transform: lowercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--line2);
}
.ev tr.row {
  cursor: pointer;
}
.ev tr.row.past td {
  color: var(--dim);
}
.ev tr.row.big td {
  background: var(--panel2);
}
.ev tr.row.big td:first-child {
  box-shadow: inset 3px 0 0 var(--hi);
}
.ev td.star {
  width: 30px;
  text-align: center;
  padding: 0;
}
.star-btn {
  background: none;
  border: 0;
  padding: 4px 6px;
  font: 700 15px var(--font);
  color: var(--line2);
  line-height: 1;
}
.star-btn.on,
.star-mark {
  color: var(--hi);
  font: 700 15px var(--font);
}
button.star-btn:hover {
  color: var(--hi);
}
.ev td.dates {
  white-space: nowrap;
}
.ev td.track b {
  font-weight: 600;
}
.ev td.track .title {
  color: var(--muted);
  font-size: 12px;
  margin-left: 6px;
}
.ev td.who {
  white-space: normal;
  min-width: 180px;
  max-width: 360px;
  line-height: 1.35;
  padding-top: 5px;
  padding-bottom: 5px;
}
.ev td.who .maybe {
  color: var(--muted);
}
.ev td.count {
  width: 36px;
  text-align: right;
  font-weight: 600;
}
.ev td.none {
  color: var(--line2);
}
.signup {
  font-size: 12.5px;
  white-space: nowrap;
}
.signup-missing {
  color: var(--dim);
  font-size: 12px;
}
.status-seg {
  display: inline-grid;
  grid-auto-flow: column;
  border: 1px solid var(--line2);
}
.status-seg button {
  background: transparent;
  border: 0;
  color: var(--muted);
  font: 500 12px var(--font);
  padding: 3px 7px;
}
.status-seg button + button {
  border-left: 1px solid var(--line2);
}
.status-seg button.on {
  background: var(--text);
  color: var(--bg);
}
.status-seg button:hover:not(.on) {
  color: var(--text);
}

/* status marks (Events x people) */
.mk {
  display: inline-block;
  min-width: 52px;
  padding: 2px 4px;
  font: 600 11px var(--font);
  text-align: center;
}
.mk.going {
  background: var(--text);
  color: var(--bg);
}
.mk.interested {
  border: 1px solid var(--muted);
  color: var(--muted);
}
.mk.waitlist {
  border: 1px dashed var(--dim);
  color: var(--dim);
}
.mk.blank {
  color: var(--line2);
  min-width: 52px;
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
.legend-item .mk {
  min-width: 0;
  padding: 1px 6px;
}
.ev th.person {
  text-align: center;
  width: 66px;
  padding: 6px 2px 5px;
}
.ev td.cell {
  text-align: center;
  padding: 0 2px;
}
button.cellbtn {
  background: none;
  border: 0;
  padding: 3px 0;
}
button.cellbtn:hover .mk.blank {
  color: var(--muted);
}
.avatar {
  flex: none;
  width: 24px;
  height: 24px;
  background: var(--panel2);
  border: 1px solid var(--line2);
  display: inline-grid;
  place-items: center;
  font: 700 9.5px var(--font);
  color: var(--text);
  letter-spacing: 0.02em;
}
.avatar.me {
  border: 2px solid var(--accent);
}
.person-h {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  max-width: 64px;
}
.person-h span:last-child {
  max-width: 64px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ev td.others {
  white-space: normal;
  color: var(--muted);
  font-size: 12.5px;
  min-width: 140px;
}

/* empty / sign-in / setup panels */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 20px;
  max-width: 560px;
  display: grid;
  gap: 12px;
}
.card h2 {
  margin: 0;
  font-size: 20px;
}
.card p {
  margin: 0;
  color: var(--muted);
}
.card .row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
}
.card input[type="text"],
.card input[type="url"] {
  flex: 1;
  min-width: 200px;
  height: 32px;
}
.kicker {
  color: var(--hi);
  font: 600 11px var(--mono);
  text-transform: lowercase;
  letter-spacing: 0.08em;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  background: var(--panel2);
  border: 1px solid var(--line2);
  padding: 4px 9px;
  font: 500 12.5px var(--font);
}
.chip:hover {
  border-color: var(--muted);
}
.empty-row td {
  height: 64px;
  color: var(--muted);
  text-align: center;
  white-space: normal;
}

/* group page */
.grp {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  align-items: start;
  max-width: 1100px;
}
.grp .card {
  max-width: none;
}
.list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.list li {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  border-bottom: 1px solid var(--line);
}
.list li .grow {
  flex: 1;
  min-width: 0;
}
.list li small {
  color: var(--dim);
}
.list .btn {
  height: 26px;
  font-size: 12px;
}
.copyrow {
  display: flex;
  gap: 8px;
}
.copyrow input {
  flex: 1;
  min-width: 0;
  height: 30px;
  font: 12.5px var(--mono);
}

/* drawer (event detail, add/edit form, import) */
.drawer-scrim {
  position: fixed;
  inset: 0;
  background: rgb(0 0 0 / 0.45);
  z-index: 40;
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(560px, 100vw);
  z-index: 41;
  background: var(--panel);
  border-left: 1px solid var(--line2);
  overflow-y: auto;
  padding: 20px 22px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.drawer[hidden],
.drawer-scrim[hidden] {
  display: none;
}
.drawer-h {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.drawer-h .grow {
  flex: 1;
  min-width: 0;
}
.drawer-h h2 {
  margin: 2px 0 4px;
  font-size: 24px;
}
.drawer-h .sub {
  color: var(--muted);
}
.drawer section {
  display: grid;
  gap: 8px;
}
.drawer section > h3 {
  margin: 0;
  font: 600 13px var(--font);
  display: flex;
  gap: 8px;
  align-items: baseline;
}
.drawer section > h3 small {
  color: var(--muted);
  font-weight: 400;
}
.drawer .btn {
  text-decoration: none;
}
.drawer .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.drawer .notes {
  white-space: pre-wrap;
  margin: 0;
}
.people-t td {
  height: 30px;
}
.people-t td.lvl {
  color: var(--muted);
}
.form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.form .full {
  grid-column: 1 / -1;
}
.form input,
.form select,
.form textarea {
  width: 100%;
  height: 32px;
}
.form textarea {
  height: 80px;
  font: inherit;
  color: var(--text);
  background: var(--panel2);
  border: 1px solid var(--line2);
  padding: 6px 9px;
  resize: vertical;
}
.form .err {
  grid-column: 1 / -1;
  color: var(--bad);
  margin: 0;
}
.comment {
  border-bottom: 1px solid var(--line);
  padding: 6px 0;
}
.comment .by {
  color: var(--muted);
  font-size: 12px;
  display: flex;
  gap: 8px;
}
.comment p {
  margin: 2px 0 0;
  white-space: pre-wrap;
}
.linkbtn {
  background: none;
  border: 0;
  padding: 0;
  color: var(--muted);
  text-decoration: underline;
  font-size: 12px;
}
.linkbtn:hover {
  color: var(--text);
}

.dsc-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 60;
  background: var(--text);
  color: var(--bg);
  padding: 8px 14px;
  font-weight: 600;
}
.dsc-toast[hidden] {
  display: none;
}

@media (max-width: 1180px) {
  .dsc header.top .tabs .tab .ico {
    display: none;
  }
}
@media (max-width: 900px) {
  .dsc header.top .brand small,
  .dsc header.top .brand .mark {
    display: none;
  }
}
@media (max-width: 640px) {
  .dsc header.top {
    padding: 0 8px;
  }
  .dsc header.top .brand {
    padding-right: 10px;
  }
  .dsc header.top .brand b {
    font-size: 24px;
  }
  .dsc #groupWrap .ctrl-lab {
    display: none;
  }
  .dsc #groupSelect {
    max-width: 110px;
  }
  .dsc-main {
    padding: 16px 16px 40px;
  }
  .toolbar .actions {
    margin-left: 0;
  }
  .form {
    grid-template-columns: 1fr;
  }
  .ev td.who {
    min-width: 140px;
  }
}
.dsc #acctBtn {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dsc input[type="checkbox"] {
  accent-color: var(--text);
}
@media (max-width: 640px) {
  .dsc #acctBtn {
    max-width: 72px;
  }
}
#impPreview {
  display: grid;
  gap: 16px;
}
.drawer .hint {
  overflow-wrap: anywhere;
}
.drawer .tbl-wrap {
  border-top: 0;
}

/* feed (feed.js) */
.fe {
  display: grid;
  grid-template-columns: minmax(0, 680px) minmax(280px, 360px);
  gap: 16px;
  align-items: start;
}
.fe-main,
.fe-side {
  display: grid;
  gap: 12px;
  min-width: 0;
}
.fe-side .card,
.fe-main .card {
  max-width: none;
}
.fe-people h3 {
  margin: 4px 0 0;
  font: 600 13px var(--font);
}
.fe-side .list li small {
  margin-right: 4px;
}
.fi {
  background: var(--panel);
  border: 1px solid var(--line);
  display: grid;
}
.fi-h {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px 0;
  font-size: 13.5px;
}
.fi-h .grow {
  flex: 1;
  min-width: 0;
}
.fi a,
.fe-side a:not(.btn) {
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}
.fi a:not(.btn):hover,
.fe-side a:not(.btn):hover {
  text-decoration: underline;
}
.fi-h time,
.fi-vis {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.fi-vis {
  border: 1px solid var(--line2);
  padding: 1px 6px;
}
.fi-result {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 28px;
  padding: 12px 16px 4px;
}
.fi-fig,
.fi-pb {
  display: grid;
  gap: 2px;
}
.fi-fig b.dot {
  font: 900 34px/1.05 var(--dot);
  color: var(--hi);
}
.fi-fig small,
.fi-pb small {
  color: var(--muted);
  font-size: 12px;
}
.fi-pb b {
  font: 700 22px/1.1 var(--dot);
  color: var(--hi);
}
.fi-pb.off b {
  color: var(--text);
}
.fi-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 8px 16px 0;
  border-top: 1px solid var(--line);
}
.fi-stats div {
  padding: 6px 0;
}
.fi-stats dt {
  color: var(--muted);
  font-size: 11.5px;
}
.fi-stats dd {
  margin: 0;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fi-caption {
  margin: 8px 16px 0;
  white-space: pre-wrap;
}
.fi-going {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px 0;
}
.fi-going .grow {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}
.fi-going small {
  color: var(--muted);
}
.fi-f {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
}
.fi-f .btn.on,
.dsc-main .btn.on {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}
.fi-kudos {
  color: var(--muted);
  font-size: 12.5px;
  flex: 1;
  min-width: 0;
}
.fi-comments {
  border-top: 1px solid var(--line);
  padding: 4px 16px 12px;
  display: grid;
  gap: 4px;
}
.fi-comments[hidden] {
  display: none;
}
.fi-say {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}
.fi-say input {
  flex: 1;
  min-width: 0;
  height: 30px;
}
.fld-lab {
  display: block;
  font-size: 12px;
  margin-bottom: 4px;
}
@media (max-width: 1000px) {
  .fe {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 560px) {
  .fi-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.drawer .facts {
  display: flex;
  gap: 12px;
}
.drawer .facts .k,
.lk h4 {
  color: var(--muted);
}
.lk h4 {
  margin: 4px 0 0;
  font: 600 12px var(--font);
}
.sch {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 8px;
  padding: 3px 0;
  border-bottom: 1px solid var(--line);
}
.sch span:first-child {
  color: var(--muted);
}
.sch-day {
  color: var(--hi);
  font: 600 11px var(--mono);
  text-transform: lowercase;
  letter-spacing: 0.08em;
  margin-top: 6px;
}
.me-form {
  grid-template-columns: 1fr 2fr;
}
@media (max-width: 640px) {
  .me-form {
    grid-template-columns: 1fr;
  }
}
.people-t td {
  white-space: normal;
}

/* explore + result in depth (feed.js) */
.fi-vs {
  margin: 8px 16px 0;
  color: var(--muted);
  font-size: 13px;
}
.fi-vs.ahead {
  color: var(--text);
}
.fi-h .btn {
  height: 26px;
}
#exCar {
  height: 28px;
  width: 180px;
}
.fe-t table {
  width: 100%;
}
.fe-t .num,
.fe-corners .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.fe-corners td.find {
  color: var(--hi);
  font-weight: 600;
}
.fe-t td.is-best {
  color: var(--best, var(--hi));
  background: color-mix(in srgb, var(--hi) 12%, transparent);
  font-weight: 700;
}
.tagc {
  color: var(--tag);
  font: 700 12px var(--mono);
  margin-right: 4px;
}
.fe-vs .fi-stats {
  margin: 0;
}
.fe-t th {
  text-align: left;
}
.fe-t th.num {
  text-align: right;
}
.fe-vs .fi-stats {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.fe-t {
  min-width: 0;
}
.fe-t .tbl-wrap {
  overflow-x: auto;
  max-width: 100%;
}
@media (max-width: 560px) {
  .fe-corners .cn {
    display: none;
  }
  .fe-corners th,
  .fe-corners td {
    padding-left: 4px;
    padding-right: 4px;
  }
}

/* Phones: each event is a card instead of a table row that scrolls sideways,
   so who's going and your own status stay on screen. */
@media (max-width: 640px) {
  #evTable.ev thead {
    display: none;
  }
  #evTable.ev,
  #evTable.ev tbody,
  #evTable.ev tr.month,
  #evTable.ev tr.empty-row {
    display: block;
  }
  #evTable.ev tr.month td,
  #evTable.ev tr.empty-row td {
    display: block;
  }
  #evTable.ev tr.row {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    grid-template-areas:
      "star dates count"
      "star track track"
      "star org signup"
      "star who who"
      "star you you";
    column-gap: 8px;
    row-gap: 4px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
  }
  #evTable.ev tr.row > td {
    display: block;
    height: auto;
    width: auto;
    max-width: none;
    padding: 0;
    border: 0;
    min-width: 0;
    white-space: normal;
  }
  #evTable.ev td.star {
    grid-area: star;
  }
  #evTable.ev td.dates {
    grid-area: dates;
  }
  #evTable.ev td.track {
    grid-area: track;
  }
  #evTable.ev td.org {
    grid-area: org;
    color: var(--muted);
  }
  #evTable.ev td.signup {
    grid-area: signup;
    text-align: right;
  }
  #evTable.ev td.who {
    grid-area: who;
    min-width: 0;
  }
  #evTable.ev td.count {
    grid-area: count;
    white-space: nowrap;
  }
  #evTable.ev td.count:not(:empty)::after {
    content: " going";
    color: var(--muted);
  }
  #evTable.ev td.you {
    grid-area: you;
  }
}

/* Phones: header controls that don't fit beside the logo and the two places
   (Progress's Track and Units) wrap onto a row of their own. */
@media (max-width: 600px) {
  .dsc header.top.lockup {
    flex-wrap: wrap;
    height: auto;
    min-height: 56px;
  }
  .dsc header.top.lockup .brand,
  .dsc header.top.lockup .places {
    height: 52px;
  }
  .dsc header.top.lockup .nav-div {
    display: none;
  }
  /* this page's tabs take a row of their own under the logo and places */
  .dsc header.top.lockup .subnav {
    order: 5;
    flex: 1 0 100%;
    height: 44px;
    border-top: 1px solid var(--line);
    overflow-x: auto;
    scrollbar-width: none;
  }
  .dsc header.top.lockup .hdr-controls:has(.ctrl:not([hidden]) + .ctrl, #trackWrap:not([hidden])) {
    flex: 1 0 100%;
    justify-content: flex-end;
    height: auto;
    padding: 8px 0;
    border-top: 1px solid var(--line);
  }
  .dsc header.top.lockup .hdr-controls .ctrl-lab {
    display: none;
  }
}
/* Phones: the group page is one column that fits the screen (the invite
   link's input used to stretch it to 1000 px). */
@media (max-width: 600px) {
  .grp {
    grid-template-columns: minmax(0, 1fr);
  }
  .grp > *,
  .copyrow input {
    min-width: 0;
  }
}
/* Phones: Going / Interested / Waitlist are full-width, thumb-sized buttons. */
@media (max-width: 600px) {
  .status-seg {
    display: grid;
    grid-auto-columns: minmax(0, 1fr);
    width: 100%;
  }
  .status-seg button {
    min-height: 44px;
    font-size: 15px;
    padding: 0 6px;
  }
}
