:root {
  --text: #1b1b2b;
  --muted: #5b5b72;
  --accent: #6366f1;
  --accent-2: #ec4899;
  --glass: rgba(255, 255, 255, 0.72);
  --glass-strong: rgba(248, 249, 253, 0.92);
  --glass-border: rgba(255, 255, 255, 0.85);
  --line: rgba(20, 20, 60, 0.1);
  --shadow: 0 10px 40px rgba(30, 30, 80, 0.1);
  --radius: 18px;
  --wrap: 820px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --px: 0;
  --py: 0;
  --sy: 0;
}

html.dark {
  --text: #ececf5;
  --muted: #a3a3bd;
  --accent: #8b8bff;
  --accent-2: #f472b6;
  --glass: rgba(28, 28, 40, 0.72);
  --glass-strong: rgba(14, 14, 22, 0.9);
  --glass-border: rgba(255, 255, 255, 0.14);
  --line: rgba(255, 255, 255, 0.1);
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

::selection {
  background: rgba(99, 102, 241, 0.3);
}

/* motion */
@keyframes fade-up {
  from { opacity: 0; translate: 0 18px; }
  to   { opacity: 1; translate: 0 0; }
}

@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}

.rain-canvas {
  position: fixed;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  pointer-events: none;
  transform: translate3d(calc(var(--px) * -28px), calc(var(--py) * -22px), 0) scale(1.08);
}

/* layered mountains (parallax with --px/--py/--sy) */
.scenery {
  position: fixed;
  inset: 0;
  z-index: -3;
  overflow: hidden;
  pointer-events: none;
}

/* daylight: sun + drifting cloud layers (behind the mountains) */
.sun {
  position: absolute;
  top: 8vh;
  right: 17%;
  width: 26vmin;
  height: 26vmin;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    #ffffff 0 12%,
    #fff3c4 20%,
    rgba(255, 236, 170, 0.4) 40%,
    rgba(255, 236, 170, 0) 66%
  );
  transform: translate3d(calc(var(--px) * -4px), calc(var(--py) * -2px), 0);
}

.clouds {
  position: absolute;
  inset: 0;
  will-change: transform;
}
.clouds--a {
  transform: translate3d(calc(var(--px) * -12px), calc(var(--py) * -5px), 0);
}
.clouds--b {
  transform: translate3d(calc(var(--px) * -32px), calc(var(--py) * -13px), 0);
}
.clouds--c {
  transform: translate3d(calc(var(--px) * -58px), calc(var(--py) * -24px), 0);
}

.cloud {
  position: absolute;
  top: var(--top, 20vh);
  left: 0;
  width: var(--size, 130px);
  height: calc(var(--size, 130px) * 0.5);
  color: #f2f7ff;
  filter: drop-shadow(0 12px 18px rgba(70, 110, 180, 0.16));
  animation: cloud-move var(--dur, 70s) linear infinite;
  animation-delay: var(--delay, 0s);
}
.cloud > * { fill: currentColor; }
.clouds--a .cloud { opacity: 0.8; }
.clouds--b .cloud { opacity: 0.9; }
.clouds--c .cloud { opacity: 0.95; }

@keyframes cloud-move {
  from { transform: translateX(-45vw); }
  to   { transform: translateX(145vw); }
}

.range {
  position: absolute;
  left: -4%;
  bottom: -90px;
  width: 108%;
  color: #6d6df0;
  will-change: transform;
}
.range path { fill: currentColor; }
.range--distant {
  height: 74vh;
  opacity: 0.06;
  color: #8b9cf0;
  transform: translate3d(
    calc(var(--px) * -3px),
    calc(var(--py) * -2px + clamp(-12px, var(--sy) * -0.01px, 0px)),
    0
  );
}
.range--far {
  height: 62vh;
  opacity: 0.1;
  transform: translate3d(
    calc(var(--px) * -12px),
    calc(var(--py) * -5px + clamp(-26px, var(--sy) * -0.02px, 0px)),
    0
  );
}
.range--mid {
  height: 52vh;
  opacity: 0.16;
  transform: translate3d(
    calc(var(--px) * -26px),
    calc(var(--py) * -10px + clamp(-48px, var(--sy) * -0.04px, 0px)),
    0
  );
}
.range--near {
  height: 40vh;
  opacity: 0.24;
  transform: translate3d(
    calc(var(--px) * -46px),
    calc(var(--py) * -18px + clamp(-72px, var(--sy) * -0.06px, 0px)),
    0
  );
}
.range--fore {
  height: 34vh;
  opacity: 0.34;
  color: #4f46e5;
  transform: translate3d(
    calc(var(--px) * -74px),
    calc(var(--py) * -28px + clamp(-110px, var(--sy) * -0.1px, 0px)),
    0
  );
}
.range--front {
  height: 28vh;
  opacity: 0.46;
  color: #3f38c9;
  transform: translate3d(
    calc(var(--px) * -116px),
    calc(var(--py) * -44px + clamp(-170px, var(--sy) * -0.15px, 0px)),
    0
  );
}
.range--closest {
  height: 22vh;
  opacity: 0.6;
  color: #2f2a9e;
  transform: translate3d(
    calc(var(--px) * -170px),
    calc(var(--py) * -64px + clamp(-220px, var(--sy) * -0.2px, 0px)),
    0
  );
}

/* floating dust motes (strong foreground parallax) */
.dust {
  position: absolute;
  inset: 0;
  will-change: transform;
}
.dust--far {
  transform: translate3d(calc(var(--px) * -54px), calc(var(--py) * -24px), 0);
}
.dust--mid {
  transform: translate3d(calc(var(--px) * -96px), calc(var(--py) * -42px), 0);
}
.dust--near {
  transform: translate3d(calc(var(--px) * -140px), calc(var(--py) * -60px), 0);
}
.mote {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--r);
  height: var(--r);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  opacity: var(--o, 0.5);
}

.haze {
  position: absolute;
  left: -8%;
  bottom: 16vh;
  width: 116%;
  height: 24vh;
  opacity: 0.4;
  filter: blur(16px);
  background:
    radial-gradient(60% 100% at 28% 60%, rgba(220, 235, 255, 0.7), transparent 70%),
    radial-gradient(50% 90% at 74% 42%, rgba(210, 228, 250, 0.55), transparent 70%);
  transform: translate3d(calc(var(--px) * -5px), calc(var(--py) * -3px), 0);
}

.scenery::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 24vh;
  background: linear-gradient(to top, rgba(150, 180, 220, 0.35), transparent);
}

html.dark .sun {
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.9) 0 12%,
    rgba(200, 214, 255, 0.5) 22%,
    rgba(200, 214, 255, 0) 60%
  );
  opacity: 0.7;
}
html.dark .cloud { color: #35405e; filter: none; }
html.dark .clouds--a .cloud { opacity: 0.5; }
html.dark .clouds--b .cloud { opacity: 0.35; }
html.dark .clouds--c .cloud { opacity: 0.28; }
html.dark .range { color: #a5b4fc; }
html.dark .range--distant { opacity: 0.1; }
html.dark .range--far { opacity: 0.14; }
html.dark .range--mid { opacity: 0.2; }
html.dark .range--near { opacity: 0.28; }
html.dark .range--fore { opacity: 0.36; color: #c7d2fe; }
html.dark .range--front { opacity: 0.44; color: #aab4f0; }
html.dark .range--closest { opacity: 0.55; color: #8f9be6; }
html.dark .mote { background: rgba(200, 214, 255, 0.7); }
html.dark .haze {
  background:
    radial-gradient(60% 100% at 28% 60%, rgba(120, 140, 255, 0.22), transparent 70%),
    radial-gradient(50% 90% at 74% 42%, rgba(236, 72, 153, 0.16), transparent 70%);
}
html.dark .scenery::after {
  background: linear-gradient(to top, rgba(10, 10, 20, 0.6), transparent);
}

/* mouse parallax is applied to the wallpaper layers only
   (scenery + rain), never to the page content */

.reveal { opacity: 0; }
.reveal.is-visible {
  animation: fade-up 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: var(--reveal-delay, 0ms);
}

/* hero entrance */
.hero-copy > * {
  animation: fade-up 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.hero-copy > *:nth-child(2) { animation-delay: 0.09s; }
.hero-copy > *:nth-child(3) { animation-delay: 0.18s; }
.hero-copy > *:nth-child(4) { animation-delay: 0.27s; }

.hero-photo.photo-ring {
  animation: fade-up 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.15s both,
    floaty 6s ease-in-out 1s infinite;
}

html {
  scroll-behavior: smooth;
  overflow-y: scroll;
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: clip;
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  font-weight: 500;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  background: linear-gradient(180deg, #5f9de6 0%, #86b6ec 34%, #b3cfef 66%, #cfe0f3 100%);
  background-attachment: fixed;
}

html.dark body {
  background: linear-gradient(180deg, #0b1220 0%, #101f3a 42%, #0a1626 72%, #0b1526 100%);
}

h1, h2, h3 { line-height: 1.2; }

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

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* nav (glass) */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--glass-strong);
  border-bottom: 1px solid var(--glass-border);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  font-size: 1.1rem;
}
.brand:hover { text-decoration: none; }

.nav nav a {
  position: relative;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.95rem;
  margin-left: 1.6rem;
  transition: color 0.2s ease;
}
.nav nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -6px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}
.nav nav a:hover { color: var(--text); text-decoration: none; }
.nav nav a:hover::after,
.nav nav a.active::after { transform: scaleX(1); }
.nav nav a.active { color: var(--accent); }

.theme-toggle {
  margin-left: 1.6rem;
  width: 2.2rem;
  height: 2.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); transform: rotate(20deg); }

/* hero */
.hero {
  padding: 2rem 0 1.75rem;
}

.hero + .section { padding-top: 0.75rem; }

.hero-inner {
  display: flex;
  align-items: center;
  gap: 3rem;
}

.hero-copy { flex: 1 1 auto; min-width: 0; }

/* photo with gradient ring */
.photo-ring {
  padding: 5px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 18px 50px rgba(99, 102, 241, 0.35);
}
.photo-ring img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.hero-photo {
  flex: 0 0 auto;
  width: 220px;
  height: 220px;
}

/* about intro */
.about-intro {
  display: flex;
  align-items: flex-start;
  gap: 2.5rem;
}
.about-text { flex: 1 1 auto; min-width: 0; }
.about-text p:first-child { margin-top: 0; }
.about-text p:last-child { margin-bottom: 0; }
.about-photo {
  flex: 0 0 auto;
  width: 170px;
  height: 170px;
}

@media (max-width: 720px) {
  .hero-inner {
    flex-direction: column-reverse;
    align-items: flex-start;
    gap: 1.75rem;
  }
  .hero-photo { width: 170px; height: 170px; }
  .about-intro { flex-direction: column; gap: 1.75rem; }
  .about-photo { width: 170px; height: 170px; }
}

.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  margin: 0 0 1.5rem;
}

.hero h1 {
  font-size: clamp(2.25rem, 6vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 1.25rem;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--accent);
}

.lead {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 52ch;
  margin: 0 0 2.25rem;
}

.actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }

.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.95rem;
  background: linear-gradient(120deg, var(--accent), var(--accent-2), var(--accent));
  background-size: 200% 100%;
  background-position: 0% 0;
  color: #fff;
  border: 1px solid transparent;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-position 0.4s ease;
}
.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
  background-position: 100% 0;
  box-shadow: 0 12px 30px rgba(99, 102, 241, 0.45);
}

.btn.ghost {
  background: var(--glass);
  background-size: auto;
  color: var(--text);
  border-color: var(--glass-border);
  box-shadow: none;
}
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); box-shadow: none; background-position: 0 0; }

/* page head (sub-pages) */
.page-head {
  padding: 2.5rem 0 0.75rem;
}

.page-head h1 {
  font-size: clamp(2rem, 5vw, 2.9rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 1rem;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--accent);
}

.page-head .lead { margin-bottom: 0; }

.page-head + .section { padding-top: 0.75rem; }

/* sections */
.section {
  padding: 1.5rem 0;
}

.section + .section { padding-top: 0; }

.section h2 {
  position: relative;
  padding-left: 0.95rem;
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 1.75rem;
}
.section h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.18em;
  bottom: 0.18em;
  width: 4px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}

.section p { color: var(--muted); max-width: 62ch; }
.section p strong { color: var(--text); font-weight: 700; }

/* grid + glass cards */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}

.card,
.achv-card,
.timeline {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card {
  padding: 1.7rem;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 18px 50px rgba(99, 102, 241, 0.22);
}

.card h3 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
  font-weight: 700;
}

.card ul {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--muted);
  font-size: 0.95rem;
}
.card ul li { margin-bottom: 0.4rem; }

.card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.focus-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin-top: 1.1rem;
  font-size: 0.9rem;
}
.focus-links a { font-weight: 600; }

/* home quick links */
.link-card {
  position: relative;
  display: block;
  color: var(--text);
}
.link-card::after {
  content: "\2192";
  position: absolute;
  top: 1.6rem;
  right: 1.7rem;
  color: var(--accent);
  opacity: 0.45;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.link-card:hover::after { transform: translateX(5px); opacity: 1; }
.link-card:hover { text-decoration: none; }
.link-card h3 { color: var(--accent); }
.link-card p { margin: 0; color: var(--muted); font-size: 0.95rem; }

/* writeups */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 0.28rem 0.65rem 0.28rem 0.55rem;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.14);
  color: var(--accent);
}
.tag::before {
  content: "";
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}
.writeup .tag { margin-bottom: 0.9rem; }
.tag.web { color: #0284c7; background: rgba(2, 132, 199, 0.14); }
.tag.crypto { color: #7c3aed; background: rgba(124, 58, 237, 0.14); }
.tag.misc { color: #db2777; background: rgba(219, 39, 119, 0.14); }
.tag.rev { color: #059669; background: rgba(5, 150, 105, 0.14); }
.tag.pwn { color: #d97706; background: rgba(217, 119, 6, 0.14); }
.tag.osint { color: #0891b2; background: rgba(8, 145, 178, 0.14); }
.tag.forensics { color: #4f46e5; background: rgba(79, 70, 229, 0.14); }

html.dark .tag.web { color: #7dd3fc; background: rgba(56, 189, 248, 0.18); }
html.dark .tag.crypto { color: #c4b5fd; background: rgba(167, 139, 250, 0.18); }
html.dark .tag.misc { color: #f9a8d4; background: rgba(244, 114, 182, 0.18); }
html.dark .tag.rev { color: #6ee7b7; background: rgba(52, 211, 153, 0.18); }
html.dark .tag.pwn { color: #fcd34d; background: rgba(251, 191, 36, 0.18); }
html.dark .tag.osint { color: #67e8f9; background: rgba(34, 211, 238, 0.18); }
html.dark .tag.forensics { color: #a5b4fc; background: rgba(129, 140, 248, 0.18); }

.writeup h3 { margin-bottom: 0.5rem; }
.writeup p { margin: 0 0 0.9rem; font-size: 0.95rem; }
.meta { color: var(--muted); font-size: 0.85rem; font-weight: 600; }

/* contact links */
.links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.links a {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
}
.links a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* achievements */
.achv-group { margin-top: 2.25rem; }
.achv-group:first-of-type { margin-top: 0; }

.achv-title {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.9rem;
}

.achv-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1rem;
}

.achv-card {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 1.3rem;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.achv-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 18px 50px rgba(99, 102, 241, 0.22);
}

.achv-card:has(.achv-img) { cursor: zoom-in; }

.achv-img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  margin-bottom: 0.2rem;
  cursor: zoom-in;
}

/* image lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 4vmin;
  background: rgba(9, 9, 16, 0.82);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.lightbox.open { opacity: 1; }

.lightbox-img {
  max-width: 100%;
  max-height: 90vh;
  border-radius: 12px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  transform: scale(0.96);
  transition: transform 0.25s ease;
}
.lightbox.open .lightbox-img { transform: scale(1); }

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.lightbox-close:hover { background: rgba(0, 0, 0, 0.6); }

.achv-card .rank {
  align-self: flex-start;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: linear-gradient(120deg, rgba(99, 102, 241, 0.22), rgba(236, 72, 153, 0.22));
  color: var(--accent);
}
.rank.gold { background: linear-gradient(120deg, #fde68a, #fbbf24); color: #7c4a03; }
.rank.silver { background: linear-gradient(120deg, #e5e7eb, #cbd5e1); color: #475569; }
.rank.special { background: linear-gradient(120deg, #bbf7d0, #4ade80); color: #065f46; }
.rank.top { background: linear-gradient(120deg, #a5f3fc, #22d3ee); color: #0e7490; }

.achv-card h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
}
.achv-card p { margin: 0; color: var(--muted); font-size: 0.85rem; }

/* timeline (experience / education) */
.timeline {
  list-style: none;
  padding: 1.5rem;
}

.tl-item {
  display: flex;
  gap: 1.75rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}
.tl-item:first-child { padding-top: 0; }
.tl-item:last-child { border-bottom: none; padding-bottom: 0; }

.tl-when {
  flex: 0 0 12rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
  padding-top: 0.15rem;
}

.tl-item h3 {
  margin: 0 0 0.15rem;
  font-size: 1.05rem;
  font-weight: 700;
}
.tl-item p { margin: 0; color: var(--muted); font-size: 0.95rem; }

/* writeup list links */
.writeup { position: relative; }
.writeup h3 a { color: var(--text); }
.writeup h3 a:hover { color: var(--accent); text-decoration: none; }
/* make the whole card clickable */
.writeup h3 a::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: var(--radius);
}

/* writeup reader */
.back { margin: 0 0 1rem; font-size: 0.9rem; font-weight: 600; }

.post-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}
.post-meta .tag { font-size: 0.66rem; }

.prose {
  color: var(--text);
  font-size: 1.02rem;
  line-height: 1.8;
  overflow-wrap: break-word;
}

.prose > *:first-child { margin-top: 0; }

.prose h1, .prose h2, .prose h3, .prose h4 {
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin: 2.25rem 0 1rem;
  scroll-margin-top: 80px;
}
.prose h1 { font-size: 1.9rem; }
.prose h2 { font-size: 1.55rem; }
.prose h3 { font-size: 1.25rem; }
.prose h4 { font-size: 1.05rem; }

.prose p { margin: 1.1rem 0; }

.prose a { font-weight: 600; }

.prose ul, .prose ol { margin: 1.1rem 0; padding-left: 1.5rem; }
.prose li { margin: 0.4rem 0; }
.prose li::marker { color: var(--accent); }

.prose blockquote {
  margin: 1.5rem 0;
  padding: 0.5rem 1.25rem;
  border-left: 3px solid var(--accent);
  color: var(--muted);
  background: var(--glass);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.prose code {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88em;
  background: rgba(99, 102, 241, 0.12);
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
}

.prose pre {
  background: #14141c;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  box-shadow: var(--shadow);
}
.prose pre code {
  background: none;
  padding: 0;
  font-size: 0.85rem;
  line-height: 1.6;
  color: #e6e6f0;
}

.prose img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--glass-border);
  margin: 1.5rem 0;
  box-shadow: var(--shadow);
}

.prose hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 2.5rem 0;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.95rem;
  display: block;
  overflow-x: auto;
}
.prose th, .prose td {
  border: 1px solid var(--line);
  padding: 0.6rem 0.85rem;
  text-align: left;
}
.prose th { background: var(--glass); font-weight: 700; }

.prose .callout {
  margin: 2rem 0;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  background: linear-gradient(120deg, rgba(16, 185, 129, 0.16), rgba(34, 211, 238, 0.16));
  border: 1px solid rgba(16, 185, 129, 0.4);
}
.prose .callout p { margin: 0; }

.prose-error {
  padding: 1.25rem 1.5rem;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  color: var(--muted);
  box-shadow: var(--shadow);
}
.prose-error code { font-size: 0.85em; }

/* footer */
footer {
  padding: 3rem 0;
}
footer p { margin: 0; color: var(--muted); font-size: 0.9rem; }

@media (max-width: 620px) {
  body { font-size: 16px; }
  .nav-inner { height: auto; padding: 0.9rem 0; flex-direction: column; gap: 0.5rem; }
  .nav nav a { margin: 0 0.7rem; }
  .hero { padding: 1.5rem 0 1.75rem; }
  .section { padding: 2.5rem 0; }
  .page-head { padding: 2rem 0 0.75rem; }
  .tl-item { flex-direction: column; gap: 0.25rem; }
  .tl-when { flex-basis: auto; padding-top: 0; }
}

/* page loader */
.loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  animation: loader-auto-hide 0.6s ease 4s forwards;
}

/* sliding doors */
.loader::before,
.loader::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50.2%;
  z-index: -1;
  background: linear-gradient(135deg, #eef1ff 0%, #f7f2fb 55%, #eafaf9 100%);
  background-size: 200% 100%;
  will-change: transform;
  transition: transform 0.9s cubic-bezier(0.76, 0, 0.24, 1);
}
.loader::before { left: 0; background-position: 0% 0; }
.loader::after { right: 0; background-position: 100% 0; }

html.dark .loader::before,
html.dark .loader::after {
  background-image: linear-gradient(135deg, #0a0a14 0%, #150f24 55%, #08161f 100%);
}

.loader.is-open::before { transform: translateX(-101%); }
.loader.is-open::after { transform: translateX(101%); }

.loader.is-open .loader-canvas,
.loader.is-open .loader-status,
.loader.is-open .loader-bar,
.loader.is-open .loader-pct {
  opacity: 0;
  transition: opacity 0.5s ease;
}

.no-loader .loader { display: none !important; }

.loader-canvas {
  display: block;
  width: min(92vw, 520px);
  height: 200px;
}

@keyframes loader-auto-hide {
  to { opacity: 0; visibility: hidden; }
}

.loader-status {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  min-height: 1em;
}
.loader-status::after {
  content: "_";
  margin-left: 2px;
  color: var(--accent);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink {
  50% { opacity: 0; }
}

.loader-bar {
  width: min(240px, 60vw);
  height: 4px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.16);
  overflow: hidden;
}
.loader-bar i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.6);
  transition: width 0.25s ease;
}

.loader-pct {
  margin-top: -0.7rem;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--muted);
}

/* click ripple */
.click-ripple {
  position: fixed;
  z-index: 10000;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.55), rgba(236, 72, 153, 0.3) 55%, transparent 72%);
  animation: ripple-out 0.65s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes ripple-out {
  from { transform: scale(0.2); opacity: 0.9; }
  to   { transform: scale(13); opacity: 0; }
}

/* click particle burst */
.click-particle {
  position: fixed;
  z-index: 10000;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  pointer-events: none;
  background: var(--c, var(--accent));
  box-shadow: 0 0 8px var(--c, var(--accent));
  animation: particle-fly 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes particle-fly {
  0% {
    transform: translate(0, 0) scale(var(--s, 1));
    opacity: 1;
  }
  100% {
    transform: translate(var(--dx, 0), var(--dy, 0)) scale(0);
    opacity: 0;
  }
}

