/* ============================================================
   Shared theme — purposed.in / AFG / Travelogue / UUKA
   Mobile-first · Card-based · Faceted nav · PWA-ready
   Goal: <8KB critical CSS, system fonts only, no render-blocking
   ============================================================ */
:root{
  --accent:#6366f1;
  --accent-dark:#4f46e5;
  --accent-light:#e0e7ff;
  --bg:#f7f8fa;
  --surface:#fff;
  --border:#e2e8f0;
  --text:#1a1a1a;
  --muted:#64748b;
  --radius:10px;
  --radius-lg:16px;
  --tap:44px;
  --shadow-sm:0 1px 3px rgba(0,0,0,.08);
  --shadow:0 4px 16px rgba(99,102,241,.12);
  font-size:16px;
}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  background:var(--bg);color:var(--text);line-height:1.5;
}
a{color:var(--accent);text-decoration:none}
a:hover{text-decoration:underline}
img,svg{max-width:100%;height:auto}

/* Header / nav — shared across all three properties */
header.site-header{background:#1a1f36;color:#fff;padding:14px 20px}
header.site-header h1{margin:0;font-size:18px;font-weight:600}
header.site-header .tagline{font-size:12px;color:#9aa5c1;margin-top:2px}
nav.tabs{display:flex;gap:8px;padding:10px 20px;background:var(--surface);
  border-bottom:1px solid var(--border);flex-wrap:wrap}
nav.tabs a{padding:6px 12px;border-radius:6px;color:#444;font-size:13px}
nav.tabs a.active{background:var(--accent);color:#fff}

/* Cross-promo strip: lets each site surface the other's content */
.cross-promo{display:flex;gap:10px;align-items:center;padding:8px 20px;
  background:#eef2ff;border-bottom:1px solid var(--border);font-size:12.5px;flex-wrap:wrap}
.cross-promo a{font-weight:600}
.cross-promo .sep{color:var(--border)}

/* Layout primitives */
.container{max-width:1200px;margin:0 auto;padding:16px 20px}
.panel{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:14px}
.grid-2{display:flex;gap:16px;flex-wrap:wrap}
.grid-2 > .panel{flex:1;min-width:280px}

/* Forms */
input,textarea,select,button{font-family:inherit;font-size:14px}
input[type=text],input[type=search],input[type=email],textarea{
  width:100%;padding:8px 10px;border:1px solid var(--border);border-radius:6px}
button,.btn{padding:8px 16px;background:var(--accent);color:#fff;border:none;
  border-radius:6px;font-size:13px;cursor:pointer}
button:hover,.btn:hover{background:var(--accent-dark)}
.btn-secondary{background:var(--surface);color:var(--accent);border:1px solid var(--accent)}

/* ── Card grid — mobile-first, scales to multi-col ─────────────────────────── */
.card-grid{
  display:grid;
  grid-template-columns:1fr;
  gap:12px;
  margin:12px 0;
}
@media(min-width:480px){ .card-grid{ grid-template-columns:repeat(2,1fr); } }
@media(min-width:768px){ .card-grid{ grid-template-columns:repeat(3,1fr); gap:16px; } }
@media(min-width:1024px){ .card-grid{ grid-template-columns:repeat(4,1fr); } }

.node-card{
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:14px;
  cursor:pointer;
  transition:box-shadow .15s,border-color .15s;
  display:flex;
  flex-direction:column;
  gap:6px;
}
.node-card:hover,.node-card:focus-visible{
  box-shadow:var(--shadow);
  border-color:var(--accent);
  outline:none;
}
.node-card .nc-type{
  font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.5px;
  color:var(--accent);background:var(--accent-light);
  display:inline-block;padding:2px 7px;border-radius:4px;align-self:flex-start;
}
.node-card .nc-title{ font-size:14px;font-weight:600;color:var(--text);line-height:1.35; }
.node-card .nc-sub  { font-size:12px;color:var(--muted);line-height:1.4; }
.node-card .nc-meta { font-size:11px;color:#94a3b8;margin-top:auto; }

/* ── Bottom-sheet (filter drawer) ─────────────────────────────────────────── */
.bottom-sheet-overlay{
  position:fixed;inset:0;background:rgba(0,0,0,.45);z-index:200;
  display:none;align-items:flex-end;
}
.bottom-sheet-overlay.open{ display:flex; }
.bottom-sheet{
  background:#fff;border-radius:20px 20px 0 0;
  width:100%;max-height:85vh;overflow-y:auto;
  padding:20px 20px 32px;
  animation:slideUp .25s ease;
}
@keyframes slideUp{ from{ transform:translateY(100%); } to{ transform:translateY(0); } }
.sheet-handle{
  width:40px;height:4px;background:#e2e8f0;border-radius:2px;
  margin:0 auto 16px;
}
.filter-group{ margin-bottom:16px; }
.filter-group h3{ font-size:12px;font-weight:700;text-transform:uppercase;letter-spacing:.5px;color:var(--muted);margin:0 0 8px; }
.filter-chips{ display:flex;flex-wrap:wrap;gap:6px; }
.chip{
  padding:6px 12px;border-radius:20px;font-size:12px;font-weight:500;
  border:1px solid var(--border);background:#fff;color:var(--text);cursor:pointer;
  transition:background .12s,border-color .12s,color .12s;
}
.chip.active,.chip:hover{ background:var(--accent);color:#fff;border-color:var(--accent); }

/* ── Sticky sort/filter bar ─────────────────────────────────────────────────── */
.sort-bar{
  position:sticky;top:0;z-index:100;
  background:var(--bg);border-bottom:1px solid var(--border);
  display:flex;align-items:center;gap:8px;
  padding:8px 16px;overflow-x:auto;
}
.sort-bar::-webkit-scrollbar{ display:none; }
.sort-btn{
  white-space:nowrap;padding:6px 14px;border-radius:20px;border:1px solid var(--border);
  background:#fff;font-size:12px;font-weight:600;cursor:pointer;
  display:inline-flex;align-items:center;gap:5px;
}
.sort-btn.active,.sort-btn:hover{ background:var(--accent);color:#fff;border-color:var(--accent); }
.filter-trigger{
  margin-left:auto;white-space:nowrap;padding:6px 14px;border-radius:20px;
  border:1px solid var(--accent);color:var(--accent);font-size:12px;font-weight:600;
  background:#fff;cursor:pointer;display:inline-flex;align-items:center;gap:5px;
}
.filter-trigger:hover,.filter-trigger.has-filters{ background:var(--accent);color:#fff; }

/* Lists / cards */
ul.results{list-style:none;padding:0;margin:8px 0}
.result-item,.card{padding:12px;border-radius:var(--radius);font-size:13.5px;background:var(--surface);border:1px solid var(--border);}
.result-item:hover{background:var(--accent-light);cursor:pointer;border-color:var(--accent);}
.badge{display:inline-block;font-size:10px;padding:2px 7px;border-radius:10px;
  background:var(--accent-light);color:var(--accent);margin-left:6px;font-weight:600;}
.meta{color:var(--muted);font-size:11.5px}

/* Forum-specific */
.thread-row{display:flex;justify-content:space-between;padding:10px 8px;
  border-bottom:1px solid var(--border);font-size:14px}
.thread-row .stats{color:var(--muted);font-size:12px;white-space:nowrap}
.post{border:1px solid var(--border);border-radius:var(--radius);padding:12px;margin-bottom:10px}
.post .post-meta{color:var(--muted);font-size:12px;margin-bottom:6px}

footer.site-footer{padding:20px;text-align:center;color:var(--muted);font-size:12px}

/* Empty state */
.empty-state{color:var(--muted);font-size:13px;padding:20px;text-align:center}

/* Idea generator widgets — shared across purposed.in / AFG / Travelogue */
.type-tabs{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:14px}
.type-tabs a{padding:6px 12px;border:1px solid var(--border);border-radius:16px;
  font-size:13px;color:#444}
.type-tabs a.active{background:var(--accent);color:#fff;border-color:var(--accent)}
form.seed-form{display:flex;gap:8px;margin-bottom:16px}
form.seed-form input{flex:1}
.idea-card{border:1px solid var(--border);border-radius:var(--radius);padding:12px 14px;margin-bottom:10px}
.idea-card h3{margin:0 0 6px;font-size:14px}
.idea-card p{margin:0;font-size:13.5px;line-height:1.5;color:#333}

/* Shared-account widget — login/signup or signed-in status, every page */
.auth-widget{font-size:12.5px;color:var(--muted);padding:6px 20px;background:var(--bg);
  border-bottom:1px solid var(--border);text-align:right}
.auth-widget a{font-weight:600}

/* Free-tier essay generator CTA — shown via crossPromoHtml() on every page */
.essay-cta{background:#eef4ff;border:1px solid var(--accent);border-radius:var(--radius);
  padding:10px 14px;margin:10px 0;font-size:13px;color:var(--text)}
.essay-cta strong{color:var(--accent-dark)}
.essay-cta a{font-weight:600;margin-left:4px}

/* Network cross-linking footer block */
.network-links{background:var(--surface);border-top:1px solid var(--border);
  padding:14px 20px;font-size:12.5px;color:var(--muted)}
.network-links strong{color:var(--text)}
.network-links a{margin-right:10px}

/* ============================================================
   Accessibility & mobile-landing polish
   Visitors arriving from social/search ads on a phone need:
   - clearly tappable controls (>=44px touch targets)
   - visible focus states (keyboard + assistive tech)
   - AA contrast on every text/background pairing above
   - consistent vertical rhythm so stacked panels don't feel cramped
   ============================================================ */

/* Visible focus ring everywhere — helps anyone tabbing through on
   a connected keyboard, and satisfies WCAG 2.4.7 */
a:focus-visible,button:focus-visible,.btn:focus-visible,
input:focus-visible,select:focus-visible,textarea:focus-visible,
.result-item:focus-visible,.uni-item:focus-visible{
  outline:3px solid var(--accent-dark);outline-offset:2px;border-radius:4px;
}

/* Comfortable tap targets for primary actions */
button,.btn,nav.tabs a,.type-tabs a{
  min-height:var(--tap);display:inline-flex;align-items:center;justify-content:center;
  padding:10px 18px;
}
.type-tabs a,.badge{min-height:auto} /* small inline chips stay compact */
.type-tabs a{min-height:var(--tap);padding:10px 14px}

/* List/result rows: bigger hit area + breathing room between items
   so adjacent links don't get mis-tapped on small screens */
.result-item,.card,.idea-card,.thread-row,.uni-item{
  min-height:var(--tap);
}
.result-item,.card{padding:12px}
ul.results > *{margin-bottom:6px}

/* Form controls — taller inputs are easier to hit and read on mobile */
input[type=text],input[type=search],input[type=email],textarea,select{
  min-height:var(--tap);padding:10px 12px;font-size:15px;
}

/* Section rhythm: consistent spacing between stacked panels on the
   single-column mobile layout most ad traffic lands on */
@media (max-width:639px){
  .container{padding:14px 16px}
  .panel{padding:14px;margin-bottom:14px}
  .panel:last-child{margin-bottom:0}
  .grid-2{gap:14px}
  header.site-header{padding:14px 16px}
  .cross-promo{padding:10px 16px}
  footer.site-footer{padding:24px 16px}
  /* full-width primary buttons read better as thumb targets */
  form.seed-form{flex-direction:column}
  form.seed-form button{width:100%}
}

/* ── Node-type colour families ─────────────────────────────────────────────── */
.nc-type.nf-knowledge{ background:#e0e7ff;color:#4338ca; } /* indigo — concept, word_study */
.nc-type.nf-practical{ background:#dcfce7;color:#15803d; } /* green  — guide, tool, generator */
.nc-type.nf-research { background:#f3e8ff;color:#7e22ce; } /* purple — case_study, debate, timeline */
.nc-type.nf-explore  { background:#fef3c7;color:#b45309; } /* amber  — data_explorer, exploration */
