/* ===== tokens ===== */
:root {
  --bg: #0d0d0f;
  --bg-panel: #15151a;
  --bg-panel-2: #1a1a21;
  --line: #2b2b33;
  --line-soft: #1f1f26;
  --text: #e8e6e3;
  --text-dim: #8a8a94;
  --text-faint: #54545e;
  --accent: #ff6f9c;
  --accent-dim: #b14d6c;
  --accent-glow: rgba(255, 111, 156, 0.35);
  --mono: 'Space Mono', monospace;
  --sans: 'Inter', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  overflow-x: hidden;
  cursor: default;
}

::selection { background: var(--accent); color: #0d0d0f; }

a { color: inherit; text-decoration: none; }

/* ===== particle canvas + grain ===== */
#particles {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

.cursor-dot {
  position: fixed;
  width: 18px;
  height: 18px;
  border: 1px solid var(--accent);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: width .15s, height .15s, opacity .15s, background .15s;
  opacity: 0;
}
@media (hover: hover) {
  .cursor-dot { opacity: 1; }
}
.cursor-dot.hovering {
  width: 38px;
  height: 38px;
  background: var(--accent-glow);
}

/* ===== nav ===== */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(13, 13, 15, 0.7);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
}

.brand {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.05em;
  color: var(--text);
}
.brand-blink {
  color: var(--accent);
  animation: blink 1.1s steps(2) infinite;
}

.nav-links {
  display: flex;
  gap: 32px;
}

.nav-link {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--text-dim);
  letter-spacing: 0.03em;
  position: relative;
  transition: color .25s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-link .num {
  color: var(--text-faint);
  font-size: 0.72rem;
}
.nav-link:hover, .nav-link.active {
  color: var(--text);
}
.nav-link.active .num { color: var(--accent); }
.nav-link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -6px;
  height: 1px;
  width: 0;
  background: var(--accent);
  transition: width .25s;
}
.nav-link:hover::after, .nav-link.active::after {
  width: 100%;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.nav-toggle span {
  width: 22px;
  height: 1.5px;
  background: var(--text);
  display: block;
}

/* ===== layout shells ===== */
main { position: relative; z-index: 2; }

.section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 140px 28px 100px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 48px;
}
.section-head .num {
  font-family: var(--mono);
  color: var(--accent);
  font-size: 0.9rem;
}
.section-head h2 {
  font-family: var(--mono);
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.section-head::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* ===== hero ===== */
.hero { padding-top: 120px; }

.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 60px;
  align-items: center;
}

.eyebrow {
  font-family: var(--mono);
  color: var(--accent);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  margin-bottom: 18px;
}
.eyebrow::before { content: '● '; }

.hero-title {
  font-family: var(--mono);
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 22px;
}

.glitch-text {
  position: relative;
  color: var(--accent);
  display: inline-block;
}
.glitch-text::before,
.glitch-text::after {
  content: attr(data-text);
  position: absolute;
  left: 0; top: 0;
  width: 100%; height: 100%;
  opacity: 0;
}
.glitch-text:hover::before {
  color: #6ad7ff;
  opacity: 0.7;
  animation: glitchShift 0.4s steps(2) infinite;
}
.glitch-text:hover::after {
  color: #ffd86a;
  opacity: 0.7;
  animation: glitchShift2 0.35s steps(2) infinite;
}

.terminal-line {
  font-family: var(--mono);
  font-size: 0.95rem;
  color: var(--text-dim);
  margin-bottom: 24px;
  min-height: 1.4em;
}
.terminal-line .prompt { color: var(--accent); margin-right: 10px; }
.terminal-line .typed { color: var(--text); }
.cursor-blink { animation: blink 1s steps(2) infinite; color: var(--accent); }

.hero-desc {
  color: var(--text-dim);
  font-size: 1rem;
  line-height: 1.7;
  max-width: 480px;
  margin-bottom: 36px;
}
.kao { color: var(--accent); font-family: var(--mono); }

.hero-actions {
  display: flex;
  gap: 14px;
  margin-bottom: 38px;
  flex-wrap: wrap;
}

.btn {
  font-family: var(--mono);
  font-size: 0.85rem;
  padding: 13px 24px;
  border-radius: 3px;
  transition: all .25s;
  letter-spacing: 0.02em;
}
.btn-primary {
  background: var(--accent);
  color: #14141a;
  font-weight: 700;
}
.btn-primary:hover {
  background: #ff8db3;
  box-shadow: 0 0 24px var(--accent-glow);
  transform: translateY(-2px);
}
.btn-ghost {
  border: 1px solid var(--line);
  color: var(--text-dim);
}
.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--text);
  transform: translateY(-2px);
}

.socials {
  display: flex;
  gap: 16px;
}
.social-icon {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--text-dim);
  transition: all .25s;
}
.social-icon svg { width: 17px; height: 17px; }
.social-icon:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 6px 18px var(--accent-glow);
}

/* ===== pfp shred effect ===== */
.hero-pfp-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  justify-self: center;
}

.pfp-frame {
  position: relative;
  width: 280px;
  height: 280px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-panel);
  overflow: hidden;
  cursor: pointer;
}

.pfp-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 5;
  font-family: var(--mono);
  font-size: 0.62rem;
  color: var(--text-faint);
  background: rgba(13,13,15,0.6);
  padding: 2px 7px;
  border-radius: 3px;
  letter-spacing: 0.03em;
}

.pfp-base {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  position: relative;
  z-index: 1;
  transition: opacity .15s;
}
.pfp-frame.shredding .pfp-base { opacity: 0; }

.shred-stage {
  position: absolute;
  inset: 0;
  z-index: 2;
  opacity: 0;
  pointer-events: none;
}
.pfp-frame.shredding .shred-stage {
  opacity: 1;
}

/* shatter/tile grid */
.shred-stage.mode-shatter {
  display: grid;
}
.shred-stage.mode-shatter .shred-tile {
  position: relative;
  overflow: hidden;
}
.shred-stage.mode-shatter .shred-tile img {
  position: absolute;
  object-fit: cover;
}

.pfp-hint {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-faint);
  letter-spacing: 0.05em;
}

/* ===== scroll cue ===== */
.scroll-cue {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-faint);
  letter-spacing: 0.1em;
  display: flex;
  align-items: center;
  gap: 6px;
}
.scroll-cue .arrow {
  animation: floatY 1.6s ease-in-out infinite;
  color: var(--accent);
}

/* ===== about ===== */
.about-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 0.9fr;
  gap: 22px;
}

.about-card {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 26px;
  transition: border-color .25s, transform .25s;
}
.about-card:hover {
  border-color: var(--accent-dim);
  transform: translateY(-3px);
}

.card-label {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--accent);
  margin-bottom: 16px;
  letter-spacing: 0.03em;
}

.main-card p {
  color: var(--text-dim);
  line-height: 1.75;
  margin-bottom: 14px;
  font-size: 0.95rem;
}
.main-card p:last-child { margin-bottom: 0; }
.main-card strong { color: var(--text); }

.stack-list { list-style: none; display: flex; flex-direction: column; gap: 14px; }
.stack-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--text-dim);
  gap: 12px;
}
.bar {
  flex: 1;
  max-width: 110px;
  height: 5px;
  background: var(--line-soft);
  border-radius: 3px;
  overflow: hidden;
}
.bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 3px;
  transition: width 1.2s cubic-bezier(.2,.8,.2,1);
}
.bar.in-view i { width: var(--w); }

.fact-row {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 0.82rem;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
  color: var(--text-dim);
}
.fact-row:last-child { border-bottom: none; }
.fact-row span:last-child { color: var(--text); }
.live-dot { color: #5ee6a0 !important; display: flex; align-items: center; gap: 6px; }
.live-dot::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #5ee6a0;
  display: inline-block;
  animation: pulse 1.6s infinite;
}

/* ===== projects ===== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
}

.project-card {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 28px;
  transition: border-color .25s, transform .25s, box-shadow .25s;
  position: relative;
}
.project-card:hover {
  border-color: var(--accent-dim);
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(0,0,0,0.35);
}

.project-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-faint);
  letter-spacing: 0.04em;
}
.project-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #5ee6a0;
}
.project-dot.dot-wip { background: #ffd86a; }

.project-card h3 {
  font-size: 1.15rem;
  margin-bottom: 10px;
  font-weight: 600;
}
.project-card p {
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 18px;
}

.tags {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}
.tags span {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  padding: 3px 9px;
  border-radius: 3px;
}

.project-link {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--text-dim);
  transition: color .2s, letter-spacing .2s;
}
.project-link:hover {
  color: var(--accent);
  letter-spacing: 0.03em;
}

/* ===== blog ===== */
.blog-list {
  display: flex;
  flex-direction: column;
}

.blog-entry {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 22px 4px;
  border-bottom: 1px solid var(--line-soft);
  transition: padding-left .25s, background .25s;
  background: none;
  border-left: none;
  border-right: none;
  border-top: none;
  width: 100%;
  text-align: left;
  font-family: var(--sans);
  cursor: pointer;
}
.blog-entry:hover {
  padding-left: 14px;
  background: var(--bg-panel);
}
.blog-date {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-faint);
  width: 100px;
  flex-shrink: 0;
}
.blog-title {
  flex: 1;
  font-size: 1rem;
  color: var(--text);
}
.blog-arrow {
  color: var(--text-faint);
  transition: color .25s, transform .25s;
}
.blog-entry:hover .blog-arrow {
  color: var(--accent);
  transform: translateX(4px);
}

.blog-note {
  margin-top: 28px;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-faint);
}

/* ===== footer ===== */
.footer {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 36px 20px 44px;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-faint);
  border-top: 1px solid var(--line-soft);
}
.footer p { margin-bottom: 6px; }
.footer-blink { color: var(--accent-dim); }
.visitor-counter {
  display: block;
  margin: 18px auto 0;
  height: auto;
  max-width: 90%;
}
.footer-egg {
  cursor: pointer;
  display: inline-block;
  transition: color .2s;
}
.footer-egg:hover { color: var(--accent); }
.footer-egg.revealed {
  color: var(--accent);
  animation: eggPop .35s ease;
}

/* ===== blog modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(8, 8, 10, 0.78);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  width: 100%;
  max-width: 640px;
  max-height: 82vh;
  position: relative;
  display: flex;
  flex-direction: column;
  transform: translateY(18px) scale(0.98);
  opacity: 0;
  transition: transform .3s cubic-bezier(.2,.8,.2,1), opacity .3s ease;
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
}
.modal-overlay.open .modal-box {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 5;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--bg-panel-2);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .2s;
}
.modal-close svg { width: 15px; height: 15px; }
.modal-close:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: rotate(90deg);
}

.modal-scroll {
  overflow-y: auto;
  padding: 44px 40px 40px;
}
.modal-scroll::-webkit-scrollbar { width: 8px; }
.modal-scroll::-webkit-scrollbar-track { background: transparent; }
.modal-scroll::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 4px;
}

.modal-date {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--accent);
  margin-bottom: 10px;
  letter-spacing: 0.03em;
}
.modal-title {
  font-family: var(--mono);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 24px;
  line-height: 1.3;
}
.modal-body {
  color: var(--text-dim);
  font-size: 0.96rem;
  line-height: 1.8;
}
.modal-body p {
  margin-bottom: 18px;
}
.modal-body p:last-child { margin-bottom: 0; }
.modal-body strong { color: var(--text); }
.modal-body code {
  font-family: var(--mono);
  background: var(--bg-panel-2);
  padding: 2px 7px;
  border-radius: 3px;
  font-size: 0.88em;
  color: var(--accent);
}
.modal-body img {
  width: 100%;
  border-radius: 6px;
  border: 1px solid var(--line);
  margin: 22px 0;
  display: block;
}
.modal-body .img-caption {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-faint);
  margin-top: -16px;
  margin-bottom: 22px;
  text-align: center;
}
.modal-body blockquote {
  border-left: 2px solid var(--accent);
  padding-left: 16px;
  color: var(--text);
  font-style: italic;
  margin: 18px 0;
}

@keyframes eggPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

body.modal-locked { overflow: hidden; }

/* ===== keyframes ===== */
@keyframes blink { 50% { opacity: 0; } }
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(5px); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
@keyframes glitchShift {
  0% { transform: translate(0,0); }
  50% { transform: translate(-2px, 1px); }
  100% { transform: translate(2px, -1px); }
}
@keyframes glitchShift2 {
  0% { transform: translate(0,0); }
  50% { transform: translate(2px, -1px); }
  100% { transform: translate(-2px, 1px); }
}

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .7s ease, transform .7s ease;
}
.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* ===== responsive ===== */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 50px; }
  .hero-pfp-wrap { order: -1; }
  .about-grid { grid-template-columns: 1fr; }
  .projects-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(13,13,15,0.97);
    flex-direction: column;
    padding: 20px 28px 28px;
    gap: 18px;
    border-bottom: 1px solid var(--line-soft);
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-toggle { display: flex; }
  .section { padding: 110px 20px 70px; }
  .pfp-frame { width: 220px; height: 220px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}