:root {
  --bg: #0b0c0f;
  --panel: #101318;
  --muted: #a0a7b4;
  --text: #e9edf2;
  --text-weak: #c9ced8;
  --border: #1a1f27;
  --accent: #5b8cff;
  --accent-weak: #3a65d6;
  --success: #35c27e;
  --danger: #ff6b6b;
  --warning: #ffd166;

  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 18px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;

  --shadow-1: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 8px 20px rgba(0, 0, 0, 0.35);
  --shadow-focus: 0 0 0 2px rgba(91, 140, 255, 0.35);
}

* {
  box-sizing: border-box
}

html,
body {
  height: 100%
}

html {
  color-scheme: dark
}

body {
  margin: 0;
  font: 14px/1.55 system-ui, -apple-system, Segoe UI, Roboto, Inter, "Helvetica Neue", Arial, Noto Sans, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);
  background: radial-gradient(1200px 800px at 10% -10%, rgba(91, 140, 255, 0.08), transparent 40%),
    radial-gradient(1200px 800px at 120% 0%, rgba(53, 194, 126, 0.06), transparent 40%),
    var(--bg);
}

a {
  color: var(--text);
  text-decoration: none
}

a:hover {
  color: #fff;
  text-decoration: underline
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 var(--space-5)
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(180deg, rgba(16, 19, 24, 0.95), rgba(16, 19, 24, 0.85));
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(6px);
  padding: var(--space-4) 0;
  margin-bottom: var(--space-5);
}

.site-header h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0.2px
}

.site-header a {
  color: #fff;
  text-decoration: none
}

.nav {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-top: 8px;
  flex-wrap: wrap
}

.nav a {
  padding: 6px 10px;
  border-radius: 10px;
  background: transparent;
  border: 1px solid transparent
}

.nav a:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
  text-decoration: none
}

.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.00));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-1);
}

.card-pad {
  padding: var(--space-5)
}

.card .muted {
  color: var(--muted)
}

.card .header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border)
}

.card .body {
  padding: var(--space-4) var(--space-5)
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  color: #fff;
  background: linear-gradient(180deg, var(--accent), var(--accent-weak));
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.feed {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-5);
}

.mixed-feed {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-5);
}

.card .media {
  background: #0e1117;
  aspect-ratio: 16/9;
  width: 100%;
  display: block;
  object-fit: cover;
  border-bottom: 1px solid var(--border);
}

.card .title {
  font-size: 16px;
  font-weight: 600;
  margin: 6px 0 4px 0
}

.card .meta {
  font-size: 12px;
  color: var(--muted)
}

.card .desc {
  margin-top: 6px;
  color: var(--text-weak);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden
}

.featured {
  outline: 2px solid rgba(91, 140, 255, 0.35);
  outline-offset: 2px;
}

.featured-card {
  margin-bottom: 34px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #0f131a;
  color: var(--text);
  cursor: pointer;
  transition: transform .02s ease, background .15s ease, border .15s ease;
  font-weight: 600;
}

.btn:focus {
  outline: none;
  box-shadow: var(--shadow-focus)
}

.btn:hover {
  background: #0f1520;
  text-decoration: none
}

.btn:active {
  transform: translateY(1px)
}

.btn-primary {
  background: linear-gradient(180deg, var(--accent), var(--accent-weak));
  border-color: rgba(255, 255, 255, 0.08);
  color: #fff
}

.btn-primary:hover {
  filter: brightness(1.05)
}

.btn-secondary {
  background: #0f141c
}

.btn-ghost {
  background: transparent
}

.input,
.textarea,
select {
  width: 100%;
  background: #0e1218;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  outline: none;
  transition: box-shadow .15s ease, border .15s ease;
}

.textarea,
select {
  color: #fff;
}

.input:focus,
.textarea:focus,
select:focus {
  box-shadow: var(--shadow-focus);
  border-color: var(--accent-weak)
}

.textarea {
  min-height: 110px;
  resize: vertical
}

label {
  display: block;
  margin: 10px 0 6px 0;
  color: var(--text-weak)
}

.alert {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #0e1218
}

.alert.ok {
  border-color: rgba(53, 194, 126, 0.5);
  background: rgba(53, 194, 126, 0.08)
}

.alert.error {
  border-color: rgba(255, 107, 107, 0.5);
  background: rgba(255, 107, 107, 0.08)
}

.avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  background: #0e1117;
  border: 1px solid var(--border)
}

#loader {
  text-align: center;
  padding: var(--space-5);
  color: var(--muted)
}

/* Toasts */
.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  bottom: 22px;
  z-index: 50;
  opacity: 0;
  background: #0f1520;
  color: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  box-shadow: var(--shadow-1);
  transition: opacity .2s ease, transform .2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0)
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 60;
  background: rgba(8, 10, 13, 0.6);
  backdrop-filter: blur(4px)
}

.modal.open {
  display: flex
}

.modal .modal-content {
  width: min(640px, 92vw);
  background: #0f1520;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow-1);
}

.modal .modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 10px
}

/* Nav bar beneath header */
.subnav {
  margin: 4px 0 18px 0;
  color: var(--muted)
}

.subnav a {
  color: var(--text-weak)
}

.subnav a:hover {
  color: #fff;
  text-decoration: none
}

/* Small utilities */
.muted {
  color: var(--muted)
}

.center {
  text-align: center
}

.hidden {
  display: none !important
}

hr.sep {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 16px 0
}


/* Search styleing */

/* Results section cards */
#search-results .search-result {
  padding: 12px;
  margin-bottom: 8px;
}

#search-results .result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

#search-results .result-info {
  display: flex;
  flex-direction: column;
}

#search-results .recent {
  color: #555;
  margin-top: 4px;
}

#search-results .count {
  color: #666;
}

#search-results .why {
  color: #777;
  font-style: italic;
}

#search-results {
  margin-bottom: 12px;
}

/* Keep search results visible below fixed header */
#search-results {
  scroll-margin-top: 200px;
  /* tweak to your header height */
  margin-bottom: 12px;
}


/* Keep clamp default (3 lines) */
.card .desc{
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;          /* needed for line-clamp */
  overflow-wrap: anywhere;      /* avoid layout break on long tokens */
}

/* When expanded (Show more), render user newlines */
.card .desc.open{
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
  text-overflow: clip;
  white-space: pre-line;        /* <-- interprets \n as line breaks, safe */
}

/* Expanded state MUST beat any clamp */
.card .desc.open{
  display: block !important;           /* beat display:-webkit-box */
  -webkit-line-clamp: initial !important;
  -webkit-box-orient: initial !important;
  overflow: visible !important;
  text-overflow: clip !important;
  white-space: pre-line !important;    /* keep user newlines */
  max-height: none !important;         /* just in case */
  height: auto !important;             /* just in case */
}


/* If you show FULL descriptions on the profile page (no clamp),
   keep newlines without turning off your per-card toggle logic */
.profile-full .card .desc.open{
  white-space: pre-line;        /* show \n as real new lines */
}
