@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;700&display=swap');

:root {
  --bg: #050508;
  --surface: #0a0b10;
  --border: #1a1b22;
  --accent: #8a9bae;
  --accent-dim: rgba(138, 155, 174, 0.08);
  --accent-glow: rgba(138, 155, 174, 0.2);
  --amber: #c9a87c;
  --amber-dim: rgba(201, 168, 124, 0.08);
  --amber-glow: rgba(201, 168, 124, 0.15);
  --text: #909098;
  --text-muted: #4a4a55;
  --text-bright: #c0c0c8;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.8;
  overflow-x: hidden;
}

/* ── CRT Effects ───────────────────────────────────────── */

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(
    ellipse at center,
    transparent 60%,
    rgba(0, 0, 0, 0.45) 100%
  );
  pointer-events: none;
  z-index: 9998;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 1px,
    rgba(0, 0, 0, 0.08) 1px,
    rgba(0, 0, 0, 0.08) 2px
  );
  pointer-events: none;
  z-index: 9999;
}

@keyframes flicker {
  0%, 97%, 100% { opacity: 1; }
  98% { opacity: 0.97; }
  99% { opacity: 0.99; }
}

body {
  animation: flicker 8s infinite;
}

/* ── Navigation ────────────────────────────────────────── */

nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10000;
  padding: 0 2rem;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(5, 5, 8, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: #e8e8f0;
  font-weight: 400;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
}

.nav-brand img {
  filter: brightness(1.4) saturate(1.2);
  transition: filter 0.2s, drop-shadow 0.2s;
}

.nav-brand img:hover {
  filter: brightness(1.8) saturate(1.4) drop-shadow(0 0 6px rgba(255, 80, 80, 0.8));
}

.nav-brand svg {
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
}

.nav-links a {
  color: #d0d0d8;
  text-decoration: none;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  transition: color 0.2s;
}

.nav-links a::before {
  content: '[';
  color: #606068;
}

.nav-links a::after {
  content: ']';
  color: #606068;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent);
}

.nav-links a:hover::before,
.nav-links a:hover::after,
.nav-links a.active::before,
.nav-links a.active::after {
  color: var(--accent);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
}

/* ── Hero ──────────────────────────────────────────────── */

.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  max-width: 720px;
  margin: 0 auto;
  padding: 6rem 2rem 4rem;
  position: relative;
}

.hero-header {
  color: var(--text-muted);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  margin-bottom: 1.5rem;
  white-space: pre-line;
  line-height: 1.6;
}

.hero h1 {
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  font-weight: 700;
  color: var(--text-bright);
  letter-spacing: 0.02em;
  margin-bottom: 0.3rem;
}

.hero .subtitle {
  font-size: 0.82rem;
  color: var(--amber);
  text-shadow: 0 0 10px var(--amber-glow);
  margin-bottom: 1.5rem;
  letter-spacing: 0.06em;
}

.hero .tagline {
  color: var(--text);
  font-size: 0.78rem;
  margin-bottom: 2rem;
  line-height: 2;
  max-width: 520px;
}

.hero-buttons {
  display: flex;
  gap: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem;
  font-family: inherit;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-decoration: none;
  border-radius: 1px;
  transition: all 0.2s;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
  border: 1px solid var(--accent);
  font-weight: 500;
}

.btn-primary:hover {
  box-shadow: 0 0 12px var(--accent-glow);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  border-color: var(--amber);
  color: var(--amber);
}

/* ── Sections ──────────────────────────────────────────── */

section {
  max-width: 720px;
  margin: 0 auto;
  padding: 3.5rem 2rem;
}

.section-title {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-bright);
  text-shadow: 0 0 8px var(--accent-glow);
  margin-bottom: 1.25rem;
  letter-spacing: 0.06em;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.divider {
  max-width: 720px;
  margin: 0 auto;
  border: none;
  border-top: 1px dashed var(--border);
}

/* ── About ─────────────────────────────────────────────── */

.about-text {
  font-size: 0.78rem;
  line-height: 2;
  color: var(--text);
}

.about-text .highlight {
  color: var(--amber);
}

/* ── About photo ───────────────────────────────────────── */

.about-photo {
  display: block;
  margin-top: 1.75rem;
  width: 100%;
  max-width: 420px;
  border: 1px solid var(--border);
  border-radius: 2px;
  filter: brightness(0.9) saturate(0.85);
  transition: filter 0.3s;
}

.about-photo:hover {
  filter: brightness(1) saturate(1);
}

/* ── Projects ──────────────────────────────────────────── */

.projects-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.project-item {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.6rem 0;
  text-decoration: none;
  color: var(--text);
  border-bottom: 1px dotted var(--border);
  transition: color 0.15s;
}

.project-item:last-child {
  border-bottom: none;
}

.project-item:hover {
  color: var(--accent);
}

.project-item:hover .project-name {
  color: var(--accent);
  text-shadow: 0 0 6px var(--accent-glow);
}

.project-name {
  font-weight: 500;
  color: var(--text-bright);
  font-size: 0.78rem;
  white-space: nowrap;
  transition: all 0.15s;
}

.project-sep {
  color: var(--text-muted);
  flex-shrink: 0;
}

.project-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
  flex-grow: 1;
}

.project-tag {
  font-size: 0.58rem;
  color: var(--amber);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Stack ─────────────────────────────────────────────── */

.stack-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 2.2;
  word-spacing: 0.15em;
}

.stack-text span {
  color: var(--text);
  transition: color 0.15s;
}

.stack-text span:hover {
  color: var(--accent);
}

.stack-text .sep {
  color: var(--border);
  margin: 0 0.15rem;
}

/* ── Contact ───────────────────────────────────────────── */

.contact p {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-bottom: 1.25rem;
  line-height: 1.9;
}

.contact-links {
  display: flex;
  gap: 0.75rem;
}

.contact-links a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.72rem;
  transition: text-shadow 0.2s;
}

.contact-links a:hover {
  text-shadow: 0 0 8px var(--accent-glow);
}

.contact-links .sep {
  color: var(--text-muted);
}

/* ── Footer ────────────────────────────────────────────── */

footer {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 2rem;
  color: var(--text-muted);
  font-size: 0.6rem;
  letter-spacing: 0.04em;
  border-top: 1px dashed var(--border);
}

/* ── Easter Egg: Berry ASMR animation ─────────────────── */

@keyframes berry-asmr {
  0%   { transform: scale(1) rotate(0deg); }
  20%  { transform: scale(1.5) rotate(-8deg); }
  40%  { transform: scale(0.85) rotate(5deg); }
  60%  { transform: scale(1.3) rotate(-4deg); }
  80%  { transform: scale(0.95) rotate(2deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.berry-popping {
  animation: berry-asmr 0.6s ease-in-out forwards;
  cursor: pointer;
}

.nav-brand img {
  cursor: crosshair;
}

/* ── Easter Egg: Page flip ─────────────────────────────── */

@keyframes flip-out {
  from { transform: perspective(1200px) rotateY(0deg); opacity: 1; }
  to   { transform: perspective(1200px) rotateY(90deg); opacity: 0; }
}

@keyframes flip-in {
  from { transform: perspective(1200px) rotateY(-90deg); opacity: 0; }
  to   { transform: perspective(1200px) rotateY(0deg); opacity: 1; }
}

body.flipping-out { animation: flip-out 0.45s ease-in forwards; }
body.flipping-in  { animation: flip-in  0.45s ease-out forwards; }

/* ── Easter Egg: Back side (early internet) ────────────── */

#page-back {
  display: none;
  position: relative;
  min-height: 100vh;
  background-color: #000080;
  background-image: radial-gradient(circle, rgba(255,255,255,0.15) 1px, transparent 1px);
  background-size: 24px 24px;
  font-family: 'Comic Sans MS', 'Courier New', cursive;
  color: #ffff00;
  padding-top: 2rem;
  padding-bottom: 4rem;
}

#page-back marquee {
  background: #ff00ff;
  color: #ffff00;
  font-size: 1rem;
  font-weight: bold;
  padding: 0.4rem 0;
  letter-spacing: 0.08em;
}

.back-inner {
  max-width: 800px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem;
  text-align: center;
}

.gif-strip {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 1.5rem;
  margin: 2rem 0;
  flex-wrap: wrap;
}

.gif-strip img {
  width: 64px;
  height: 64px;
  image-rendering: pixelated;
  object-fit: contain;
}

.gif-strip img:nth-child(1) { transform: rotate(-6deg); }
.gif-strip img:nth-child(2) { transform: rotate(4deg); }
.gif-strip img:nth-child(3) { transform: rotate(-3deg); }
.gif-strip img:nth-child(4) { transform: rotate(7deg); }
.gif-strip img:nth-child(5) { transform: rotate(-5deg); }

.retro-badges {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  margin: 1.5rem 0;
  font-size: 0.9rem;
  color: #00ffff;
  flex-wrap: wrap;
}

@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

.blink {
  animation: blink 1s step-start infinite;
  color: #ff69b4;
  font-weight: bold;
}

.back-blog {
  max-width: 600px;
  margin: 2rem auto;
  border: 4px solid transparent;
  border-image: linear-gradient(90deg, #ff0000, #ff7700, #ffff00, #00ff00, #0000ff, #8b00ff) 1;
  padding: 1.5rem;
  background: rgba(0, 0, 0, 0.4);
}

.back-blog h2 {
  color: #ff69b4;
  font-size: 1.5rem;
  margin-bottom: 1.25rem;
  text-shadow: 2px 2px #000000;
}

.blog-post h3 {
  color: #00ffff;
  font-size: 1rem;
  margin-bottom: 1rem;
}

.blog-img {
  max-width: 100%;
  border: 4px ridge #ff69b4;
  display: block;
  margin: 0 auto 1rem;
}

.blog-post p {
  color: #ffff00;
  font-size: 0.9rem;
}

#btn-flip-back {
  margin-top: 2rem;
  padding: 6px 14px;
  font-family: 'Arial', sans-serif;
  font-size: 0.8rem;
  background: #c0c0c0;
  color: #000000;
  border: none;
  border-top: 2px solid #ffffff;
  border-left: 2px solid #ffffff;
  border-right: 2px solid #808080;
  border-bottom: 2px solid #808080;
  cursor: pointer;
  letter-spacing: 0.02em;
}

#btn-flip-back:active {
  border-top: 2px solid #808080;
  border-left: 2px solid #808080;
  border-right: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
}

/* ── Falling Stars ─────────────────────────────────────── */

.falling-stars-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

@keyframes star-fall {
  0%   { top: -5%; opacity: 1; }
  100% { top: 105%; opacity: 0.3; }
}

.falling-star {
  position: absolute;
  font-size: 1.2rem;
  animation: star-fall linear infinite;
}

.falling-star:nth-child(1) { left:  8%; color: #ff69b4; animation-duration: 4.2s; animation-delay:  0.0s; }
.falling-star:nth-child(2) { left: 19%; color: #00ffff; animation-duration: 3.8s; animation-delay:  0.7s; }
.falling-star:nth-child(3) { left: 33%; color: #ffff00; animation-duration: 5.1s; animation-delay:  1.2s; }
.falling-star:nth-child(4) { left: 47%; color: #ff4500; animation-duration: 4.5s; animation-delay:  0.3s; }
.falling-star:nth-child(5) { left: 58%; color: #7fff00; animation-duration: 3.6s; animation-delay:  1.8s; }
.falling-star:nth-child(6) { left: 70%; color: #ff00ff; animation-duration: 4.8s; animation-delay:  0.9s; }
.falling-star:nth-child(7) { left: 81%; color: #00ff7f; animation-duration: 4.0s; animation-delay:  2.4s; }
.falling-star:nth-child(8) { left: 92%; color: #ffa500; animation-duration: 5.3s; animation-delay:  1.5s; }

/* ── Cursor Star Trail ─────────────────────────────────── */

.star-trail {
  position: fixed;
  pointer-events: none;
  font-size: 1rem;
  z-index: 9000;
  animation: trail-fade 0.8s ease-out forwards;
}

@keyframes trail-fade {
  0%   { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-30px); }
}

/* ── Retro Badge Strip ─────────────────────────────────── */

.retro-badge-strip {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 1.5rem 0;
}

.retro-badge {
  display: inline-block;
  padding: 0.4rem 0.6rem;
  font-size: 0.6rem;
  font-family: 'Arial', sans-serif;
  font-weight: bold;
  text-align: center;
  line-height: 1.4;
  cursor: default;
  border-top: 2px solid #ffffff;
  border-left: 2px solid #ffffff;
  border-right: 2px solid #808080;
  border-bottom: 2px solid #808080;
}

.badge-ie         { background: #000080; color: #ffffff; }
.badge-notepad    { background: #006400; color: #ffff00; }
.badge-resolution { background: #8b0000; color: #00ffff; }
.badge-html       { background: #4b0082; color: #ff69b4; }

/* ── Rainbow Heading ───────────────────────────────────── */

.rainbow-heading {
  font-size: 1.5rem;
  font-weight: bold;
  font-family: 'Comic Sans MS', 'Courier New', cursive;
  margin: 1rem 0 0.5rem;
  letter-spacing: 0.06em;
  line-height: 1.6;
}

.rainbow-heading span {
  display: inline-block;
  animation: rainbow-cycle 3s linear infinite;
}

@keyframes rainbow-cycle {
  0%   { color: #ff0000; }
  14%  { color: #ff8800; }
  28%  { color: #ffff00; }
  42%  { color: #00ff00; }
  57%  { color: #00ffff; }
  71%  { color: #0000ff; }
  85%  { color: #ff00ff; }
  100% { color: #ff0000; }
}

/* ── Bottom Marquee ────────────────────────────────────── */

.marquee-bottom {
  background: #006400;
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: bold;
  padding: 0.3rem 0;
  letter-spacing: 0.06em;
  margin: 1rem 0;
}

/* ── Retro Clock ───────────────────────────────────────── */

#retro-clock {
  display: none;
  position: fixed;
  top: 1rem;
  right: 1.5rem;
  width: 135px;
  background: #c0c0c0;
  border-top: 2px solid #ffffff;
  border-left: 2px solid #ffffff;
  border-right: 2px solid #808080;
  border-bottom: 2px solid #808080;
  z-index: 200;
  font-family: 'Arial', sans-serif;
}

body[data-side="back"] #retro-clock {
  display: block;
}

.clock-titlebar {
  background: linear-gradient(90deg, #000080, #1084d0);
  color: #ffffff;
  font-size: 0.6rem;
  font-weight: bold;
  padding: 3px 5px;
}

.clock-body {
  padding: 6px 8px;
  text-align: center;
}

#clock-time {
  font-size: 0.82rem;
  font-weight: bold;
  color: #000000;
  font-family: 'Courier New', monospace;
}

#clock-date {
  font-size: 0.58rem;
  color: #404040;
  margin-top: 2px;
  font-family: 'Arial', sans-serif;
}

/* ── Guestbook ─────────────────────────────────────────── */

.back-guestbook {
  max-width: 600px;
  margin: 2rem auto;
  background: rgba(0, 0, 0, 0.4);
  border: 4px solid transparent;
  border-image: linear-gradient(90deg, #ff69b4, #00ffff, #ffff00, #ff69b4) 1;
  padding: 1.25rem;
}

.back-guestbook h2 {
  color: #ff69b4;
  font-size: 1.2rem;
  margin-bottom: 1rem;
  text-shadow: 2px 2px #000000;
}

.gb-entry {
  background: rgba(255, 255, 255, 0.07);
  border: 1px dashed #00ffff;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.6rem;
  text-align: left;
}

.gb-entry:last-child {
  margin-bottom: 0;
}

.gb-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.25rem;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.gb-name {
  color: #ffff00;
  font-weight: bold;
  font-size: 0.75rem;
}

.gb-date {
  color: #00ffff;
  font-size: 0.62rem;
}

.gb-msg {
  color: #ffffff;
  font-size: 0.72rem;
  line-height: 1.5;
}

/* ── Web Ring ──────────────────────────────────────────── */

.webring {
  max-width: 400px;
  margin: 1.5rem auto;
  padding: 0.75rem 1rem;
  background: rgba(0, 0, 0, 0.4);
  border: 3px ridge #c0c0c0;
  font-family: 'Arial', sans-serif;
}

.webring-title {
  color: #00ffff;
  font-weight: bold;
  font-size: 0.78rem;
  margin-bottom: 0.6rem;
}

.webring-nav {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
  flex-wrap: wrap;
}

.webring-btn {
  background: #c0c0c0;
  border-top: 2px solid #ffffff;
  border-left: 2px solid #ffffff;
  border-right: 2px solid #808080;
  border-bottom: 2px solid #808080;
  font-size: 0.68rem;
  padding: 2px 8px;
  cursor: pointer;
  font-family: 'Arial', sans-serif;
  color: #000000;
}

.webring-btn:active {
  border-top: 2px solid #808080;
  border-left: 2px solid #808080;
  border-right: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
}

/* ── AIM Buddy List ────────────────────────────────────── */

#aim-widget {
  display: none;
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  width: 165px;
  background: #c0c0c0;
  border-top: 2px solid #ffffff;
  border-left: 2px solid #ffffff;
  border-right: 2px solid #808080;
  border-bottom: 2px solid #808080;
  z-index: 200;
  font-family: 'Arial', sans-serif;
}

body[data-side="back"] #aim-widget {
  display: block;
}

#aim-widget.aim-hidden {
  display: none !important;
}

.aim-titlebar {
  background: linear-gradient(90deg, #000080, #1084d0);
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: bold;
  padding: 3px 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.aim-close-btn {
  background: #c0c0c0;
  border-top: 1px solid #ffffff;
  border-left: 1px solid #ffffff;
  border-right: 1px solid #808080;
  border-bottom: 1px solid #808080;
  font-size: 0.55rem;
  width: 14px;
  height: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.aim-body {
  padding: 6px;
  background: #ffffff;
  font-size: 0.62rem;
  color: #000000;
}

.aim-group {
  font-weight: bold;
  color: #000080;
  font-size: 0.6rem;
  margin-bottom: 2px;
}

.aim-buddy {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 1px 0;
  color: #000000;
  font-size: 0.62rem;
}

.aim-away-msg {
  font-style: italic;
  color: #808080;
  font-size: 0.55rem;
  margin: 1px 0 4px 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.aim-footer {
  display: flex;
  gap: 3px;
  padding: 4px;
  justify-content: center;
  background: #c0c0c0;
}

.aim-btn {
  background: #c0c0c0;
  border-top: 2px solid #ffffff;
  border-left: 2px solid #ffffff;
  border-right: 2px solid #808080;
  border-bottom: 2px solid #808080;
  font-size: 0.62rem;
  padding: 2px 8px;
  cursor: pointer;
  font-family: 'Arial', sans-serif;
}

.aim-btn:active {
  border-top: 2px solid #808080;
  border-left: 2px solid #808080;
  border-right: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
}

/* ── Responsive ────────────────────────────────────────── */

@media (max-width: 640px) {
  nav {
    padding: 0 1.25rem;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 48px;
    left: 0;
    right: 0;
    background: rgba(5, 5, 8, 0.97);
    backdrop-filter: blur(8px);
    flex-direction: column;
    padding: 1rem 1.25rem;
    gap: 0.6rem;
    border-bottom: 1px solid var(--border);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-toggle {
    display: block;
  }

  .hero {
    padding: 5rem 1.25rem 3rem;
  }

  .hero h1 {
    font-size: 1.4rem;
  }

  .hero-buttons {
    flex-direction: column;
    width: 100%;
    max-width: 240px;
  }

  .btn {
    justify-content: center;
  }

  section {
    padding: 2.5rem 1.25rem;
  }

  .project-item {
    flex-wrap: wrap;
    gap: 0.25rem;
  }

  .project-tag {
    width: 100%;
  }

  .contact-links {
    flex-direction: column;
    gap: 0.35rem;
  }
}
