/* BestAI — sistem vizual derivat din „Luminous Agency” (folderul libelula):
   fundal midnight, accent lavandă, CTA galben, Inter, carduri rotunjite. */

:root {
  --bg: #0B1B2B;
  --bg-deep: #041424;
  --surface: #112338;
  --surface-2: #172E49;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.2);
  --text: #F5F7FB;
  --text-2: #C6D2E3;
  --muted: #8FA0B6;
  --primary: #8C76C4;
  --primary-soft: rgba(140, 118, 196, 0.15);
  --link: #D0BCFF;
  --accent: #FCE941;
  --accent-ink: #0B1B2B;
  --accent-text: #FCE941;
  --bar: #9A84D3;
  --danger: #FFB4AB;
  --success: #9BE3B0;
  --glow: 0 8px 32px -8px rgba(140, 118, 196, 0.25);
  --header-bg: rgba(11, 27, 43, 0.82);
  --radius: 8px;
  --radius-lg: 16px;
  --wrap: 1160px;
  --gutter: 20px;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #F6F5FB;
  --bg-deep: #ECEAF5;
  --surface: #FFFFFF;
  --surface-2: #F1EEF9;
  --border: rgba(11, 27, 43, 0.1);
  --border-strong: rgba(11, 27, 43, 0.25);
  --text: #0B1B2B;
  --text-2: #34445A;
  --muted: #5F6F84;
  --primary-soft: rgba(140, 118, 196, 0.14);
  --link: #5B45A0;
  --accent-text: #5B45A0;
  --bar: #8C76C4;
  --danger: #B3261E;
  --success: #1B6E3A;
  --glow: 0 8px 28px -10px rgba(91, 69, 160, 0.3);
  --header-bg: rgba(246, 245, 251, 0.85);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.02em; line-height: 1.15; text-wrap: balance; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.narrow { max-width: 760px; }
.section { padding: 56px 0; }
.section + .section { padding-top: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Header ─────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap { display: flex; align-items: center; gap: 24px; height: 64px; }
.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 800; font-size: 20px; letter-spacing: -0.03em; }
.logo:hover { text-decoration: none; }
.logo-mark {
  width: 32px; height: 32px; border-radius: 10px; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-size: 15px; font-weight: 800; letter-spacing: -0.04em;
}
.logo em { font-style: normal; color: var(--primary); }
:root[data-theme="light"] .logo em { color: var(--link); }

.nav { display: flex; gap: 4px; margin-right: auto; }
.nav a { color: var(--text-2); font-weight: 600; font-size: 14px; padding: 8px 12px; border-radius: var(--radius); }
.nav a:hover { color: var(--text); background: var(--surface); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--link); background: var(--primary-soft); }

.header-tools { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 999px;
  background: transparent; border: 1px solid var(--border); color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { color: var(--text); border-color: var(--primary); background: var(--primary-soft); }
.icon-btn svg { width: 18px; height: 18px; }
.theme-toggle .sun { display: none; }
:root[data-theme="light"] .theme-toggle .sun { display: block; }
:root[data-theme="light"] .theme-toggle .moon { display: none; }
.menu-btn { display: none; }

.nav-cta {
  font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; margin-left: 8px; white-space: nowrap;
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--accent); background: transparent; color: var(--accent-text);
}
.nav-cta:hover { background: var(--accent); color: var(--accent-ink); }
:root[data-theme="light"] .nav-cta { border-color: var(--primary); }
:root[data-theme="light"] .nav-cta:hover { background: var(--primary); color: #fff; }

/* ── Popup pentru afaceri ───────────────────────────── */
.lead-dialog {
  width: min(480px, calc(100vw - 32px)); padding: 32px; border-radius: var(--radius-lg);
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong);
  box-shadow: 0 24px 64px -12px rgba(0, 0, 0, 0.6), var(--glow);
}
.lead-dialog::backdrop { background: rgba(4, 20, 36, 0.7); backdrop-filter: blur(4px); }
.lead-dialog[open] { animation: lead-in .25s ease-out; }
@keyframes lead-in { from { opacity: 0; transform: translateY(12px); } }
.lead-close { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; }
.lead-dialog h2 { font-size: 26px; font-weight: 800; margin: 10px 36px 12px 0; }
.lead-text { color: var(--text-2); line-height: 1.6; margin-bottom: 20px; }
.lead-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 12px; }
.lead-error { color: var(--danger); font-size: 14px; font-weight: 600; margin-top: 8px; }

/* ── Buttons, chips, forms ──────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 700; cursor: pointer; border: 0; white-space: nowrap;
  transition: transform .15s, box-shadow .15s, background .15s, border-color .15s;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 12px 28px; }
.btn-primary:hover { transform: scale(1.02); box-shadow: 0 8px 24px -4px rgba(252, 233, 65, 0.35); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 11px 20px; font-weight: 600; }
.btn-ghost:hover { border-color: var(--primary); color: var(--link); background: var(--primary-soft); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 4px 10px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  background: var(--primary-soft); color: var(--link); white-space: nowrap;
}
.chip:hover { text-decoration: none; }
.chip-accent { background: var(--accent); color: var(--accent-ink); }
.chip-plain { background: var(--surface-2); color: var(--text-2); }

.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-text); }

input[type="text"], input[type="email"], input[type="search"], textarea {
  width: 100%; font: inherit; color: var(--text);
  background: color-mix(in srgb, var(--bg) 60%, transparent);
  border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 12px 16px;
}
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(140, 118, 196, 0.2); }
label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; color: var(--text-2); }
.trap { position: absolute; left: -9999px; }

.inline-form { display: flex; gap: 10px; flex-wrap: wrap; }
.inline-form input { flex: 1 1 220px; min-width: 0; }

/* ── Cards ──────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px;
}
a.card, .card-link { display: block; color: inherit; transition: transform .2s, border-color .2s, box-shadow .2s; }
a.card:hover, .card-link:hover { text-decoration: none; transform: translateY(-4px); border-color: rgba(140, 118, 196, 0.4); box-shadow: var(--glow); }

.grid { display: grid; gap: 20px; }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.section-head h2 { font-size: 28px; font-weight: 700; }
.section-head .more { font-weight: 600; font-size: 14px; white-space: nowrap; }

.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 13px; color: var(--muted); }
.meta .dot::before { content: '·'; margin-right: 12px; }

/* Article card */
.post { display: flex; flex-direction: column; padding: 0; overflow: hidden; height: 100%; }
.post-cover {
  aspect-ratio: 16 / 8; display: grid; place-items: center; font-size: 44px;
  background:
    radial-gradient(120% 90% at 85% 0%, rgba(252, 233, 65, 0.16), transparent 60%),
    radial-gradient(120% 120% at 0% 100%, rgba(140, 118, 196, 0.45), transparent 65%),
    var(--surface-2);
}
.post-cover img { width: 100%; height: 100%; object-fit: cover; }
.article-cover img { width: 100%; height: auto; }
.post-body { display: flex; flex-direction: column; gap: 10px; padding: 20px; flex: 1; }
.post-body h3 { font-size: 19px; font-weight: 700; line-height: 1.3; letter-spacing: -0.01em; color: var(--text); }
.post-body p { color: var(--text-2); font-size: 15px; }
.post-body .meta { margin-top: auto; padding-top: 6px; }

/* Compact news row */
.news-list { display: flex; flex-direction: column; }
.news-row { display: grid; grid-template-columns: 44px 1fr; gap: 14px; align-items: start; padding: 16px 0; border-bottom: 1px solid var(--border); color: inherit; }
.news-row:last-child { border-bottom: 0; }
.news-row:hover { text-decoration: none; }
.news-row:hover h3 { color: var(--link); }
.news-row .emoji { width: 44px; height: 44px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; font-size: 20px; }
.news-row .emoji { overflow: hidden; }
.news-row .emoji img { width: 100%; height: 100%; object-fit: cover; }
.news-row h3 { font-size: 16px; font-weight: 600; line-height: 1.35; letter-spacing: -0.005em; margin-bottom: 4px; }

/* ── Hero ───────────────────────────────────────────── */
.hero { position: relative; overflow: hidden; background: var(--bg-deep); border-bottom: 1px solid var(--border); }
.hero::before, .hero::after { content: ''; position: absolute; border-radius: 50%; filter: blur(80px); pointer-events: none; }
.hero::before { width: 420px; height: 420px; right: -120px; top: -160px; background: rgba(140, 118, 196, 0.28); }
.hero::after { width: 320px; height: 320px; left: 30%; bottom: -220px; background: rgba(252, 233, 65, 0.1); }
.hero .wrap { position: relative; z-index: 1; padding-top: 64px; padding-bottom: 64px; }
.hero h1 { font-size: clamp(36px, 6vw, 60px); font-weight: 800; letter-spacing: -0.03em; line-height: 1.08; max-width: 15ch; }
.hero h1 span { color: var(--primary); }
:root[data-theme="light"] .hero h1 span { color: var(--link); }
.hero .lead { font-size: 18px; line-height: 1.6; color: var(--text-2); max-width: 54ch; margin: 20px 0 28px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.status-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; margin-bottom: 20px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-2);
  font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
}
.status-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(252, 233, 65, 0.2); }
:root[data-theme="light"] .status-pill i { background: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

.page-head { padding: 48px 0 32px; }
.page-head h1 { font-size: clamp(30px, 5vw, 44px); font-weight: 800; }
.page-head p { color: var(--text-2); font-size: 18px; margin-top: 12px; max-width: 60ch; }

/* Featured */
.featured { display: grid; grid-template-columns: 1.15fr 1fr; gap: 32px; align-items: stretch; }
.featured .post-cover { aspect-ratio: auto; min-height: 220px; font-size: 64px; }
.featured-main { display: grid; grid-template-rows: auto 1fr; padding: 0; overflow: hidden; }
.featured-main .post-body { padding: 28px; gap: 14px; }
.featured-main h2 { font-size: clamp(24px, 3vw, 32px); font-weight: 700; color: var(--text); }
.featured-main p { color: var(--text-2); font-size: 17px; line-height: 1.6; }

/* ── Ranking bars ───────────────────────────────────── */
.ranking { list-style: none; margin: 0; padding: 0; }
.rank-row {
  display: grid; grid-template-columns: 28px minmax(0, 190px) minmax(0, 1fr); gap: 12px; align-items: center;
  padding: 10px 8px; border-radius: var(--radius);
}
.rank-row:hover { background: var(--surface-2); }
.rank-pos { font-size: 13px; font-weight: 700; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.rank-name { min-width: 0; }
.rank-name a { color: var(--text); font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-name small { color: var(--muted); font-size: 12px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-bar { display: flex; align-items: center; gap: 10px; min-width: 0; }
.rank-bar .bar {
  height: 12px; min-width: 4px; background: var(--bar); border-radius: 0 4px 4px 0;
  width: calc((100% - 76px) * var(--w) / 100);
}
.rank-bar .value { font-size: 14px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rank-bar .value small { font-weight: 500; color: var(--muted); }
.rank-row.is-self { background: var(--primary-soft); }
.bench-card h3 { font-size: 20px; font-weight: 700; margin: 12px 0 6px; }
.bench-card .sub { color: var(--text-2); font-size: 15px; margin-bottom: 16px; }
.bench-card .foot { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.empty { color: var(--muted); font-size: 15px; padding: 12px 0; }

/* Stat tiles */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.stat .label { font-size: 13px; color: var(--muted); }
.stat .value { font-size: 22px; font-weight: 700; margin-top: 4px; letter-spacing: -0.01em; }
.stat .hint { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ── Article page ───────────────────────────────────── */
.article-head { padding: 40px 0 8px; }
.article-head h1 { font-size: clamp(30px, 5vw, 46px); font-weight: 800; line-height: 1.12; margin: 16px 0; }
.article-head .summary { font-size: 20px; line-height: 1.55; color: var(--text-2); }
.article-head .meta { margin-top: 20px; font-size: 14px; }
.article-cover { border-radius: var(--radius-lg); overflow: hidden; margin: 28px 0 0; }

.tldr { margin: 32px 0; border-left: 4px solid var(--accent); }
:root[data-theme="light"] .tldr { border-left-color: var(--primary); }
.tldr h2 { font-size: 14px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-text); margin-bottom: 12px; }
.tldr ul { margin: 0; padding-left: 20px; display: grid; gap: 8px; font-size: 17px; line-height: 1.5; }

.prose { font-size: 18px; line-height: 1.75; color: var(--text-2); overflow-wrap: break-word; }
.prose > * + * { margin-top: 1.1em; }
.prose h2 { font-size: 26px; font-weight: 700; color: var(--text); margin-top: 1.8em; }
.prose h3 { font-size: 21px; font-weight: 600; color: var(--text); margin-top: 1.6em; }
.prose strong { color: var(--text); font-weight: 600; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li + li { margin-top: 0.4em; }
.prose a { text-decoration: underline; text-underline-offset: 3px; }
.prose a.term-link { text-decoration: underline dotted; text-decoration-thickness: 2px; color: inherit; cursor: help; }
.prose a.term-link:hover { color: var(--link); }
.prose blockquote { margin-left: 0; margin-right: 0; padding: 4px 0 4px 20px; border-left: 3px solid var(--primary); color: var(--text); font-style: italic; }
.prose code { background: var(--surface-2); padding: 2px 6px; border-radius: 4px; font-size: 0.9em; }
.prose pre { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; overflow-x: auto; }
.prose table { width: 100%; border-collapse: collapse; font-size: 15px; display: block; overflow-x: auto; }
.prose th, .prose td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.prose-sm { font-size: 16px; line-height: 1.65; }

details.curious { margin: 36px 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
details.curious summary { cursor: pointer; padding: 18px 24px; font-weight: 700; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
details.curious summary::-webkit-details-marker { display: none; }
details.curious summary::after { content: '+'; font-size: 22px; font-weight: 400; color: var(--link); }
details.curious[open] summary::after { content: '−'; }
details.curious .prose { padding: 0 24px 24px; }

.source-note { margin: 32px 0; padding: 16px 20px; border-radius: 12px; background: var(--surface-2); font-size: 14px; color: var(--text-2); line-height: 1.6; }

.comments h2 { font-size: 24px; margin-bottom: 20px; }
.comment { padding: 16px 0; border-bottom: 1px solid var(--border); }
.comment header { display: flex; gap: 10px; align-items: baseline; margin-bottom: 6px; }
.comment strong { font-weight: 600; }
.comment time { font-size: 13px; color: var(--muted); }
.comment p { color: var(--text-2); white-space: pre-line; overflow-wrap: anywhere; }
.comment-form { margin-top: 28px; display: grid; gap: 16px; }
.form-note { font-size: 13px; color: var(--muted); }

.flash { padding: 12px 16px; border-radius: var(--radius); margin: 16px 0; font-weight: 600; font-size: 15px; background: var(--surface-2); border: 1px solid var(--border); }
.flash.success { color: var(--success); }
.flash.error { color: var(--danger); }
.draft-banner { background: var(--accent); color: var(--accent-ink); font-weight: 700; text-align: center; padding: 8px 16px; font-size: 14px; }

/* ── Glossary ───────────────────────────────────────── */
.letters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 32px; }
.letters a { width: 36px; height: 36px; display: grid; place-items: center; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); font-weight: 700; color: var(--text-2); }
.letters a:hover { border-color: var(--primary); color: var(--link); text-decoration: none; }
.letter-group { margin-bottom: 36px; scroll-margin-top: 84px; }
.letter-group > h2 { font-size: 28px; color: var(--primary); margin-bottom: 12px; }
:root[data-theme="light"] .letter-group > h2 { color: var(--link); }
.term-card h3 { font-size: 18px; font-weight: 700; margin-bottom: 6px; color: var(--text); }
.term-card p { color: var(--text-2); font-size: 15px; }
.term-of-day { display: flex; flex-direction: column; gap: 12px; height: 100%; }
.term-of-day h3 { font-size: 26px; font-weight: 700; }
.term-of-day p { color: var(--text-2); font-size: 17px; line-height: 1.6; }

/* ── Newsletter band & footer ───────────────────────── */
.band { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 36px; display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: center; }
.band h2 { font-size: 26px; font-weight: 700; margin-bottom: 8px; }
.band p { color: var(--text-2); }

.pagination { display: flex; justify-content: center; align-items: center; gap: 16px; margin-top: 40px; font-size: 14px; color: var(--muted); }

.site-footer { margin-top: 72px; background: var(--bg-deep); border-top: 1px solid var(--border); padding: 48px 0 32px; font-size: 14px; color: var(--muted); }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; }
.site-footer h4 { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-2); margin-bottom: 12px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.site-footer a { color: var(--text-2); }
.site-footer .about { max-width: 38ch; margin-top: 12px; line-height: 1.6; }
.footer-bottom { margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 960px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .featured, .band { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .menu-btn { display: grid; }
  .nav {
    display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--border); padding: 8px var(--gutter) 16px;
  }
  .nav.open { display: flex; }
  .nav a { padding: 14px 12px; font-size: 16px; }
  .nav-cta { margin: 10px 12px 0; padding: 12px 16px; font-size: 15px; align-self: flex-start; }
}

@media (max-width: 640px) {
  :root { --gutter: 16px; }
  .section { padding: 40px 0; }
  .grid-3, .grid-2, .footer-grid { grid-template-columns: 1fr; }
  .hero .wrap { padding-top: 40px; padding-bottom: 44px; }
  .section-head h2 { font-size: 23px; }
  .prose { font-size: 17px; }
  .band { padding: 24px; }
  .card { padding: 20px; }
  .post, .featured-main { padding: 0; }
  .rank-row { grid-template-columns: 22px minmax(0, 1fr); row-gap: 6px; }
  .rank-bar { grid-column: 2; }
  .btn-primary { padding: 12px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
