/* ─── AgriTech Green Theme ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0a1410;
  --bg-alt:    #0f1a16;
  --border:    #1a2820;
  --text:      #e8e8e8;
  --text-dim:  #666666;
  --text-mid:  #999999;
  --accent:    #00d97f;
  --accent2:   #ffa500;
  --glow:      #00d97f80;
  --mono:      'Courier New', 'Courier', monospace;
  --radius:    0px;
  --max-w:     960px;
  --header-h:  56px;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  letter-spacing: 0.02em;
}

/* ─── Scanlines effect ────────────────────────────────────────────── */
.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  opacity: 0.03;
  background-image: repeating-linear-gradient(
    0deg,
    rgba(0,0,0,0.15),
                                              rgba(0,0,0,0.15) 1px,
                                              transparent 1px,
                                              transparent 2px
  );
  animation: scanlines 8s linear infinite;
}

@keyframes scanlines {
  0% { transform: translateY(0); }
  100% { transform: translateY(10px); }
}

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

main.container { flex: 1; }

/* ─── Header ──────────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--bg-alt);
  border-bottom: 1px solid var(--accent);
  box-shadow: 0 0 20px var(--glow);
}

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

.logo {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: normal;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.logo-dot { color: var(--accent2); }

nav { display: flex; gap: 24px; }

.nav-link {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  text-decoration: none;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: all 0.2s;
  border: 1px solid transparent;
  padding: 4px 8px;
}

.nav-link:hover,
.nav-link.active {
  color: var(--accent);
  border: 1px solid var(--accent);
  box-shadow: inset 0 0 10px var(--glow);
}

/* ─── Hero ────────────────────────────────────────────────────────── */
.hero {
  padding: 64px 0 48px;
  border-bottom: 1px solid var(--border);
}

.hero-label {
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--accent);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 16px;
  opacity: 0.8;
}

.hero-title {
  font-family: var(--mono);
  font-size: 1.8rem;
  font-weight: normal;
  line-height: 1.4;
  color: var(--text);
  letter-spacing: 0.02em;
}

.hero-title em {
  color: var(--accent);
  font-style: normal;
  opacity: 0.9;
}

/* ─── Home Layout (two-column) ────────────────────────────────────── */
.home-layout {
  display: grid;
  grid-template-columns: 1fr 160px;
  gap: 0 48px;
  align-items: start;
}

/* ─── Post List ───────────────────────────────────────────────────── */
.post-list {
  padding: 40px 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.post-item {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 0 24px;
  padding: 24px 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: all 0.15s;
  cursor: pointer;
}

.post-item:hover {
  border-bottom-color: var(--accent);
  box-shadow: inset 0 0 15px rgba(0, 217, 127, 0.05);
}

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

.post-date {
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--text-dim);
  padding-top: 2px;
  letter-spacing: 0.05em;
  white-space: nowrap;
  text-transform: uppercase;
}

.post-meta { display: flex; flex-direction: column; gap: 6px; }

.post-title {
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: normal;
  line-height: 1.4;
  color: var(--text);
  transition: color 0.2s;
  letter-spacing: 0.01em;
}

.post-excerpt {
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.5;
}

.post-tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent2);
  border: 1px solid var(--accent2);
  padding: 3px 6px;
  width: fit-content;
  margin-top: 4px;
}

/* ─── Tag Sidebar ─────────────────────────────────────────────────── */
.tag-sidebar {
  padding-top: 40px;
  position: sticky;
  top: calc(var(--header-h) + 24px);
}

.sidebar-label {
  font-family: var(--mono);
  font-size: 0.6rem;
  color: var(--text-dim);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.tag-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tag-btn {
  background: none;
  border: 1px solid transparent;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: left;
  padding: 5px 8px;
  cursor: pointer;
  transition: all 0.15s;
  width: 100%;
}

.tag-btn:hover {
  color: var(--accent);
  border-color: var(--border);
}

.tag-btn.active {
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: inset 0 0 8px var(--glow);
}

/* ─── Post Article ────────────────────────────────────────────────── */
.post-article { padding: 56px 0 64px; }

.post-article .post-header {
  margin-bottom: 44px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.post-article .post-header .post-date {
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--accent);
  letter-spacing: 0.1em;
  display: block;
  margin-bottom: 12px;
  text-transform: uppercase;
}

.post-article .post-header h1 {
  font-family: var(--mono);
  font-size: 1.6rem;
  font-weight: normal;
  line-height: 1.3;
  letter-spacing: 0.01em;
  margin-bottom: 12px;
}

.post-article .post-header .summary {
  font-size: 0.85rem;
  color: var(--text-mid);
  line-height: 1.6;
}

/* ─── Prose ───────────────────────────────────────────────────────── */
.prose {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text);
}

.prose h2 {
  font-family: var(--mono);
  font-size: 1.1rem;
  font-weight: normal;
  color: var(--accent);
  margin: 2em 0 0.8em;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.prose h3 {
  font-family: var(--mono);
  font-weight: normal;
  margin: 1.8em 0 0.6em;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.prose p { margin: 0 0 1.2em; }

.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 2px;
  transition: all 0.2s;
}

.prose a:hover {
  color: var(--accent2);
  text-decoration-color: var(--accent2);
  text-shadow: 0 0 10px var(--glow);
}

.prose code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--bg-alt);
  border: 1px solid var(--accent);
  padding: 2px 6px;
  color: var(--accent2);
}

.prose pre {
  background: var(--bg-alt);
  border: 1px solid var(--accent);
  padding: 16px 20px;
  overflow-x: auto;
  margin: 1.4em 0;
  box-shadow: inset 0 0 15px rgba(0, 217, 127, 0.05);
}

.prose pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.6;
}

.prose blockquote {
  border-left: 2px solid var(--accent);
  margin: 1.6em 0;
  padding: 0 0 0 16px;
  color: var(--text-mid);
  font-style: normal;
  letter-spacing: 0.01em;
}

.prose ul, .prose ol { margin: 0 0 1.2em 1.5em; }
.prose li { margin-bottom: 0.4em; }

.prose hr {
  border: none;
  border-top: 1px solid var(--accent);
  margin: 2em 0;
  opacity: 0.3;
}

.prose strong { color: var(--accent); font-weight: normal; }

/* ─── About Page ──────────────────────────────────────────────────── */
.about-page { padding: 64px 0; }

.about-title {
  font-family: var(--mono);
  font-size: 1.4rem;
  font-weight: normal;
  margin-bottom: 40px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.about-body {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-mid);
  max-width: 560px;
}

.about-body p { margin-bottom: 1.2em; }

.about-body h2 {
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: normal;
  color: var(--accent);
  margin: 2em 0 0.8em;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.about-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.about-body a:hover {
  color: var(--accent2);
  text-shadow: 0 0 10px var(--glow);
}

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

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

.site-footer span,
.footer-links a {
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--text-dim);
  text-decoration: none;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.footer-links { display: flex; gap: 16px; }
.footer-links a:hover { color: var(--accent); }

/* ─── Back link ───────────────────────────────────────────────────── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  text-decoration: none;
  margin-bottom: 40px;
  transition: all 0.2s;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.back-link:hover {
  color: var(--accent);
  text-shadow: 0 0 10px var(--glow);
}

/* ─── Scrollbar & Selection ──────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 0; }
::-webkit-scrollbar-thumb:hover { background: var(--accent2); }
::selection { background: var(--accent); color: var(--bg); }

/* ─── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .home-layout {
    grid-template-columns: 1fr;
  }

  .tag-sidebar {
    position: static;
    padding-top: 0;
    padding-bottom: 32px;
    border-top: 1px solid var(--border);
    order: -1; /* show tags above posts on mobile */
  }

  .tag-list {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }

  .tag-btn {
    width: auto;
  }

  .post-item { grid-template-columns: 1fr; gap: 6px; }
  .post-date { padding-top: 0; }
  .site-footer .container { flex-direction: column; gap: 10px; text-align: center; }
  .hero-title { font-size: 1.3rem; }
}

/* ─── Images in prose ─────────────────────────────────────────────── */
.prose img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--accent);
  margin: 1.8em auto;
  opacity: 0.9;
  transition: opacity 0.2s;
}

.prose img:hover {
  opacity: 1;
  box-shadow: 0 0 20px var(--glow);
}

.prose figure {
  margin: 1.8em 0;
  text-align: center;
}

.prose figure img {
  margin: 0 auto 0.6em;
}

.prose figcaption {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
