/* =========================================================
   DeepSeek V4 Flash blog post — stylesheet
   ========================================================= */

/* ---------- Theme tokens ---------- */
:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'Lora', Georgia, 'Times New Roman', serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;

  --max-width: 760px;

  /* Light theme */
  --bg: #fbfaf7;
  --bg-elevated: #ffffff;
  --text: #1a1a1a;
  --text-muted: #5b5b63;
  --text-subtle: #8a8a93;
  --border: #e6e2da;
  --border-strong: #d0ccc1;
  --accent: #c46b3c;          /* warm amber, evokes the gold Sparks */
  --accent-hover: #a8552b;
  --link: #b8531f;
  --link-hover: #8c3c12;

  --code-bg: #1f1d1a;
  --code-text: #ece7df;
  --code-inline-bg: #f1ede4;
  --code-inline-text: #8c3c12;
  --code-inline-border: #e6e2da;

  --info-bg: #fff8ec;
  --info-border: #e8c98a;
  --info-text: #5e4310;

  --highlight-bg: #fdf2e6;
  --highlight-border: #c46b3c;

  --quote-bg: #f5f1e8;
  --quote-border: #c46b3c;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
}

[data-theme='dark'] {
  --bg: #15141a;
  --bg-elevated: #1c1b22;
  --text: #e8e6e1;
  --text-muted: #a8a59c;
  --text-subtle: #76736b;
  --border: #2a2932;
  --border-strong: #3a3944;
  --accent: #e89968;
  --accent-hover: #f3b186;
  --link: #f3b186;
  --link-hover: #ffc89e;

  --code-bg: #0f0e12;
  --code-text: #e8e6e1;
  --code-inline-bg: #2a2932;
  --code-inline-text: #f3b186;
  --code-inline-border: #3a3944;

  --info-bg: #2a2418;
  --info-border: #6e5527;
  --info-text: #e6c98a;

  --highlight-bg: #2a201a;
  --highlight-border: #e89968;

  --quote-bg: #1c1b22;
  --quote-border: #e89968;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
}

/* ---------- Reset & base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-header__brand {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.theme-toggle {
  background: transparent;
  border: 1px solid var(--border);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.theme-toggle:hover {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
}

/* ---------- Layout ---------- */
.post {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 48px 24px 80px;
}

.post-header {
  margin-bottom: 48px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.post-header h1 {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(1.85rem, 4.5vw, 2.6rem);
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin: 0 0 16px;
  color: var(--text);
}

.post-meta {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
  letter-spacing: 0.01em;
}

.post-meta__sep {
  margin: 0 8px;
  color: var(--text-subtle);
}

/* ---------- Headings ---------- */
article h2 {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.6rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin: 56px 0 18px;
  padding-top: 8px;
  color: var(--text);
}

article h3 {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 1.18rem;
  line-height: 1.4;
  margin: 36px 0 12px;
  color: var(--text);
}

/* ---------- Body text ---------- */
article p {
  margin: 0 0 18px;
  color: var(--text);
}

article a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color 0.12s ease;
}

article a:hover {
  color: var(--link-hover);
}

article strong {
  font-weight: 600;
  color: var(--text);
}

article em {
  color: var(--text-muted);
}

article ul,
article ol {
  margin: 0 0 20px;
  padding-left: 1.5em;
}

article li {
  margin-bottom: 8px;
}

article li::marker {
  color: var(--accent);
}

.footnote {
  font-size: 0.9rem;
  color: var(--text-muted);
  border-left: 2px solid var(--border-strong);
  padding-left: 14px;
  margin: 24px 0;
}

/* ---------- Figures ---------- */
figure {
  margin: 28px 0;
  text-align: center;
}

figure img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}

figcaption {
  margin-top: 12px;
  font-size: 0.88rem;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.5;
}

/* ---------- Inline code & code blocks ---------- */
code {
  font-family: var(--font-mono);
  font-size: 0.88em;
}

p code,
li code,
aside code,
td code {
  background: var(--code-inline-bg);
  color: var(--code-inline-text);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--code-inline-border);
  white-space: nowrap;
}

pre {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 18px 20px;
  border-radius: 10px;
  overflow-x: auto;
  margin: 20px 0 28px;
  font-size: 0.84rem;
  line-height: 1.55;
  border: 1px solid color-mix(in srgb, var(--code-bg) 70%, var(--border));
  box-shadow: var(--shadow-sm);
}

pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  border: 0;
  font-size: inherit;
  white-space: pre;
}

/* Pretty scrollbar for code blocks */
pre::-webkit-scrollbar {
  height: 8px;
}
pre::-webkit-scrollbar-track {
  background: transparent;
}
pre::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
pre::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ---------- Callouts ---------- */
.callout {
  background: var(--highlight-bg);
  border-left: 4px solid var(--highlight-border);
  padding: 18px 22px;
  border-radius: 0 8px 8px 0;
  margin: 28px 0;
  font-size: 1.02rem;
  line-height: 1.6;
}

.callout--highlight strong {
  color: var(--text);
}

aside.info {
  position: relative;
  background: var(--info-bg);
  border: 1px solid var(--info-border);
  border-left: 4px solid var(--info-border);
  color: var(--info-text);
  padding: 12px 16px 12px 44px;
  border-radius: 6px;
  margin: 18px 0;
  font-size: 0.94rem;
  line-height: 1.55;
}

aside.info::before {
  content: 'ℹ';
  position: absolute;
  left: 14px;
  top: 11px;
  font-size: 1.05rem;
  font-weight: 700;
  font-style: normal;
  color: var(--info-border);
}

aside.info code {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.08);
  color: inherit;
}

[data-theme='dark'] aside.info code {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
}

/* ---------- Blockquote ---------- */
blockquote {
  margin: 24px 0;
  padding: 14px 22px;
  background: var(--quote-bg);
  border-left: 4px solid var(--quote-border);
  border-radius: 0 8px 8px 0;
  color: var(--text-muted);
  font-style: italic;
  font-family: var(--font-serif);
  font-size: 1.02rem;
  line-height: 1.65;
}

/* ---------- Tables ---------- */
.table-wrap {
  overflow-x: auto;
  margin: 24px 0 28px;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

thead {
  background: var(--bg-elevated);
}

th,
td {
  text-align: left;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
}

th {
  font-weight: 600;
  color: var(--text);
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: color-mix(in srgb, var(--accent) 5%, transparent);
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 40px;
  padding: 24px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-subtle);
  font-family: var(--font-mono);
}

.site-footer p {
  margin: 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
  body {
    font-size: 16px;
  }

  .post {
    padding: 32px 18px 60px;
  }

  article h2 {
    font-size: 1.4rem;
    margin-top: 44px;
  }

  article h3 {
    font-size: 1.08rem;
  }

  pre {
    font-size: 0.78rem;
    padding: 14px 16px;
    border-radius: 8px;
    /* Allow code blocks to extend slightly past the body padding on mobile */
    margin-left: -6px;
    margin-right: -6px;
  }

  .callout,
  blockquote {
    padding: 14px 16px;
  }
}

/* ---------- Selection ---------- */
::selection {
  background: color-mix(in srgb, var(--accent) 35%, transparent);
  color: var(--text);
}