/* ============================================================
   MadrasAI — v3 Design System
   Deep-space black + gradient mesh, Space Grotesk / Inter
   ============================================================ */

:root {
  --bg: #050508;
  --bg-1: #0a0a12;
  --bg-2: #0e0e1a;
  --surface: rgba(255, 255, 255, 0.03);
  --surface-2: rgba(255, 255, 255, 0.05);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --ink: #f4f4f8;
  --ink-soft: #c8c8d6;
  --muted: #8a8a9e;
  --brand-1: #7c5cff;   /* violet   */
  --brand-2: #3d8bff;   /* blue     */
  --brand-3: #2fd6c3;   /* teal     */
  --brand-hot: #ff5c8a; /* accent   */
  --grad-brand: linear-gradient(120deg, var(--brand-1), var(--brand-2) 50%, var(--brand-3));
  --grad-text: linear-gradient(100deg, #fff 10%, #b9a8ff 45%, #6ee7f5 90%);
  --danger: #ff6b81;
  --ok: #34d399;
  --radius-xl: 28px;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --max: 1200px;
  --font-display: 'Space Grotesk', 'Segoe UI', sans-serif;
  --font-body: 'Inter', 'Segoe UI', sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-lg: 0 24px 80px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ---- Ambient background: gradient mesh + grid + noise ---- */
.site-scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.scene-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  will-change: transform;
}

.scene-orb.orb-1 {
  width: 46vw; min-width: 420px; aspect-ratio: 1;
  top: -14vw; right: -10vw;
  background: radial-gradient(circle, rgba(124, 92, 255, 0.32), transparent 65%);
  animation: orbDrift 22s ease-in-out infinite alternate;
}

.scene-orb.orb-2 {
  width: 38vw; min-width: 360px; aspect-ratio: 1;
  left: -12vw; top: 34%;
  background: radial-gradient(circle, rgba(61, 139, 255, 0.22), transparent 65%);
  animation: orbDrift 28s ease-in-out infinite alternate-reverse;
}

.scene-orb.orb-3 {
  width: 30vw; min-width: 280px; aspect-ratio: 1;
  right: -6vw; bottom: -10vw;
  background: radial-gradient(circle, rgba(47, 214, 195, 0.18), transparent 65%);
  animation: orbDrift 26s ease-in-out infinite alternate;
}

@keyframes orbDrift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(6vw, 4vw, 0) scale(1.15); }
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 30%, transparent 80%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
}

main, header, footer { position: relative; z-index: 2; }

/* ---- Typography ---- */
h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--ink);
}

p { margin: 0; }
img { display: block; max-width: 100%; }
a { color: inherit; }

.muted { color: var(--muted); }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 18px;
  padding: 7px 16px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  backdrop-filter: blur(8px);
}

.eyebrow::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--grad-brand);
  box-shadow: 0 0 12px rgba(124, 92, 255, 0.9);
  animation: pulseDot 2.2s ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.5); opacity: 0.6; }
}

.lede {
  font-size: 1.15rem;
  color: var(--ink-soft);
  max-width: 56ch;
}

.gradient-text {
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.container {
  width: min(var(--max), calc(100% - 44px));
  margin: 0 auto;
}

.page {
  width: min(var(--max), calc(100% - 44px));
  margin: 0 auto;
  padding: 56px 0 110px;
}

/* ---- Buttons ---- */
.btn {
  --btn-x: 0px; --btn-y: 0px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 26px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transform: translate(var(--btn-x), var(--btn-y));
  transition: transform 0.25s var(--ease-out), box-shadow 0.3s ease, background 0.3s ease, border-color 0.3s ease;
  will-change: transform;
}

.btn-primary {
  color: #fff;
  background: var(--grad-brand);
  background-size: 160% 160%;
  box-shadow: 0 8px 32px rgba(124, 92, 255, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  animation: gradShift 6s ease infinite;
}

.btn-primary:hover {
  box-shadow: 0 12px 44px rgba(124, 92, 255, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

@keyframes gradShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.btn-ghost {
  color: var(--ink-soft);
  border-color: var(--line-strong);
  background: var(--surface);
  backdrop-filter: blur(8px);
}

.btn-ghost:hover { color: var(--ink); border-color: rgba(255, 255, 255, 0.3); background: var(--surface-2); }

.btn-google {
  width: 100%;
  color: var(--ink);
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.text-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #a8b6ff;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
}

.text-link::after {
  content: "→";
  transition: transform 0.25s var(--ease-out);
}

.text-link:hover::after { transform: translateX(5px); }

/* ---- Navbar: floating glass ---- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  padding: 14px 0;
  transition: padding 0.35s var(--ease-out);
}

.nav-container {
  width: min(var(--max), calc(100% - 44px));
  margin: 0 auto;
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 22px;
  position: relative;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(10, 10, 18, 0.6);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  transition: background 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;
}

.navbar.is-scrolled .nav-container {
  background: rgba(8, 8, 15, 0.85);
  border-color: var(--line-strong);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
}

.brand img {
  width: auto;
  height: 38px;
  filter: drop-shadow(0 0 10px rgba(124, 92, 255, 0.5));
}

.brand-text {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-link {
  position: relative;
  padding: 9px 15px;
  border-radius: 999px;
  font-size: 0.93rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.25s ease, background 0.25s ease;
}

.nav-link:hover { color: var(--ink); background: var(--surface-2); }

.nav-link.is-active {
  color: var(--ink);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.nav-user { color: var(--muted); font-size: 0.88rem; padding: 0 6px; }

.nav-links .btn { padding: 9px 20px; font-size: 0.88rem; }

.nav-toggle {
  display: none;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
}

/* ---- Hero v3 ---- */
.hero-v3 {
  position: relative;
  min-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 70px 0 40px;
}

#heroCanvas {
  position: absolute;
  inset: -90px -50vw 0;
  margin: 0 auto;
  width: 100vw;
  height: calc(100% + 90px);
  z-index: 0;
  pointer-events: none;
}

.hero-v3 > * { position: relative; z-index: 1; }

.hero-v3 h1 {
  margin: 0 auto;
  max-width: 17ch;
  font-size: clamp(2.6rem, 7vw, 5.4rem);
  font-weight: 700;
  letter-spacing: -0.035em;
}

.hero-v3 h1 .w {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
}

.hero-v3 h1 .w > span {
  display: inline-block;
  transform: translateY(110%);
  animation: wordUp 0.9s var(--ease-out) forwards;
  animation-delay: calc(var(--i) * 0.07s + 0.15s);
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

@keyframes wordUp {
  to { transform: translateY(0); }
}

.hero-v3 .lede {
  margin: 26px auto 0;
  opacity: 0;
  animation: fadeUp 0.9s var(--ease-out) 0.75s forwards;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  margin-top: 36px;
  opacity: 0;
  animation: fadeUp 0.9s var(--ease-out) 0.9s forwards;
}

.hero-v3 .eyebrow {
  opacity: 0;
  animation: fadeUp 0.9s var(--ease-out) 0.05s forwards;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(26px); }
  to   { opacity: 1; transform: translateY(0); }
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0;
  margin-top: 64px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  backdrop-filter: blur(12px);
  overflow: hidden;
  opacity: 0;
  animation: fadeUp 0.9s var(--ease-out) 1.1s forwards;
}

.hero-stat {
  padding: 22px 44px;
  text-align: center;
  border-right: 1px solid var(--line);
}

.hero-stat:last-child { border-right: none; }

.hero-stat strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 700;
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-stat span {
  font-size: 0.82rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.scroll-cue {
  margin-top: 58px;
  width: 26px;
  height: 42px;
  border: 2px solid var(--line-strong);
  border-radius: 999px;
  position: relative;
  opacity: 0;
  animation: fadeUp 0.9s var(--ease-out) 1.4s forwards;
}

.scroll-cue::before {
  content: "";
  position: absolute;
  top: 7px; left: 50%;
  width: 4px; height: 8px;
  margin-left: -2px;
  border-radius: 999px;
  background: var(--brand-2);
  animation: cueDrop 1.8s ease-in-out infinite;
}

@keyframes cueDrop {
  0% { transform: translateY(0); opacity: 1; }
  70% { transform: translateY(14px); opacity: 0; }
  100% { transform: translateY(0); opacity: 0; }
}

/* ---- Marquee ---- */
.marquee {
  position: relative;
  margin: 30px 0 0;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}

.marquee-track {
  display: flex;
  gap: 48px;
  width: max-content;
  animation: marqueeMove 30s linear infinite;
}

.marquee:hover .marquee-track { animation-play-state: paused; }

.marquee-track span {
  display: inline-flex;
  align-items: center;
  gap: 48px;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.marquee-track span::after {
  content: "✦";
  color: var(--brand-1);
  font-size: 0.8rem;
}

@keyframes marqueeMove {
  to { transform: translateX(-50%); }
}

/* ---- Sections ---- */
.section { margin-top: 110px; }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 36px;
}

.section-head h2 {
  font-size: clamp(1.7rem, 3.4vw, 2.5rem);
  letter-spacing: -0.025em;
}

/* ---- Cards ---- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 26px;
}

.card {
  --mx: 50%;
  --my: 50%;
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.015));
  overflow: hidden;
  transform-style: preserve-3d;
  transition: transform 0.35s var(--ease-out), border-color 0.35s ease, box-shadow 0.35s ease;
  will-change: transform;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
  background: radial-gradient(340px circle at var(--mx) var(--my), rgba(124, 92, 255, 0.16), transparent 65%);
}

.card:hover::before { opacity: 1; }

.card:hover {
  border-color: rgba(124, 92, 255, 0.45);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(124, 92, 255, 0.18);
}

.card-media {
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.02);
  transition: transform 0.7s var(--ease-out), filter 0.7s ease;
  filter: saturate(0.92);
}

.card:hover .card-media img { transform: scale(1.09); filter: saturate(1.1); }

.card-body {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 22px 24px 24px;
  flex: 1;
}

.card-meta, .post-meta, .post-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.dot { color: var(--brand-1); }

.card-title {
  font-family: var(--font-display);
  font-size: 1.22rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.3;
  color: var(--ink);
  text-decoration: none;
  transition: color 0.25s ease;
}

.card-title:hover { color: #b9a8ff; }

.card-excerpt {
  font-size: 0.95rem;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 8px;
}

.card-kicker {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #a8b6ff;
}

.pill, .chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
  transition: border-color 0.25s ease, color 0.25s ease, background 0.25s ease, transform 0.25s var(--ease-out);
}

.pill:hover, .chip:hover {
  color: var(--ink);
  border-color: rgba(124, 92, 255, 0.55);
  background: rgba(124, 92, 255, 0.12);
  transform: translateY(-2px);
}

.chip.active {
  color: #fff;
  background: var(--grad-brand);
  border-color: transparent;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 22px 0;
}

/* ---- Newsletter ---- */
.newsletter { margin-top: 120px; }

.newsletter-card {
  position: relative;
  padding: 64px 40px;
  text-align: center;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line-strong);
  background:
    radial-gradient(600px 300px at 20% 0%, rgba(124, 92, 255, 0.22), transparent 60%),
    radial-gradient(600px 300px at 80% 100%, rgba(47, 214, 195, 0.16), transparent 60%),
    var(--bg-1);
  overflow: hidden;
}

.newsletter-card::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(120deg, rgba(124,92,255,0.5), transparent 30%, transparent 70%, rgba(47,214,195,0.5));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.newsletter-card h2 { font-size: clamp(1.6rem, 3vw, 2.3rem); margin-bottom: 10px; }

.newsletter-form {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin: 28px auto 12px;
  max-width: 520px;
}

.newsletter-form input {
  flex: 1;
  min-width: 240px;
}

/* ---- Inputs ---- */
.input,
.newsletter-form input,
.auth-form input,
.contact-form input,
.contact-form textarea,
.comment-form input,
.comment-form textarea,
.field input,
.field textarea {
  padding: 13px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
  width: 100%;
}

.input:focus,
.newsletter-form input:focus,
.auth-form input:focus,
.contact-form input:focus,
.contact-form textarea:focus,
.comment-form input:focus,
.comment-form textarea:focus,
.field input:focus,
.field textarea:focus {
  border-color: rgba(124, 92, 255, 0.65);
  box-shadow: 0 0 0 4px rgba(124, 92, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
}

::placeholder { color: var(--muted); }

/* ---- Blog listing ---- */
.blog-wrap { display: block; }

.page-head { margin-bottom: 30px; }
.page-head h1 {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  letter-spacing: -0.03em;
  margin-bottom: 10px;
}

.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 26px 0 6px;
}

.toolbar .input { max-width: 420px; }

.post-list {
  display: flex;
  flex-direction: column;
  gap: 22px;
  margin-top: 26px;
}

.post-item {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
  transition: transform 0.35s var(--ease-out), border-color 0.35s ease, box-shadow 0.35s ease;
}

.post-item:hover {
  transform: translateY(-4px);
  border-color: rgba(124, 92, 255, 0.4);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

.post-item-media { display: block; height: 100%; min-height: 180px; overflow: hidden; }
.post-item-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s var(--ease-out); }
.post-item:hover .post-item-media img { transform: scale(1.07); }

.post-item-body { padding: 22px 24px 22px 0; display: flex; flex-direction: column; gap: 10px; }
.post-item-title { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; color: var(--ink); text-decoration: none; line-height: 1.3; }
.post-item-title:hover { color: #b9a8ff; }
.post-item-excerpt { color: var(--muted); font-size: 0.95rem; }
.post-item-actions { margin-top: auto; display: flex; align-items: center; gap: 14px; padding-top: 6px; }

.pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 48px;
}

.pager a, .pager span {
  min-width: 40px;
  padding: 9px 14px;
  text-align: center;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  transition: border-color 0.25s ease, background 0.25s ease;
}

.pager a:hover { border-color: rgba(124, 92, 255, 0.55); background: rgba(124, 92, 255, 0.12); }
.pager .active, .pager [aria-current] { color: #fff; background: var(--grad-brand); border-color: transparent; }

/* ---- Post page ---- */
.post-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0;
  z-index: 2000;
  background: var(--grad-brand);
  box-shadow: 0 0 14px rgba(124, 92, 255, 0.8);
}

.post-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 46px;
  align-items: start;
}

.post-article { min-width: 0; }

.post-header h1 {
  font-size: clamp(1.9rem, 4.4vw, 3rem);
  letter-spacing: -0.03em;
  margin: 14px 0 22px;
}

.post-author {
  display: flex;
  align-items: center;
  gap: 13px;
  margin: 18px 0;
}

.post-author img {
  width: 46px; height: 46px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(124, 92, 255, 0.5);
}

.post-author a { text-decoration: none; color: var(--ink); }
.post-author span { display: block; font-size: 0.82rem; color: var(--muted); }

.post-cover {
  width: 100%;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  margin: 26px 0;
  box-shadow: var(--shadow-lg);
}

.prose, .post-article .content {
  font-size: 1.05rem;
  color: var(--ink-soft);
  line-height: 1.85;
}

.prose h2, .post-article h2 { margin: 44px 0 16px; font-size: 1.65rem; }
.prose h3, .post-article h3 { margin: 34px 0 12px; font-size: 1.3rem; }
.prose p, .post-article .content p { margin: 0 0 18px; }
.prose img, .post-article .content img { border-radius: var(--radius-md); margin: 22px auto; }
.prose a, .post-article .content a { color: #a8b6ff; }
.prose blockquote, .post-article blockquote {
  margin: 26px 0;
  padding: 18px 24px;
  border-left: 3px solid var(--brand-1);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: var(--surface);
  color: var(--ink-soft);
}
.prose code { background: var(--surface-2); padding: 2px 7px; border-radius: 6px; font-size: 0.9em; }
.prose pre, .post-article pre {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  overflow-x: auto;
}

/* Sidebar / TOC */
.post-toc {
  position: sticky;
  top: 110px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  backdrop-filter: blur(10px);
}

.post-toc h4 { font-size: 0.82rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.toc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.toc-list a {
  display: block;
  padding: 7px 12px;
  border-left: 2px solid transparent;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.9rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.toc-list a:hover, .toc-list a.active { color: var(--ink); border-left-color: var(--brand-1); background: var(--surface-2); }

.post-tags, .tag-list { display: flex; flex-wrap: wrap; gap: 10px; margin: 30px 0; }

.post-share { display: flex; gap: 10px; margin: 24px 0; }
.share-btn {
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.25s ease, color 0.25s ease, transform 0.25s var(--ease-out);
}
.share-btn:hover { color: var(--ink); border-color: rgba(124, 92, 255, 0.55); transform: translateY(-2px); }

/* Engagement + comments */
.post-engagement {
  margin: 44px 0;
  padding: 26px 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.engagement-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.engagement-actions { display: flex; align-items: center; gap: 12px; }

.like-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  transition: transform 0.2s var(--ease-out), border-color 0.25s ease, background 0.25s ease;
}
.like-button:hover { transform: scale(1.05); border-color: rgba(255, 92, 138, 0.6); }
.like-button.liked { background: rgba(255, 92, 138, 0.15); border-color: rgba(255, 92, 138, 0.6); color: #ff9ab5; }
.like-count { font-weight: 700; }

.comments-area { margin-top: 26px; }
.comment-form { display: flex; flex-direction: column; gap: 12px; margin-bottom: 26px; }
.comment-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.comment-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.comment-list li {
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

/* References / related */
.post-reference, .related-posts { margin-top: 54px; }
.reference-kicker { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: #a8b6ff; }
.reference-group { margin-top: 18px; }
.reference-links, .reference-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.reference-link {
  display: block;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  text-decoration: none;
  transition: border-color 0.25s ease, transform 0.25s var(--ease-out);
}
.reference-link:hover { border-color: rgba(124, 92, 255, 0.5); transform: translateX(4px); }
.reference-link-title { display: block; color: var(--ink); font-weight: 600; font-size: 0.95rem; }
.reference-link-meta { display: block; color: var(--muted); font-size: 0.82rem; margin-top: 2px; }
.reference-cta { margin-top: 16px; }
.meta-kicker { font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }

/* ---- Auth / profile ---- */
.auth-section { display: flex; justify-content: center; padding: 40px 0; }

.auth-card, .profile-card, .info-card {
  position: relative;
  padding: 36px 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
  backdrop-filter: blur(14px);
}

.auth-card { width: 100%; max-width: 440px; }
.auth-card h1, .auth-card h2 { font-size: 1.7rem; margin-bottom: 6px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; margin-top: 22px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field label { font-size: 0.86rem; font-weight: 600; color: var(--ink-soft); }
.auth-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 20px 0;
  color: var(--muted);
  font-size: 0.82rem;
}
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line-strong); }
.auth-note { margin-top: 18px; font-size: 0.88rem; color: var(--muted); text-align: center; }
.auth-note a { color: #a8b6ff; }

.profile-section { max-width: 720px; margin: 0 auto; }
.profile-card { margin-bottom: 22px; }
.profile-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.profile-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
}
.profile-item:last-child { border-bottom: none; }
.profile-actions { display: flex; gap: 12px; margin-top: 20px; }

.author-hero {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 30px 32px;
  margin-bottom: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
}
.author-hero img { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(124, 92, 255, 0.5); }

/* ---- Info pages (about/contact) ---- */
.content-section { max-width: 780px; margin: 0 auto; }
.content-section > h1 { font-size: clamp(2.1rem, 4.6vw, 3.2rem); letter-spacing: -0.03em; margin-bottom: 16px; }

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 22px;
  margin: 36px 0;
}

.info-card h3 { font-size: 1.15rem; margin-bottom: 8px; }
.info-card p { color: var(--muted); font-size: 0.94rem; }

.contact-form { display: flex; flex-direction: column; gap: 14px; margin-top: 26px; }
.contact-form textarea { min-height: 150px; resize: vertical; }

.notice {
  padding: 14px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-size: 0.92rem;
}
.notice.success, .success { border-color: rgba(52, 211, 153, 0.5); background: rgba(52, 211, 153, 0.1); color: #a7f3d0; }
.notice.error, .error { border-color: rgba(255, 107, 129, 0.5); background: rgba(255, 107, 129, 0.1); color: #ffb3c0; }

.not-found { text-align: center; padding: 90px 0; }
.not-found h1, .not-found h2 { font-size: clamp(2rem, 5vw, 3rem); margin-bottom: 14px; }
.not-found .btn { margin-top: 24px; }

/* ---- Footer ---- */
.site-footer {
  margin-top: 130px;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, transparent, rgba(124, 92, 255, 0.05));
  position: relative;
  overflow: hidden;
}

.site-footer::before {
  content: "MADRASAI";
  position: absolute;
  left: 50%;
  bottom: -0.34em;
  transform: translateX(-50%);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(4.5rem, 15vw, 12rem);
  letter-spacing: 0.04em;
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1px rgba(255, 255, 255, 0.05);
  pointer-events: none;
  white-space: nowrap;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 30px;
  padding: 56px 0 72px;
  position: relative;
}

.footer-brand { display: flex; flex-direction: column; gap: 8px; max-width: 320px; }
.footer-brand strong { font-family: var(--font-display); font-size: 1.25rem; letter-spacing: 0.02em; }
.footer-brand span { color: var(--muted); font-size: 0.92rem; }

.footer-signal { display: flex; gap: 5px; margin-top: 10px; }
.footer-signal span {
  width: 5px;
  border-radius: 999px;
  background: var(--grad-brand);
  animation: signalBar 1.4s ease-in-out infinite;
}
.footer-signal span:nth-child(1) { height: 12px; animation-delay: 0s; }
.footer-signal span:nth-child(2) { height: 18px; animation-delay: 0.18s; }
.footer-signal span:nth-child(3) { height: 9px; animation-delay: 0.36s; }

@keyframes signalBar {
  0%, 100% { transform: scaleY(0.5); opacity: 0.6; }
  50% { transform: scaleY(1.15); opacity: 1; }
}

.footer-links { display: flex; gap: 22px; }
.footer-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.93rem;
  transition: color 0.25s ease;
}
.footer-links a:hover { color: var(--ink); }

.footer-meta { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 0.85rem; }

/* ---- Chatbox overrides ---- */
.chat-fab {
  background: var(--grad-brand) !important;
  border: none !important;
  color: #fff !important;
  box-shadow: 0 10px 34px rgba(124, 92, 255, 0.5) !important;
  font-family: var(--font-body) !important;
  font-weight: 700 !important;
}

.chat-panel {
  background: rgba(10, 10, 18, 0.95) !important;
  border: 1px solid var(--line-strong) !important;
  backdrop-filter: blur(20px) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-lg) !important;
}

/* ---- Scroll reveal system ---- */
.reveal-target {
  opacity: 0;
  transform: translateY(34px);
  transition:
    opacity 0.85s var(--ease-out) var(--reveal-delay, 0s),
    transform 0.85s var(--ease-out) var(--reveal-delay, 0s);
  will-change: opacity, transform;
}

.reveal-target.is-visible { opacity: 1; transform: translateY(0); }

/* ---- Legacy hero fallback (non-home pages using .hero) ---- */
.hero:not(.hero-v3) { padding: 60px 0; }
.hero-card { display: none; }
.hero-topics { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.topic {
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
}

/* ---- Responsive ---- */
@media (max-width: 960px) {
  .post-layout { grid-template-columns: 1fr; }
  .post-toc { position: static; order: -1; }
  .post-item { grid-template-columns: 1fr; }
  .post-item-body { padding: 0 22px 22px; }
  .footer-inner { flex-direction: column; }
}

@media (max-width: 760px) {
  .nav-toggle { display: inline-flex; }
  .nav-links {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    padding: 16px;
    gap: 8px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-lg);
    background: rgba(8, 8, 15, 0.97);
    backdrop-filter: blur(24px);
    box-shadow: var(--shadow-lg);
  }
  .nav-links.show { display: flex; animation: fadeUp 0.3s var(--ease-out); }
  .nav-link { padding: 12px 16px; }
  .hero-stat { padding: 18px 26px; flex: 1; }
  .hero-v3 { min-height: auto; padding-top: 40px; }
  .comment-fields { grid-template-columns: 1fr; }
  .section { margin-top: 72px; }
  .toolbar { flex-wrap: wrap; }
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
  .reveal-target { opacity: 1; transform: none; }
  .hero-v3 h1 .w > span { transform: none; animation: none; }
  .hero-v3 .lede, .hero-actions, .hero-stats, .hero-v3 .eyebrow, .scroll-cue { opacity: 1; animation: none; }
}

::selection { background: rgba(124, 92, 255, 0.4); color: #fff; }

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(124, 92, 255, 0.5); }
