/* WriteKit Tenant - Plane Design Aesthetic */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #fafafa;
  --text: #0a0a0a;
  --muted: #737373;
  --border: #e5e5e5;
  /* --accent and --font-body are set dynamically in base.html */
  --accent: #10b981;
  --font-body: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  font-size: 14px;
}

/* Layout */
.layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  min-height: 100vh;
}

/* Sidebar */
aside {
  padding: 2rem 1.5rem;
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.sidebar-top {
  display: flex;
  flex-direction: column;
}

.sidebar-profile {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
}

.sidebar-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 0.5rem;
}

.sidebar-avatar-default {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 16px;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.sidebar-name {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}

.sidebar-name:hover {
  color: var(--accent);
}

.sidebar-role {
  font-size: 12px;
  color: var(--muted);
}

.logo {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2rem;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
  display: block;
}

nav {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

nav a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}

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

.studio-btn {
  display: block;
  padding: 0.75rem 1rem;
  background: var(--text);
  color: var(--bg);
  text-decoration: none;
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  transition: opacity 0.15s;
}

.studio-btn:hover {
  opacity: 0.9;
}

/* Search Trigger */
.search-trigger {
  margin-top: 1.5rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  background: var(--bg);
  font-family: inherit;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.search-trigger:hover {
  border-color: var(--muted);
  color: var(--text);
}

.search-trigger kbd {
  font-family: inherit;
  font-size: 11px;
  padding: 0.15em 0.4em;
  border: 1px solid var(--border);
  background: var(--bg);
}

/* Search Modal */
.search-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
}

.search-modal.active {
  display: block;
}

.search-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 10, 0.5);
}

.search-modal-content {
  position: absolute;
  top: 15%;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 560px;
  background: var(--bg);
  border: 1px solid var(--border);
}

.search-modal #search-input {
  width: 100%;
  padding: 1rem 1.25rem;
  border: none;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  font-family: inherit;
  font-size: 15px;
  outline: none;
}

.search-modal .search-results {
  max-height: 400px;
  overflow-y: auto;
}

.search-modal .search-result {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.search-modal .search-result:last-child {
  border-bottom: none;
}

.search-modal .search-result a {
  text-decoration: none;
  color: inherit;
  display: block;
}

.search-modal .search-result:hover,
.search-modal .search-result.focused {
  background: var(--border);
}

.search-modal .search-result-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.search-modal .search-result-title {
  font-size: 14px;
  font-weight: 500;
}

.search-modal .search-result-badge {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.4rem;
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent);
  border-radius: 3px;
}

.search-modal .search-result-snippet {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.search-modal .search-result-title mark,
.search-modal .search-result-snippet mark {
  background: color-mix(in srgb, var(--accent) 30%, transparent);
  color: inherit;
}

.search-modal .search-no-results {
  padding: 1rem 1.25rem;
  font-size: 13px;
  color: var(--muted);
}

.search-hint {
  padding: 0.75rem 1.25rem;
  font-size: 11px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  text-align: right;
}

/* Main Content */
main {
  padding: 2rem 3rem;
  max-width: 800px;
}

/* Home - Hero Section */
.hero-home {
  padding: 4rem 0 3rem;
}

.hero-home .hero-label {
  display: block;
  font-size: 11px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 1.5rem;
}

.hero-home .hero-title {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.3;
  max-width: 600px;
  margin-bottom: 1.5rem;
}

.hero-links {
  display: flex;
  gap: 1.5rem;
}

.hero-links a {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}

.hero-links a:hover {
  color: var(--accent);
}

/* Home - Content Section */
.content-section {
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.content-section .section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.content-section .section-label {
  font-size: 11px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.section-link {
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}

.section-link:hover {
  color: var(--text);
}

/* Home - Posts Grid */
.posts-grid {
  display: grid;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
}

.post-card-home {
  background: var(--bg);
  padding: 1.5rem;
}

.post-card-home a {
  text-decoration: none;
  color: inherit;
  display: block;
}

.post-card-date {
  display: block;
  font-size: 11px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.post-card-title {
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  transition: color 0.15s;
}

.post-card-home a:hover .post-card-title {
  color: var(--accent);
}

.post-card-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

/* Home - Recent Posts (legacy) */
.recent-posts {
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.section-title {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 1rem;
}

.post-list-compact {
  list-style: none;
  padding: 0;
  margin: 0;
}

.post-list-compact li {
  border-bottom: 1px solid var(--border);
}

.post-list-compact a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.875rem 0;
  text-decoration: none;
  color: inherit;
  gap: 1rem;
}

.post-list-compact a:hover .post-title {
  color: var(--accent);
}

.post-list-compact .post-title {
  font-size: 14px;
  transition: color 0.15s;
}

.post-list-compact .post-date {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.view-all {
  display: inline-block;
  margin-top: 1.25rem;
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
}

.view-all:hover {
  color: var(--text);
}

/* Blog - Page Header */
.page-header {
  padding: 2rem 0;
  margin-bottom: 1rem;
}

.page-header h1 {
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.page-header p {
  color: var(--muted);
  font-size: 14px;
}

/* Tags Page */
.tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.tag-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  transition: all 0.15s;
}

.tag-link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.tag-link .tag-name {
  font-size: 13px;
  font-weight: 500;
}

.tag-link .tag-count {
  font-size: 11px;
  color: var(--muted);
  background: var(--border);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
}

.tag-link:hover .tag-count {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent);
}

/* Individual Tag Page */
.back-link {
  display: inline-block;
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 0.75rem;
}

.back-link:hover {
  color: var(--accent);
}

.empty-state {
  color: var(--muted);
  font-size: 14px;
  padding: 2rem 0;
}

/* Sections */
.section {
  margin-bottom: 3rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.section-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.section-link {
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
}

.section-link:hover {
  color: var(--text);
}

/* Posts Grid (Home) */
.posts-grid {
  display: grid;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
}

.post-card {
  background: var(--bg);
  padding: 1.5rem;
}

.post-card a {
  text-decoration: none;
  color: inherit;
}

.post-card .post-date {
  font-size: 11px;
  color: var(--muted);
  display: block;
  margin-bottom: 0.5rem;
}

.post-card h3 {
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.post-card p {
  font-size: 12px;
  color: var(--muted);
}

/* Posts List (Blog) */
.posts-list {
  display: flex;
  flex-direction: column;
}

.post-row {
  border-bottom: 1px solid var(--border);
}

.post-row a {
  display: block;
  padding: 1.25rem 0;
  text-decoration: none;
  color: inherit;
}

.post-row a:hover .post-title {
  color: var(--accent);
}

.post-row .post-date {
  font-size: 11px;
  color: var(--muted);
  display: block;
  margin-bottom: 0.25rem;
}

.post-row .post-title {
  font-size: 1.125rem;
  font-weight: 500;
  margin: 0;
  color: var(--text);
  transition: color 0.15s;
}

.post-row .post-desc {
  font-size: 13px;
  color: var(--muted);
  margin-top: 0.375rem;
}

/* Pagination */
.pagination {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: center;
  padding: 2rem 0;
}

.pagination a {
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
}

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

.pagination .page-info {
  font-size: 11px;
  color: var(--muted);
}

/* Post Content */
/* Post Article */
article.post {
  max-width: 680px;
}

.post-header {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.post-header .hero-label {
  font-size: 11px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 1rem;
}

.post-header h1 {
  font-size: 2rem;
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 1rem;
}

.post-header .hero-text {
  font-size: 1.125rem;
  color: var(--muted);
  line-height: 1.6;
}

.post-content {
  font-size: 15px;
  line-height: 1.8;
}

.post-content h2 {
  font-size: 1.5rem;
  font-weight: 500;
  margin: 2rem 0 1rem;
  letter-spacing: -0.02em;
}

.post-content h3 {
  font-size: 1.25rem;
  font-weight: 500;
  margin: 1.5rem 0 0.75rem;
}

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

.post-content a {
  color: var(--accent);
  text-decoration: none;
}

.post-content a:hover {
  text-decoration: underline;
}

.post-content code {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  background: var(--border);
  padding: 0.15em 0.4em;
  font-size: 0.9em;
  border-radius: 3px;
}

.post-content pre {
  margin: 1.5rem 0;
  padding: 1rem;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.6;
  border-radius: 4px;
  background: #fafafa;
}

.post-content pre code {
  background: none;
  padding: 0;
  font-size: inherit;
  border-radius: 0;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

/* Chroma syntax highlighting wrapper */
.post-content .chroma,
.post-content pre.chroma {
  margin: 1.5rem 0;
  padding: 1rem;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.6;
  border-radius: 4px;
}

.post-content .chroma code {
  background: none;
  padding: 0;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

/* Ensure chroma's inline styles take precedence */
.post-content .chroma .line {
  display: block;
}

.post-content .chroma .cl {
  display: inline;
}

/* Enhanced code blocks with title, line numbers, and highlighting */
.post-content .code-block {
  margin: 1.5rem 0;
  border-radius: 8px;
  overflow: hidden;
  background: #fafafa;
  border: 1px solid var(--border);
}

.post-content .code-block .code-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #f0f0f0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.post-content .code-block .code-lang {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.post-content .code-block .code-title {
  color: var(--foreground);
  font-weight: 500;
}

.post-content .code-block .code-copy {
  margin-left: auto;
  padding: 4px 8px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
}

.post-content .code-block .code-copy:hover {
  background: var(--background);
  color: var(--foreground);
  border-color: var(--accent);
}

.post-content .code-block pre {
  margin: 0;
  padding: 1rem;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.6;
  border-radius: 0;
  background: transparent;
}

.post-content .code-block code {
  background: none;
  padding: 0;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  display: block;
}

.post-content .code-block .line {
  display: block;
  padding: 0 4px;
  margin: 0 -4px;
}

.post-content .code-block .highlight-line {
  background: rgba(16, 185, 129, 0.1);
  border-left: 3px solid var(--accent);
  margin-left: -7px;
  padding-left: 7px;
}

/* Line numbers */
.post-content .code-block code.line-numbers {
  counter-reset: line-number attr(data-start);
}

.post-content .code-block code.line-numbers[data-start] {
  counter-reset: line-number calc(attr(data-start) - 1);
}

.post-content .code-block code.line-numbers .line::before {
  content: attr(data-line);
  display: inline-block;
  width: 2.5em;
  margin-right: 1em;
  padding-right: 0.5em;
  text-align: right;
  color: var(--muted);
  border-right: 1px solid var(--border);
  user-select: none;
}

/* Diff styling */
.post-content .code-block[data-lang="diff"] .line {
  padding-left: 8px;
}

.post-content .code-block .chroma .gd {
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
}

.post-content .code-block .chroma .gi {
  background: rgba(5, 150, 105, 0.1);
  color: #059669;
}

.post-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
  color: var(--muted);
  margin: 1.5rem 0;
  font-style: italic;
}

.post-content blockquote p:last-child {
  margin-bottom: 0;
}

.post-content ul, .post-content ol {
  margin: 1rem 0;
  padding-left: 1.5rem;
}

.post-content li {
  margin-bottom: 0.5rem;
}

.post-content li > ul,
.post-content li > ol {
  margin: 0.5rem 0 0;
}

.post-content img {
  max-width: 100%;
  height: auto;
  margin: 1.5rem 0;
  border-radius: 4px;
}

.post-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 14px;
}

.post-content th,
.post-content td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  text-align: left;
}

.post-content th {
  background: #fafafa;
  font-weight: 500;
}

.post-content tr:nth-child(even) td {
  background: #fafafa;
}

.post-content kbd {
  display: inline-block;
  padding: 0.15em 0.4em;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.85em;
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: 3px;
  box-shadow: inset 0 -1px 0 var(--border);
}

.post-content mark {
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  padding: 0.1em 0.2em;
  border-radius: 2px;
}

.post-content sup,
.post-content sub {
  font-size: 0.75em;
}

.post-content abbr {
  text-decoration: underline dotted;
  cursor: help;
}

.post-content del {
  color: var(--muted);
}

/* Footnotes */
.post-content .footnotes {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  font-size: 13px;
}

.post-content .footnotes hr {
  display: none;
}

.post-content .footnotes ol {
  padding-left: 1.25rem;
}

.post-content .footnotes li {
  margin-bottom: 0.75rem;
  color: var(--muted);
}

.post-content .footnotes li p {
  margin: 0;
  display: inline;
}

.post-content .footnote-ref {
  font-size: 0.75em;
  vertical-align: super;
  line-height: 0;
  margin-left: 0.1em;
}

.post-content .footnote-ref a {
  color: var(--accent);
  text-decoration: none;
}

.post-content .footnote-ref a:hover {
  text-decoration: underline;
}

.post-content .footnote-backref {
  font-size: 0.85em;
  margin-left: 0.25em;
  text-decoration: none;
}

/* Definition Lists */
.post-content dl {
  margin: 1.5rem 0;
}

.post-content dt {
  font-weight: 500;
  margin-top: 1rem;
}

.post-content dt:first-child {
  margin-top: 0;
}

.post-content dd {
  margin-left: 0;
  padding-left: 1rem;
  border-left: 2px solid var(--border);
  color: var(--muted);
  margin-top: 0.25rem;
}

/* Embeds */
.post-content iframe {
  max-width: 100%;
  margin: 1.5rem 0;
  border: 1px solid var(--border);
}

.post-content details {
  margin: 1.5rem 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.75rem 1rem;
}

.post-content summary {
  cursor: pointer;
  font-weight: 500;
}

.post-content details[open] summary {
  margin-bottom: 0.75rem;
}

/* Task list checkboxes */
.post-content input[type="checkbox"] {
  margin-right: 0.5rem;
  accent-color: var(--accent);
}

/* TOC */
.toc {
  margin: 3rem 0;
  padding: 1.25rem 1.5rem;
  background: #fafafa;
  border-radius: 4px;
}

.toc h4 {
  font-size: 10px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 1rem;
}

.toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc li {
  margin-bottom: 0.5rem;
}

.toc a {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  transition: color 0.15s;
}

.toc a:hover {
  color: var(--accent);
}

.toc-level-2 { padding-left: 0; }
.toc-level-3 { padding-left: 1rem; }
.toc-level-4 { padding-left: 2rem; }

/* Section headers for reactions/comments */
.section-header {
  margin-bottom: 1rem;
}

.section-label {
  font-size: 10px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

/* Reactions */
.reactions {
  margin: 3rem 0;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.reaction-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.reaction-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  transition: all 0.15s;
}

.reaction-btn:hover {
  border-color: var(--muted);
}

.reaction-btn.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.reaction-btn .emoji {
  font-size: 16px;
}

.reaction-btn .count {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 12px;
  color: var(--muted);
}

/* Comments */
.comments {
  margin: 3rem 0;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.comments-list {
  margin-bottom: 1.5rem;
}

.comment {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.comment-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.comment-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.comment-author {
  font-weight: 500;
  font-size: 13px;
}

.comment-date {
  font-size: 10px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  color: var(--muted);
}

.comment-content {
  font-size: 14px;
  line-height: 1.6;
}

/* Comment Form - Production Ready */
.comment-form {
  background: color-mix(in srgb, var(--text) 3%, var(--bg));
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.comment-form:focus-within {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 8%, transparent);
}

.comment-form textarea {
  width: 100%;
  min-height: 100px;
  padding: 0.875rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.65;
  resize: vertical;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.comment-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}

.comment-form textarea::placeholder {
  color: var(--muted);
  font-style: italic;
}

.comment-form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.75rem;
  gap: 1rem;
}

.comment-form button[type="submit"] {
  padding: 0.625rem 1.25rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.comment-form button[type="submit"]:hover {
  background: color-mix(in srgb, var(--accent) 85%, black);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 25%, transparent);
}

.comment-form button[type="submit"]:active {
  transform: translateY(0);
  box-shadow: none;
}

.comment-form button[type="submit"]::after {
  content: '→';
  font-size: 14px;
  transition: transform 0.2s ease;
}

.comment-form button[type="submit"]:hover::after {
  transform: translateX(2px);
}

/* Reaction Tooltip */
.reaction-btn {
  position: relative;
}

.reaction-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.reaction-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--text);
}

/* Threaded Comments */
.comment-depth-1 {
  margin-left: 2rem;
  padding-left: 1rem;
  border-left: 2px solid var(--border);
}

.comment-replies {
  margin-top: 0.5rem;
}

.comment-edited {
  font-size: 10px;
  color: var(--muted);
  font-style: italic;
}

.comment-actions {
  margin-top: 0.5rem;
  display: flex;
  gap: 0.75rem;
}

.comment-actions button {
  background: none;
  border: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s;
}

.comment-actions button:hover {
  color: var(--text);
}

.reply-form-inline,
.edit-form-inline {
  margin-top: 1rem;
  padding: 0.875rem;
  background: color-mix(in srgb, var(--text) 2%, var(--bg));
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.reply-form-inline:focus-within,
.edit-form-inline:focus-within {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 8%, transparent);
}

.reply-form-inline textarea,
.edit-form-inline textarea {
  width: 100%;
  min-height: 80px;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.reply-form-inline textarea:focus,
.edit-form-inline textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 10%, transparent);
}

.reply-form-actions,
.edit-form-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 0.625rem;
}

.reply-form-actions button,
.edit-form-actions button {
  padding: 0.5rem 0.875rem;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  transition: all 0.15s ease;
}

.reply-form-actions button:hover,
.edit-form-actions button:hover {
  background: color-mix(in srgb, var(--text) 5%, var(--bg));
}

.reply-form-actions button[type="submit"],
.edit-form-actions button[type="submit"] {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  font-weight: 600;
}

.reply-form-actions button[type="submit"]:hover,
.edit-form-actions button[type="submit"]:hover {
  background: color-mix(in srgb, var(--accent) 85%, black);
  transform: translateY(-1px);
}

/* Comment Toolbar - Polished */
.comment-toolbar {
  display: flex;
  gap: 0.375rem;
  margin-bottom: 0.625rem;
  padding-bottom: 0.625rem;
  border-bottom: 1px solid var(--border);
}

.md-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 6px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.md-btn:hover {
  background: color-mix(in srgb, var(--text) 8%, var(--bg));
  border-color: var(--border);
}

.md-btn:active {
  background: color-mix(in srgb, var(--text) 12%, var(--bg));
  transform: scale(0.95);
}

.md-btn svg {
  width: 14px;
  height: 14px;
  stroke: var(--text);
  stroke-width: 2;
  fill: none;
}

.md-btn-italic {
  font-style: italic;
}

.md-btn-bold {
  font-weight: 700;
}

/* Comment Content Markdown */
.comment-content p {
  margin: 0 0 0.5em;
}

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

.comment-content strong,
.comment-content b {
  font-weight: 600;
}

.comment-content em,
.comment-content i {
  font-style: italic;
}

.comment-content code {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.9em;
  background: #f5f5f5;
  padding: 0.125em 0.25em;
  border-radius: 3px;
}

.comment-content pre {
  background: #f5f5f5;
  padding: 0.75rem;
  overflow-x: auto;
  font-size: 13px;
  margin: 0.5em 0;
}

.comment-content pre code {
  background: none;
  padding: 0;
}

.comment-content blockquote {
  margin: 0.5em 0;
  padding-left: 1rem;
  border-left: 3px solid var(--border);
  color: var(--muted);
}

.comment-content a {
  color: var(--accent);
  text-decoration: none;
}

.comment-content a:hover {
  text-decoration: underline;
}

/* Mention Dropdown */
.mention-dropdown {
  position: fixed;
  background: var(--bg);
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  max-height: 200px;
  overflow-y: auto;
}

.mention-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-size: 13px;
}

.mention-item:hover,
.mention-item.focused {
  background: #f5f5f5;
}

.mention-item img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
}

.mention-avatar-placeholder {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--muted);
}

/* Login Modal */
.login-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.login-modal {
  background: var(--bg);
  width: 100%;
  max-width: 400px;
  margin: 1rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.login-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.login-modal-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.login-modal-close {
  background: none;
  border: none;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  padding: 0;
}

.login-modal-close:hover {
  color: var(--text);
}

.login-modal-content {
  padding: 1.5rem 1.25rem;
}

.login-modal-content p {
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-size: 14px;
}

.login-modal-providers {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.login-provider-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  background: var(--bg);
  text-decoration: none;
  color: var(--text);
  font-size: 14px;
  transition: all 0.15s;
}

.login-provider-btn:hover {
  background: #f5f5f5;
}

.login-provider-btn svg {
  flex-shrink: 0;
}

.login-no-providers {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

/* Post Navigation */
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.post-nav a {
  text-decoration: none;
  color: inherit;
  padding: 1rem;
  margin: -1rem;
  border-radius: 4px;
  transition: background 0.15s;
}

.post-nav a:hover {
  background: #fafafa;
}

.post-nav .label {
  font-size: 10px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: block;
  margin-bottom: 0.5rem;
}

.post-nav .title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  transition: color 0.15s;
}

.post-nav a:hover .title {
  color: var(--accent);
}

.post-nav .next {
  text-align: right;
}

/* Footer */
footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2rem 0;
  border-top: 1px solid var(--border);
  margin-top: 3rem;
  color: var(--muted);
  font-size: 12px;
}

footer a {
  color: var(--muted);
  text-decoration: none;
}

footer a:hover {
  color: var(--accent);
}

/* Responsive */
@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }

  aside {
    position: relative;
    height: auto;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.5rem;
    gap: 1rem;
  }

  .sidebar-top {
    flex-direction: row;
    align-items: center;
    gap: 2rem;
  }

  aside nav {
    flex-direction: row;
    gap: 1.5rem;
  }

  .logo {
    margin-bottom: 0;
  }

  .search-trigger {
    margin-top: 0;
    width: auto;
    padding: 0.4rem 0.6rem;
  }

  .search-trigger span {
    display: none;
  }

  .studio-btn {
    padding: 0.5rem 1rem;
    white-space: nowrap;
  }

  main {
    padding: 1.5rem;
  }

  .hero-home {
    padding: 2rem 0;
  }

  .hero-links {
    flex-wrap: wrap;
    gap: 1rem;
  }

  footer {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }

  .posts-grid {
    grid-template-columns: 1fr;
  }

  .post-content pre,
  .post-content .chroma {
    margin-left: -1.5rem;
    margin-right: -1.5rem;
    border-radius: 0;
    padding: 1rem 1.5rem;
  }
}

@media (max-width: 600px) {
  .sidebar-top {
    gap: 1rem;
  }

  aside nav {
    gap: 1rem;
  }

  .studio-btn {
    font-size: 11px;
    padding: 0.4rem 0.75rem;
  }

  .hero-home .hero-title {
    font-size: 1.25rem;
  }

  .page-header h1 {
    font-size: 1.25rem;
  }

  .post-row .post-title {
    font-size: 1rem;
  }
}
