/* ============================================================
   north-echo.dev — terminal aesthetic, no frameworks, no bloat
   ============================================================ */

:root {
  --bg:          #0a0e14;
  --bg-elevated: #0f1319;
  --fg:          #c5cdd9;
  --fg-dim:      #6b7d8f;
  --fg-bright:   #e6edf3;
  --accent:      #39d353;
  --accent-dim:  #1a7f2b;
  --link:        #58a6ff;
  --border:      #1c2333;
  --tag-bg:      #151b27;
  --tag-border:  #253040;
  --code-bg:     #0d1117;
  --font-mono:   "Berkeley Mono", "JetBrains Mono", "Fira Code", "SF Mono", monospace;
  --font-body:   "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --max-width:   720px;
}

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

html {
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

/* ---- Header ---- */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 1.25rem 0;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-logo {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.cursor {
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.site-nav a {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--fg-dim);
  text-decoration: none;
  margin-left: 1.5rem;
  text-transform: lowercase;
  letter-spacing: 0.02em;
  transition: color 0.15s;
}

.site-nav a:hover,
.site-nav a.active {
  color: var(--fg-bright);
}

/* ---- Hero ---- */
.hero {
  padding: 4rem 0 3rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 3rem;
}

.hero h1 {
  font-family: var(--font-mono);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--fg-bright);
  line-height: 1.3;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}

.hero-sub {
  color: var(--fg-dim);
  font-size: 1rem;
  max-width: 580px;
  line-height: 1.65;
}

/* ---- Post list ---- */
.recent-posts,
.post-list {
  margin-bottom: 3rem;
}

.recent-posts h2,
.post-list h1,
.projects-preview h2 {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 1.5rem;
}

.post-preview {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 0 1.5rem;
}

.post-preview time {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--fg-dim);
  padding-top: 0.15rem;
}

.post-preview h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.post-preview h3 a {
  color: var(--fg-bright);
  text-decoration: none;
  transition: color 0.15s;
}

.post-preview h3 a:hover {
  color: var(--accent);
}

.post-preview p {
  color: var(--fg-dim);
  font-size: 0.9rem;
  grid-column: 2;
}

.post-preview .tags {
  grid-column: 2;
  margin-top: 0.4rem;
}

/* ---- Tags ---- */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--fg-dim);
  background: var(--tag-bg);
  border: 1px solid var(--tag-border);
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
}

/* ---- Projects grid ---- */
.projects-preview {
  padding: 3rem 0;
  border-top: 1px solid var(--border);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.project-card {
  display: block;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}

.project-card:hover {
  border-color: var(--accent-dim);
  background: var(--bg-elevated);
}

.project-card h3 {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--accent);
  margin-bottom: 0.4rem;
}

.project-card p {
  color: var(--fg-dim);
  font-size: 0.85rem;
  line-height: 1.5;
}

/* ---- Single post ---- */
.post {
  padding: 3rem 0;
}

.post-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.post-header h1 {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--fg-bright);
  line-height: 1.3;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.post-meta time,
.reading-time {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--fg-dim);
}

/* ---- Post content ---- */
.post-content h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--fg-bright);
  margin: 2.5rem 0 1rem;
  letter-spacing: -0.01em;
}

.post-content h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--fg-bright);
  margin: 2rem 0 0.75rem;
}

.post-content p {
  margin-bottom: 1.25rem;
}

.post-content a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: rgba(88, 166, 255, 0.3);
  text-underline-offset: 2px;
  transition: text-decoration-color 0.15s;
}

.post-content a:hover {
  text-decoration-color: var(--link);
}

.post-content strong {
  color: var(--fg-bright);
  font-weight: 600;
}

.post-content ul, .post-content ol {
  margin: 0 0 1.25rem 1.25rem;
}

.post-content li {
  margin-bottom: 0.4rem;
}

.post-content blockquote {
  border-left: 3px solid var(--accent-dim);
  padding: 0.5rem 0 0.5rem 1.25rem;
  margin: 1.5rem 0;
  color: var(--fg-dim);
  font-style: italic;
}

.post-content code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--code-bg);
  padding: 0.15em 0.35em;
  border-radius: 3px;
  color: var(--fg-bright);
}

.post-content pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.25rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  font-size: 0.85rem;
  line-height: 1.55;
}

.post-content pre code {
  background: none;
  padding: 0;
  border-radius: 0;
}

/* Tables */
.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9rem;
}

.post-content th {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-dim);
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 2px solid var(--border);
}

.post-content td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.post-content tr:hover td {
  background: var(--bg-elevated);
}

/* Images */
.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  border: 1px solid var(--border);
  margin: 1.5rem 0;
}

/* Horizontal rule */
.post-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

/* ---- Post nav ---- */
.post-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.post-nav {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--fg-dim);
  text-decoration: none;
  transition: color 0.15s;
}

.post-nav:hover {
  color: var(--accent);
}

/* ---- Footer ---- */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: 2rem 0;
}

.footer-links {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}

.footer-links a {
  color: var(--fg-dim);
  text-decoration: none;
  transition: color 0.15s;
}

.footer-links a:hover {
  color: var(--fg-bright);
}

.footer-links .sep {
  color: var(--border);
  margin: 0 0.5rem;
}

.copyright {
  font-size: 0.75rem;
  color: var(--fg-dim);
}

.copyright a {
  color: var(--fg-dim);
  text-decoration: underline;
}

/* ---- Responsive ---- */
@media (max-width: 640px) {
  html { font-size: 16px; }

  .site-header .container {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .site-nav a {
    margin-left: 0;
    margin-right: 1.25rem;
  }

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

  .post-preview {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .post-preview p,
  .post-preview .tags {
    grid-column: 1;
  }

  .project-grid {
    grid-template-columns: 1fr;
  }
}
