/* ============================================
   chb.sh — stylesheet
   ============================================ */

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

/* --- Reset & base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg:        #0d0d0d;
  --bg-card:   #111111;
  --bg-hover:  #161616;
  --border:    #222222;
  --green:     #00e676;
  --green-dim: #00a152;
  --text:      #c8c8c8;
  --text-dim:  #555555;
  --text-mute: #333333;
  --mono:      'JetBrains Mono', 'Courier New', monospace;
  --sans:      -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.7;
  min-height: 100vh;

  /* dot-matrix background */
  background-image: radial-gradient(var(--text-mute) 1px, transparent 1px);
  background-size: 28px 28px;
  background-attachment: fixed;
}

a {
  color: var(--green);
  text-decoration: none;
  transition: color 0.2s;
}
a:hover {
  color: #fff;
}

/* --- Typography --- */
h1, h2, h3 {
  font-family: var(--mono);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.mono {
  font-family: var(--mono);
}

/* --- Layout --- */
.container {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

section {
  padding: 5rem 0;
  border-bottom: 1px solid var(--border);
}
section:last-of-type {
  border-bottom: none;
}

/* --- Nav --- */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(13, 13, 13, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

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

.nav-logo {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--green);
  text-decoration: none;
}
.nav-logo:hover {
  color: var(--green);
}
.nav-logo span {
  color: var(--text-dim);
}

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

.nav-links a {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  transition: color 0.2s;
}
.nav-links a:hover {
  color: var(--green);
}

/* --- Section header / prompt --- */
.prompt {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}
.prompt::before {
  content: '$ ';
  color: var(--green);
}

.section-title {
  font-size: 1.6rem;
  color: #fff;
  margin-bottom: 2rem;
}

/* --- Hero --- */
#hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: 56px;
  border-bottom: 1px solid var(--border);
}

.terminal-window {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  width: 100%;
}

.terminal-bar {
  background: #1a1a1a;
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  border-bottom: 1px solid var(--border);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.dot-red   { background: #ff5f57; }
.dot-yellow { background: #ffbd2e; }
.dot-green  { background: #28c840; }

.terminal-title {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-left: 0.5rem;
}

.terminal-body {
  padding: 2rem;
}

.terminal-line {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 0.3rem;
}
.terminal-line .path   { color: var(--green); }
.terminal-line .cmd    { color: #fff; }

.hero-name {
  font-family: var(--mono);
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: 700;
  color: #fff;
  margin: 1.5rem 0 0.5rem;
  line-height: 1.1;
}

.hero-tagline {
  font-family: var(--mono);
  font-size: 1.1rem;
  color: var(--green);
  margin-bottom: 1.5rem;
  min-height: 1.5em;
}

.cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--green);
  vertical-align: text-bottom;
  animation: blink 1s step-end infinite;
}

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

.hero-links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.btn {
  font-family: var(--mono);
  font-size: 0.8rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--green);
  color: var(--green);
  background: transparent;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  display: inline-block;
}
.btn:hover {
  background: var(--green);
  color: #000;
}

/* --- About --- */
#about p {
  max-width: 620px;
  margin-bottom: 1rem;
  color: var(--text);
  line-height: 1.8;
}

#about a {
  font-family: var(--mono);
  color: var(--green);
  font-weight: 700;
}
#about a:hover {
  color: #fff;
}

/* --- Contact layout --- */
.contact-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
}

.about-photo-frame {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 0 0 1px var(--border), 0 0 28px rgba(0, 230, 118, 0.1);
  transition: box-shadow 0.4s ease;
}

.about-photo-frame:hover {
  box-shadow: 0 0 0 1px var(--green-dim), 0 0 36px rgba(0, 230, 118, 0.2);
}

.about-photo {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: center center;
  display: block;
  opacity: 0.75;
  transition: opacity 0.4s ease;
}

.about-photo-frame:hover .about-photo {
  opacity: 1;
}

@media (max-width: 640px) {
  .contact-layout {
    grid-template-columns: 1fr;
  }
  .contact-layout .about-photo-frame {
    max-width: 160px;
  }
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.tag {
  font-family: var(--mono);
  font-size: 0.75rem;
  padding: 0.25rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-dim);
}

/* --- Projects --- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

@media (max-width: 540px) {
  .projects-grid {
    grid-template-columns: 1fr;
  }
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.5rem;
  transition: border-color 0.2s, background 0.2s;
  display: flex;
  flex-direction: column;
}
.project-card:hover {
  border-color: var(--green-dim);
  background: var(--bg-hover);
}

.project-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.project-logo {
  height: 22px;
  width: auto;
  max-width: 80px;
  object-fit: contain;
  flex-shrink: 0;
  opacity: 0.85;
}

.project-logo.invert {
  filter: brightness(0) invert(1);
}

.project-name {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0;
}

.project-desc {
  font-size: 0.875rem;
  color: var(--text-dim);
  line-height: 1.6;
  margin-bottom: 1rem;
  flex: 1;
}

.project-link {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--green);
}
.project-link::after {
  content: ' →';
}

/* --- Blog --- */
.blog-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.blog-item {
  display: flex;
  align-items: baseline;
  gap: 1.5rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}
.blog-item:first-child {
  border-top: 1px solid var(--border);
}

.blog-date {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  white-space: nowrap;
  min-width: 90px;
}

.blog-title {
  font-size: 0.95rem;
  color: var(--text);
  transition: color 0.2s;
}
.blog-item a:hover .blog-title {
  color: var(--green);
}

.blog-more {
  display: inline-block;
  margin-top: 1.5rem;
  font-family: var(--mono);
  font-size: 0.8rem;
}

/* --- Contact --- */
.contact-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.contact-list li {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-family: var(--mono);
  font-size: 0.875rem;
}

.contact-key {
  color: var(--text-dim);
  min-width: 80px;
}

.contact-val {
  color: var(--text);
}

/* --- Footer --- */
footer {
  text-align: center;
  padding: 2rem 0;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-mute);
}

/* --- Blog pages --- */
.blog-header {
  padding-top: calc(56px + 3rem);
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 3rem;
}

.blog-back {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  display: inline-block;
  margin-bottom: 1.5rem;
}
.blog-back::before { content: '← '; }
.blog-back:hover { color: var(--green); }

.post-title {
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  color: #fff;
  margin-bottom: 0.5rem;
}

.post-meta {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-dim);
}

.post-body {
  max-width: 660px;
  margin: 0 auto;
  padding-bottom: 5rem;
}

.post-body p  { margin-bottom: 1.4rem; line-height: 1.85; }
.post-body h2 { font-size: 1.3rem; color: #fff; margin: 2.5rem 0 1rem; }
.post-body h3 { font-size: 1.05rem; color: var(--text); margin: 2rem 0 0.75rem; }
.post-body ul, .post-body ol { padding-left: 1.5rem; margin-bottom: 1.4rem; }
.post-body li { margin-bottom: 0.4rem; }
.post-body code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 0.1em 0.4em;
  border-radius: 3px;
  color: var(--green);
}
.post-body pre {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.25rem;
  overflow-x: auto;
  margin-bottom: 1.4rem;
}
.post-body pre code {
  background: none;
  border: none;
  padding: 0;
}
.post-body blockquote {
  border-left: 2px solid var(--green-dim);
  padding-left: 1.25rem;
  color: var(--text-dim);
  margin-bottom: 1.4rem;
}
.post-body a { color: var(--green); }
.post-body a:hover { color: #fff; }

/* Blog index listing */
.blog-index-list {
  list-style: none;
}
.blog-index-item {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
}
.blog-index-item:first-child { border-top: 1px solid var(--border); }
.blog-index-title {
  font-size: 1.05rem;
  color: #fff;
  display: block;
  margin-bottom: 0.25rem;
  transition: color 0.2s;
}
.blog-index-item a:hover .blog-index-title { color: var(--green); }
.blog-index-excerpt {
  font-size: 0.875rem;
  color: var(--text-dim);
}

/* --- Responsive --- */
@media (max-width: 600px) {
  .nav-links { display: none; }
  .terminal-body { padding: 1.25rem; }
  .hero-name { margin-top: 1rem; }
  .blog-item { flex-direction: column; gap: 0.2rem; }
  .blog-date { min-width: unset; }
}
