/* Local Self-Hosted Webfonts */
@font-face {
  font-family: 'EB Garamond';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../webfonts/eb-garamond-normal.woff2") format("woff2");
}

@font-face {
  font-family: 'EB Garamond';
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url("../webfonts/eb-garamond-italic.woff2") format("woff2");
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("../webfonts/jetbrains-mono-normal.woff2") format("woff2");
}

/* Monograph & Broadside Design System */
:root {
  color-scheme: light dark;
  --bg: #fbf9f4;
  --bg-cell: #f7f5ef;
  --text: #1c1917;
  --muted: #78716c;
  --link: #991b1b;
  --link-hover: #b91c1c;
  --border: #e7e5e4;
  --surface: #f4f1ea;
  --code-bg: #ece8df;
  --font-serif: 'EB Garamond', Garamond, Georgia, serif;
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151413;
    --bg-cell: #1d1b19;
    --text: #ede7dc;
    --muted: #9d9588;
    --link: #d99b43;
    --link-hover: #e6af5c;
    --border: #312c26;
    --surface: #1e1b19;
    --code-bg: #26231f;
  }
}

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

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

body {
  background-color: transparent;
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 1.18rem;
  line-height: 1.75;
  padding: 3.5rem 2rem 5rem;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#game-of-life-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
}

a {
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

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

/* Broadside 2-Column Responsive Layout */
.broadside-layout {
  max-width: 1060px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 4.5rem;
}

/* Sticky Desktop Sidebar */
.sidebar {
  position: sticky;
  top: 3.5rem;
  height: fit-content;
  font-size: 0.95rem;
}

.avatar {
  width: 90px;
  height: 90px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--border);
  margin-bottom: 1.25rem;
  display: block;
}

.avatar-link {
  display: block;
  width: fit-content;
  border-bottom: none;
}

.avatar-link:hover,
.avatar-link:focus {
  border-bottom: none;
}

.site-title {
  font-size: 2.1rem;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.site-title a {
  color: var(--text);
  border-bottom: none;
}

.site-title a:hover,
.site-title a:focus {
  color: var(--text);
  border-bottom: none;
}

.site-tagline {
  color: var(--muted);
  font-style: italic;
  margin-top: 0.35rem;
  font-size: 1.05rem;
  line-height: 1.4;
}

.sidebar-nav {
  margin: 2.25rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.sidebar-nav a {
  color: var(--muted);
  border-bottom: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  color: var(--text);
}

.sidebar-nav a.active::before {
  content: '›';
  color: var(--link);
  font-weight: bold;
}

.sidebar-social {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.sidebar-social a {
  color: var(--muted);
  border-bottom: none;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.sidebar-social a:hover {
  color: var(--text);
}

.sidebar-social i {
  width: 16px;
  text-align: center;
  font-size: 0.95rem;
}

/* Main Content Area */
.main-content {
  min-width: 0;
}

.lead-bio {
  font-size: 1.28rem;
  line-height: 1.8;
  margin-bottom: 2.5rem;
}

.lead-bio h4 {
  font-size: 1.18rem;
  font-weight: 600;
  color: var(--text);
  margin-top: 2rem;
  margin-bottom: 0.65rem;
}

.lead-bio h4:first-child {
  margin-top: 0;
}

.lead-bio p {
  margin-bottom: 1.25rem;
}

.lead-bio ul {
  list-style: none;
  margin: 0.85rem 0 1.5rem;
  padding: 0;
}

.lead-bio li {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: 0.85rem;
  line-height: 1.75;
}

.lead-bio li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--muted);
}

/* Sections */
.section {
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.section-header-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.section-title {
  font-size: 1.55rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.section-action {
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.group-title {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 1.85rem 0 1rem;
}

/* Editorial Lists */
.editorial-list {
  list-style: none;
}

.editorial-list li {
  margin-bottom: 2.25rem;
}

.entry-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.entry-title {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  min-width: 0;
}

.entry-name {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
}

.media-type-icon {
  color: var(--muted);
  font-size: 0.9em;
  opacity: 0.85;
  flex-shrink: 0;
}

.entry-meta {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
}

.entry-desc {
  margin: 0.4rem 0 0.5rem;
  color: var(--text);
  font-size: 1.08rem;
}

.entry-links {
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.entry-links .dot {
  margin: 0 0.35rem;
  color: var(--border);
}

/* Now Box */
.now-box {
  background: var(--surface);
  border-left: 3px solid var(--link);
  padding: 1.35rem 1.6rem;
  border-radius: 0 6px 6px 0;
  margin-bottom: 2rem;
}

.now-box p {
  margin-bottom: 0.6rem;
  font-size: 1.12rem;
}

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

.meta-note {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.6rem;
}

/* Personal Quirks & Stories */
.stories-list {
  list-style: none;
}

.stories-list li {
  margin-bottom: 1.25rem;
  position: relative;
  padding-left: 1.4rem;
}

.stories-list li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--link);
}

.sheldon-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  background: var(--surface);
  padding: 1.25rem;
  border-radius: 6px;
  margin-top: 1rem;
}

.sheldon-thumb {
  width: 76px;
  height: 76px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

.sheldon-caption {
  font-size: 1.05rem;
}

.connecting-box {
  background: var(--surface);
  border-radius: 6px;
  padding: 1.4rem 1.6rem;
  margin-top: 2rem;
}

.connecting-box h4 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.connecting-box p {
  font-size: 1.08rem;
  line-height: 1.7;
}

/* Poetry Styling */
.poem-card {
  margin-bottom: 2.75rem;
}

.poem-title {
  font-size: 1.55rem;
  font-weight: 600;
  font-style: italic;
  margin-bottom: 0.25rem;
}

.poem-title a {
  color: var(--text);
  border-bottom: none;
}

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

.poem-published {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.poem-content {
  line-height: 1.85;
  font-size: 1.18rem;
  white-space: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.poem-content p {
  margin-bottom: 1rem;
}

.poem-stanza-indent {
  margin: 0.85rem 0 0.85rem 3.5rem;
}

.poem-epigraph {
  margin-top: 1.5rem;
  font-size: 0.95rem;
  color: var(--muted);
  text-align: right;
  font-style: italic;
  white-space: normal;
}

.poem-attribution {
  margin-top: 4rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--muted);
  white-space: normal;
}

.poem-page-container {
  max-width: 680px;
  padding-bottom: 5rem;
}

/* Article & Prose Styling */
.article-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.article-title {
  font-size: 2.3rem;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 0.75rem;
}

.article-title-image {
  margin: 0 0 1.25rem 0;
  line-height: 0;
}

.blog-header-image {
  width: 100%;
  max-width: 600px;
  height: auto;
  display: block;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.article-meta {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.article-body {
  font-size: 1.18rem;
  line-height: 1.8;
}

.article-body p {
  margin-bottom: 1.4rem;
}

.article-body h2 {
  font-size: 1.65rem;
  font-weight: 600;
  margin: 2.5rem 0 1rem;
  letter-spacing: -0.01em;
}

.article-body h3 {
  font-size: 1.35rem;
  font-weight: 600;
  margin: 2rem 0 0.75rem;
}

.article-body ul,
.article-body ol {
  margin: 1.25rem 0 1.5rem 2rem;
}

.article-body li {
  margin-bottom: 0.5rem;
}

.article-body blockquote {
  border-left: 3px solid var(--link);
  padding-left: 1.25rem;
  margin: 1.5rem 0;
  color: var(--muted);
  font-style: italic;
}

.article-body img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  border: 1px solid var(--border);
  margin: 1.5rem 0;
  display: block;
}

.article-body figure {
  margin: 2rem 0;
}

.article-body figcaption {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.5rem;
  text-align: center;
}

code,
kbd,
samp,
.article-body code {
  font-family: var(--font-mono);
  font-size: 0.82em;
  background: var(--code-bg);
  padding: 0.15em 0.35em;
  border-radius: 4px;
}

pre,
.article-body pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.1rem 1.25rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.6;
}

pre code,
.article-body pre code {
  background: transparent;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
}

.canonical-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 2.5rem;
}

/* Responsive / Mobile Breakpoint */
@media (max-width: 860px) {
  body {
    padding: 2rem 1rem 4rem;
  }

  .broadside-layout {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    width: 100%;
    min-width: 0;
  }

  .sidebar {
    position: static;
    top: auto;
    border-bottom: none;
    padding-bottom: 0;
    width: 100%;
    min-width: 0;
  }

  .avatar {
    width: 68px;
    height: 68px;
    margin-bottom: 0.85rem;
  }

  .site-title {
    font-size: 1.85rem;
  }

  .sidebar-links {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem 0.5rem;
    margin-top: 1.25rem;
    padding: 0.75rem 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
  }

  .sidebar-nav {
    margin: 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.65rem;
    font-size: 0.78rem;
    flex-shrink: 0;
  }

  .sidebar-nav a {
    gap: 0.25rem;
  }

  .sidebar-nav a.active::before {
    display: none;
  }

  .sidebar-nav a.active {
    color: var(--link);
    font-weight: 600;
  }

  .sidebar-social {
    margin: 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.55rem;
    flex-shrink: 0;
  }

  .sidebar-social a {
    font-size: 0;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
  }

  .sidebar-social i {
    width: auto;
    font-size: 0.95rem;
  }

  .social-label,
  .feed-label {
    display: none;
  }
}

/* Accessibility */
.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  background: var(--text);
  color: var(--bg);
  padding: 0.5rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  z-index: 10000;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: top 0.15s ease-out;
}

.skip-link:focus {
  top: 1rem;
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Syntax Highlighting (Monograph & Broadside Palette) */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
  color: var(--muted);
  font-style: italic;
}

.token.punctuation {
  color: #57534e;
}

.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol {
  color: #b45309;
}

.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin {
  color: #1e5e3a;
}

.token.operator,
.token.entity,
.token.url {
  color: #78716c;
}

.token.atrule,
.token.attr-value,
.token.keyword {
  color: #991b1b;
  font-weight: 500;
}

.token.function,
.token.class-name {
  color: #8c3a10;
}

.token.regex,
.token.important,
.token.variable {
  color: #831843;
}

@media (prefers-color-scheme: dark) {
  .token.comment,
  .token.prolog,
  .token.doctype,
  .token.cdata {
    color: var(--muted);
  }

  .token.punctuation {
    color: #a8a29e;
  }

  .token.property,
  .token.tag,
  .token.boolean,
  .token.number,
  .token.constant,
  .token.symbol {
    color: #e5c07b;
  }

  .token.selector,
  .token.attr-name,
  .token.string,
  .token.char,
  .token.builtin {
    color: #78b88e;
  }

  .token.operator,
  .token.entity,
  .token.url {
    color: #9d9588;
  }

  .token.atrule,
  .token.attr-value,
  .token.keyword {
    color: #d99b43;
  }

  .token.function,
  .token.class-name {
    color: #f08c54;
  }

  .token.regex,
  .token.important,
  .token.variable {
    color: #e06c75;
  }
}

