/* ==========================================================================
   Explore (explore.cfm) and the tabs it loads from ajax/: Feed, Following,
   Authors, Characters, Stories and Posts. Profile pages load the Feed,
   Followers Only and Characters tabs too, so they link this file as well.
   Cards follow the read page (read.css), chips and grids follow search.
   Every colour comes from the site variables so custom themes carry over.
   ========================================================================== */

.ex-wrap,
.tab-content-area {
  --ex-line: color-mix(in srgb, var(--surface-color) 75%, var(--text-light));
  --ex-deep: color-mix(in srgb, var(--surface-color) 50%, var(--bg-color));
}
.ex-page { max-width: 1140px; margin: 1.25rem auto 2rem; padding: 0 16px; box-sizing: border-box; }
.ex-page .tab-container { max-width: none; overflow: visible; background: none; }
.ex-page .tab-content-area { margin: .75rem 0 0; min-height: 8rem; }
/* profile pages give the panel no padding of their own */
.tab-content-area > .ex-wrap { padding: 1rem; }
.ex-page h1.ex-h1 {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 1.6rem;
  margin: 0 0 .75rem;
}
.ex-wrap [hidden], .ex-page [hidden] { display: none !important; }
.ex-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.ex-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
}
.ex-loading img { width: 50px; height: auto; margin: 0; }

/* ---------- toolbar: new post / story, sort ---------- */
.ex-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: .6rem 1rem;
  margin: 0 0 1rem;
}
.ex-new { display: flex; flex-wrap: wrap; gap: .5rem; }
.ex-sort {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-size: .85rem;
  font-weight: normal;
  color: var(--text-muted);
  margin: 0 0 0 auto;
}
.ex-sort select { width: auto; margin: 0; padding: .4rem .75rem; }

.ex-btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  border: 1px solid var(--ex-line);
  border-radius: 999px;
  padding: .4rem .95rem;
  font: inherit;
  font-size: .85rem;
  font-weight: 700;
  color: var(--text-light);
  background: var(--ex-deep);
  text-decoration: none;
  cursor: pointer;
  margin: 0;
}
.ex-btn:hover { border-color: var(--accent-pink); color: #fff; }
.ex-btn.is-primary {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-pink), var(--accent-purple));
}
.ex-btn.is-primary:hover { filter: brightness(1.1); }
.ex-btn[disabled] { opacity: .6; cursor: default; }
.ex-btn .svg-icon, .ex-btn svg { width: 20px; height: 20px; fill: currentColor; }
.ex-btn .follow-toggle { align-items: center; }

/* ---------- avatar with optional frame (same stacking as read.css .rd-avatar) ---------- */
.ex-avatar {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 68px;
  width: 68px;
  height: 68px;
  line-height: 0;
  text-decoration: none;
}
.ex-avatar > img { grid-area: 1 / 1; margin: 0; max-width: none; }
.ex-avatar .ex-pic {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--accent-purple);
}
.ex-avatar.is-character .ex-pic { border-color: var(--accent-gold); }
.ex-avatar .ex-frame { width: 100%; height: 100%; object-fit: contain; pointer-events: none; z-index: 2; }
.ex-avatar.has-frame .ex-pic { border: none; width: 50px; height: 50px; }

/* ---------- shared card ---------- */
.ex-card {
  background: var(--surface-color2);
  border: 1px solid rgba(255, 255, 255, .05);
  border-radius: var(--border-radius);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
  padding: 1rem 1.15rem;
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--text-light);
}
.ex-head { display: flex; gap: .8rem; align-items: flex-start; min-width: 0; }
.ex-head-main { flex: 1; min-width: 0; }
.ex-kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .3rem .45rem;
  font-size: .72rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.ex-flags { display: inline-flex; gap: .5rem; margin-left: .2rem; letter-spacing: 0; }
.ex-pill {
  font-size: .72rem;
  letter-spacing: 0;
  text-transform: none;
  border-radius: 999px;
  padding: .08rem .55rem;
  background: var(--ex-line);
  color: var(--text-light);
  white-space: nowrap;
  text-decoration: none;
}
.ex-pill i { margin-right: .25rem; }
.ex-pill.is-ic { background: color-mix(in srgb, var(--accent-purple) 35%, transparent); }
.ex-pill.is-ooc { background: color-mix(in srgb, var(--accent-pink) 30%, transparent); }
.ex-pill.is-status { background: color-mix(in srgb, var(--accent-gold) 22%, transparent); color: var(--accent-gold); }
a.ex-pill:hover { filter: brightness(1.2); }

.ex-wrap .ex-title {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 1.3rem;
  line-height: 1.25;
  margin: .2rem 0 .1rem;
}
.ex-wrap .ex-title a { color: var(--text-light); text-decoration: none; }
.ex-wrap .ex-title a:hover { color: var(--accent-pink); }
.ex-by { font-size: .9rem; color: var(--text-muted); }
.ex-by a { font-weight: 700; color: var(--accent-pink); text-decoration: none; }
.ex-by a.is-character { color: var(--accent-gold); }
.ex-by a:hover { text-decoration: underline; }
.ex-by.is-big a { font-family: 'Josefin Sans', sans-serif; font-size: 1.2rem; }
.ex-meta { display: flex; flex-wrap: wrap; gap: .2rem 1rem; font-size: .78rem; color: var(--text-muted); margin-top: .35rem; }
.ex-meta i { margin-right: .3rem; }

/* ---------- categories / tags / co-authors ---------- */
.ex-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: .6rem 1.2rem;
  margin-top: .85rem;
}
.ex-wrap .ex-details h4 {
  font-size: .72rem;
  font-weight: 700;
  color: var(--accent-gold);
  margin: 0 0 .3rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.ex-chips { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.ex-chips .ex-extra { display: contents; }
.ex-chip {
  background: var(--ex-deep);
  color: var(--lavender-mist, #c9b0ff);
  border: 1px solid color-mix(in srgb, var(--accent-purple) 55%, transparent);
  border-radius: 999px;
  padding: .1rem .55rem;
  font-size: .76rem;
  text-decoration: none;
  line-height: 1.5;
}
a.ex-chip:hover { border-color: var(--accent-pink); color: #fff; }
/* facts, reply speed: each value links to a search for it */
.ex-wrap .ex-link { color: inherit; text-decoration: none; border-bottom: 1px dotted color-mix(in srgb, currentColor 45%, transparent); }
.ex-wrap .ex-link:hover { color: var(--accent-pink); border-bottom-color: currentColor; }
.ex-wrap .ex-more {
  background: none;
  border: none;
  color: var(--accent-pink);
  cursor: pointer;
  font: inherit;
  font-size: .76rem;
  padding: .1rem .35rem;
  margin: 0;
}
.ex-wrap .ex-more:hover { text-decoration: underline; }

/* ---------- feed (stories and posts) ---------- */
.ex-feed { display: flex; flex-direction: column; gap: 1rem; }
.ex-item { padding: 0; overflow: hidden; }
.ex-item > .ex-inner { padding: 1rem 1.15rem; }
.ex-banner { line-height: 0; }
.ex-banner img { display: block; width: 100%; height: 180px; object-fit: cover; margin: 0; max-width: none; }

/* Writing preview: member HTML, faded out at the bottom. contain keeps stray styles inside the card. */
.ex-preview {
  position: relative;
  margin-top: .9rem;
  padding-top: .85rem;
  border-top: 1px solid var(--ex-line);
  max-height: 22rem;
  overflow: hidden;
  contain: content;
  font-size: .93rem;
  line-height: 1.55;
}
.ex-preview::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4rem;
  background: linear-gradient(to bottom, transparent, var(--surface-color2));
  pointer-events: none;
}
.ex-preview img { max-width: 100%; height: auto; }

.ex-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  margin-top: .85rem;
}
.ex-item .reactions-bar {
  gap: .35rem;
  margin-top: .85rem;
  padding-top: .8rem;
  border-top: 1px solid var(--ex-line);
}
.ex-item .reactions-bar .reaction-btn,
.ex-item .reactions-bar .reactionbar-btn {
  background: var(--ex-deep);
  border: 1px solid var(--ex-line);
  border-radius: 999px;
  padding: .2rem .6rem;
  font-size: .85rem;
  display: inline-flex;
  align-items: center;
}
.ex-item .reactions-bar .reaction-btn:hover,
.ex-item .reactions-bar .reactionbar-btn:hover { transform: none; border-color: var(--accent-pink); }
.ex-item .reactions-bar .reaction-btn.selected {
  transform: none;
  border-color: var(--accent-pink);
  background: color-mix(in srgb, var(--accent-pink) 18%, transparent);
}
.ex-item .reactions-bar .reactionbar-btn a { color: inherit; }
.ex-item .reactions-bar > a { text-decoration: none; }

.ex-loadmore { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin: 1.25rem 0 .25rem; }
.ex-empty { text-align: center; padding: 2rem 1rem; color: var(--text-muted); }
.ex-empty i { font-size: 2rem; display: block; margin-bottom: .5rem; }

/* ---------- authors and characters ---------- */
.ex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  align-items: stretch; /* cards in a row share a height, so buttons line up along the bottom */
}
.ex-profile { display: flex; flex-direction: column; gap: .65rem; }
.ex-profile .ex-head { align-items: center; }
.ex-wrap .ex-name {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 1.2rem;
  line-height: 1.2;
  margin: 0;
}
.ex-wrap .ex-name a { color: var(--accent-pink); text-decoration: none; }
.ex-wrap .ex-name a.is-character { color: var(--accent-gold); }
.ex-wrap .ex-name a:hover { text-decoration: underline; }
.ex-sub { font-size: .82rem; color: var(--text-muted); }
.ex-sub a { color: var(--text-light); text-decoration: none; }
.ex-sub a:hover { color: var(--accent-pink); }
.ex-tagline { font-size: .9rem; font-style: italic; margin: 0; max-height: 4.2rem; overflow: hidden; contain: content; }
.ex-tagline p { margin: 0; }
.ex-bio {
  margin: 0;
  color: var(--text-muted);
  font-size: .88rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ex-facts { margin: 0; padding: 0; list-style: none; font-size: .82rem; display: grid; gap: .2rem; }
.ex-facts li {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ex-facts i { width: 1.1rem; color: var(--text-muted); text-align: center; margin-right: .25rem; }
.ex-stats {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem 1rem;
  margin: 0;
  padding: .6rem 0 0;
  border-top: 1px solid var(--ex-line);
  list-style: none;
  font-size: .8rem;
  color: var(--text-light);
}
.ex-stat { display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; }
.ex-stat i { color: var(--text-muted); }
/* counts and buttons sit along the bottom of every card in the row */
.ex-profile .ex-stats { margin-top: auto; }
.ex-profile .ex-foot { padding-top: .2rem; }

.ex-wrap #loader { text-align: center; margin: 1.25rem auto; color: var(--text-muted); }

/* ---------- phones ---------- */
@media (max-width: 640px) {
  .tab-content-area > .ex-wrap { padding: .75rem; }
  .ex-sort { margin-left: 0; }
  .ex-item > .ex-inner { padding: .9rem; }
  .ex-banner img { height: 120px; }
  .ex-wrap .ex-title { font-size: 1.15rem; }
  .ex-preview { max-height: 16rem; }
  .ex-grid { grid-template-columns: 1fr; }
}
