/* LibFPGA.com — single stylesheet, no framework. */

:root {
  --bg: #ffffff;
  --bg-alt: #f4f6f8;
  --text: #1a222c;
  --muted: #5c6a78;
  --accent: #0e7c66;       /* teal-green: "signal" */
  --accent-hi: #0fa284;
  --border: #d8dee5;
  --code-bg: #10161d;
  --code-text: #d6e2ec;
  --flash-ok: #0e7c66;
  --flash-err: #b3372e;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10161d;
    --bg-alt: #171f28;
    --text: #d6e2ec;
    --muted: #8798a8;
    --accent: #35c39f;
    --accent-hi: #52dcb8;
    --border: #2a3642;
    --code-bg: #0a0f14;
    --code-text: #cfe0ee;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}
.container { max-width: 960px; margin: 0 auto; padding: 0 1.25rem; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hi); text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; }
h1 { font-size: 1.9rem; }
.muted { color: var(--muted); }

/* Header */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
}
.site-header nav {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: .8rem; padding-bottom: .8rem;
}
.brand {
  font-weight: 700; font-size: 1.25rem; color: var(--text);
  font-family: ui-monospace, "Cascadia Code", "JetBrains Mono", monospace;
}
.brand:hover { text-decoration: none; color: var(--text); }
.brand-lib { color: var(--accent); }
.nav-links a { margin-left: 1.1rem; color: var(--text); font-weight: 500; }
.nav-links a:hover { color: var(--accent); }

/* Hero + cards */
.hero { padding: 2.2rem 0 1rem; max-width: 46rem; }
.hero p { font-size: 1.1rem; color: var(--muted); }
.lede { color: var(--muted); max-width: 46rem; }
.card-grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  margin: 1.2rem 0;
}
.card {
  display: block; padding: 1rem 1.1rem;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-alt); color: var(--text);
}
.card:hover { border-color: var(--accent); text-decoration: none; color: var(--text); }
.card h3 { margin: 0 0 .35rem; font-size: 1.02rem; color: var(--accent); }
.card p { margin: 0; font-size: .9rem; color: var(--muted); }

/* Tool form */
.tool-form {
  display: grid; gap: .9rem 1.2rem;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  align-items: end;
  background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: 8px; padding: 1.1rem; margin: 1.2rem 0;
}
.tool-form label { display: flex; flex-direction: column; gap: .25rem; font-size: .9rem; font-weight: 600; }
.tool-form input, .tool-form select {
  font: inherit; padding: .45rem .6rem;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg); color: var(--text);
}
.tool-form small { font-weight: 400; }
button.primary, .subscribe-form button {
  font: inherit; font-weight: 600; cursor: pointer;
  background: var(--accent); color: #fff; border: 0;
  border-radius: 6px; padding: .55rem 1.2rem;
}
button.primary:hover, .subscribe-form button:hover { background: var(--accent-hi); }

/* Results */
.result-values { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); padding: 0; }
.result-values div {
  border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: 6px; padding: .55rem .8rem; background: var(--bg-alt);
}
.result-values dt { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.result-values dd { margin: .15rem 0 0; font-family: ui-monospace, monospace; font-size: .95rem; overflow-wrap: anywhere; }
.notes li { margin-bottom: .4rem; }

/* Tables */
.table-wrap { overflow-x: auto; margin: .8rem 0; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { text-align: left; padding: .45rem .7rem; border-bottom: 1px solid var(--border); }
th { background: var(--bg-alt); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
tbody tr:hover { background: var(--bg-alt); }

/* Code blocks */
.code-block { margin: 1.2rem 0; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.code-head {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--bg-alt); padding: .4rem .9rem;
  font-size: .85rem; font-weight: 600;
}
.copy-btn {
  font: inherit; font-size: .8rem; cursor: pointer;
  background: transparent; border: 1px solid var(--border);
  border-radius: 5px; padding: .15rem .6rem; color: var(--muted);
}
.copy-btn:hover { color: var(--accent); border-color: var(--accent); }
.code-block pre {
  margin: 0; padding: 1rem; overflow-x: auto;
  background: var(--code-bg); color: var(--code-text);
  font: .84rem/1.5 ui-monospace, "Cascadia Code", "JetBrains Mono", monospace;
}
.prose pre {
  padding: 1rem; overflow-x: auto; border-radius: 8px;
  background: var(--code-bg); color: var(--code-text);
  font-size: .84rem;
}
.prose code, li code, p code, td code {
  font-family: ui-monospace, monospace; font-size: .88em;
  background: var(--bg-alt); padding: .08em .35em; border-radius: 4px;
}
.prose pre code { background: none; padding: 0; }
.prose table { margin: 1rem 0; display: block; overflow-x: auto; }
.prose h2 { border-bottom: 1px solid var(--border); padding-bottom: .25rem; margin-top: 2rem; }

/* Layout bits */
.two-col { display: grid; gap: 2rem; grid-template-columns: 1fr 1fr; margin: 2rem 0; }
@media (max-width: 700px) { .two-col { grid-template-columns: 1fr; } }
.breadcrumb { margin: 1.2rem 0 .3rem; font-size: .88rem; color: var(--muted); }
.post-list { list-style: none; padding: 0; }
.post-list li { margin-bottom: .55rem; }
.post-list .muted { font-size: .85rem; margin-left: .5rem; }
.post-list.big li { font-size: 1.1rem; margin-bottom: .8rem; }
.board-filters { display: flex; gap: 1.5rem; margin: 1rem 0; font-size: .92rem; }
.board-filters select { font: inherit; padding: .3rem .5rem; border-radius: 6px; border: 1px solid var(--border); background: var(--bg); color: var(--text); }

/* Ads: empty until AdSense configured; never reserve ugly space */
.ad-slot { margin: 1.5rem 0; text-align: center; }
.ad-slot:empty { display: none; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); background: var(--bg-alt); margin-top: 3rem; padding: 1.8rem 0 1rem; font-size: .92rem; }
.footer-grid { display: grid; gap: 2rem; grid-template-columns: 1fr 1fr; }
@media (max-width: 700px) { .footer-grid { grid-template-columns: 1fr; } }
.subscribe-form { display: flex; gap: .5rem; }
.subscribe-form input {
  flex: 1; font: inherit; padding: .45rem .6rem;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg); color: var(--text);
}
.copyright { margin-top: 1.4rem; font-size: .8rem; }
.flash-ok { color: var(--flash-ok); font-weight: 600; }
.flash-err { color: var(--flash-err); font-weight: 600; }
.share-hint { font-size: .85rem; }

/* Wide form fields (textareas) */
.tool-form label.wide { grid-column: 1 / -1; }
.tool-form textarea {
  font: .85rem/1.5 ui-monospace, "Cascadia Code", "JetBrains Mono", monospace;
  padding: .6rem; border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg); color: var(--text); resize: vertical; white-space: pre;
}
