/* ============================================
   Terminal Theme — style.css
   Dark terminal aesthetic for Hugo blog
   ============================================ */

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

:root {
  --bg: #0C0C0C;
  --surface: #171717;
  --border: #1F1F1F;
  --green: #22C55E;
  --amber: #F59E0B;
  --text-primary: #E5E5E5;
  --text-secondary: #A3A3A3;
  --text-tertiary: #737373;
  --text-muted: #525252;
  --font: 'JetBrains Mono', monospace;
  --max-width: 1440px;
  --side-padding: 120px;
  --content-padding: 320px;
}

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

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

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  color: var(--green);
}

img {
  max-width: 100%;
  height: auto;
}

/* --- Layout Shell --- */
.site-wrapper {
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.site-main {
  flex: 1;
}

/* --- Divider --- */
.divider {
  width: 100%;
  height: 1px;
  background: var(--border);
}

/* --- Header --- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px var(--side-padding);
  border-bottom: 1px solid var(--border);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-logo .prompt {
  color: var(--green);
  font-size: 18px;
  font-weight: 600;
}

.header-logo .site-name {
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 500;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 32px;
}

.header-nav a {
  color: var(--text-secondary);
  font-size: 13px;
}

.header-nav a:hover {
  color: var(--text-primary);
}

.header-nav .nav-icon {
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
}

.header-nav .nav-icon:hover {
  color: var(--text-secondary);
}

.header-nav .nav-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --- Hero Section --- */
.hero {
  padding: 80px var(--side-padding);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.hero-label {
  color: var(--text-tertiary);
  font-size: 13px;
}

.hero-name {
  color: var(--text-primary);
  font-size: 48px;
  font-weight: 600;
  line-height: 1.2;
}

.hero-bio {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.7;
  max-width: 800px;
}

.hero-links {
  display: flex;
  align-items: center;
  gap: 16px;
}

.hero-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--surface);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
}

.hero-link svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hero-link--primary {
  color: var(--text-primary);
}

.hero-link--primary svg {
  color: var(--green);
}

.hero-link--secondary {
  color: var(--text-secondary);
  font-weight: 400;
}

.hero-link--secondary svg {
  color: var(--text-tertiary);
}

.hero-link:hover {
  color: var(--green);
}

/* --- Posts Section (Homepage) --- */
.posts-section {
  padding: 48px var(--side-padding);
  display: flex;
  flex-direction: column;
  gap: 32px;
}

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

.section-title {
  color: var(--green);
  font-size: 18px;
  font-weight: 600;
}

.section-link {
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 500;
}

.section-link:hover {
  color: var(--green);
}

.posts-list {
  display: flex;
  flex-direction: column;
}

.post-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
  gap: 24px;
}

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

.post-item-title {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  transition: color 0.15s;
}

.post-item-date {
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
}

/* --- Products Section --- */
.products-section {
  padding: 48px var(--side-padding);
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
}

.product-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px;
  background: var(--surface);
  border-radius: 4px;
}

.product-icon svg {
  width: 20px;
  height: 20px;
  stroke: var(--green);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.product-name {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
}

.product-desc {
  color: var(--text-tertiary);
  font-size: 12px;
  line-height: 1.6;
}

.product-tag {
  font-size: 11px;
  font-family: var(--font);
}

.product-tag--active {
  color: var(--green);
}

.product-tag--acquired {
  color: var(--amber);
}

.product-link {
  color: var(--green);
  font-size: 11px;
  font-weight: 500;
}

.product-link:hover {
  text-decoration: underline;
}

/* --- Footer --- */
.site-footer {
  padding: 48px var(--side-padding);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

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

.footer-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.footer-logo .prompt {
  color: var(--green);
  font-size: 16px;
  font-weight: 600;
}

.footer-logo .site-name {
  color: var(--text-tertiary);
  font-size: 13px;
  font-weight: 500;
}

.footer-social {
  display: flex;
  align-items: center;
  gap: 24px;
}

.footer-social a {
  color: var(--text-muted);
  font-size: 12px;
}

.footer-social a:hover {
  color: var(--text-secondary);
}

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

.footer-copy {
  color: var(--text-muted);
  font-size: 11px;
}

.footer-rss {
  color: var(--green);
  font-size: 11px;
  font-weight: 500;
}

.footer-rss:hover {
  text-decoration: underline;
}

/* --- Breadcrumbs --- */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.breadcrumbs a {
  color: var(--text-tertiary);
}

.breadcrumbs a:first-child {
  color: var(--green);
  font-weight: 500;
}

.breadcrumbs a:hover {
  color: var(--green);
}

.breadcrumbs .sep {
  color: var(--text-muted);
}

.breadcrumbs .current {
  color: var(--text-secondary);
}

/* --- Post Header (Single) --- */
.post-header {
  padding: 48px var(--content-padding) 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.post-title {
  color: var(--text-primary);
  font-size: 36px;
  font-weight: 600;
  line-height: 1.3;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--text-muted);
  font-size: 12px;
}

/* --- Article Body --- */
.article-body {
  padding: 40px var(--content-padding);
  display: flex;
  flex-direction: column;
  gap: 32px;
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-secondary);
}

.article-body p {
  line-height: 1.8;
}

.article-body strong {
  color: var(--text-primary);
  font-weight: 500;
}

.article-body em {
  font-style: italic;
}

.article-body h2 {
  color: var(--green);
  font-size: 20px;
  font-weight: 600;
  margin-top: 16px;
}

.article-body h3 {
  color: var(--green);
  font-size: 20px;
  font-weight: 600;
  margin-top: 16px;
}

.article-body h4 {
  color: var(--green);
  font-size: 16px;
  font-weight: 600;
  margin-top: 8px;
}

.article-body ul,
.article-body ol {
  padding-left: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.article-body li {
  line-height: 1.8;
}

.article-body li::marker {
  color: var(--text-muted);
}

.article-body a {
  color: var(--green);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.article-body a:hover {
  color: var(--text-primary);
}

.article-body blockquote {
  background: var(--surface);
  border-left: 3px solid var(--green);
  border-radius: 4px;
  padding: 16px 24px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.8;
}

.article-body blockquote p {
  margin: 0;
}

.article-body img {
  border-radius: 4px;
}

/* --- Code / Syntax Highlighting --- */
.article-body code {
  font-family: var(--font);
  font-size: 13px;
  background: var(--surface);
  padding: 2px 6px;
  border-radius: 3px;
  color: var(--green);
}

.article-body pre {
  background: var(--surface);
  border-radius: 4px;
  padding: 16px 24px;
  overflow-x: auto;
  border: 1px solid var(--border);
}

.article-body pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.7;
}

/* Hugo Chroma syntax highlighting classes */
.highlight pre {
  background: var(--surface);
  border-radius: 4px;
  padding: 16px 24px;
  overflow-x: auto;
  border: 1px solid var(--border);
}

.highlight .chroma {
  background: var(--surface);
  color: var(--text-secondary);
}

/* Keywords */
.chroma .k,
.chroma .kc,
.chroma .kd,
.chroma .kn,
.chroma .kp,
.chroma .kr { color: #C084FC; font-weight: 500; }

/* Keyword type */
.chroma .kt { color: #22D3EE; }

/* Strings */
.chroma .s,
.chroma .sa,
.chroma .sb,
.chroma .sc,
.chroma .dl,
.chroma .sd,
.chroma .s2,
.chroma .se,
.chroma .sh,
.chroma .si,
.chroma .sx,
.chroma .sr,
.chroma .s1,
.chroma .ss { color: var(--green); }

/* Numbers */
.chroma .m,
.chroma .mb,
.chroma .mf,
.chroma .mh,
.chroma .mi,
.chroma .il,
.chroma .mo { color: var(--amber); }

/* Comments */
.chroma .c,
.chroma .ch,
.chroma .cm,
.chroma .c1,
.chroma .cs,
.chroma .cp,
.chroma .cpf { color: var(--text-muted); font-style: italic; }

/* Names / functions */
.chroma .na,
.chroma .nb,
.chroma .nc,
.chroma .no,
.chroma .nd,
.chroma .ni,
.chroma .ne,
.chroma .nf,
.chroma .nl,
.chroma .nn,
.chroma .nt,
.chroma .nv { color: #60A5FA; }

/* Operators */
.chroma .o,
.chroma .ow,
.chroma .p { color: var(--text-tertiary); }

/* Generic */
.chroma .gd { color: #F87171; }
.chroma .gi { color: var(--green); }
.chroma .ge { font-style: italic; }
.chroma .gs { font-weight: bold; }

/* --- Post Navigation --- */
.post-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 32px var(--content-padding);
}

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

.post-nav-label {
  color: var(--text-muted);
  font-size: 11px;
}

.post-nav-title {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
}

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

.post-nav-item--next {
  text-align: right;
}

.post-nav-none {
  color: var(--text-tertiary);
  font-size: 13px;
}

/* --- List Page --- */
.list-header {
  padding: 48px var(--side-padding) 32px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.list-title {
  color: var(--green);
  font-size: 24px;
  font-weight: 600;
}

.list-count {
  color: var(--text-muted);
  font-size: 12px;
}

.list-body {
  padding: 0 var(--side-padding) 48px;
}

/* --- 404 Page --- */
.page-404 {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 120px var(--side-padding);
  gap: 16px;
  text-align: center;
}

.page-404-code {
  color: var(--green);
  font-size: 72px;
  font-weight: 600;
}

.page-404-msg {
  color: var(--text-secondary);
  font-size: 16px;
}

.page-404-link {
  color: var(--green);
  font-size: 13px;
  font-weight: 500;
  margin-top: 16px;
}

.page-404-link:hover {
  text-decoration: underline;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  :root {
    --side-padding: 48px;
    --content-padding: 48px;
  }

  .products-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  :root {
    --side-padding: 24px;
    --content-padding: 24px;
  }

  .hero-name {
    font-size: 32px;
  }

  .hero-bio {
    font-size: 14px;
  }

  .post-title {
    font-size: 28px;
  }

  .products-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .post-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .post-nav {
    flex-direction: column;
    gap: 24px;
    align-items: flex-start;
  }

  .post-nav-item--next {
    text-align: left;
  }

  .site-header {
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
  }

  .footer-top {
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }
}

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

  .hero-links {
    flex-direction: column;
    align-items: flex-start;
  }
}
