/* NetlistStudio — dark theme overrides */
:root {
  --bg: #111317;
  --bg-surface: #1a1c20;
  --bg-card: #1e2024;
  --border: #2e3238;
  --text: #a8b4be;
  --text-bright: #e8ecef;   /* headings, logo trace color */
  --text-muted: #676767;    /* matches logo grid color */
  --accent: #e8a020;        /* amber-gold: warm, distinctive */
  --accent-dim: #a87010;
  --link: #e8a020;
  --link-hover: #f0b84a;
  --code-bg: #0d0f11;
}

/* ── Base ── */
body {
  background-color: var(--bg);
  color: var(--text);
  font-family: "JetBrains Mono", "Fira Code", "Cascadia Code", monospace, sans-serif;
}

/* Subtle grid overlay (evokes logo background) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(103,103,103,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(103,103,103,.04) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  z-index: 0;
}

main, header, footer, nav {
  position: relative;
  z-index: 1;
}

/* ── Pico overrides ── */
[data-theme="dark"] {
  --pico-background-color: var(--bg);
  --pico-card-background-color: var(--bg-card);
  --pico-card-border-color: var(--border);
  --pico-primary: var(--accent);
  --pico-primary-hover: var(--link-hover);
  --pico-color: var(--text);
  --pico-muted-color: var(--text-muted);
  --pico-border-color: var(--border);
  --pico-code-background-color: var(--code-bg);
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }

/* ── Nav ── */
nav {}

.nav-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
  padding-block: 1rem;
}

nav .site-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-bright);
  letter-spacing: .05em;
  display: flex;
  align-items: center;
  gap: .5rem;
}

nav .site-name img {
  width: 32px;
  height: 32px;
}

nav ul:first-of-type,
nav ul:last-of-type { margin: 0; }
nav ul { padding: 0; list-style: none; display: flex; gap: 1.5rem; }
nav ul li { padding: 0; margin: 0; }
nav ul li a { color: var(--text-muted); font-size: .9rem; letter-spacing: .04em; }
nav ul li a:hover { color: var(--accent); text-decoration: none; }

/* ── Main container ── */
.container { max-width: 900px; margin-inline: auto; padding-inline: 1.5rem; }
.container.wide { max-width: 1100px; }

/* ── Hero ── */
.hero {
  padding: 2rem 0 1.5rem;
  margin-bottom: 2rem;
}

.hero h1 {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: .5rem;
}

.hero p {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 520px;
  margin-bottom: 1.5rem;
}

.hero .accent { color: var(--accent); }

/* ── Section headings ── */
.section-title {
  font-size: .75rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.5rem;
  padding-bottom: .4rem;
  border-bottom: 1px solid var(--border);
}

/* ── Article cards ── */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-bottom: 3rem;
}

.article-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.25rem;
  transition: border-color .2s, transform .15s;
}

.article-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.article-card .card-date {
  font-size: .75rem;
  color: var(--text-muted);
  margin-bottom: .5rem;
  font-family: monospace;
}

.article-card h3 {
  font-size: 1rem;
  margin: 0 0 .6rem;
  line-height: 1.4;
}

.article-card h3 a { color: var(--text-bright); }
.article-card h3 a:hover { color: var(--accent); text-decoration: none; }

.card-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
  display: block;
  margin-bottom: .75rem;
}

.article-card .card-intro {
  font-size: .85rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

/* ── Article list (full page) ── */
.article-list { margin-bottom: 3rem; }

.article-row {
  display: flex;
  gap: 1rem;
  align-items: baseline;
  padding: .6rem 0;
  border-bottom: 1px solid var(--border);
}

.article-row .row-date {
  flex-shrink: 0;
  font-size: .8rem;
  color: var(--text-muted);
  font-family: monospace;
  width: 7rem;
}

.article-row a { color: var(--text); font-size: .95rem; }
.article-row a:hover { color: var(--accent); text-decoration: none; }
.article-row .tag a { font-size: inherit; }
.article-row .tag {
  font-size: .6rem;
  letter-spacing: 0;
  text-transform: none;
  padding: 2px 6px;
  border-radius: 50rem;
  background: var(--accent-dim);
  border-color: transparent;
  color: var(--bg);
  vertical-align: middle;
}

/* ── Tags ── */
.tags { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }

.tag {
  display: inline-flex;
  align-items: center;
  font-size: .7rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  border-radius: 3px;
  padding: .15rem .5rem;
  font-family: monospace;
}

.tag a { color: inherit; }
.tag a:hover { color: inherit; text-decoration: none; opacity: .8; }
.tag.active { background: var(--accent); color: var(--bg); }

/* ── Tag filter bar ── */
.tag-filter { margin-bottom: 2rem; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.tag-filter .label { font-size: .75rem; color: var(--text-muted); letter-spacing: .08em; text-transform: uppercase; }

/* ── Article detail ── */
.article-header { padding: 2.5rem 0 2rem; border-bottom: 1px solid var(--border); margin-bottom: 2rem; }
.article-header h1 { font-size: 1.8rem; margin-bottom: .5rem; }
.article-meta { font-size: .8rem; color: var(--text-muted); font-family: monospace; }

.article-main-image {
  width: 100%;
  max-height: 480px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  display: block;
  margin-bottom: 2rem;
}

.youtube-embed {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: 6px;
  border: 1px solid var(--border);
  margin-bottom: 2rem;
}

.youtube-embed iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: 0;
}

.article-body { line-height: 1.75; }
.article-body h2, .article-body h3 { color: var(--text-bright); margin-top: 2rem; }
.article-body h2 { font-size: 1.25rem; border-bottom: 1px solid var(--border); padding-bottom: .4rem; }
.article-body code { background: var(--bg-surface); border: 1px solid var(--border); padding: .15em .4em; border-radius: 3px; font-size: .88em; color: var(--accent); }
.article-body pre code { background: none; border: none; padding: 0; color: inherit; }
.article-body pre { background: var(--code-bg); border: 1px solid var(--border); border-radius: 6px; padding: 1.25rem; overflow-x: auto; }
.article-body pre code { background: none; padding: 0; }
.article-body img { max-width: 100%; border-radius: 4px; border: 1px solid var(--border); }
.article-body blockquote { border-left: 3px solid var(--accent); padding-left: 1rem; color: var(--text-muted); margin-left: 0; }
.article-body table { border-collapse: collapse; width: 100%; font-size: .9rem; }
.article-body th, .article-body td { border: 1px solid var(--border); padding: .5rem .75rem; text-align: left; }
.article-body th { background: var(--bg-surface); color: var(--accent); }

/* ── Syntax highlighting (Pygments monokai via codehilite) ── */
.codehilite { background: var(--code-bg) !important; border: 1px solid var(--border); border-radius: 6px; padding: 1rem; overflow-x: auto; margin: 1rem 0; color: #F8F8F2; }
.codehilite .hll { background-color: #49483e }
.codehilite .c  { color: #959077 } /* Comment */
.codehilite .k  { color: #66D9EF } /* Keyword */
.codehilite .kc { color: #66D9EF } /* Keyword.Constant */
.codehilite .kd { color: #66D9EF } /* Keyword.Declaration */
.codehilite .kn { color: #FF4689 } /* Keyword.Namespace */
.codehilite .kp { color: #66D9EF } /* Keyword.Pseudo */
.codehilite .kr { color: #66D9EF } /* Keyword.Reserved */
.codehilite .kt { color: #66D9EF } /* Keyword.Type */
.codehilite .l  { color: #AE81FF } /* Literal */
.codehilite .m  { color: #AE81FF } /* Literal.Number */
.codehilite .mb { color: #AE81FF }
.codehilite .mf { color: #AE81FF }
.codehilite .mh { color: #AE81FF }
.codehilite .mi { color: #AE81FF }
.codehilite .mo { color: #AE81FF }
.codehilite .il { color: #AE81FF }
.codehilite .s  { color: #E6DB74 } /* Literal.String */
.codehilite .sa { color: #E6DB74 }
.codehilite .sb { color: #E6DB74 }
.codehilite .sc { color: #E6DB74 }
.codehilite .dl { color: #E6DB74 }
.codehilite .sd { color: #E6DB74 }
.codehilite .s2 { color: #E6DB74 }
.codehilite .se { color: #AE81FF }
.codehilite .sh { color: #E6DB74 }
.codehilite .si { color: #E6DB74 }
.codehilite .sx { color: #E6DB74 }
.codehilite .sr { color: #E6DB74 }
.codehilite .s1 { color: #E6DB74 }
.codehilite .ss { color: #E6DB74 }
.codehilite .na { color: #A6E22E } /* Name.Attribute */
.codehilite .nc { color: #A6E22E } /* Name.Class */
.codehilite .nd { color: #A6E22E } /* Name.Decorator */
.codehilite .ne { color: #A6E22E } /* Name.Exception */
.codehilite .nf { color: #A6E22E } /* Name.Function */
.codehilite .fm { color: #A6E22E } /* Name.Function.Magic */
.codehilite .nx { color: #A6E22E } /* Name.Other */
.codehilite .no { color: #66D9EF } /* Name.Constant */
.codehilite .o  { color: #FF4689 } /* Operator */
.codehilite .ow { color: #FF4689 } /* Operator.Word */
.codehilite .err { color: #ED007E; background-color: #1E0010 }
.codehilite .ch { color: #959077 }
.codehilite .cm { color: #959077 }
.codehilite .cp { color: #959077 }
.codehilite .c1 { color: #959077 }
.codehilite .cs { color: #959077 }
.codehilite .gi { color: #A6E22E }
.codehilite .gd { color: #FF4689 }

/* ── Footer ── */
footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  margin-top: 4rem;
  color: var(--text-muted);
  font-size: .8rem;
  font-family: monospace;
}

footer a { color: var(--text-muted); }
footer a:hover { color: var(--accent); }

/* ── Social icons ── */
.social-icons {
  display: inline-flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: .6rem;
}

.social-icons a {
  display: inline-flex !important;
  align-items: center;
  color: var(--text-muted);
  line-height: 1;
}

.social-icons a:hover { color: var(--accent); }
.social-icons svg { width: 1rem; height: 1rem; fill: currentColor; display: block; }

/* ── Buttons ── */
.btn {
  display: inline-block;
  padding: .5rem 1.25rem;
  border: 1px solid var(--accent);
  border-radius: 4px;
  color: var(--accent);
  font-size: .85rem;
  letter-spacing: .05em;
  transition: background .2s, color .2s;
}

.btn:hover { background: var(--accent); color: var(--bg); text-decoration: none; }
.btn.filled { background: var(--accent); color: var(--bg); }
.btn.filled:hover { background: var(--link-hover); border-color: var(--link-hover); }

/* ── Responsive ── */
html, body { max-width: 100%; overflow-x: hidden; }

@media (max-width: 640px) {
  .articles-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.6rem; }
  nav ul { column-gap: .75rem; row-gap: .25rem; flex-wrap: wrap; }
  nav ul li a { font-size: .9rem; }
  .nav-inner { gap: .35rem; padding-block-start: .9rem; padding-block-end: .5rem; }
  .hero { padding-top: 1.25rem; }
}
