/* =========================================================
   Blue View — personal technical blog
   Static site for GitHub Pages
   ========================================================= */

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

:root {
  --ink: #0e0f14;
  --bg: #f5f6fa;
  --card: #ffffff;
  --accent: #546ac1;
  --accent-dim: #3d4f99;
  --muted: #8b90a7;
  --rule: #e2e4ef;
  --tag-bg: #eceff8;
  --tag-text: #3d4f99;
  --mono: 'DM Sans', system-ui, sans-serif;
  --sans: 'DM Sans', system-ui, sans-serif;
  --maxw: 760px;
  --ease: cubic-bezier(.22,.61,.36,1);
}

/* ============ DARK THEME ============ */
[data-theme="dark"] {
  --ink: #e7e9f2;
  --bg: #0c0d12;
  --card: #15161f;
  --accent: #8b9cf0;
  --accent-dim: #6f82e0;
  --muted: #9398b2;
  --rule: #262838;
  --tag-bg: #1c1f2e;
  --tag-text: #aab6ec;
}
[data-theme="dark"] nav { background: rgba(18,19,26,.72); }
[data-theme="dark"] nav.shrink { background: rgba(18,19,26,.9); }
[data-theme="dark"] .status-active { background: #143021; color: #6fd693; }
[data-theme="dark"] .status-planned { background: #322611; color: #e0b25a; }
[data-theme="dark"] .post-body p,
[data-theme="dark"] .post-body ul,
[data-theme="dark"] .post-body ol { color: #c2c6d8; }
[data-theme="dark"] .post-body code { color: #aab6ec; }
[data-theme="dark"] .post-body blockquote,
[data-theme="dark"] .post-body blockquote p { color: #c7d0f5; }
[data-theme="dark"] .home-hero p,
[data-theme="dark"] .post-summary { color: #b6bbcf; }
[data-theme="dark"] .about-text p { color: #aab0c6; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background .3s var(--ease), color .3s var(--ease);
}

/* Subtle dotted-grid backdrop for depth (IDE vibe) */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(var(--rule) 1px, transparent 1px);
  background-size: 26px 26px;
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 0%, transparent 75%);
          mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 0%, transparent 75%);
  opacity: .6;
  pointer-events: none;
}

a { color: inherit; }
img { max-width: 100%; display: block; }

/* ============ SCROLL PROGRESS BAR ============ */
.scroll-progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-dim));
  z-index: 50;
  transition: width .08s linear;
}

/* ============ NAV ============ */
nav {
  background: rgba(255,255,255,.72);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--rule);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  position: sticky;
  top: 0;
  z-index: 40;
  transition: height .3s var(--ease), box-shadow .3s var(--ease), background .3s var(--ease);
}
nav.shrink {
  height: 52px;
  box-shadow: 0 6px 24px -14px rgba(14,15,20,.25);
  background: rgba(255,255,255,.88);
}
.nav-logo {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  letter-spacing: -.01em;
}
.nav-logo .prompt { color: var(--accent); }
.nav-logo:hover .prompt { animation: blink .9s steps(1) infinite; }

.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-links a {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  font-family: var(--mono);
  position: relative;
  transition: color .2s var(--ease);
}
.nav-links a:not(.nav-badge)::after {
  content: '';
  position: absolute;
  left: 0; bottom: -6px;
  width: 100%; height: 1.5px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .28s var(--ease);
}
.nav-links a:not(.nav-badge):hover::after { transform: scaleX(1); }
.nav-links a:hover { color: var(--ink); }
.nav-links a.active { color: var(--accent); }
.nav-badge {
  background: var(--accent);
  color: #fff !important;
  font-family: var(--mono);
  font-size: 11px;
  padding: 5px 12px;
  border-radius: 5px;
  text-decoration: none;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease);
}
.nav-badge:hover { transform: translateY(-1px); background: var(--accent-dim); box-shadow: 0 8px 18px -8px rgba(84,106,193,.7); }

/* Dark-mode toggle */
.theme-toggle {
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--muted);
  width: 34px; height: 34px;
  border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: color .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease), background .2s var(--ease);
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-1px); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: inline-block; }

/* ============ HOME HERO ============ */
.home-hero {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 5rem 2rem 2.5rem;
}
.hero-eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.hero-eyebrow::before {
  content: '';
  display: inline-block;
  width: 20px;
  height: 1px;
  background: var(--muted);
}
.home-hero h1 {
  font-family: var(--mono);
  font-size: clamp(1.9rem, 5vw, 2.6rem);
  font-weight: 500;
  line-height: 1.15;
  color: var(--ink);
  margin-bottom: 1.25rem;
  letter-spacing: -.02em;
}
.home-hero h1 .prompt-prefix { color: var(--accent); font-weight: 400; }
.type-cursor {
  display: inline-block;
  width: 0.6ch;
  margin-left: 1px;
  color: var(--accent);
  animation: blink 1s steps(1) infinite;
}
.home-hero p {
  font-size: 16px;
  color: #4a4f65;
  max-width: 560px;
  line-height: 1.75;
  margin-bottom: 2rem;
}
.hero-links { display: flex; gap: 12px; flex-wrap: wrap; }

.btn-primary, .btn-secondary {
  font-family: var(--mono);
  font-size: 13px;
  padding: 10px 20px;
  border-radius: 6px;
  text-decoration: none;
  cursor: pointer;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-primary { background: var(--accent); color: #fff; border: 1px solid var(--accent); }
.btn-primary:hover { transform: translateY(-2px); background: var(--accent-dim); box-shadow: 0 12px 24px -12px rgba(84,106,193,.75); }
.btn-secondary { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn-secondary:hover { transform: translateY(-2px); background: var(--tag-bg); }
.btn-primary .arrow { transition: transform .2s var(--ease); }
.btn-primary:hover .arrow { transform: translateX(4px); }

/* ============ SECTION ============ */
.section {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 2rem 3.5rem;
}
.section-label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted);
  margin-bottom: 1.5rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-label::before { content: '//'; color: var(--accent); }

/* ============ PROJECT CARDS ============ */
.project-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.project-card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 1.35rem;
  text-decoration: none;
  color: inherit;
  display: block;
  height: 100%;
  transition: border-color .25s var(--ease), box-shadow .25s var(--ease), transform .25s var(--ease);
  cursor: pointer;
}
.project-card:hover {
  border-color: var(--accent);
  box-shadow: 0 18px 40px -24px rgba(84,106,193,.55), 0 0 0 3px #546ac114;
  transform: translateY(-4px);
}
.card-link { text-decoration: none; display: block; }
.card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: .85rem; }
.card-status {
  font-family: var(--mono);
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 4px;
  font-weight: 500;
  letter-spacing: .04em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.card-status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-active { background: #e8f5ec; color: #2a7d3e; }
.status-active::before { animation: pulse 1.8s infinite; }
.status-planned { background: #fef4e4; color: #8a5e0a; }
.card-title {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: .5rem;
  line-height: 1.4;
}
.card-desc { font-size: 13px; color: var(--muted); line-height: 1.65; margin-bottom: 1.1rem; }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--tag-bg);
  color: var(--tag-text);
  padding: 3px 9px;
  border-radius: 4px;
  line-height: 1.5;
}

/* ============ POST LIST ============ */
.post-list { display: flex; flex-direction: column; }
.post-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem .5rem;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  border-radius: 6px;
  transition: background .2s var(--ease), padding-left .2s var(--ease);
}
.post-item:first-child { border-top: 1px solid var(--rule); }
.post-item:hover { background: var(--card); padding-left: 1rem; }
.post-item:hover .post-title { color: var(--accent); }
.post-item:hover .post-title::before { opacity: 1; transform: translateX(0); }
.post-item-left { flex: 1; }
.post-title {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 6px;
  transition: color .2s var(--ease);
  position: relative;
}
.post-title::before {
  content: '$';
  color: var(--accent);
  opacity: 0;
  margin-left: -1.9ch;
  padding-right: 0.9ch;
  transform: translateX(-4px);
  display: inline-block;
  transition: opacity .2s var(--ease), transform .2s var(--ease);
}
.post-meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.post-date { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }

/* ============ ABOUT STRIP ============ */
.about-strip {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 2rem 2.25rem;
  display: flex;
  align-items: center;
  gap: 2rem;
}
.about-avatar {
  width: 156px; height: 156px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  object-fit: cover;
  flex-shrink: 0;
  padding: 3px;
  background: var(--card);
}
.about-text h3 { font-family: var(--mono); font-size: 18px; font-weight: 500; margin-bottom: 8px; }
.about-text p { font-size: 16px; color: var(--muted); line-height: 1.6; }
.about-links { margin-left: auto; display: flex; flex-direction: column; gap: 10px; flex-shrink: 0; }
.about-link {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  border: 1px solid var(--accent);
  padding: 7px 16px;
  border-radius: 6px;
  text-align: center;
  transition: background .2s var(--ease), color .2s var(--ease), transform .2s var(--ease);
}
.about-link:hover { background: var(--accent); color: #fff; transform: translateX(3px); }

/* ============ POST PAGE ============ */
.post-header {
  max-width: 680px;
  margin: 0 auto;
  padding: 4.5rem 2rem 1.5rem;
}
.post-eyebrow {
  font-family: var(--mono); font-size: 12px; color: var(--muted);
  margin-bottom: 1rem; display: flex; gap: 16px; align-items: center;
}
.back-link {
  font-family: var(--mono); font-size: 12px; color: var(--accent);
  text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
  margin-bottom: 1.5rem; transition: gap .2s var(--ease);
}
.back-link:hover { gap: 10px; }
.post-header h1 {
  font-family: var(--mono);
  font-size: clamp(1.6rem, 4.5vw, 2.1rem);
  font-weight: 500;
  line-height: 1.25;
  color: var(--ink);
  margin-bottom: 1rem;
  letter-spacing: -.02em;
}
.post-summary {
  font-size: 16px;
  color: #4a4f65;
  line-height: 1.75;
  margin-bottom: 1.5rem;
  max-width: 580px;
}
.post-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 2rem; }
.post-divider { border: none; border-top: 1px solid var(--rule); max-width: 636px; margin: 0 auto; }

.post-body {
  max-width: 680px;
  margin: 0 auto;
  padding: 2.5rem 2rem;
}
.post-body h2 {
  font-family: var(--mono); font-size: 1.15rem; font-weight: 500;
  color: var(--ink); margin: 2.5rem 0 .85rem; letter-spacing: -.01em;
}
.post-body h2::before { content: '# '; color: var(--accent); }
.post-body h3 { font-family: var(--mono); font-size: 1rem; font-weight: 500; margin: 1.75rem 0 .6rem; }
.post-body p { color: #3a3f55; font-size: 15.5px; line-height: 1.85; margin-bottom: 1.3rem; }
.post-body ul, .post-body ol { margin: 0 0 1.3rem 1.25rem; color: #3a3f55; line-height: 1.85; }
.post-body li { margin-bottom: .4rem; }
.post-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.post-body strong { color: var(--ink); }
.post-body code {
  font-family: var(--mono); font-size: .86em;
  background: var(--tag-bg); color: var(--accent-dim);
  padding: 2px 6px; border-radius: 4px;
}
.post-body pre {
  background: #0b0c11;
  color: #c8d0f0;
  font-family: var(--mono);
  font-size: 12.5px;
  padding: 1.35rem 1.5rem;
  border-radius: 10px;
  margin: 1.6rem 0;
  overflow-x: auto;
  line-height: 1.75;
  border: 1px solid #1c1e29;
  box-shadow: 0 20px 40px -28px rgba(14,15,20,.6);
}
.post-body pre code { background: none; color: inherit; padding: 0; font-size: inherit; }
.post-body blockquote {
  background: var(--tag-bg);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: 1rem 1.25rem;
  margin: 1.6rem 0;
  font-size: 14px;
  color: #3d4f99;
  line-height: 1.7;
}
.post-body blockquote p { color: #3d4f99; margin: 0; }
.post-body img { border-radius: 10px; margin: 1.6rem 0; border: 1px solid var(--rule); }

.post-nav {
  max-width: 680px;
  margin: 0 auto;
  padding: 1.75rem 2rem 4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--rule);
}
.post-nav a {
  font-family: var(--mono); font-size: 12px; color: var(--accent);
  text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
  transition: gap .2s var(--ease);
}
.post-nav a:hover { gap: 10px; }
.post-nav .disabled { color: var(--muted); pointer-events: none; opacity: .5; }

/* ============ FOOTER ============ */
footer {
  border-top: 1px solid var(--rule);
  margin-top: 2rem;
}
.footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
footer p { font-family: var(--mono); font-size: 12px; color: var(--muted); }
footer .footer-links { display: flex; gap: 1.25rem; }
footer .footer-links a {
  font-family: var(--mono); font-size: 12px; color: var(--muted);
  text-decoration: none; transition: color .2s var(--ease);
}
footer .footer-links a:hover { color: var(--accent); }

/* ============ SCROLL REVEAL ============ */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .7s var(--ease), transform .7s var(--ease);
  will-change: opacity, transform;
}
.reveal.in-view { opacity: 1; transform: none; }
.reveal[data-reveal="left"]  { transform: translateX(-28px); }
.reveal[data-reveal="right"] { transform: translateX(28px); }
.reveal[data-reveal="scale"] { transform: scale(.96); }

/* ============ ANIMATIONS ============ */
@keyframes blink { 0%,50% { opacity: 1; } 50.01%,100% { opacity: 0; } }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 currentColor; opacity: 1; }
  70% { box-shadow: 0 0 0 5px transparent; opacity: .6; }
  100% { box-shadow: 0 0 0 0 transparent; opacity: 1; }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: none; }
}
.hero-animate { animation: fadeUp .8s var(--ease) both; }

/* ============ RESPONSIVE ============ */
@media (max-width: 680px) {
  nav { padding: 0 1.25rem; }
  .nav-links { gap: 1rem; }
  .nav-links a:not(.nav-badge) { display: none; }
  .home-hero { padding: 3.5rem 1.5rem 2rem; }
  .section { padding: 0 1.5rem 2.5rem; }
  .project-grid { grid-template-columns: 1fr; }
  .about-strip { flex-direction: column; text-align: center; }
  .about-links { margin-left: 0; flex-direction: row; }
  .post-header, .post-body, .post-nav { padding-left: 1.5rem; padding-right: 1.5rem; }
}

/* ============ REDUCED MOTION ============ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .reveal { opacity: 1 !important; transform: none !important; }
}
