@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&family=Inter:wght@400;500;600;700&family=Newsreader:opsz,wght@6..72,400;500;600&display=swap');

:root {
  --bg-color: #c8c1b4;
  --surface-color: #c8c1b4;
  --panel-bg: #c8c1b4;
  --text-primary: #111111;
  --text-color: #111111;
  --text-secondary: #111111;
  --text-muted: #4a4540;
  --link-color: #111111;
  --link-hover: #111111;
  --border-color: #b0a99c;
  --code-bg: #beb7ab;
  --blockquote-color: #111111;
  --panel-strong: #111111;
  --accent: #111111;
  --selection-bg: #111111;
  --selection-text: #c8c1b4;
  --canvas-1: #111111;
  --canvas-2: #2c2c2c;
  --canvas-3: #454545;
  --canvas-4: #5f5f5f;
  --canvas-5: #787878;
  --canvas-6: #929292;
  --monospace: 'IBM Plex Mono', 'SFMono-Regular', Consolas, monospace;
}

body.dark-mode {
  --bg-color: #060606;
  --surface-color: #060606;
  --panel-bg: #060606;
  --text-primary: #f3f3f3;
  --text-color: #f3f3f3;
  --text-secondary: #f3f3f3;
  --text-muted: #f3f3f3;
  --link-color: #f3f3f3;
  --link-hover: #f3f3f3;
  --border-color: #2a2a2a;
  --code-bg: #121212;
  --blockquote-color: #f3f3f3;
  --panel-strong: #f3f3f3;
  --accent: #f3f3f3;
  --selection-bg: #f3f3f3;
  --selection-text: #060606;
  --canvas-1: #f3f3f3;
  --canvas-2: #dddddd;
  --canvas-3: #c5c5c5;
  --canvas-4: #acacac;
  --canvas-5: #949494;
  --canvas-6: #7b7b7b;
}

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

html {
  scroll-behavior: smooth;
  background: var(--bg-color);
}

body {
  min-height: 100vh;
  background: var(--bg-color);
  color: var(--text-color);
  font-family: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.25s ease, color 0.25s ease;
}

a {
  color: var(--link-color);
  text-decoration: none;
  transition: color 0.2s ease, border-color 0.2s ease;
}

a:hover {
  color: var(--link-hover);
}

code, pre, samp, kbd {
  font-family: var(--monospace);
}

.content-card,
.container {
  width: min(980px, calc(100% - 48px));
  margin: 0 auto;
  padding: 36px 0 56px;
  background: var(--surface-color);
  animation: fadeIn 0.45s ease-out both;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
  padding: 0 0 20px;
  border-bottom: 1px solid var(--border-color);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.site-title {
  font-family: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: clamp(38px, 5.5vw, 54px);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  line-height: 1.1;
}

.lorenz-container {
  width: 112px;
  height: 68px;
  flex-shrink: 0;
  pointer-events: none;
}

#lorenzCanvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  background: transparent;
}

nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 18px;
}

.nav-link {
  color: var(--text-secondary);
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text-primary);
  border-bottom-color: currentColor;
}

.theme-toggle {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: transparent;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.theme-toggle:hover {
  border-color: var(--text-primary);
  transform: translateY(-1px);
}

.theme-toggle svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}

.theme-icon {
  display: block;
}

body.dark-mode .sun-icon { display: none; }
body.dark-mode .moon-icon { display: block; }
body:not(.dark-mode) .sun-icon { display: block; }
body:not(.dark-mode) .moon-icon { display: none; }

main {
  display: grid;
  gap: 40px;
  padding-top: 28px;
}

.intro-grid,
.notes-grid {
  display: grid;
  gap: 32px;
  align-items: start;
}

.intro-grid {
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.9fr);
}

.notes-grid {
  grid-template-columns: minmax(0, 1.25fr) minmax(250px, 0.85fr);
}

.greeting {
  font-family: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: clamp(28px, 3.8vw, 36px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.015em;
  color: var(--text-primary);
  margin-bottom: 20px;
}

.lede {
  max-width: 44ch;
  color: var(--text-secondary);
  font-size: 17px;
  margin-bottom: 10px;
}

.bio p {
  margin-bottom: 18px;
}

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

.bio strong {
  color: var(--text-primary);
}

.bio a {
  border-bottom: 1px solid currentColor;
}

.ascii-panel {
  border: 0;
  background: transparent;
  padding: 0;
}

.ascii-art {
  min-height: 18em;
  white-space: pre;
  overflow: hidden;
  font-family: var(--monospace);
  font-size: 12px;
  line-height: 1.02;
  color: var(--panel-strong);
}

.ascii-art-compact {
  min-height: 10.6em;
  font-size: 11px;
}

.side-notes {
  display: grid;
  gap: 0;
}

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

.section-heading {
  font-family: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 28px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.blog-list {
  max-width: 100%;
}

.blog-item {
  padding: 0 0 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}

.blog-item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 0;
}

.blog-title {
  font-family: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 4px;
}

.blog-title a {
  color: var(--text-primary);
  border-bottom: 1px solid transparent;
}

.blog-title a:hover {
  border-bottom-color: currentColor;
}

.blog-date,
.blog-meta {
  color: var(--text-muted);
  font-size: 13px;
}

.back-link {
  display: inline-block;
  margin-bottom: 24px;
  font-size: 14px;
  color: var(--text-secondary);
  border-bottom: 1px solid transparent;
}

.back-link:hover {
  border-bottom-color: currentColor;
}

::selection {
  background: var(--selection-bg);
  color: var(--selection-text);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@media screen and (max-width: 900px) {
  .intro-grid,
  .notes-grid {
    grid-template-columns: 1fr;
  }

  .content-card,
  .container {
    width: min(980px, calc(100% - 40px));
    padding-top: 28px;
    padding-bottom: 40px;
  }
}

@media screen and (max-width: 768px) {
  .site-title { font-size: 36px; }
  .lorenz-container { width: 92px; height: 56px; }
  .greeting { font-size: 28px; }
  .nav-link { font-size: 13px; }
  .ascii-art { font-size: 10px; }
}

@media screen and (max-width: 480px) {
  .content-card,
  .container {
    width: calc(100% - 24px);
    padding-top: 20px;
    padding-bottom: 28px;
  }

  header { gap: 14px; padding-bottom: 16px; }
  .header-brand { gap: 10px; }
  .site-title { font-size: 28px; }
  .lorenz-container { width: 76px; height: 46px; }
  .greeting { font-size: 22px; }

  .lede, .bio p { font-size: 15px; }
  .ascii-art { min-height: 15em; font-size: 9px; }
  .ascii-art-compact { min-height: 8.8em; }
}

@media (prefers-reduced-motion: reduce) {
  html, body, .content-card, .container, .greeting, .theme-toggle {
    animation: none !important;
    transition: none !important;
  }
}
