/* ============================================
   Erlon Bertolossi — personal site
   Editorial / notebook aesthetic. Warm cream + amber.
   No bento grid, no chat. Single-column, prose-forward.
   ============================================ */

/* ---------- Tokens (Light, default) ---------- */
:root {
  --bg:        #FAF7F0;
  --bg-soft:   #F2EDE0;
  --surface:   #FFFFFF;
  --surface-2: #FBF8F1;
  --rule:      #E2DCCB;
  --rule-soft: #ECE6D6;

  --text:        #1F1B16;
  --text-soft:   #4A4339;
  --text-mute:   #7A7367;

  --accent:      #B45309;
  --accent-2:    #92400E;
  --accent-bright: #D97706;
  --accent-soft: rgba(180, 83, 9, 0.10);
  --accent-edge: rgba(180, 83, 9, 0.32);
  --highlight:   #FDE68A;

  --shadow-sm: 0 1px 0 rgba(31, 27, 22, 0.04);
  --shadow:    0 6px 24px -12px rgba(31, 27, 22, 0.18);

  --serif: 'Crimson Pro', 'Source Serif Pro', Georgia, 'Times New Roman', serif;
  --sans:  'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono:  'JetBrains Mono', ui-monospace, Menlo, monospace;

  --container: 1100px;
  --narrow: 720px;

  --t: 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Tokens (Dark) ---------- */
[data-theme='dark'] {
  --bg:        #14110D;
  --bg-soft:   #1B1813;
  --surface:   #211D17;
  --surface-2: #1A1610;
  --rule:      #2C2720;
  --rule-soft: #25201A;

  --text:        #F2EBDC;
  --text-soft:   #C7BFB1;
  --text-mute:   #8C8475;

  --accent:      #F59E0B;
  --accent-2:    #FBBF24;
  --accent-bright: #FBBF24;
  --accent-soft: rgba(245, 158, 11, 0.14);
  --accent-edge: rgba(245, 158, 11, 0.30);
  --highlight:   rgba(245, 158, 11, 0.28);

  --shadow-sm: 0 1px 0 rgba(0, 0, 0, 0.4);
  --shadow:    0 8px 30px -12px rgba(0, 0, 0, 0.6);
}

/* ---------- 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(--sans);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background var(--t), color var(--t);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img { max-width: 100%; display: block; }
a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: var(--accent-soft);
  transition: color var(--t), text-decoration-color var(--t);
}
a:hover { color: var(--accent-2); text-decoration-color: currentColor; }
button { font: inherit; cursor: pointer; background: none; border: none; color: inherit; padding: 0; }
ul, ol { padding: 0; margin: 0; list-style: none; }

p { margin: 0 0 1.1em; }

.serif { font-family: var(--serif); font-weight: 600; }
.italic { font-style: italic; }

/* highlight / marker effect */
.mark {
  background: linear-gradient(transparent 65%, var(--highlight) 65%, var(--highlight) 92%, transparent 92%);
  padding: 0 0.06em;
}
.mark-soft {
  background: linear-gradient(transparent 70%, var(--highlight) 70%, var(--highlight) 95%, transparent 95%);
}

/* ---------- Layout helpers ---------- */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}
.container.narrow { max-width: var(--narrow); }
@media (min-width: 768px) { .container { padding: 0 40px; } }

main { flex: 1; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in oklab, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--t);
}
.topbar.scrolled { border-bottom-color: var(--rule); }
.topbar-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
@media (min-width: 768px) { .topbar-inner { padding: 14px 40px; } }
.logo {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 700;
  font-size: 22px;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.logo:hover { color: var(--accent); text-decoration: none; }
.logo .dot { color: var(--accent); }

.topnav {
  display: none;
  gap: 24px;
  font-family: var(--mono);
  font-size: 13px;
}
.topnav a {
  color: var(--text-soft);
  text-decoration: none;
  letter-spacing: 0.02em;
}
.topnav a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 4px; }
@media (min-width: 760px) { .topnav { display: flex; } }

.theme-btn {
  width: 36px; height: 36px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  color: var(--text-soft);
  border: 1px solid var(--rule);
  background: var(--surface);
  transition: color var(--t), border-color var(--t), transform var(--t);
}
.theme-btn:hover { color: var(--accent); border-color: var(--accent); transform: rotate(20deg); }
.theme-btn svg { width: 16px; height: 16px; }
.icon-sun, .icon-moon { display: none; }
[data-theme='light'] .icon-moon { display: block; }
[data-theme='dark']  .icon-sun  { display: block; }

/* ---------- Section base ---------- */
.section {
  padding: 72px 0;
}
@media (min-width: 768px) { .section { padding: 96px 0; } }

.section-label {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 22px;
}
.section-h {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 36px;
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--text);
  margin: 0 0 18px;
}
@media (min-width: 768px) { .section-h { font-size: 44px; } }

.section-sub {
  color: var(--text-soft);
  font-size: 17px;
  margin: 0 0 36px;
  max-width: 56ch;
}

/* ---------- Hero (slim — kicker + CTAs only) ---------- */
.hero {
  padding: 56px 0 32px;
}
@media (min-width: 768px) { .hero { padding: 80px 0 48px; } }

.kicker {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.10em;
  color: var(--text-mute);
  margin: 0 0 18px;
}

.hero-intro {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 22px;
  line-height: 1.4;
  letter-spacing: -0.005em;
  color: var(--text);
  max-width: 38ch;
  margin: 0 0 28px;
}
@media (min-width: 768px) { .hero-intro { font-size: 26px; max-width: 42ch; } }

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}
.link-btn {
  font-family: var(--mono);
  font-size: 13.5px;
  letter-spacing: 0.02em;
  color: var(--text);
  text-decoration: none;
  padding: 12px 18px;
  border: 1px solid var(--text);
  border-radius: 999px;
  transition: background var(--t), color var(--t), border-color var(--t), transform var(--t);
}
.link-btn:hover {
  background: var(--text);
  color: var(--bg);
  text-decoration: none;
  transform: translateY(-1px);
}
.link-btn.ghost {
  border-color: var(--rule);
  color: var(--text-soft);
}
.link-btn.ghost:hover {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

/* ---------- Divider ---------- */
.divider {
  text-align: center;
  font-size: 18px;
  color: var(--text-mute);
  letter-spacing: 0.5em;
  padding: 0 0 0 0.5em;
  user-select: none;
}

/* ---------- Prose (About) ---------- */
.prose {
  font-size: 18px;
  line-height: 1.75;
  color: var(--text-soft);
}
.prose p { margin: 0 0 1.2em; }
.prose strong { color: var(--text); font-weight: 600; }
.prose em { color: var(--text); font-style: italic; }
.prose a { color: var(--accent); text-decoration-color: var(--accent-soft); }
.prose a:hover { text-decoration-color: currentColor; }

/* ---------- Now ---------- */
.now-list {
  margin: 0 0 32px;
  border-top: 1px dashed var(--rule);
}
.now-list li {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 20px;
  padding: 18px 0;
  border-bottom: 1px dashed var(--rule);
  font-size: 16.5px;
  color: var(--text-soft);
  line-height: 1.6;
}
@media (min-width: 640px) {
  .now-list li { grid-template-columns: 110px 1fr; gap: 32px; }
}
.now-tag {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  padding-top: 4px;
}
.now-list strong { color: var(--text); font-weight: 600; }
.now-updated {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text-mute);
  margin: 0;
}
.now-updated a { color: var(--text-mute); text-decoration: underline; text-decoration-color: var(--rule); }
.now-updated a:hover { color: var(--accent); }

/* ---------- Notes (blog list on home) ---------- */
.notes-list {
  margin: 0;
}
.notes-loading,
.notes-empty {
  font-style: italic;
  color: var(--text-mute);
  padding: 14px 0;
}
.note-item {
  padding: 26px 0;
  border-top: 1px solid var(--rule);
}
.note-item:last-child { border-bottom: 1px solid var(--rule); }

.note-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text-mute);
  margin-bottom: 10px;
}
.note-tag {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  letter-spacing: 0.04em;
}
.note-tag.draft { background: var(--bg-soft); color: var(--text-mute); }

.note-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 24px;
  letter-spacing: -0.005em;
  line-height: 1.25;
  margin: 0 0 8px;
}
@media (min-width: 768px) { .note-title { font-size: 28px; } }
.note-title a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  transition: color var(--t), text-decoration-color var(--t);
}
.note-title a:hover {
  color: var(--accent);
  text-decoration-thickness: 3px;
}
.note-excerpt {
  color: var(--text-soft);
  font-size: 16px;
  line-height: 1.6;
  margin: 0 0 14px;
}
.note-readmore {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-edge);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 999px;
  transition: gap var(--t), color var(--t), background var(--t), border-color var(--t);
}
.note-readmore:hover {
  color: var(--surface);
  background: var(--accent);
  border-color: var(--accent);
  gap: 12px;
}
[data-theme='dark'] .note-readmore:hover { color: #1a1306; }
.note-readmore-soon {
  color: var(--text-mute);
  background: var(--bg-soft);
  border-color: var(--rule);
  font-style: italic;
}
.note-readmore-soon:hover {
  color: var(--text-mute);
  background: var(--bg-soft);
  border-color: var(--rule);
  gap: 8px;
}
[data-theme='dark'] .note-readmore-soon:hover { color: var(--text-mute); }

/* ---------- Contact / say hi ---------- */
.contact-prose {
  font-size: 17px;
  color: var(--text-soft);
  max-width: 56ch;
  margin: 0 0 28px;
}
.contact-links {
  border-top: 1px solid var(--rule);
}
.contact-links li {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--rule);
  align-items: baseline;
}
.contact-key {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-mute);
}
.contact-links a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--rule);
  word-break: break-all;
}
.contact-links a:hover { color: var(--accent); text-decoration-color: currentColor; }

/* ---------- Footer ---------- */
.footer {
  padding: 40px 0 60px;
  margin-top: 40px;
  border-top: 1px solid var(--rule);
  background: var(--bg);
}
.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text-mute);
}
@media (min-width: 640px) {
  .footer-inner { flex-direction: row; justify-content: space-between; align-items: flex-start; }
}
.footer strong { color: var(--text-soft); font-weight: 600; }
.footer-meta { display: flex; flex-direction: column; gap: 4px; }
@media (min-width: 640px) { .footer-meta { text-align: right; } }

/* ---------- Selection / focus ---------- */
::selection { background: var(--highlight); color: var(--text); }
:focus-visible {
  outline: 2px dashed var(--accent);
  outline-offset: 4px;
  border-radius: 4px;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
}

/* ============================================================
   ARTICLE PAGES (blog/*.html)
   Header + main + sidebar layout. Reused.
   ============================================================ */

/* Article + sidebar layout */
.article-layout {
  max-width: var(--container);
  margin: 0 auto;
  padding: 32px 24px 48px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  align-items: start;
}
@media (min-width: 640px) { .article-layout { padding: 40px 28px 64px; } }
@media (min-width: 980px) { .article-layout { padding: 56px 36px 80px; } }
@media (min-width: 900px) {
  .article-layout {
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 56px;
  }
}

.article-layout .article {
  max-width: 720px;
  width: 100%;
  margin: 0;
  padding: 0;
}

.article {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 24px 48px;
}
@media (min-width: 640px) { .article { padding: 40px 28px 64px; } }
@media (min-width: 980px) { .article { padding: 56px 36px 80px; } }

.article-head {
  margin-bottom: 36px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--rule);
}
@media (min-width: 980px) { .article-head { margin-bottom: 48px; padding-bottom: 36px; } }

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text-mute);
  margin-bottom: 18px;
}
.article-tag {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  letter-spacing: 0.04em;
}
.article-readtime {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-mute);
  font-size: 12px;
}
.article-readtime::before {
  content: "·";
  color: var(--text-mute);
  margin: 0 4px 0 0;
}

.article-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 36px;
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0 0 18px;
}
@media (min-width: 768px) { .article-title { font-size: 48px; } }
@media (min-width: 980px) { .article-title { font-size: 56px; } }

.article-lede {
  font-size: 18px;
  line-height: 1.55;
  color: var(--text-soft);
  margin: 0;
}
@media (min-width: 768px) { .article-lede { font-size: 20px; } }

.article-body {
  font-size: 17.5px;
  line-height: 1.75;
  color: var(--text-soft);
}
.article-body p { margin: 0 0 1.2em; }
.article-body strong { color: var(--text); font-weight: 600; }
.article-body em { color: var(--text); font-style: italic; }
.article-body a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.article-body a:hover { color: var(--accent-2); }
.article-body h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 26px;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--text);
  margin: 2.2em 0 0.6em;
}
@media (min-width: 768px) { .article-body h2 { font-size: 30px; } }
.article-body ul, .article-body ol {
  margin: 0 0 1.2em;
  padding-left: 1.5em;
  list-style: disc;
}
.article-body li { margin: 0 0 0.4em; }
.article-body code {
  font-family: var(--mono);
  font-size: 0.92em;
  background: var(--bg-soft);
  border: 1px solid var(--rule);
  padding: 1px 6px;
  border-radius: 4px;
}
.article-body blockquote {
  border-left: 3px solid var(--accent);
  margin: 1.4em 0;
  padding: 6px 0 6px 18px;
  color: var(--text-soft);
  font-style: italic;
}

.article-foot {
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid var(--rule);
}

/* ============================================================
   Inline figures / charts inside articles
   Theme-aware via CSS variables. SVGs use classes below.
   ============================================================ */
.article-figure {
  margin: 2em 0;
  padding: 22px 22px 18px;
  background: var(--bg-soft);
  border: 1px solid var(--rule);
  border-radius: 14px;
}
.article-figure svg {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}
.article-figcaption {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-mute);
  margin-top: 14px;
  line-height: 1.55;
  text-align: center;
}
.article-figcaption strong {
  color: var(--text-soft);
  font-weight: 600;
}
.article-figcaption a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--accent-soft);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.article-figcaption a:hover {
  text-decoration-color: var(--accent);
}

/* Chart internals */
.chart-title {
  fill: var(--text);
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 14px;
  font-weight: 600;
}
.chart-label {
  fill: var(--text-soft);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
}
.chart-label-x {
  fill: var(--text-mute);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10.5px;
}
.chart-value {
  fill: var(--text);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11.5px;
  font-weight: 600;
}
.chart-axis {
  stroke: var(--text-mute);
  stroke-width: 1;
  stroke-dasharray: 2 3;
  opacity: 0.5;
}
.chart-axis-label {
  fill: var(--text-mute);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
}
.chart-track {
  fill: var(--rule);
}
.chart-bar {
  fill: var(--accent);
}
.chart-bar-muted {
  fill: var(--text-mute);
  opacity: 0.55;
}
.chart-sub {
  fill: var(--text-mute);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
  font-style: italic;
}
@media (min-width: 980px) { .article-foot { margin-top: 72px; padding-top: 36px; } }
.back-link {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-soft);
  text-decoration: none;
  transition: color var(--t);
}
.back-link:hover { color: var(--accent); }

/* ----- Sidebar ----- */
.article-sidebar {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 22px;
  padding: 24px;
  font-size: 14px;
}
@media (min-width: 900px) {
  .article-sidebar { position: sticky; top: 88px; }
}

.sidebar-name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 18px;
  text-align: center;
  margin: 0 0 4px;
  color: var(--text);
}
.sidebar-role {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  color: var(--text-mute);
  text-align: center;
  margin-bottom: 16px;
}
.sidebar-bio {
  font-size: 13.5px;
  color: var(--text-soft);
  line-height: 1.55;
  margin: 0 0 18px;
}
.sidebar-section {
  border-top: 1px solid var(--rule);
  padding-top: 14px;
  margin-bottom: 18px;
}
.sidebar-section h3 {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 12px;
  font-weight: 600;
}
.sidebar-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sidebar-links a {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: var(--text);
  text-decoration: none;
  padding: 4px 0;
  transition: color var(--t);
}
.sidebar-links a:hover { color: var(--accent); }
.sidebar-links svg { width: 14px; height: 14px; flex-shrink: 0; color: var(--text-mute); }
.sidebar-links a:hover svg { color: var(--accent); }

.sidebar-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.sidebar-topic {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-edge);
  padding: 3px 9px;
  border-radius: 999px;
}

.sidebar-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: var(--surface);
  font-weight: 600;
  font-size: 13.5px;
  padding: 12px 18px;
  border-radius: 999px;
  text-decoration: none;
  transition: background var(--t), transform var(--t);
  width: 100%;
  box-sizing: border-box;
}
[data-theme='dark'] .sidebar-cta { color: #1a1306; }
.sidebar-cta:hover {
  background: var(--accent-2);
  transform: translateY(-1px);
}
