/* Shared article styles for research.jayphen.com */

:root {
  --bg: #FAF7F2;
  --bg-warm: #F5F0E8;
  --bg-code: #1E1E2E;
  --text: #2C2A28;
  --text-secondary: #6B6560;
  --text-muted: #9E9790;
  --border: #E5DFD6;
  --surface: #FFFFFF;
  --accent: #2A7B9B;
  --accent-hover: #1F6A87;
  --accent-light: #E4F2F7;
  --code-text: #CDD6F4;
  --code-comment: #6C7086;
  --code-keyword: #CBA6F7;
  --code-string: #A6E3A1;
  --code-function: #89B4FA;
  --code-number: #FAB387;
  --code-type: #F9E2AF;
  --code-operator: #89DCEB;

  --font-display: 'Bricolage Grotesque', Georgia, serif;
  --font-body: 'DM Sans', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 740px;
  margin: 0 auto;
  padding: 80px 24px 120px;
}

/* Back link */
.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  margin-bottom: 48px;
  transition: color 0.15s;
}
.back:hover { color: var(--accent); }
.back svg { width: 16px; height: 16px; }

/* Header */
.article-header {
  margin-bottom: 56px;
}

.article-header h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

.article-meta {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 14px;
}

.article-meta .tag {
  font-size: 12px;
  background: var(--accent-light);
  color: var(--accent);
  padding: 2px 10px;
  border-radius: 4px;
  font-weight: 500;
}

.lede {
  font-size: 1.2rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 48px;
  padding-bottom: 48px;
  border-bottom: 1px solid var(--border);
}

/* Prose */
h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  margin-top: 56px;
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}

h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  margin-top: 40px;
  margin-bottom: 12px;
}

p {
  margin-bottom: 20px;
}

/* Inline code */
code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-warm);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent);
}

/* Code blocks */
pre {
  background: var(--bg-code);
  border-radius: 12px;
  padding: 24px;
  margin: 24px 0 28px;
  overflow-x: auto;
  line-height: 1.55;
  position: relative;
}

pre code {
  background: none;
  padding: 0;
  color: var(--code-text);
  font-size: 0.82rem;
  border-radius: 0;
}

.code-label {
  position: absolute;
  top: 8px;
  right: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--code-comment);
  user-select: none;
}

/* Syntax highlighting classes */
.kw { color: var(--code-keyword); }
.fn { color: var(--code-function); }
.st { color: var(--code-string); }
.cm { color: var(--code-comment); }
.nu { color: var(--code-number); }
.ty { color: var(--code-type); }
.op { color: var(--code-operator); }

/* Callout boxes */
.callout {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 20px 24px;
  margin: 28px 0;
}

.callout-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 8px;
  color: var(--accent);
}

.callout p:last-child { margin-bottom: 0; }

/* Diagram */
.diagram {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  margin: 32px 0;
  text-align: center;
  overflow-x: auto;
}

.diagram pre {
  background: none;
  padding: 0;
  margin: 0;
  text-align: left;
  display: inline-block;
}

.diagram pre code {
  color: var(--text);
  font-size: 0.8rem;
  line-height: 1.6;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0 28px;
  font-size: 0.9rem;
}

th, td {
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--bg-warm);
}

tr:last-child td {
  border-bottom: none;
}

table code {
  font-size: 0.8em;
}

/* Lists */
ul, ol {
  margin-bottom: 20px;
  padding-left: 24px;
}

li {
  margin-bottom: 8px;
}

li code {
  font-size: 0.82em;
}

/* Strong */
strong {
  font-weight: 600;
}

/* Horizontal rule */
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 48px 0;
}

/* Links */
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }

/* Footer */
.article-footer {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
}

.article-footer a {
  color: var(--accent);
  text-decoration: none;
}

.article-footer a:hover {
  text-decoration: underline;
}

/* Mobile */
@media (max-width: 600px) {
  .container { padding: 48px 16px 80px; }
  pre { padding: 16px; margin-left: -16px; margin-right: -16px; border-radius: 0; }
  .diagram { padding: 16px; margin-left: -16px; margin-right: -16px; border-radius: 0; }
}
