:root {
  --bg: #0a0e17;
  --bg-alt: #0f1420;
  --surface: #131a2b;
  --surface-hover: #182238;
  --border: #1f2a44;
  --text: #e6ecf5;
  --text-dim: #8a94ab;
  --accent: #00e5ff;
  --accent2: #7c4dff;
  --accent-grad: linear-gradient(135deg, #00e5ff 0%, #7c4dff 100%);
  --success: #00ffa3;
  --radius: 14px;
  --maxw: 880px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(0, 229, 255, 0.08), transparent 60%),
    radial-gradient(1000px 500px at 110% 10%, rgba(124, 77, 255, 0.10), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh;
}

body { line-height: 1.7; }

::selection { background: rgba(0, 229, 255, 0.25); }

a { color: var(--accent); }

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px 80px;
}

/* ---------- Top nav ---------- */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px;
  max-width: var(--maxw);
  margin: 0 auto;
}

.nav .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--text);
}

.nav .brand .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-grad);
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.7);
}

.nav .tag {
  font-size: 0.75rem;
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
}

/* ---------- Cover images ---------- */
.hero-cover {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  margin: 24px 0 28px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  position: relative;
}

.hero-cover img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

/* Tiny, unobtrusive corner credit — required for CC-BY compliance but not
   meant to draw attention away from the content. */
.cover-credit {
  position: absolute;
  bottom: 8px;
  right: 8px;
  font-size: 0.62rem;
  line-height: 1;
  color: rgba(255, 255, 255, 0.55);
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(2px);
  padding: 3px 7px;
  border-radius: 6px;
  margin: 0;
  opacity: 0.65;
  transition: opacity 0.15s ease;
}

.cover-credit:hover { opacity: 1; }

.cover-credit a {
  color: inherit;
  text-decoration: none;
}

.cover-credit a:hover { text-decoration: underline; }

.card-cover {
  margin: -20px -20px 4px;
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.card-cover img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  transition: transform 0.25s ease;
}

.card:hover .card-cover img {
  transform: scale(1.04);
}

/* ---------- Hero ---------- */
.hero {
  padding: 40px 0 20px;
}

.hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 800;
  margin: 0 0 12px;
  background: linear-gradient(135deg, #ffffff 0%, #b9c4d6 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.01em;
}

.hero p.sub {
  color: var(--text-dim);
  font-size: 1.02rem;
  max-width: 62ch;
}

/* ---------- Disclosure banner ---------- */
.disclosure {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 28px;
}

/* ---------- Find My Best Pick widget ---------- */
#ti-pick-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent2);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 28px;
}

#ti-pick-box h3 {
  margin: 0 0 6px;
  font-size: 1.1rem;
}

#ti-pick-box > p {
  margin: 0 0 14px;
  color: var(--text-dim);
  font-size: 0.9rem;
}

#ti-pick-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

#ti-pick-input {
  flex: 1 1 240px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
}

#ti-pick-input:focus {
  outline: none;
  border-color: var(--accent2);
}

#ti-pick-form button {
  background: var(--accent-grad);
  color: #041018;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
}

#ti-pick-form button:disabled {
  opacity: 0.6;
  cursor: default;
}

#ti-pick-results {
  margin-top: 16px;
}

.ti-pick-loading, .ti-pick-note {
  color: var(--text-dim);
  font-size: 0.88rem;
  margin: 8px 0 0;
}

.ti-pick-list {
  display: grid;
  gap: 12px;
}

.ti-pick-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}

.ti-pick-card strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
}

.ti-pick-meta {
  font-size: 0.78rem;
  color: var(--accent);
  margin-bottom: 6px;
  font-weight: 600;
}

.ti-pick-card p {
  margin: 0 0 10px;
  color: var(--text-dim);
  font-size: 0.88rem;
}

.ti-pick-cta {
  display: inline-block;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--accent);
  text-decoration: none;
}

.ti-pick-cta:hover { text-decoration: underline; }

/* ---------- Article typography ---------- */
.article h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); font-weight: 800; margin-bottom: 6px; }
.article > p:first-of-type { color: var(--text-dim); font-size: 1.05rem; }

.article h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-top: 2.6rem;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
}

.article h2::before {
  content: '';
  width: 6px;
  height: 22px;
  border-radius: 4px;
  background: var(--accent-grad);
  display: inline-block;
}

.article ul {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 18px 18px 34px;
  margin: 14px 0 22px;
}

.article li { margin-bottom: 6px; }

.article p { color: #cdd6e6; }

.static-page h2 { font-size: 1.15rem; font-weight: 700; margin-top: 2rem; }
.static-page p, .static-page li { color: #cdd6e6; }
.static-page ul { padding-left: 22px; }

/* ---------- CTA button ---------- */
.cta-button, a.cta-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent-grad);
  color: #04101a !important;
  font-weight: 700;
  padding: 12px 22px;
  border-radius: 10px;
  text-decoration: none;
  margin: 6px 0 18px;
  box-shadow: 0 8px 24px rgba(0, 229, 255, 0.18);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.cta-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(124, 77, 255, 0.35);
}

.cta-button::after { content: '→'; }

/* ---------- Index / article grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
  margin-top: 24px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent-grad);
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 0;
}

.card:hover {
  transform: translateY(-3px);
  border-color: rgba(0, 229, 255, 0.4);
  background: var(--surface-hover);
}

.card .badge {
  align-self: flex-start;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: rgba(0, 229, 255, 0.08);
  border: 1px solid rgba(0, 229, 255, 0.25);
  padding: 3px 9px;
  border-radius: 999px;
}

.card h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  position: relative;
  z-index: 1;
}

.card .meta {
  font-size: 0.78rem;
  color: var(--text-dim);
  position: relative;
  z-index: 1;
}

/* ---------- Footer ---------- */
footer {
  margin-top: 4rem;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-dim);
  text-align: center;
}

footer .glow {
  width: 100%;
  height: 2px;
  background: var(--accent-grad);
  opacity: 0.4;
  margin-bottom: 24px;
  border-radius: 2px;
}

/* ---------- On-site chatbot widget ---------- */
#ti-chat-toggle {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 9999;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent-grad);
  border: none;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0, 229, 255, 0.35);
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
}
#ti-chat-toggle:hover { transform: scale(1.06); }

#ti-chat-panel {
  position: fixed;
  bottom: 90px;
  right: 22px;
  z-index: 9999;
  width: min(340px, calc(100vw - 32px));
  max-height: 70vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Inter', -apple-system, sans-serif;
}
#ti-chat-panel.open { display: flex; }

#ti-chat-header {
  padding: 14px 16px;
  background: var(--accent-grad);
  color: #04101a;
  font-weight: 800;
  font-size: 0.9rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
#ti-chat-header button {
  background: none;
  border: none;
  color: #04101a;
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
}

#ti-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.85rem;
}

.ti-msg { max-width: 88%; padding: 8px 12px; border-radius: 10px; line-height: 1.5; }
.ti-msg.user { align-self: flex-end; background: var(--accent-grad); color: #04101a; }
.ti-msg.bot { align-self: flex-start; background: var(--bg-alt); border: 1px solid var(--border); color: var(--text); }
.ti-msg.bot a { color: var(--accent); }
.ti-msg .ti-sources { display: block; margin-top: 6px; font-size: 0.72rem; color: var(--text-dim); }

#ti-chat-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
}
#ti-chat-form input {
  flex: 1;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.85rem;
}
#ti-chat-form button {
  background: var(--accent-grad);
  border: none;
  color: #04101a;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
}
