/* ============================================================
   Learnova — home + shared sidebar stylesheet
   Self-contained: does not depend on the Tailwind build artifact.
   Dark mode is driven by the .dark class that the layout's
   Alpine themeApp() toggles on <html>.
   ============================================================ */

.lh-root {
  --lh-bg: #ffffff;
  --lh-bg-soft: #f6f7fb;
  --lh-surface: #ffffff;
  --lh-border: #e5e7eb;
  --lh-border-strong: #d1d5db;
  --lh-text: #111827;
  --lh-muted: #6b7280;
  --lh-faint: #9ca3af;
  --lh-accent: #4f46e5;
  --lh-accent-soft: #eef2ff;
  --lh-accent-text: #4338ca;
  --lh-shadow: 0 1px 2px rgba(17, 24, 39, .04), 0 8px 24px rgba(17, 24, 39, .06);
  --lh-shadow-lg: 0 2px 4px rgba(17, 24, 39, .05), 0 18px 40px rgba(17, 24, 39, .10);
  --lh-radius: 16px;
}

.dark .lh-root {
  --lh-bg: #020617;
  --lh-bg-soft: #0b1220;
  --lh-surface: #0f172a;
  --lh-border: #1e293b;
  --lh-border-strong: #334155;
  --lh-text: #f1f5f9;
  --lh-muted: #94a3b8;
  --lh-faint: #64748b;
  --lh-accent: #818cf8;
  --lh-accent-soft: #1e1b4b;
  --lh-accent-text: #a5b4fc;
  --lh-shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  --lh-shadow-lg: 0 2px 4px rgba(0, 0, 0, .4), 0 18px 40px rgba(0, 0, 0, .45);
}

.lh-root {
  background: var(--lh-bg);
  color: var(--lh-text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.lh-container {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: 20px;
}

@media (min-width: 1024px) {
  .lh-container { padding-inline: 32px; }
}

.lh-skip {
  position: absolute;
  left: -9999px;
}
.lh-skip:focus {
  left: 12px;
  top: 12px;
  z-index: 100;
  background: var(--lh-accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
}

/* ---------------- Hero ---------------- */

.lh-hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(60rem 30rem at 15% -10%, rgba(99, 102, 241, .22), transparent 60%),
    radial-gradient(50rem 26rem at 90% 10%, rgba(168, 85, 247, .20), transparent 60%),
    linear-gradient(160deg, #1e1b4b 0%, #312e81 45%, #0f172a 100%);
  color: #fff;
  padding: 56px 0 64px;
}

@media (min-width: 768px) {
  .lh-hero { padding: 88px 0 104px; }
}

.lh-hero__grid {
  display: grid;
  gap: 40px;
  align-items: center;
}

@media (min-width: 1024px) {
  .lh-hero__grid {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
    gap: 56px;
  }
}

.lh-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .10);
  border: 1px solid rgba(255, 255, 255, .18);
  font-size: 13px;
  font-weight: 600;
  color: #e0e7ff;
  margin-bottom: 22px;
}

.lh-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #34d399;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, .25);
}

.lh-hero h1 {
  font-size: clamp(2.1rem, 5.4vw, 3.6rem);
  line-height: 1.08;
  letter-spacing: -.025em;
  font-weight: 800;
  margin: 0 0 20px;
}

.lh-hero__grad {
  background: linear-gradient(92deg, #a5b4fc 0%, #d8b4fe 45%, #f9a8d4 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lh-hero p {
  font-size: clamp(1rem, 2.2vw, 1.125rem);
  line-height: 1.65;
  color: rgba(224, 231, 255, .82);
  margin: 0 0 28px;
  max-width: 56ch;
}

/* search */
.lh-search {
  display: flex;
  gap: 10px;
  background: rgba(255, 255, 255, .10);
  border: 1px solid rgba(255, 255, 255, .20);
  border-radius: 14px;
  padding: 8px;
  max-width: 520px;
  backdrop-filter: blur(6px);
}

.lh-search input {
  flex: 1 1 auto;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: none;
  color: #fff;
  font-size: 15px;
  padding: 10px 12px;
}
.lh-search input::placeholder { color: rgba(199, 210, 254, .60); }

.lh-search button {
  flex: 0 0 auto;
  background: #fff;
  color: #3730a3;
  font-weight: 700;
  font-size: 14px;
  border: 0;
  border-radius: 10px;
  padding: 10px 18px;
  transition: transform .15s ease, background .15s ease;
}
.lh-search button:hover { background: #eef2ff; transform: translateY(-1px); }

/* hero stat strip — real values only */
.lh-hero__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 34px;
  max-width: 520px;
}

.lh-stat {
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 14px;
  padding: 14px 16px;
}

.lh-stat__n {
  font-size: clamp(1.25rem, 3.2vw, 1.6rem);
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.1;
}

.lh-stat__l {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .09em;
  font-weight: 700;
  color: rgba(199, 210, 254, .72);
  margin-top: 5px;
}

/* hero lead card */
.lh-lead {
  display: block;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 20px;
  overflow: hidden;
  backdrop-filter: blur(8px);
  transition: transform .25s ease, background .25s ease;
}
.lh-lead:hover { transform: translateY(-3px); background: rgba(255, 255, 255, .11); }

.lh-lead__media {
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, #4338ca, #7c3aed);
  overflow: hidden;
}
.lh-lead__media img { width: 100%; height: 100%; object-fit: cover; }

.lh-lead__body { padding: 20px 22px 24px; }

.lh-lead__label {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #c7d2fe;
  margin-bottom: 10px;
}

.lh-lead h2 {
  font-size: 1.2rem;
  line-height: 1.35;
  font-weight: 700;
  margin: 0 0 8px;
  color: #fff;
}

.lh-lead p {
  font-size: .9rem;
  line-height: 1.6;
  color: rgba(224, 231, 255, .72);
  margin: 0 0 14px;
}

.lh-lead__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  color: rgba(199, 210, 254, .70);
  align-items: center;
}

/* ---------------- Sections ---------------- */

.lh-main {
  display: grid;
  gap: 40px;
  align-items: start;
}

@media (min-width: 1024px) {
  .lh-main { grid-template-columns: minmax(0, 1fr) 320px; gap: 48px; }
}

.lh-section { padding: 44px 0; }

@media (min-width: 768px) {
  .lh-section { padding: 64px 0; }
}

.lh-section--soft { background: var(--lh-bg-soft); }

.lh-section--line { border-top: 1px solid var(--lh-border); }

.lh-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.lh-head__kicker {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--lh-accent);
  display: block;
  margin-bottom: 8px;
}

.lh-head h2 {
  font-size: clamp(1.4rem, 3.4vw, 1.9rem);
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.2;
  margin: 0;
}

.lh-head p {
  margin: 8px 0 0;
  color: var(--lh-muted);
  font-size: .95rem;
  line-height: 1.6;
  max-width: 62ch;
}

.lh-link-more {
  font-size: .85rem;
  font-weight: 700;
  color: var(--lh-accent);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.lh-link-more:hover { text-decoration: underline; }

/* filter page header (category / tag / search) */
.lh-filterbar {
  border-bottom: 1px solid var(--lh-border);
  background: var(--lh-surface);
  padding: 28px 0;
}
.lh-filterbar h1 {
  margin: 0 0 6px;
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -.02em;
}
.lh-filterbar p { margin: 0; color: var(--lh-muted); font-size: .95rem; }

/* ---------------- Post grid + cards ---------------- */

.lh-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.lh-card {
  display: flex;
  flex-direction: column;
  background: var(--lh-surface);
  border: 1px solid var(--lh-border);
  border-radius: var(--lh-radius);
  overflow: hidden;
  box-shadow: var(--lh-shadow);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.lh-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--lh-shadow-lg);
  border-color: var(--lh-border-strong);
}

.lh-card__media {
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, var(--lh-accent), #7c3aed);
  overflow: hidden;
}
.lh-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .45s ease; }
.lh-card:hover .lh-card__media img { transform: scale(1.05); }

.lh-card__body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
}

.lh-chip {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--lh-accent-text);
  background: var(--lh-accent-soft);
  border-radius: 7px;
  padding: 4px 8px;
  margin-bottom: 10px;
  align-self: flex-start;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lh-card h3 {
  margin: 0 0 8px;
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: -.01em;
  color: var(--lh-text);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lh-card p {
  margin: 0 0 14px;
  font-size: .875rem;
  line-height: 1.6;
  color: var(--lh-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lh-meta {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--lh-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: .75rem;
  color: var(--lh-faint);
}

.lh-meta__dot { color: var(--lh-border-strong); }

/* ---------------- Topics ---------------- */

.lh-topics {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}

.lh-topic {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--lh-surface);
  border: 1px solid var(--lh-border);
  border-radius: 13px;
  transition: border-color .2s ease, transform .2s ease, background .2s ease;
}

.lh-topic:hover {
  border-color: var(--lh-accent);
  transform: translateY(-2px);
}

.lh-topic__badge {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: .72rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: .02em;
}

.lh-topic__name {
  font-size: .9rem;
  font-weight: 700;
  color: var(--lh-text);
  line-height: 1.3;
}

.lh-topic__count {
  font-size: .72rem;
  color: var(--lh-faint);
  margin-top: 2px;
}

/* ---------------- Tags ---------------- */

.lh-tags { display: flex; flex-wrap: wrap; gap: 8px; }

.lh-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 600;
  background: var(--lh-bg-soft);
  border: 1px solid var(--lh-border);
  color: var(--lh-muted);
  transition: background .18s ease, color .18s ease, border-color .18s ease;
}
.lh-tag:hover { background: var(--lh-accent); border-color: var(--lh-accent); color: #fff; }
.lh-tag b { font-size: .68rem; opacity: .65; font-weight: 700; }

/* ---------------- Newsletter ---------------- */

.lh-news {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 55%, #a21caf 100%);
  border-radius: 20px;
  padding: 32px 28px;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.lh-news::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 2px 2px, rgba(255, 255, 255, .18) 1px, transparent 0);
  background-size: 22px 22px;
  opacity: .5;
  pointer-events: none;
}
.lh-news > * { position: relative; z-index: 1; }

.lh-news h2 {
  margin: 0 0 8px;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -.02em;
}

.lh-news p { margin: 0 0 20px; font-size: .92rem; color: rgba(255, 255, 255, .85); line-height: 1.6; }

.lh-news form { display: flex; gap: 10px; flex-wrap: wrap; }

.lh-news input {
  flex: 1 1 220px;
  min-width: 0;
  padding: 12px 14px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, .28);
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font-size: .9rem;
  outline: none;
}
.lh-news input::placeholder { color: rgba(255, 255, 255, .6); }
.lh-news input:focus { border-color: #fff; background: rgba(255, 255, 255, .2); }

.lh-news button {
  padding: 12px 22px;
  border-radius: 11px;
  border: 0;
  background: #fff;
  color: #3730a3;
  font-weight: 800;
  font-size: .88rem;
  transition: transform .15s ease;
}
.lh-news button:hover { transform: translateY(-1px); }

.lh-news__ok {
  margin-top: 14px;
  font-size: .85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.lh-news__ok[hidden] { display: none; }

/* ---------------- Sidebar (shared with post page) ---------------- */

.lh-side { display: none; }

@media (min-width: 1024px) {
  .lh-side {
    display: block;
    width: 320px;
    flex: 0 0 320px;
    /* Flow with the page. A sticky rail taller than the viewport pins its top
       edge and strands the rest below the fold. */
    position: static;
    top: auto;
    height: auto;
    max-height: none;
    overflow: visible;
  }

  /* Nested inside the post page rail, which is itself non-scrolling. */
  .lh-side--inline {
    width: 100%;
    flex: 1 1 auto;
    position: static;
    top: auto;
    max-height: none;
    overflow: visible;
  }
}

.lh-widget {
  background: var(--lh-surface);
  border: 1px solid var(--lh-border);
  border-radius: var(--lh-radius);
  padding: 20px;
  margin-bottom: 24px;
  /* Guard: the sidebar must never scroll independently of the page. */
  overflow: visible;
  max-height: none;
}

.lh-widget:last-child { margin-bottom: 0; }

.lh-widget__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}

.lh-widget__head h3 {
  margin: 0;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--lh-muted);
}

.lh-widget__link { font-size: .75rem; font-weight: 700; color: var(--lh-accent); }
.lh-widget__link:hover { text-decoration: underline; }

.lh-mini { display: grid; gap: 14px; }

.lh-mini__item { display: flex; gap: 12px; align-items: flex-start; }

.lh-mini__media {
  width: 66px;
  height: 46px;
  flex: 0 0 66px;
  border-radius: 9px;
  overflow: hidden;
  background: var(--lh-bg-soft);
}
.lh-mini__media img { width: 100%; height: 100%; object-fit: cover; }

.lh-mini__title {
  font-size: .84rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--lh-text);
  margin: 0 0 5px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lh-mini__item:hover .lh-mini__title { color: var(--lh-accent); }

.lh-mini__meta { font-size: .7rem; color: var(--lh-faint); display: flex; flex-wrap: wrap; gap: 6px; }

.lh-catlist { display: grid; gap: 8px; }

.lh-catrow {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: 11px;
  border: 1px solid transparent;
  transition: background .18s ease, border-color .18s ease;
}
.lh-catrow:hover { background: var(--lh-bg-soft); border-color: var(--lh-border); }

.lh-catrow__badge {
  width: 32px; height: 32px; flex: 0 0 32px;
  border-radius: 9px;
  display: grid; place-items: center;
  font-size: .66rem; font-weight: 800; color: #fff;
}

.lh-catrow__name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: .84rem;
  font-weight: 600;
  color: var(--lh-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lh-catrow__n {
  font-size: .68rem;
  font-weight: 700;
  color: var(--lh-faint);
  background: var(--lh-bg-soft);
  border-radius: 999px;
  padding: 2px 7px;
  flex: 0 0 auto;
}

/* ---------------- Empty state ---------------- */

.lh-empty {
  text-align: center;
  padding: 56px 20px;
  border: 1px dashed var(--lh-border-strong);
  border-radius: var(--lh-radius);
  color: var(--lh-muted);
}
.lh-empty strong { display: block; font-size: 1.05rem; color: var(--lh-text); margin-bottom: 6px; }

/* ---------------- Pagination ---------------- */

.lh-pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 40px;
  font-size: .88rem;
  color: var(--lh-muted);
}
.lh-pager a {
  font-weight: 700;
  color: var(--lh-accent);
  padding: 8px 14px;
  border: 1px solid var(--lh-border);
  border-radius: 9px;
}
.lh-pager a:hover { background: var(--lh-bg-soft); }

@media (prefers-reduced-motion: reduce) {
  .lh-card, .lh-lead, .lh-topic, .lh-search button, .lh-news button { transition: none !important; }
  .lh-card:hover, .lh-lead:hover, .lh-topic:hover { transform: none !important; }
}
