/* ============================================================
   GitHub Trending Digest — Custom Theme
   Aesthetic: Amber Terminal · Editorial Dark
   ============================================================ */

:root {
  --bg:            #0b0c0f;
  --bg-surface:    #111318;
  --bg-elevated:   #181922;
  --bg-hover:      #1e202b;
  --border:        #222430;
  --border-mid:    #2c2e3e;
  --border-bright: #3a3d52;

  --text:          #b8bace;
  --text-dim:      #5c5f78;
  --text-muted:    #3d4057;
  --text-bright:   #dde0f0;
  --text-white:    #f0f2ff;

  --amber:         #e8a820;
  --amber-dim:     #a97318;
  --amber-glow:    rgba(232, 168, 32, 0.10);
  --amber-line:    rgba(232, 168, 32, 0.20);

  --cyan:          #45c4d8;
  --green:         #52d08a;
  --red:           #e86060;
  --yellow:        #f0c040;

  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  --font-serif: 'Source Serif 4', Georgia, serif;

  --max-w: 760px;
  --header-h: 52px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: 1.75;
  min-height: 100vh;
}

/* ─── Atmosphere ─── */
.bg-atmosphere {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 60% 40% at 15% 0%, rgba(232,168,32,0.05) 0%, transparent 60%),
    radial-gradient(ellipse 50% 60% at 85% 100%, rgba(69,196,216,0.03) 0%, transparent 60%);
}

/* ─── Header ─── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  height: var(--header-h);
  background: rgba(11, 12, 15, 0.88);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  text-decoration: none;
  color: var(--text-bright);
  transition: color 0.2s;
}

.site-brand:hover { color: var(--amber); }

.brand-pulse {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  flex-shrink: 0;
  box-shadow: 0 0 8px var(--amber);
  animation: pulse-dot 2.4s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px var(--amber); }
  50%       { opacity: 0.35; box-shadow: 0 0 3px var(--amber); }
}

.brand-text {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

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

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

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

/* ─── Main ─── */
.site-main {
  position: relative;
  z-index: 1;
  padding: 3.5rem 1.5rem 6rem;
}

.content-body {
  max-width: var(--max-w);
  margin: 0 auto;
}

/* ─── Typography: H1 ─── */
.content-body h1 {
  font-family: var(--font-mono);
  font-size: clamp(1.125rem, 2.5vw, 1.5rem);
  font-weight: 700;
  color: var(--text-white);
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-mid);
  position: relative;
}

.content-body h1::before {
  content: '';
  display: block;
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 2.5rem;
  height: 1px;
  background: var(--amber);
}

/* ─── Typography: H2 ─── */
.content-body h2 {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--amber);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-top: 3rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.content-body h2::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--amber-line);
}

/* ─── Typography: H3 ─── */
.content-body h3 {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-bright);
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  padding: 0.625rem 0.875rem;
  background: var(--bg-elevated);
  border-left: 2px solid var(--amber);
  border-radius: 0 4px 4px 0;
  line-height: 1.4;
}

/* ─── Typography: H4–H6 ─── */
.content-body h4, .content-body h5, .content-body h6 {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-dim);
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

/* ─── Paragraphs ─── */
.content-body p {
  margin-bottom: 0.875rem;
  color: var(--text);
}

/* italic tagline paragraph (subtitle after h1) */
.content-body > p:first-of-type > em:only-child,
.content-body > h1 + p > em {
  display: block;
  font-size: 0.875rem;
  font-style: italic;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
  font-family: var(--font-serif);
}

/* ─── Links ─── */
.content-body a {
  color: var(--cyan);
  text-decoration: none;
  border-bottom: 1px solid rgba(69, 196, 216, 0.25);
  transition: color 0.15s, border-color 0.15s;
}

.content-body a:hover {
  color: var(--amber);
  border-color: rgba(232, 168, 32, 0.45);
}

/* ─── Lists ─── */
.content-body ul,
.content-body ol {
  padding-left: 1.375rem;
  margin-bottom: 0.875rem;
}

.content-body li {
  margin-bottom: 0.375rem;
  color: var(--text);
}

.content-body li > p { margin-bottom: 0.25rem; }

/* Index page: article list items get card treatment */
.content-body > ul > li,
.content-body > ol > li {
  list-style: none;
  margin-left: -1.375rem;
  padding: 0.5rem 0.875rem;
  border-radius: 5px;
  border: 1px solid transparent;
  margin-bottom: 0.25rem;
  transition: background 0.2s, border-color 0.2s;
}

.content-body > ul > li:hover,
.content-body > ol > li:hover {
  background: var(--bg-hover);
  border-color: var(--border-mid);
}

.content-body > ul > li::before {
  content: '→';
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-right: 0.5rem;
}

/* Nested lists back to normal */
.content-body li li {
  list-style: disc;
  margin-left: 0;
  padding: 0;
  border: none;
  background: none;
}

.content-body li li::before { content: none; }
.content-body li li:hover { background: none; border: none; }

/* ─── HR ─── */
.content-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.25rem 0;
}

/* ─── Strong / Em ─── */
.content-body strong {
  color: var(--text-bright);
  font-weight: 600;
}

.content-body em {
  color: var(--text-dim);
  font-style: italic;
}

/* ─── Code ─── */
.content-body code {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-mid);
  border-radius: 3px;
  padding: 0.1em 0.38em;
  color: var(--amber);
}

.content-body pre {
  background: var(--bg-surface);
  border: 1px solid var(--border-mid);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin-bottom: 1.25rem;
}

.content-body pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text);
  font-size: 0.8125rem;
}

/* ─── Blockquote ─── */
.content-body blockquote {
  border-left: 2px solid var(--border-bright);
  padding: 0.625rem 1rem;
  margin: 1.25rem 0;
  background: var(--bg-surface);
  border-radius: 0 5px 5px 0;
  color: var(--text-dim);
  font-style: italic;
}

.content-body blockquote strong { color: var(--text); }

/* ─── Tables ─── */
.content-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.8125rem;
  font-family: var(--font-mono);
  display: block;
  overflow-x: auto;
}

.content-body thead {
  background: var(--bg-elevated);
}

.content-body th {
  color: var(--amber);
  font-weight: 600;
  text-align: left;
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--border-mid);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.content-body td {
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--border);
  color: var(--text);
  vertical-align: top;
  line-height: 1.5;
}

.content-body tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.018);
}

.content-body tbody tr:hover td {
  background: var(--bg-elevated);
}

/* ─── Methodology section badge-style list ─── */
.content-body ol {
  counter-reset: method-counter;
  list-style: none;
  padding-left: 0;
}

.content-body ol > li {
  counter-increment: method-counter;
  margin-left: 0;
  padding: 0.5rem 0.875rem 0.5rem 2.25rem;
  position: relative;
}

.content-body ol > li::before {
  content: counter(method-counter);
  position: absolute;
  left: 0.625rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--amber);
  background: var(--amber-glow);
  border: 1px solid var(--amber-line);
  border-radius: 3px;
  width: 1.25rem;
  text-align: center;
  padding: 0 0.1rem;
  top: 0.55rem;
}

/* ─── Footer ─── */
.site-footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--border);
  padding: 1.75rem 1.5rem;
}

.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.footer-mono {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.footer-sep {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
}

.footer-dim {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

/* ─── Scrollbar (Webkit) ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ─── Responsive ─── */
@media (max-width: 640px) {
  .site-main { padding: 2.25rem 1rem 4rem; }
  .content-body h1 { font-size: 1.0625rem; }
  .content-body h3 { font-size: 0.8125rem; padding: 0.5rem 0.75rem; }
  .content-body table { font-size: 0.75rem; }
  .site-nav { gap: 0.875rem; }
}
