/* ============================================================
   Discourse-like font scale + your theme
   UI: Inter
   Mono blocks: IBM Plex Mono
   ============================================================ */

:root{
  --bg0:#070B12;
  --bg1:#0B1220;
  --bg2:#0F1A2E;

  --text: rgba(255,255,255,.92);
  --muted: rgba(255,255,255,.62);

  --line: rgba(255,255,255,.10);
  --line2: rgba(255,255,255,.14);

  --accent:#18D3C8;

  --shadow: 0 18px 55px rgba(0,0,0,.55);

  /* Top segmented pills */
  --pillBorder: rgba(255,255,255,.18);
  --pillDivider: rgba(255,255,255,.14);
  --pillHover: rgba(255,255,255,.08);
  --pillLeftBg: rgba(0,0,0,.22);

  /* Patreon */
  --patreonA: #ff4a1f;
  --patreonB: #ff6a2a;

  /* Discourse-ish scale */
  --fs-base: 15px;   /* main body text */
  --fs-small: 13px;  /* meta */
  --fs-xs: 12px;     /* subtle/meta */
  --fs-h3: 16px;     /* section title */
  --fs-modal-title: 18px;
  --lh-base: 1.5;
  --lh-tight: 1.35;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }

body{
  margin:0;
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  background:
    radial-gradient(1200px 520px at 20% -10%, rgba(33,167,255,.12), transparent 55%),
    radial-gradient(900px 420px at 85% 0%, rgba(24,211,200,.14), transparent 55%),
    linear-gradient(180deg, var(--bg0), var(--bg1) 35%, var(--bg0));
  color:var(--text);
  overflow-x:hidden;
}

/* Prevent background scroll when modal open */
body.modal-open{ overflow:hidden; }

/* Utilities */
.row{ display:flex; gap:10px; align-items:center; }
.stack{ display:flex; flex-direction:column; gap:10px; }
.muted{ color:var(--muted); }
.small{ font-size: var(--fs-small); }
.xs{ font-size: var(--fs-xs); }
.accent{ color:var(--accent); }

/* Topbar */
.topbar{
  position:sticky;
  top:0;
  z-index:50;
  display:grid;
  grid-template-columns: 260px 1fr 420px;
  gap:12px;
  padding:14px 16px;
  backdrop-filter: blur(14px);
  background: rgba(7,11,18,.72);
  border-bottom: 1px solid var(--line);
}

.brand{ display:flex; align-items:center; }
.brandMark{
  display:flex;
  align-items:center;
  gap:8px;
  padding:10px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line);
  box-shadow: 0 10px 24px rgba(0,0,0,.25);
}

.chev{ color:var(--accent); font-weight:800; }
.cmdText{ font-weight:700; letter-spacing:.2px; }
.cmdCursor{
  font-weight:800;
  color:var(--accent);
  animation: cursorBlink 1s step-end infinite;
}
@keyframes cursorBlink{ 0%,49%{opacity:1} 50%,100%{opacity:0} }

/* Search */
.topCenter{ display:flex; align-items:center; justify-content:center; }
.searchWrap{
  width:min(720px, 100%);
  display:flex;
  gap:8px;
  align-items:center;
  padding:10px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line);
}
.search{
  flex:1;
  background:transparent;
  border:none;
  outline:none;
  color:var(--text);
  font-size: var(--fs-base);
}
.search::placeholder{ color: rgba(255,255,255,.45); }

/* Buttons */
.iconBtn{
  width:34px; height:34px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
  color: var(--text);
  cursor:pointer;
}
.iconBtn:hover{ background: rgba(255,255,255,.08); }

.chipBtn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  padding:10px 12px;
  border-radius:999px;
  border:1px solid var(--line);
  background: rgba(255,255,255,.05);
  color:var(--text);
  cursor:pointer;
  font-weight:600;
  text-decoration:none;
  font-size: var(--fs-small);
}
.chipBtn:hover{ background: rgba(255,255,255,.08); }
.chipBtn.wide{ padding:12px 16px; min-width: 220px; }

.topRight{ display:flex; justify-content:flex-end; align-items:center; }

/* Attached top segmented group */
.topPillGroup{
  display:flex;
  align-items:stretch;
  border-radius: 10px;
  overflow:hidden;
  border: 1px solid var(--pillBorder);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  box-shadow: 0 10px 26px rgba(0,0,0,.35);
}
.topPill{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  height: 36px;
  padding: 0 14px;
  border:none;
  background: transparent;
  color: rgba(255,255,255,.92);
  text-decoration:none;
  font-weight:600;
  cursor:pointer;
  user-select:none;
  white-space:nowrap;
  font-size: var(--fs-small);
}
.topPill + .topPill{ border-left: 1px solid var(--pillDivider); }
.topPill--left{
  width:38px; padding:0;
  background: var(--pillLeftBg);
  font-weight:700;
}
.topPill:hover{ background: var(--pillHover); }
.topPill:active{ background: rgba(255,255,255,.12); }
.topPillIcon{ display:flex; }

.topPill--patreon{
  background: linear-gradient(180deg, var(--patreonB), var(--patreonA));
  color: rgba(255,255,255,.96);
  font-weight:700;
}
.topPill--patreon:hover{ filter: brightness(1.04); }
.topPillImg{ width:18px; height:18px; object-fit:contain; display:block; }

/* Layout */
.layout{
  display:grid;
  grid-template-columns: 260px 1fr 320px;
  gap:16px;
  padding:16px;
  max-width: 1400px;
  margin: 0 auto;
}
.sidebar{ display:flex; flex-direction:column; gap:14px; }
.content{ min-width: 0; }

.card{
  padding:14px;
  border-radius: 18px;
  background: rgba(12,20,38,.70);
  border: 1px solid var(--line);
  box-shadow: 0 14px 40px rgba(0,0,0,.35);
}
.card.subtle{ background: rgba(12,20,38,.45); }
.cardTitle{
  font-weight:700;
  margin-bottom:12px;
  letter-spacing:.2px;
  font-size: var(--fs-small);
  text-transform:none;
}

/* Categories */
.catBtn{
  text-align:left;
  padding:10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
  color: var(--text);
  cursor:pointer;
  font-weight:600;
  font-size: var(--fs-small);
}
.catBtn:hover{ background: rgba(255,255,255,.08); }
.catBtn.active{
  border-color: rgba(24,211,200,.42);
  background: rgba(24,211,200,.10);
}

/* Filters */
.chip{
  display:flex;
  gap:10px;
  align-items:center;
  padding:10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
  color: var(--text);
  font-weight:600;
  font-size: var(--fs-small);
}
.chip input{ accent-color: var(--accent); }

/* Tags */
.tagCloud{ display:flex; flex-wrap:wrap; gap:8px; }
.tag{
  border:1px solid var(--line);
  background: rgba(255,255,255,.04);
  color: rgba(255,255,255,.86);
  padding:7px 10px;
  border-radius: 999px;
  cursor:pointer;
  font-weight:600;
  font-size: var(--fs-xs);
}
.tag:hover{ background: rgba(255,255,255,.08); }
.tag.active{
  border-color: rgba(24,211,200,.42);
  background: rgba(24,211,200,.10);
  color: rgba(235,255,255,.95);
}

/* Content header */
.contentHeader{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
}
.sortWrap{ display:flex; align-items:center; gap:10px; }
select{
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line);
  color: var(--text);
  padding:10px 12px;
  border-radius: 12px;
  outline:none;
  font-size: var(--fs-small);
}
select:focus{ border-color: rgba(24,211,200,.45); }

.miniStat{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
  font-weight:700;
  font-size: var(--fs-small);
}
.dot{
  width:10px; height:10px;
  border-radius:999px;
  background: var(--accent);
  box-shadow: 0 0 18px rgba(24,211,200,.45);
}

/* Feed */
.feed{ display:flex; flex-direction:column; gap:12px; }
.topic{
  display:flex;
  gap:12px;
  justify-content:space-between;
  align-items:flex-start;
  padding:14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(12,20,38,.60);
  cursor:pointer;
  transition: transform .08s ease, background .12s ease, border-color .12s ease;
}
.topic:hover{
  transform: translateY(-1px);
  background: rgba(12,20,38,.78);
  border-color: rgba(24,211,200,.20);
}
.title{
  font-weight:700;
  letter-spacing:.1px;
  font-size: 16px; /* Discourse-ish topic title weight/size */
  line-height: 1.25;
}
.excerpt{
  margin-top:8px;
  color: rgba(255,255,255,.70);
  font-size: var(--fs-small);
  line-height: var(--lh-base);
}
.meta{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin-top:10px;
}
.kpi{
  padding:6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
  color: rgba(255,255,255,.80);
  font-size: var(--fs-xs);
  font-weight:600;
}

/* Side lists */
.sideList{ display:flex; flex-direction:column; gap:10px; }
.sideItem{
  padding:10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
  cursor:pointer;
  font-size: var(--fs-small);
}
.sideItem:hover{ background: rgba(255,255,255,.07); }

/* Load more */
.loadMoreWrap{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:10px;
  padding:14px 0 6px;
}

/* =============================
   MODALS
   ============================= */
.modal{ position:fixed; inset:0; z-index:100; display:block; }
.modal[hidden]{ display:none; }
.modalBackdrop{
  position:absolute; inset:0;
  background: rgba(0,0,0,.66);
  backdrop-filter: blur(8px);
}
.modalCard{
  position:relative;
  width:min(980px, calc(100% - 28px));
  max-height: calc(100% - 28px);
  margin: 14px auto;
  border-radius: 22px;
  border: 1px solid var(--line2);
  background: rgba(10,18,34,.92);
  box-shadow: var(--shadow);
  overflow:hidden;
  display:flex;
  flex-direction:column;
}
.entryModal{ width:min(1020px, calc(100% - 28px)); }

.modalTop{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  padding:14px 14px 12px;
  border-bottom: 1px solid var(--line);
}
.modalTitle{
  font-weight:700;
  font-size: var(--fs-modal-title);
  line-height: 1.2;
}
.modalMeta{ margin-top:6px; }
.entryHead{ min-width:0; }

/* Hero */
.entryHero{
  height: 150px;
  background:
    linear-gradient(180deg, rgba(0,0,0,.20), rgba(0,0,0,.75)),
    radial-gradient(1100px 240px at 50% 0%, rgba(24,211,200,.14), transparent 55%);
  border-bottom: 1px solid var(--line);
}
.entryHeroOverlay{ height:100%; display:flex; align-items:flex-end; }
.entryHeroText{ padding:14px; }
.entryHeroTitle{ font-weight:700; font-size: 18px; }
.entryHeroSub{ margin-top:6px; color: rgba(255,255,255,.70); font-size: var(--fs-small); }

/* Entry body */
.entryBody{ padding:14px; overflow:auto; }
.entrySection{ margin-bottom:16px; }

.sectionTitle{
  margin:0 0 10px 0;
  font-size: var(--fs-h3);
  font-weight:700;
  letter-spacing:.2px;
}

/* Details grid */
.detailsGrid{
  display:grid;
  grid-template-columns: 160px 1fr;
  gap:8px 12px;
  padding:12px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
  font-size: var(--fs-small);
}
.detailsGrid .k{ color: rgba(255,255,255,.70); font-weight:600; }
.detailsGrid .v{ color: rgba(255,255,255,.92); font-weight:600; }

/* Paid/Free coloring */
.detailsGrid .v.accessPaid{ color:#ff4d6d !important; }
.detailsGrid .v.accessFree{ color:#3cff8f !important; }

/* Mono blocks (Changelog/Notes/Preview JSON) */
.monoBlock{
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: var(--fs-xs);
  line-height: var(--lh-base);
  padding:12px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
  color: rgba(255,255,255,.84);
}

/* Features grid */
.featuresGrid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap:12px;
}
.featureCard{
  padding:12px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
}
.featureTitle{
  font-weight:700;
  margin-bottom:10px;
  font-size: var(--fs-small);
}
.featureList{ display:flex; flex-direction:column; gap:8px; }
.featureItem{
  padding:8px 10px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(0,0,0,.14);
  color: rgba(255,255,255,.82);
  font-size: var(--fs-xs);
  line-height: var(--lh-tight);
}

/* Modal bottom */
.modalBottom{
  padding:12px 14px;
  border-top: 1px solid var(--line);
  display:flex;
  flex-direction:column;
  gap:10px;
}
.tagRow{ display:flex; flex-wrap:wrap; gap:8px; }
.modalActions{ display:flex; flex-wrap:wrap; gap:10px; }

/* Generator page helpers */
.genGrid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap:12px;
  margin-top:10px;
}
.genField{ display:flex; flex-direction:column; gap:8px; }
.genField--row{ grid-column: 1 / -1; }

.genField input,
.genField select{
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.12);
  color: rgba(255,255,255,.92);
  padding:10px 12px;
  border-radius: 14px;
  outline:none;
  font-size: var(--fs-small);
}
.genField input:focus,
.genField select:focus{ border-color: rgba(24,211,200,.45); }

.genTextarea{
  width:100%;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.12);
  color: rgba(255,255,255,.92);
  padding:12px;
  border-radius: 18px;
  outline:none;
  resize: vertical;
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: var(--fs-xs);
  line-height: var(--lh-base);
}
.genTextarea:focus{ border-color: rgba(24,211,200,.45); }

.genGroups{ display:flex; flex-direction:column; gap:12px; margin-top:12px; }
.genGroupCard{
  padding:12px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
}

/* Responsive */
@media (max-width: 1100px){
  .layout{ grid-template-columns: 240px 1fr; }
  .sidebar.right{ display:none; }
  .topbar{ grid-template-columns: 240px 1fr 420px; }
}
@media (max-width: 860px){
  .layout{ grid-template-columns: 1fr; }
  .sidebar.left{ order:2; }
  .content{ order:1; }
  .topbar{ grid-template-columns: 1fr; gap:10px; }
  .topRight{ justify-content:flex-start; flex-wrap:wrap; }
  .featuresGrid{ grid-template-columns: 1fr; }
  .genGrid{ grid-template-columns: 1fr; }
}
