/* ========================================
   ensardev.com — neon / glass "dev-kawaii" theme
   Win98 theme lives in win98.css and is untouched.
   ======================================== */

:root,
[data-theme="dark"] {
  --bg:      #07070e;
  --bg2:     #0c0a16;
  --ink:     #d8d3ec;
  --head:    #f6f4ff;
  --muted:   #9990b6;
  --faint:   #6a6389;

  --purple:  #8b5cf6;
  --indigo:  #6366f1;
  --cyan:    #22d3ee;
  --blue:    #38bdf8;
  --accent:  #8b5cf6;
  --grad:    linear-gradient(115deg, #38bdf8 0%, #6366f1 50%, #8b5cf6 100%);

  --glass:      rgba(255,255,255,0.035);
  --glass-2:    rgba(255,255,255,0.06);
  --glass-brd:  rgba(255,255,255,0.09);
  --glass-brd2: rgba(255,255,255,0.16);

  --chip-bg:  rgba(167,139,250,0.13);
  --chip-tx:  #cbbcff;

  --a-blue:   rgba(56,189,248,0.26);
  --a-cyan:   rgba(34,211,238,0.20);
  --a-purple: rgba(139,92,246,0.30);
  --grid-line: rgba(167,139,250,0.10);
  --aurora-op: 0.6;
  --spot-color: rgba(167,139,250,0.11);
  --star: #ffffff;

  --shadow:   0 18px 50px rgba(0,0,0,0.45);

  --switcher-bg: rgba(18,16,28,0.78);
  --switcher-border: 1px solid rgba(255,255,255,0.10);
  --switcher-btn-hover: rgba(255,255,255,0.08);
  --switcher-active-bg: rgba(139,92,246,0.18);
  --switcher-active-color: #c9bcff;
  --switcher-color: #9990b6;
}

[data-theme="light"] {
  --bg:      #f3f1fb;
  --bg2:     #eae6f8;
  --ink:     #3a3357;
  --head:    #1a1436;
  --muted:   #6b6390;
  --faint:   #8f88ad;

  --purple:  #7c3aed;
  --indigo:  #4f46e5;
  --cyan:    #0891b2;
  --blue:    #2563c7;
  --accent:  #6d28d9;
  --grad:    linear-gradient(115deg, #2563c7 0%, #4f46e5 50%, #7c3aed 100%);

  --glass:      rgba(255,255,255,0.6);
  --glass-2:    rgba(255,255,255,0.8);
  --glass-brd:  rgba(26,20,54,0.10);
  --glass-brd2: rgba(26,20,54,0.20);

  --chip-bg:  rgba(124,58,237,0.10);
  --chip-tx:  #6d28d9;

  --a-blue:   rgba(37,99,199,0.15);
  --a-cyan:   rgba(8,145,178,0.13);
  --a-purple: rgba(124,58,237,0.16);
  --grid-line: rgba(124,58,237,0.10);
  --aurora-op: 0.7;
  --spot-color: rgba(124,58,237,0.08);
  --star: #7c3aed;

  --shadow:   0 18px 44px rgba(26,20,54,0.12);

  --switcher-bg: rgba(255,255,255,0.85);
  --switcher-border: 1px solid rgba(26,20,54,0.12);
  --switcher-btn-hover: rgba(26,20,54,0.06);
  --switcher-active-bg: rgba(124,58,237,0.14);
  --switcher-active-color: #6d28d9;
  --switcher-color: #6b6390;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
  background:
    radial-gradient(120% 80% at 50% -10%, var(--bg2) 0%, var(--bg) 55%),
    var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background 0.3s, color 0.3s;
}
.site-win98 { display: none; }
::selection { background: rgba(167,139,250,0.28); color: var(--head); }
a { color: var(--accent); text-decoration: none; }
.mono, code {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}
code {
  font-size: 0.85em;
  background: var(--chip-bg);
  padding: 1px 6px;
  border-radius: 5px;
  color: var(--chip-tx);
}

/* ========================================
   Background FX
   ======================================== */
.fx-aurora, .fx-grid, .fx-spot, .fx-stars {
  position: fixed; z-index: 0; pointer-events: none;
}
.fx-aurora {
  inset: -25%;
  filter: blur(72px);
  opacity: var(--aurora-op);
  background:
    radial-gradient(28% 30% at 18% 22%, var(--a-blue) 0%, transparent 60%),
    radial-gradient(26% 28% at 82% 18%, var(--a-cyan) 0%, transparent 62%),
    radial-gradient(30% 32% at 62% 82%, var(--a-purple) 0%, transparent 60%);
  animation: aurora 20s ease-in-out infinite alternate;
}
@keyframes aurora {
  0%   { transform: translate3d(0,0,0) scale(1); }
  50%  { transform: translate3d(2.5%,-2.5%,0) scale(1.08); }
  100% { transform: translate3d(-2.5%,2%,0) scale(1.04); }
}
.fx-grid {
  left: 0; right: 0; bottom: 0; height: 46vh;
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 46px 46px;
  transform: perspective(320px) rotateX(70deg);
  transform-origin: bottom center;
  mask-image: linear-gradient(to top, #000 0%, transparent 88%);
  -webkit-mask-image: linear-gradient(to top, #000 0%, transparent 88%);
  opacity: 0.6;
  animation: gridflow 6s linear infinite;
}
@keyframes gridflow { to { background-position: 0 46px; } }
.fx-spot {
  inset: 0;
  background: radial-gradient(340px circle at var(--mx, 50%) var(--my, -200px),
              var(--spot-color) 0%, transparent 70%);
}
.fx-stars { inset: 0; }
.fx-stars span {
  position: absolute;
  border-radius: 50%;
  background: var(--star);
  opacity: 0;
  box-shadow: 0 0 6px currentColor;
  color: var(--star);
  animation: twinkle 4.5s ease-in-out infinite;
}
@keyframes twinkle { 0%,100% { opacity: 0; } 50% { opacity: 0.75; } }

/* ========================================
   Theme switcher
   ======================================== */
.theme-switcher {
  position: fixed; top: 16px; right: 16px; z-index: 9999;
  display: flex; gap: 2px;
  background: var(--switcher-bg);
  border: var(--switcher-border);
  border-radius: 24px; padding: 3px;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}
.theme-btn {
  width: 34px; height: 34px; border: none; border-radius: 50%;
  background: transparent; color: var(--switcher-color);
  font-size: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.theme-btn:hover { background: var(--switcher-btn-hover); color: var(--head); }
.theme-btn.active {
  background: var(--switcher-active-bg);
  color: var(--switcher-active-color);
}

/* Windows 98 launcher — colourful waving flag, gently pulsing so it's easy to spot */
.theme-btn-98 { position: relative; overflow: visible; }
.win-flag {
  width: 18px; height: 15px; display: block;
  border-radius: 1px;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.55));
  transform: perspective(34px) rotateY(-13deg);
  transition: transform 0.2s;
  background:
    linear-gradient(#ff5b5b, #ff5b5b) left 0  top 0    / 8px 7px no-repeat,
    linear-gradient(#3ad14f, #3ad14f) right 0 top 0    / 8px 7px no-repeat,
    linear-gradient(#3d9bff, #3d9bff) left 0  bottom 0 / 8px 7px no-repeat,
    linear-gradient(#ffcf3a, #ffcf3a) right 0 bottom 0 / 8px 7px no-repeat;
}
.theme-btn-98:hover .win-flag { transform: perspective(34px) rotateY(0deg) scale(1.06); }

/* ========================================
   Glass utility
   ======================================== */
.glass {
  background: var(--glass);
  border: 1px solid var(--glass-brd);
  backdrop-filter: blur(16px) saturate(1.25);
  -webkit-backdrop-filter: blur(16px) saturate(1.25);
}

/* ========================================
   Top nav
   ======================================== */
.topnav {
  position: sticky; top: 0; z-index: 100;
  max-width: 1080px;
  margin: 0 auto;
  padding: 18px 28px;
  display: flex;
  align-items: center;
  gap: 30px;
}
.brand {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 1rem;
  color: var(--head);
  letter-spacing: -0.02em;
}
.brand-mark { color: var(--accent); }
.brand-caret { color: var(--cyan); animation: blink 1.1s steps(1) infinite; }
.topnav-links { display: flex; gap: 22px; }
.topnav-links a {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  color: var(--muted);
  transition: color 0.16s;
}
.topnav-links a::before { content: ''; }
.topnav-links a:hover { color: var(--head); }

/* ========================================
   Page wrapper
   ======================================== */
.page {
  position: relative; z-index: 1;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 28px 90px;
}

/* ========================================
   Hero
   ======================================== */
.hero { padding: 46px 0 20px; }
.hero-card {
  border-radius: 22px;
  padding: 38px;
  display: flex;
  align-items: center;
  gap: 34px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.hero-card::after {   /* top sheen line */
  content: '';
  position: absolute; left: 0; right: 0; top: 0; height: 1px;
  background: var(--grad);
  opacity: 0.6;
}
.hero-avatar-wrap { position: relative; flex: none; }
.hero-avatar {
  width: 132px; height: 132px;
  border-radius: 50%;
  object-fit: cover;
  padding: 3px;
  background: var(--grad);
  box-shadow: 0 0 0 1px var(--glass-brd), 0 0 34px rgba(167,139,250,0.45);
  animation: glowpulse 4s ease-in-out infinite;
}
@keyframes glowpulse {
  0%,100% { box-shadow: 0 0 0 1px var(--glass-brd), 0 0 30px rgba(167,139,250,0.35); }
  50%     { box-shadow: 0 0 0 1px var(--glass-brd), 0 0 42px rgba(56,189,248,0.5); }
}
.hero-status-dot {
  position: absolute; right: 8px; bottom: 10px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #34d399; border: 3px solid var(--bg);
  box-shadow: 0 0 0 0 rgba(52,211,153,0.5);
  animation: ping 2.2s infinite;
}
@keyframes ping {
  0% { box-shadow: 0 0 0 0 rgba(52,211,153,0.5); }
  70% { box-shadow: 0 0 0 9px rgba(52,211,153,0); }
  100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); }
}
.hero-text { min-width: 0; }
.hero-hi {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0 0 6px;
}
.hero-name {
  font-size: clamp(2.1rem, 5vw, 3.1rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.04;
  margin: 0 0 10px;
  background: var(--grad);
  background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  animation: shimmer 6s linear infinite;
}
@keyframes shimmer { to { background-position: 200% center; } }
.hero-typed {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.98rem;
  color: var(--head);
  margin: 0 0 16px;
  min-height: 1.4em;
}
.hero-typed .prompt { color: var(--cyan); }
.caret, .brand-caret { display: inline-block; }
.caret { color: var(--cyan); animation: blink 1.05s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.hero-bio {
  font-size: 0.96rem;
  color: var(--muted);
  margin: 0 0 24px;
  max-width: 52ch;
}
.hero-bio .kao { color: var(--accent); white-space: nowrap; font-weight: 600; }
.hero-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: 0.88rem; font-weight: 600;
  padding: 11px 20px; border-radius: 12px;
  border: 1px solid var(--glass-brd2);
  background: var(--glass-2); color: var(--head);
  cursor: pointer;
  transition: transform 0.16s, box-shadow 0.16s, border-color 0.16s;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary {
  border: none; color: #0a0a12;
  background: var(--grad); background-size: 160% auto;
  box-shadow: 0 8px 26px rgba(167,139,250,0.4);
}
[data-theme="light"] .btn-primary { color: #fff; }
.btn-primary:hover { box-shadow: 0 12px 32px rgba(99,102,241,0.45); background-position: 100% center; }

.social-icons { display: flex; gap: 9px; }
.social-icons a {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 11px;
  color: var(--muted);
  background: var(--glass);
  border: 1px solid var(--glass-brd);
  font-size: 1rem;
  transition: all 0.18s;
}
.social-icons a:hover {
  color: var(--head);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(167,139,250,0.3);
}

/* ========================================
   Sections
   ======================================== */
.section { margin-top: 64px; scroll-margin-top: 80px; }
.sec-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; margin-bottom: 24px;
}
.sec-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.15rem; font-weight: 700;
  color: var(--head); margin: 0;
  letter-spacing: -0.01em;
}
.sec-hash { color: var(--accent); margin-right: 2px; }
.sec-glint {
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  opacity: 0.8;
}
.sec-more {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem; color: var(--muted);
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: 7px;
  transition: color 0.16s;
}
.sec-more i { font-size: 0.78em; transition: transform 0.16s; }
.sec-more:hover { color: var(--accent); }
.sec-more:hover i { transform: translateX(4px); }

/* ========================================
   Project cards
   ======================================== */
.cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}
.card {
  --c1: var(--purple); --c2: var(--cyan);
  position: relative;
  border-radius: 18px;
  padding: 24px;
  display: flex; flex-direction: column; gap: 13px;
  box-shadow: var(--shadow);
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  overflow: hidden;
}
.card::before {   /* accent top line */
  content: '';
  position: absolute; left: 0; right: 0; top: 0; height: 2px;
  background: linear-gradient(90deg, var(--c1), var(--c2));
  opacity: 0; transition: opacity 0.2s;
}
.card:hover {
  transform: translateY(-5px);
  border-color: color-mix(in srgb, var(--c1) 55%, transparent);
  box-shadow: var(--shadow), 0 0 34px -6px var(--c1);
}
.card:hover::before { opacity: 1; }
.card-top { display: flex; align-items: center; gap: 13px; }
.card-icon {
  width: 42px; height: 42px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px;
  font-size: 1.05rem;
  color: var(--c1);
  background: color-mix(in srgb, var(--c1) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--c1) 30%, transparent);
}
.card-name {
  font-size: 1.12rem; font-weight: 700;
  color: var(--head); margin: 0; letter-spacing: -0.01em;
}
.card-desc { font-size: 0.9rem; color: var(--muted); margin: 0; flex: 1; }
.card-tags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
.card-tags li {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem; font-weight: 500;
  color: var(--chip-tx);
  background: var(--chip-bg);
  padding: 3px 9px; border-radius: 6px;
}
.card-links { display: flex; gap: 18px; margin-top: 2px; }
.card-links a {
  font-size: 0.83rem; font-weight: 600;
  color: var(--ink);
  display: inline-flex; align-items: center; gap: 6px;
  transition: color 0.16s;
}
.card-links a:first-child { color: var(--c1); }
.card-links a:hover { color: var(--head); }
.card-links i { font-size: 0.9em; }

/* ========================================
   Panels (Writing timeline + Activity list, injected by JS)
   ======================================== */
.panel { border-radius: 18px; padding: 10px 26px; box-shadow: var(--shadow); }
.muted { color: var(--muted); font-size: 0.9rem; }
.medium-list-title { display: none; }
.medium-list, .github-list { list-style: none; margin: 0; padding: 0; }
.medium-link-white {
  color: var(--head) !important; font-weight: 600; display: block;
  transition: color 0.16s;
}
.medium-link-white:hover { color: var(--accent) !important; }
.medium-meta { font-size: 0.78rem; color: var(--faint); }

/* Writing = timeline */
#mediumPosts .medium-list { position: relative; padding-left: 26px; }
#mediumPosts .medium-list::before {
  content: ''; position: absolute; left: 4px; top: 10px; bottom: 12px; width: 2px;
  background: linear-gradient(var(--blue), var(--indigo), var(--cyan));
  opacity: 0.5;
}
#mediumPosts .medium-list li { position: relative; padding: 4px 0 24px; }
#mediumPosts .medium-list li:last-child { padding-bottom: 6px; }
#mediumPosts .medium-list li::before {
  content: ''; position: absolute; left: -26px; top: 8px;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--bg), 0 0 10px var(--accent);
}
#mediumPosts .medium-link-white { font-size: 1rem; margin-bottom: 7px; }
#mediumPosts .medium-link-white::before { content: none; }
.medium-tags-row { margin-top: 9px; }
.medium-tag {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem; color: var(--chip-tx);
  background: var(--chip-bg); border-radius: 6px;
  padding: 2px 8px; margin: 4px 4px 0 0;
}

/* Activity = compact mono */
#githubRepos .github-list { display: flex; flex-direction: column; gap: 2px; }
#githubRepos .github-repo-item {
  padding: 12px 14px; margin: 0 -14px; border-radius: 10px;
  transition: background 0.16s;
}
#githubRepos .github-repo-item:hover { background: var(--glass-2); }
#githubRepos .medium-link-white {
  font-family: 'JetBrains Mono', monospace; font-size: 0.9rem; margin-bottom: 4px;
}
#githubRepos .medium-link-white::before {
  content: '\f07b'; font-family: 'Font Awesome 6 Free'; font-weight: 900;
  font-size: 0.82em; margin-right: 9px; color: var(--accent);
}
#githubRepos .github-repo-desc { font-size: 0.83rem; color: var(--muted); margin-top: 3px; }
#githubRepos .medium-meta {
  font-family: 'JetBrains Mono', monospace; font-size: 0.72rem; margin-top: 5px;
}
.medium-meta .github-lang { display: inline-flex; align-items: center; gap: 5px; }
.github-lang-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

/* ========================================
   Footer
   ======================================== */
.footer {
  margin-top: 70px; padding-top: 26px;
  border-top: 1px solid var(--glass-brd);
  text-align: center;
  color: var(--faint); font-size: 0.84rem;
}
.footer p { margin: 0 0 4px; }
.footer .heart { color: var(--accent); }
.footer-sub { font-family: 'JetBrains Mono', monospace; font-size: 0.74rem; opacity: 0.8; }

/* ========================================
   Subpage (projects.html)
   ======================================== */
.subpage {
  position: relative; z-index: 1;
  max-width: 1000px; margin: 0 auto;
  padding: 34px 28px 80px;
}
.back-link {
  font-family: 'JetBrains Mono', monospace;
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.84rem; color: var(--muted);
  margin-bottom: 36px; transition: color 0.16s, gap 0.16s;
}
.back-link i { font-size: 0.8em; transition: transform 0.16s; }
.back-link:hover { color: var(--accent); }
.back-link:hover i { transform: translateX(-3px); }
.subpage-head { margin-bottom: 34px; }
.subpage-title {
  font-size: clamp(1.9rem, 5vw, 2.5rem); font-weight: 800; letter-spacing: -0.03em;
  margin: 0 0 8px;
  background: var(--grad); background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shimmer 6s linear infinite;
}
.subpage-sub { font-size: 0.98rem; color: var(--muted); margin: 0; max-width: 56ch; }

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 820px) {
  .hero-card { flex-direction: column; text-align: center; padding: 32px 24px; gap: 22px; }
  .hero-bio { max-width: none; }
  .hero-actions { justify-content: center; }
  .hero-avatar { width: 112px; height: 112px; }
  .cards { grid-template-columns: 1fr; }
  .topnav { padding: 16px 20px; gap: 18px; }
  .page { padding: 0 20px 70px; }
}
@media (max-width: 480px) {
  .topnav-links { gap: 14px; }
  .theme-switcher { top: 10px; right: 10px; }
  .theme-btn { width: 30px; height: 30px; font-size: 12px; }
  .panel { padding: 8px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; scroll-behavior: auto !important; }
  .btn:hover, .social-icons a:hover, .card:hover { transform: none; }
}
