/* =========================================================
   Shamim Hossain — Blog
   Modern minimal tech theme, light + dark
   ========================================================= */

:root {
  --bg: #fafafa;
  --bg-elevated: #ffffff;
  --text: #14171f;
  --text-muted: #5b6270;
  --border: #e6e8ec;
  --accent: #4f46e5;
  --accent-strong: #3730a3;
  --accent-soft: rgba(79, 70, 229, 0.1);
  --code-bg: #f1f1f5;
  --feed: #c2410c;
  --shadow: 0 1px 2px rgba(20, 23, 31, 0.04), 0 8px 24px rgba(20, 23, 31, 0.06);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --max-width: 880px;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Space Grotesk", var(--font-sans);
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

:root[data-theme="dark"] {
  --bg: #0b0d12;
  --bg-elevated: #12141b;
  --text: #e7e9ee;
  --text-muted: #8b93a3;
  --border: #232733;
  --accent: #818cf8;
  --accent-strong: #a5b0ff;
  --accent-soft: rgba(129, 140, 248, 0.14);
  --code-bg: #171a23;
  --feed: #fb923c;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 28px rgba(0, 0, 0, 0.35);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0d12;
    --bg-elevated: #12141b;
    --text: #e7e9ee;
    --text-muted: #8b93a3;
    --border: #232733;
    --accent: #818cf8;
    --accent-strong: #a5b0ff;
    --accent-soft: rgba(129, 140, 248, 0.14);
    --code-bg: #171a23;
    --feed: #fb923c;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 28px rgba(0, 0, 0, 0.35);
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s ease, color 0.2s ease;
  /* Safety net: nothing should ever be able to force a horizontal scrollbar
     on the page itself (e.g. an unbroken long URL in post content). */
  overflow-x: hidden;
}

img {
  max-width: 100%;
}

a {
  color: inherit;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--border);
}

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

.brand {
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  color: var(--text);
}

.brand .mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

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

.nav a {
  white-space: nowrap;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 14.5px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 999px;
  transition: color 0.15s ease, background 0.15s ease;
}

.nav a:hover {
  color: var(--text);
  background: var(--accent-soft);
}

.nav a.active {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.nav .icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: pointer;
  margin-left: 6px;
  transition: color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.nav .icon-btn:hover {
  color: var(--accent-strong);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.nav .icon-btn svg {
  width: 17px;
  height: 17px;
}

#theme-toggle .sun,
#theme-toggle .moon {
  display: none;
}
:root[data-theme="dark"] #theme-toggle .moon { display: inline-flex; }
:root[data-theme="dark"] #theme-toggle .sun { display: none; }
:root[data-theme="light"] #theme-toggle .sun { display: inline-flex; }
:root[data-theme="light"] #theme-toggle .moon { display: none; }
:root:not([data-theme]) #theme-toggle .sun { display: inline-flex; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) #theme-toggle .sun { display: none; }
  :root:not([data-theme]) #theme-toggle .moon { display: inline-flex; }
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  padding: 96px 0 64px;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(var(--border) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 0%, #000 40%, transparent 100%);
  opacity: 0.6;
  pointer-events: none;
}

.hero .container {
  position: relative;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-strong);
  background: var(--accent-soft);
  padding: 6px 12px;
  border-radius: 999px;
  margin-bottom: 22px;
}

.eyebrow .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(32px, 5vw, 50px);
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0 0 20px;
  max-width: 760px;
}

.hero p.lede {
  font-size: 18px;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 0 32px;
}

.hero .cta-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn-primary {
  background: var(--text);
  color: var(--bg);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

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

.feature-callout {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 40px;
  max-width: 640px;
  padding: 16px 20px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.5;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.feature-callout:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
}

.feature-callout strong {
  display: block;
  color: var(--text);
  font-weight: 600;
  margin-bottom: 2px;
}

.callout-icon {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--bg-elevated);
  color: var(--accent-strong);
  display: flex;
  align-items: center;
  justify-content: center;
}

.callout-icon svg {
  width: 22px;
  height: 22px;
}

.callout-arrow {
  flex: none;
  margin-left: auto;
  font-size: 20px;
  color: var(--accent-strong);
  transition: transform 0.15s ease;
}

.feature-callout:hover .callout-arrow {
  transform: translateX(3px);
}

/* Stacked callouts sit close together. */
.feature-callout + .feature-callout {
  margin-top: 12px;
}

/* On the ADLC overview the callout follows the lede, which has no bottom margin there. */
.adlc-hero .feature-callout {
  margin-top: 24px;
}

/* ---------- Posts grid ---------- */

.posts-section {
  padding: 24px 0 100px;
}

.posts-section .section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 28px;
}

.posts-section h2 {
  font-family: var(--font-display);
  font-size: 24px;
  margin: 0;
}

.posts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.post-card {
  display: block;
  text-decoration: none;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 26px 28px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.post-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}

.post-card .meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.post-card .meta-row .sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-muted);
}

.post-card h3 {
  font-family: var(--font-display);
  font-size: 21px;
  line-height: 1.35;
  margin: 0 0 10px;
  letter-spacing: -0.01em;
}

.post-card p {
  color: var(--text-muted);
  font-size: 15px;
  margin: 0 0 16px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-strong);
  background: var(--accent-soft);
  padding: 4px 10px;
  border-radius: 999px;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
}

/* ---------- Post page ---------- */

.post-hero {
  padding: 56px 0 20px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  margin-bottom: 28px;
}

.back-link:hover {
  color: var(--accent-strong);
}

.post-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(28px, 4.4vw, 42px);
  line-height: 1.18;
  letter-spacing: -0.02em;
  margin: 0 0 18px;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 20px;
}

.post-meta .sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-muted);
}

article.post-body {
  /* Only set top/bottom here — leave left/right alone so .container's own
     24px side padding applies. This element previously zeroed that out
     (shorthand `padding: 12px 0 100px`), leaving content flush against the
     screen edge on mobile with zero margin for list markers etc. to render
     into, which is what was clipping the References list numbers. */
  padding-top: 12px;
  padding-bottom: 100px;
  max-width: 720px;
  margin: 0 auto;
  font-size: 17.5px;
  /* Long unbroken strings (bare URLs, etc.) wrap instead of overflowing the
     viewport on narrow screens — this is what was truncating posts on mobile. */
  overflow-wrap: break-word;
}

article.post-body h2 {
  font-family: var(--font-display);
  font-size: 26px;
  margin: 44px 0 16px;
  letter-spacing: -0.01em;
}

article.post-body h3 {
  font-family: var(--font-display);
  font-size: 20px;
  margin: 34px 0 12px;
}

article.post-body p {
  margin: 0 0 20px;
  color: var(--text);
}

article.post-body strong {
  color: var(--text);
}

article.post-body a {
  color: var(--accent-strong);
  text-decoration-color: var(--accent-soft);
  text-underline-offset: 3px;
}

article.post-body ul,
article.post-body ol {
  margin: 0 0 20px;
  padding-left: 22px;
}

article.post-body li {
  margin-bottom: 10px;
}

article.post-body blockquote {
  margin: 28px 0;
  padding: 4px 0 4px 20px;
  border-left: 3px solid var(--accent);
  color: var(--text-muted);
  font-style: italic;
}

article.post-body code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 5px;
}

article.post-body pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  overflow-x: auto;
  margin: 0 0 24px;
}

article.post-body pre code {
  background: none;
  padding: 0;
  font-size: 14px;
  line-height: 1.6;
}

article.post-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 44px 0;
}

article.post-body img {
  border-radius: var(--radius-sm);
  margin: 8px 0 24px;
}

/* Inline SVG diagrams in posts: inline (not <img>) so they follow the theme tokens. */
article.post-body .post-figure {
  margin: 32px 0 36px;
}

article.post-body .post-figure svg {
  display: block;
  width: 100%;
  max-width: 440px; /* keeps label text near body size on wide screens */
  height: auto;
}

article.post-body .post-figure figcaption {
  margin-top: 12px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.55;
}

.post-figure .fig-own { fill: var(--accent); }
.post-figure .fig-carried { fill: var(--text-muted); opacity: 0.45; }
.post-figure .fig-axis { stroke: var(--border); stroke-width: 1.5; }
.post-figure .fig-sep { stroke: var(--text-muted); stroke-width: 1; stroke-dasharray: 3 4; }
.post-figure .fig-title { fill: var(--text); font-size: 21px; font-weight: 600; }
.post-figure .fig-label { fill: var(--text-muted); font-size: 18px; }

.post-footer-cta {
  max-width: 720px;
  margin: 0 auto 100px;
  padding: 28px 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.post-footer-cta p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14.5px;
}

/* ---------- About / placeholder ---------- */

.about-placeholder {
  padding: 90px 0 120px;
  text-align: center;
}

.about-placeholder .icon-wrap {
  width: 64px;
  height: 64px;
  margin: 0 auto 24px;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-strong);
}

.about-placeholder h1 {
  font-family: var(--font-display);
  font-size: 30px;
  margin: 0 0 12px;
}

.about-placeholder p {
  color: var(--text-muted);
  max-width: 460px;
  margin: 0 auto 28px;
}

/* ---------- Subscribe (subscribe.html) ---------- */

.subscribe { max-width: 640px; padding: 72px 20px 110px; }
.subscribe .icon-wrap {
  width: 56px;
  height: 56px;
  margin: 0 0 20px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--feed) 12%, transparent);
  color: var(--feed);
}
.subscribe h1 { font-family: var(--font-display); font-size: clamp(28px, 5vw, 36px); margin: 0 0 10px; }
.sub-lede { color: var(--text-muted); font-size: 17px; margin: 0 0 26px; }

.feed-box {
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
}
.feed-label { display: block; margin-bottom: 8px; font: 500 12px var(--font-mono); letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); }
.feed-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.feed-row code {
  flex: 1 1 260px;
  min-width: 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--code-bg);
  font: 500 14px var(--font-mono);
  overflow-wrap: anywhere;
  user-select: all;
}
.feed-row .btn { flex: none; min-width: 96px; justify-content: center; }

.sub-steps { margin: 28px 0 0; padding-left: 22px; display: flex; flex-direction: column; gap: 14px; line-height: 1.6; }
.sub-steps li::marker { font-family: var(--font-display); font-weight: 600; color: var(--accent-strong); }
.sub-steps code, .sub-note code { font: 500 0.92em var(--font-mono); background: var(--code-bg); padding: 1px 5px; border-radius: 4px; }
.subscribe a:not(.btn) { color: var(--accent-strong); }
.sub-note { margin: 28px 0 0; padding-top: 20px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 14.5px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 36px 0;
}

.site-footer .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--text-muted);
  font-size: 13.5px;
}

.site-footer a {
  text-decoration: none;
  color: var(--text-muted);
}

.site-footer a:hover {
  color: var(--accent-strong);
}

.footer-links {
  display: flex;
  gap: 18px;
}

/* RSS link (FR-FEED-4): goes to subscribe.html; the icon takes the feed orange, the word "RSS" stays muted. */
.footer-links .rss { display: inline-flex; align-items: center; gap: 5px; }
.footer-links .rss svg { flex: none; color: var(--feed); }

/* ---------- Utility ---------- */

.skeleton {
  border-radius: var(--radius-md);
  background: linear-gradient(90deg, var(--code-bg) 25%, var(--border) 37%, var(--code-bg) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  height: 120px;
}

@keyframes shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

@media (min-width: 640px) {
  .posts-grid { grid-template-columns: 1fr; }
}

/* Three nav links + two icon buttons don't fit beside the full brand name on
   phones; keep the SH mark and drop the name text. */
@media (max-width: 560px) {
  .site-header .container { padding: 0 16px; }
  .brand .brand-name { display: none; }
  .nav a { padding: 7px 11px; }
  .nav .icon-btn { margin-left: 2px; }
}
