@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=JetBrains+Mono:wght@300;400;500&family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&display=swap');

/* ─── Variables ─────────────────────────────────── */
:root {
  --bg:        #0a0a0c;
  --bg-subtle: #111115;
  --surface:   #16161c;
  --border:    #222230;
  --muted:     #3a3a50;
  --dim:       #6b6b8a;
  --text:      #c8c8d8;
  --bright:    #eeeef5;
  --accent:    #e8855a;
  --accent-lt: #f0a882;
  --amber:     #c9a84c;

  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body:    'Libre Baskerville', Georgia, serif;
  --font-mono:    'JetBrains Mono', monospace;

  --max-w: 740px;
  --gap:   clamp(1.5rem, 5vw, 3rem);
}

/* ─── Reset ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: clamp(0.95rem, 1.5vw, 1.05rem);
  line-height: 1.8;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
  opacity: 0.4;
}

/* ─── Layout ─────────────────────────────────────── */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gap);
}

/* ─── Header ─────────────────────────────────────── */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 2rem 0;
  position: sticky;
  top: 0;
  background: rgba(10, 10, 12, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 100;
}

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

.site-title {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--bright);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.site-title::before {
  content: '>';
  color: var(--accent);
  animation: blink 1.2s step-end infinite;
}

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

.site-nav {
  display: flex;
  gap: 1.5rem;
}

.site-nav a {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
  text-decoration: none;
  transition: color 0.2s;
}

.site-nav a:hover { color: var(--accent-lt); }

/* ─── Hero ───────────────────────────────────────── */
.hero {
  padding: clamp(4rem, 10vw, 7rem) 0 clamp(3rem, 7vw, 5rem);
  border-bottom: 1px solid var(--border);
}

.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.25rem;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 7vw, 4.8rem);
  line-height: 1.05;
  color: var(--bright);
  margin-bottom: 1.5rem;
  letter-spacing: -0.02em;
}

.hero h1 em {
  font-style: italic;
  color: var(--accent-lt);
}

.hero-desc {
  font-size: 1rem;
  color: var(--dim);
  max-width: 500px;
  line-height: 1.7;
}

/* ─── Post List ──────────────────────────────────── */
.post-list {
  padding: clamp(3rem, 7vw, 5rem) 0;
}

.section-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.post-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 1rem 2rem;
  padding: 1.75rem 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  position: relative;
}

.post-item:first-of-type { border-top: 1px solid var(--border); }

.post-item::before {
  content: '';
  position: absolute;
  left: -2rem; right: -2rem;
  top: 0.35rem; bottom: 0.35rem;
  background: var(--bg-subtle);
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  z-index: -1;
}

.post-item:hover::before { opacity: 1; }

.post-item-title {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 2.5vw, 1.35rem);
  color: var(--bright);
  line-height: 1.3;
  margin-bottom: 0.4rem;
  transition: color 0.2s;
}

.post-item:hover .post-item-title { color: var(--accent-lt); }

.post-item-excerpt {
  font-size: 0.88rem;
  color: var(--dim);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-meta {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
  white-space: nowrap;
  padding-top: 0.3rem;
}

.post-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.63rem;
  letter-spacing: 0.04em;
  padding: 0.18em 0.55em;
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--dim);
  background: var(--surface);
}

/* ─── Post Page ──────────────────────────────────── */
.post-header {
  padding: clamp(3rem, 7vw, 5rem) 0 2.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 3rem;
}

.post-header .post-meta { margin-bottom: 1.5rem; }

.post-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.1;
  color: var(--bright);
  letter-spacing: -0.02em;
  margin-bottom: 1.25rem;
}

.post-subtitle {
  font-size: 1rem;
  color: var(--dim);
  font-style: italic;
}

/* ─── Post Content ───────────────────────────────── */
.post-content { padding-bottom: 5rem; }

.post-content h2,
.post-content h3,
.post-content h4 {
  font-family: var(--font-display);
  color: var(--bright);
  margin: 2.5rem 0 1rem;
  line-height: 1.2;
}

.post-content h2 { font-size: 1.75rem; }
.post-content h3 { font-size: 1.3rem; }
.post-content h4 { font-size: 1rem; font-style: italic; color: var(--dim); }

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

.post-content a {
  color: var(--accent-lt);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(232, 133, 90, 0.35);
  transition: color 0.2s, text-decoration-color 0.2s;
}

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

.post-content strong { color: var(--bright); font-weight: 700; }
.post-content em     { font-style: italic; }

.post-content ul, .post-content ol {
  margin: 0 0 1.5rem 1.25rem;
}
.post-content li { margin-bottom: 0.35rem; }

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

/* ─── Code ───────────────────────────────────────── */
code {
  font-family: var(--font-mono);
  font-size: 0.84em;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.1em 0.4em;
  color: var(--accent-lt);
}

pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.5rem;
  overflow-x: auto;
  margin: 2rem 0;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text);
  font-size: 0.875rem;
  line-height: 1.7;
}

.highlight .k,  .highlight .kd { color: var(--accent-lt); }
.highlight .s,  .highlight .s1, .highlight .s2 { color: #9ecf8a; }
.highlight .c,  .highlight .c1 { color: var(--muted); font-style: italic; }
.highlight .n,  .highlight .nf { color: #d4c5f9; }
.highlight .mi, .highlight .mf { color: var(--amber); }

/* ─── Images ─────────────────────────────────────── */
.post-content img {
  max-width: 100%;
  border-radius: 6px;
  border: 1px solid var(--border);
  margin: 2rem 0;
}

/* ─── Footer ─────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2.5rem 0;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.05em;
}

.site-footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-links { display: flex; gap: 1.5rem; }
.footer-links a { color: var(--muted); text-decoration: none; transition: color 0.2s; }
.footer-links a:hover { color: var(--accent-lt); }

/* ─── 404 ─────────────────────────────────────────── */
.error-page {
  text-align: center;
  padding: clamp(5rem, 15vw, 10rem) 0;
}

.error-page .code {
  font-family: var(--font-mono);
  font-size: 6rem;
  color: var(--border);
  line-height: 1;
  margin-bottom: 1rem;
}

.error-page h1 {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--bright);
  margin-bottom: 1rem;
}

/* ─── Animations ─────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.hero, .post-list, .post-header { animation: fadeUp 0.6s ease both; }

/* ─── Hamburger ───────────────────────────────────── */
.nav-toggle {
  display: none !important;
  flex-direction: column;
  justify-content: space-between;
  width: 28px;
  height: 18px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

.nav-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--dim);
  transition: background 0.2s;
}

.nav-toggle:hover span { background: var(--accent-lt); }

/* ─── Responsive ─────────────────────────────────── */
@media (max-width: 600px) {
  .post-item { grid-template-columns: 1fr; }
  .post-meta { padding-top: 0; }

  .nav-toggle { display: flex !important; flex-direction: column; }

  .site-nav {
    display: none !important;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: rgba(10, 10, 12, 0.97);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 0;
  }

  .site-nav.is-open { display: flex !important; }

  .site-nav a {
    padding: 0.75rem 1.5rem;
    font-size: 0.85rem;
  }
}
