/* ==========================================================
   Dylan Zhang — homepage
   Shares the violet/aubergine identity of the /causalab/ and
   /faulty-memory/ write-ups so the whole site reads as one brand.
   ========================================================== */

:root {
  --bg:        #fbfaff;
  --bg-tint:   #f2eefc;
  --bg-dark:   #160f2b;
  --bg-dark-2: #1f1640;
  --ink:       #1c1730;
  --ink-soft:  #443a5c;
  --ink-quiet: #6c6385;
  --rule:      #e0d8f2;

  --accent:     #7c3aed;
  --accent-deep:#6024c0;
  --accent-soft:#a472f0;
  --accent-2:   #2563c9;
  --accent-3:   #149a73;

  --serif: "Source Serif 4", Charter, Georgia, serif;
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono:  "JetBrains Mono", "SF Mono", Menlo, monospace;

  --container: 1080px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
::selection { background: rgba(124,58,237,.18); }

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

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 700; letter-spacing: -.015em; color: var(--ink); margin: 0; }

.wrap { max-width: var(--container); margin: 0 auto; padding: 0 28px; }

/* scrollbar */
::-webkit-scrollbar { width: 9px; }
::-webkit-scrollbar-track { background: var(--bg-tint); }
::-webkit-scrollbar-thumb { background: #cdbff0; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-soft); }

/* fade-in (progressive enhancement: only hides when JS is active) */
.js .fade { opacity: 0; transform: translateY(14px); transition: opacity .7s ease, transform .7s ease; }
.js .fade.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .js .fade { opacity: 1; transform: none; } }

/* =========================== NAV =========================== */
.nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: saturate(150%) blur(14px);
  -webkit-backdrop-filter: saturate(150%) blur(14px);
  background: rgba(251,250,255,.8);
  border-bottom: 1px solid var(--rule);
}
.nav-inner { max-width: var(--container); margin: 0 auto; padding: 13px 28px; display: flex; align-items: center; justify-content: space-between; }
.nav-brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; color: var(--ink); font-size: 15px; }
.nav-brand .dot { width: 11px; height: 11px; border-radius: 50%; background: radial-gradient(circle at 30% 30%, var(--accent-soft), var(--accent-deep)); box-shadow: 0 0 0 3px rgba(124,58,237,.16); }
.nav-links { display: flex; gap: 22px; font-size: 14px; }
.nav-links a { color: var(--ink-soft); }
.nav-links a:hover { color: var(--accent); }
.nav-links a.active { color: var(--accent); }
@media (max-width: 820px) { .nav-links { display: none; } }

/* =========================== HERO =========================== */
.hero {
  position: relative; overflow: hidden;
  padding: 84px 0 70px;
  background:
    radial-gradient(circle at 12% -10%, rgba(124,58,237,.18), transparent 45%),
    radial-gradient(circle at 95% 0%, rgba(37,99,201,.13), transparent 42%),
    radial-gradient(circle at 80% 120%, rgba(20,154,115,.10), transparent 46%);
  border-bottom: 1px solid var(--rule);
}
.hero::before {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(124,58,237,.12) 1.3px, transparent 1.5px);
  background-size: 30px 30px;
  -webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,.45), transparent 80%);
          mask-image: linear-gradient(180deg, rgba(0,0,0,.45), transparent 80%);
  pointer-events: none;
}
.hero-grid {
  position: relative;
  display: grid; grid-template-columns: 1fr 300px; gap: 48px; align-items: center;
}
.hero-eyebrow {
  font-size: 13px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent-deep); margin-bottom: 18px; display: inline-flex; align-items: center; gap: 10px;
}
.hero-eyebrow::before { content: ""; width: 26px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, var(--accent), var(--accent-soft)); }
.hero-title { font-family: var(--serif); font-size: clamp(2.2rem, 4.6vw, 3.5rem); line-height: 1.06; letter-spacing: -.022em; margin: 0 0 22px; }
.hero-title .grad {
  font-style: italic;
  background: linear-gradient(95deg, var(--accent-deep), var(--accent-soft) 55%, var(--accent-2));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.hero-sub { font-size: 1.18rem; line-height: 1.6; color: var(--ink-soft); max-width: 600px; margin: 0 0 26px; font-family: var(--serif); }
.hero-name { font-family: var(--sans); font-size: 15px; color: var(--ink-quiet); margin-bottom: 28px; }
.hero-name strong { color: var(--ink); font-weight: 600; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 500; padding: 9px 16px; border-radius: 999px;
  background: linear-gradient(135deg, var(--accent-deep), var(--accent)); color: #fff;
  box-shadow: 0 10px 22px -12px rgba(124,58,237,.7); transition: transform .15s ease, box-shadow .15s ease;
}
.pill:hover { transform: translateY(-2px); color: #fff; box-shadow: 0 14px 26px -12px rgba(124,58,237,.85); }
.pill-ghost { background: #fff; color: var(--ink-soft); border: 1px solid var(--rule); box-shadow: none; }
.pill-ghost:hover { color: var(--accent); border-color: var(--accent-soft); background: #fff; }

/* avatar */
.hero-photo { position: relative; justify-self: center; }
.hero-photo img {
  width: 230px; height: 230px; object-fit: cover; border-radius: 28px;
  border: 1px solid var(--rule);
  box-shadow: 0 30px 60px -30px rgba(96,36,192,.55);
}
.hero-photo::after {
  content: ""; position: absolute; inset: -14px -14px auto auto; width: 90px; height: 90px;
  border-radius: 50%; background: radial-gradient(circle at 40% 40%, rgba(164,114,240,.5), transparent 70%);
  filter: blur(8px); z-index: -1;
}
.hero-badge {
  margin-top: 22px; display: inline-flex; align-items: center; gap: 10px;
  background: rgba(20,154,115,.1); border: 1px solid rgba(20,154,115,.3);
  color: #0e7a5a; border-radius: 12px; padding: 9px 14px; font-size: 13.5px; font-weight: 500;
}
.hero-badge .blip { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-3); box-shadow: 0 0 0 0 rgba(20,154,115,.5); animation: blip 2s infinite; }
@keyframes blip { 0% { box-shadow: 0 0 0 0 rgba(20,154,115,.5);} 70% { box-shadow: 0 0 0 8px rgba(20,154,115,0);} 100% { box-shadow: 0 0 0 0 rgba(20,154,115,0);} }

@media (max-width: 820px) {
  .hero-grid { grid-template-columns: 1fr; gap: 32px; }
  .hero-photo { order: -1; justify-self: start; }
  .hero-photo img { width: 150px; height: 150px; border-radius: 22px; }
}

/* =========================== SECTIONS =========================== */
.section { padding: 76px 0; border-bottom: 1px solid var(--rule); }
.section-tint { background: var(--bg-tint); }
.section-dark {
  background: radial-gradient(circle at 12% 0%, rgba(124,58,237,.22), transparent 45%),
              radial-gradient(circle at 90% 100%, rgba(37,99,201,.16), transparent 45%), var(--bg-dark);
  color: #e8e3f7; border-bottom-color: #2a2050;
}
.section-dark h2, .section-dark h3 { color: #fbfaff; }
.kicker { font-size: 12.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent-deep); margin-bottom: 12px; display: inline-flex; align-items: center; gap: 9px; }
.kicker::before { content: ""; width: 20px; height: 2px; border-radius: 2px; background: currentColor; opacity: .6; }
.section-dark .kicker { color: var(--accent-soft); }
.h-lg { font-size: 2rem; line-height: 1.16; margin-bottom: .8em; }

/* =========================== VISION =========================== */
.vision-lede { font-family: var(--serif); font-size: 1.32rem; line-height: 1.55; color: #f3effc; max-width: 760px; margin: 0 0 1.1em; }
.section-dark .vision-lede strong, .vision-lede .em { color: #fff; }
.vision-lede .em { background: linear-gradient(95deg, var(--accent-soft), #8fb6ff); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; font-style: italic; }
.vision-body { font-size: 1.05rem; line-height: 1.7; color: #cfc6ea; max-width: 760px; }
.vision-body a { color: #c0a6f5; border-bottom: 1px solid rgba(192,166,245,.4); }

.pillars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 40px; }
.pillar {
  background: rgba(255,255,255,.04); border: 1px solid #322656; border-radius: 16px; padding: 22px 20px;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.pillar:hover { transform: translateY(-4px); border-color: var(--accent-soft); background: rgba(164,114,240,.08); }
.pillar .p-ico { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 19px; background: linear-gradient(135deg, rgba(124,58,237,.3), rgba(37,99,201,.25)); color: #e8e0ff; margin-bottom: 14px; }
.pillar h3 { font-family: var(--sans); font-size: 15px; font-weight: 700; color: #fbfaff; margin-bottom: 6px; }
.pillar p { font-size: 13.5px; line-height: 1.5; color: #b3a9d4; margin: 0; }
@media (max-width: 900px) { .pillars { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .pillars { grid-template-columns: 1fr; } }

/* =========================== NEWS TIMELINE =========================== */
.timeline { position: relative; margin-top: 8px; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(180deg, var(--accent), var(--accent-2)); border-radius: 2px; opacity: .35; }
.tl-item { position: relative; padding: 0 0 26px; }
.tl-item::before { content: ""; position: absolute; left: -26px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid var(--accent); }
.tl-item.hot::before { background: var(--accent); box-shadow: 0 0 0 4px rgba(124,58,237,.18); }
.tl-date { font-family: var(--mono); font-size: 12.5px; color: var(--ink-quiet); margin-bottom: 3px; }
.tl-body { font-size: 15.5px; color: var(--ink-soft); line-height: 1.55; }
.tl-body a { font-weight: 600; border-bottom: 1px solid rgba(124,58,237,.3); }
.tag { display: inline-block; font-family: var(--sans); font-size: 11px; font-weight: 700; letter-spacing: .04em; padding: 2px 9px; border-radius: 999px; vertical-align: 1px; margin-right: 6px; }
.tag-violet { background: rgba(124,58,237,.12); color: var(--accent-deep); }
.tag-blue { background: rgba(37,99,201,.12); color: var(--accent-2); }
.tag-amber { background: rgba(214,122,32,.14); color: #b4651a; }
.tag-rose  { background: rgba(194,53,107,.13); color: #b02a5e; }

/* =========================== CARDS GRID =========================== */
.cards2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 760px) { .cards2 { grid-template-columns: 1fr; } }
.card {
  position: relative; overflow: hidden; display: block;
  background: #fff; border: 1px solid var(--rule); border-radius: 20px; padding: 26px;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 26px 48px -30px rgba(96,36,192,.55); border-color: var(--accent-soft); }
.card .glow { position: absolute; top: -40px; right: -40px; width: 140px; height: 140px; border-radius: 50%; background: rgba(164,114,240,.22); filter: blur(20px); transition: background .18s ease; }
.card:hover .glow { background: rgba(164,114,240,.4); }
.card-rel { position: relative; }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.card-ico { width: 46px; height: 46px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 19px; background: linear-gradient(135deg, rgba(124,58,237,.12), rgba(37,99,201,.1)); color: var(--accent-deep); border: 1px solid var(--rule); }
.card h3 { font-family: var(--sans); font-size: 17px; font-weight: 700; line-height: 1.3; color: var(--ink); }
.card p { font-size: 14px; color: var(--ink-quiet); margin: 0; line-height: 1.55; }
.card-link { display: inline-flex; align-items: center; gap: 7px; margin-top: 16px; font-size: 14px; font-weight: 600; color: var(--accent-deep); }
.card:hover .card-link .arr { transform: translateX(4px); }
.card-link .arr { transition: transform .18s ease; }

/* =========================== PUBLICATIONS =========================== */
.pubyear { display: flex; align-items: center; gap: 14px; margin: 34px 0 18px; }
.pubyear:first-child { margin-top: 0; }
.pubyear .yr { font-family: var(--serif); font-weight: 700; font-size: 1.25rem; color: var(--accent-deep); }
.pubyear .line { flex: 1; height: 1px; background: var(--rule); }
.pub { padding: 16px 0; border-bottom: 1px solid var(--rule); display: grid; grid-template-columns: 1fr; gap: 5px; }
.pub:last-child { border-bottom: none; }
.pub-badges { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 4px; }
.badge { font-family: var(--sans); font-size: 11px; font-weight: 700; letter-spacing: .03em; padding: 3px 10px; border-radius: 999px; }
.badge-spot { background: linear-gradient(135deg, #b02a5e, #d67a20); color: #fff; }
.badge-venue { background: var(--accent-deep); color: #fff; }
.badge-pre { background: rgba(124,58,237,.12); color: var(--accent-deep); }
.badge-writeup { background: #fff; color: var(--accent-deep); border: 1px solid var(--accent-soft); }
.badge-writeup:hover { background: var(--bg-tint); color: var(--accent-deep); }
.pub-title { font-family: var(--serif); font-size: 1.15rem; font-weight: 700; line-height: 1.3; color: var(--ink); }
.pub-title a:hover { color: var(--accent-deep); }
.pub-authors { font-size: 14px; color: var(--ink-quiet); line-height: 1.5; }
.pub-authors .me { font-weight: 700; color: var(--ink); border-bottom: 2px solid var(--accent-soft); }
.pub-authors .eq { font-style: italic; font-size: 12.5px; color: var(--ink-quiet); }

/* =========================== EXPERIENCE / EDUCATION =========================== */
.xp { display: grid; gap: 14px; }
.xp-row {
  display: flex; align-items: center; gap: 18px; justify-content: space-between;
  background: #fff; border: 1px solid var(--rule); border-radius: 16px; padding: 18px 22px;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.xp-row:hover { transform: translateY(-2px); box-shadow: 0 18px 34px -28px rgba(96,36,192,.5); border-color: var(--accent-soft); }
.xp-left { display: flex; align-items: center; gap: 16px; }
.xp-ico { width: 50px; height: 50px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 22px; background: var(--bg-tint); border: 1px solid var(--rule); color: var(--accent-deep); flex: 0 0 auto; }
.xp-role { font-family: var(--serif); font-size: 1.12rem; font-weight: 700; color: var(--ink); line-height: 1.25; }
.xp-org { font-size: 14px; color: var(--ink-soft); }
.xp-meta { text-align: right; flex: 0 0 auto; }
.xp-when { font-family: var(--mono); font-size: 12.5px; color: var(--ink-quiet); }
.xp-where { font-size: 12.5px; color: var(--ink-quiet); margin-top: 3px; }
@media (max-width: 640px) {
  .xp-row { flex-direction: column; align-items: flex-start; gap: 12px; }
  .xp-meta { text-align: left; }
}

/* =========================== FOOTER =========================== */
.footer { background: var(--bg-dark); color: #cfc6ea; padding: 56px 0 48px; }
.footer h3 { color: #fff; font-size: 1.5rem; margin-bottom: 14px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 36px; }
.footer a { color: #c0a6f5; }
.footer a:hover { color: #fff; }
.footer-col h4 { font-family: var(--sans); font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent-soft); margin-bottom: 12px; }
.footer-col p, .footer-col a { display: block; font-size: 14px; line-height: 1.9; }
.footer-note { margin-top: 36px; padding-top: 20px; border-top: 1px solid #2a2050; font-size: 12.5px; color: #8a80ad; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr; gap: 24px; } }

.social { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.social a {
  display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px;
  background: rgba(255,255,255,.05); border: 1px solid #322656; color: #d9d2f0;
  padding: 8px 14px; border-radius: 10px; transition: border-color .15s ease, background .15s ease;
}
.social a:hover { border-color: var(--accent-soft); background: rgba(164,114,240,.12); color: #fff; }
