/* ==========================================================================
   borkert.dev — Minimalist Academic & Editorial Typesetting
   Clean, bookish, typography-first personal research index.
   ========================================================================== */

:root {
  --bg: #fcfbf9;
  --bg-subtle: #f4f2ee;
  --bg-card: #ffffff;
  --bg-code: #f3f1ec;

  --text-main: #1c1917;
  --text-muted: #66625c;
  --text-dim: #736e67;
  --text-link: #8c2d19; /* muted warm terracotta */
  --text-link-hover: #1c1917;

  --border: #e7e4dc;
  --border-light: #ece9e2;
  --border-dark: #1c1917;

  --font-serif: "Newsreader", "Charter", "ETBembo", "Georgia", "Cambria", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", "Menlo", "Consolas", monospace;

  --max-w: 920px;
  --line-height: 1.68;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141414;
    --bg-subtle: #1c1c1c;
    --bg-card: #191919;
    --bg-code: #1e1e1e;

    --text-main: #eae6df;
    --text-muted: #a39e93;
    --text-dim: #8a857d;
    --text-link: #d97757;
    --text-link-hover: #ffffff;

    --border: #2c2b28;
    --border-light: #242320;
    --border-dark: #eae6df;
  }
}

[data-theme="light"] {
  --bg: #fcfbf9;
  --bg-subtle: #f4f2ee;
  --bg-card: #ffffff;
  --bg-code: #f3f1ec;
  --text-main: #1c1917;
  --text-muted: #66625c;
  --text-dim: #736e67;
  --text-link: #8c2d19;
  --text-link-hover: #1c1917;
  --border: #e7e4dc;
  --border-light: #ece9e2;
  --border-dark: #1c1917;
}

[data-theme="dark"] {
  --bg: #141414;
  --bg-subtle: #1c1c1c;
  --bg-card: #191919;
  --bg-code: #1e1e1e;
  --text-main: #eae6df;
  --text-muted: #a39e93;
  --text-dim: #8a857d;
  --text-link: #d97757;
  --text-link-hover: #ffffff;
  --border: #2c2b28;
  --border-light: #242320;
  --border-dark: #eae6df;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  color-scheme: light dark;
}

/* Skip link for keyboard & screen reader accessibility */
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  background: var(--bg-card);
  color: var(--text-main);
  padding: 8px 14px;
  border: 1px solid var(--border-dark);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  text-decoration: underline;
  z-index: 1000;
  transition: top 0.15s ease-out;
}

.skip-link:focus,
.skip-link:focus-visible {
  top: 16px;
  outline: 2px solid var(--text-link);
  outline-offset: 2px;
}

/* Visible focus rings for keyboard navigation */
:focus-visible {
  outline: 2px solid var(--text-link);
  outline-offset: 3px;
  border-radius: 2px;
}

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

body {
  background-color: var(--bg);
  color: var(--text-main);
  font-family: var(--font-serif);
  line-height: var(--line-height);
  padding: 40px 20px 60px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.container {
  max-width: var(--max-w);
  margin: 0 auto;
}

/* Links */
a {
  color: var(--text-link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: rgba(140, 45, 25, 0.4);
  transition: all 0.15s ease;
}

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

.header a, .nav a, .repo-link a, .meta a {
  text-decoration: none;
}

.header a:hover, .nav a:hover, .repo-link a:hover, .meta a:hover {
  text-decoration: underline;
}

/* Top Header */
header {
  margin-bottom: 36px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
}

h1 {
  font-family: var(--font-serif);
  font-size: 2.1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-main);
}

.header-links {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  gap: 16px;
}

.theme-toggle-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 3px;
  cursor: pointer;
  margin-left: 12px;
}

.theme-toggle-btn:hover {
  color: var(--text-main);
  border-color: var(--text-muted);
}

.bio {
  font-size: 1.15rem;
  line-height: 1.55;
  color: var(--text-main);
  margin-top: 14px;
}

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

.bio strong {
  font-weight: 600;
}

/* Navigation / Jump Bar */
.toc {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-dim);
  display: flex;
  gap: 18px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.toc span {
  color: var(--text-muted);
}

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

.toc a:hover {
  color: var(--text-main);
  text-decoration: underline;
}

/* Sections */
section {
  margin-top: 44px;
}

h2 {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 20px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* Article & Blog Post Typography */
.post-content {
  font-size: 1.12rem;
  line-height: 1.72;
}

.post-header {
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.post-header h1 {
  font-size: 2.35rem;
  line-height: 1.2;
  margin-bottom: 12px;
  font-family: var(--font-serif);
  font-weight: 600;
  letter-spacing: -0.015em;
}

.post-meta {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-dim);
}

.header-back {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  text-decoration: none;
  color: var(--text-muted);
}

.header-back:hover {
  color: var(--text-main);
  text-decoration: underline;
}

.post-content p {
  margin-bottom: 18px;
}

.post-content h2 {
  margin-top: 44px;
  margin-bottom: 18px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-serif);
  font-size: 1.45rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: -0.01em;
  color: var(--text-main);
}

.post-content h3 {
  margin-top: 32px;
  margin-bottom: 14px;
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-main);
}

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

.post-content ul,
.post-content ol {
  margin-bottom: 20px;
  padding-left: 28px;
}

.post-content li {
  margin-bottom: 8px;
}

.post-content blockquote {
  margin: 24px 0;
  padding: 14px 20px;
  border-left: 3px solid var(--text-link);
  background: var(--bg-subtle);
  border-radius: 0 4px 4px 0;
  font-style: italic;
  color: var(--text-main);
}

.table-container {
  overflow-x: auto;
  margin: 24px 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  line-height: 1.5;
}

table th,
table td {
  padding: 11px 15px;
  border: 1px solid var(--border);
  vertical-align: top;
}

table th {
  background: var(--bg-subtle);
  text-align: left;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

/* Project / System Entry */
.system-entry {
  margin-bottom: 40px;
  padding-bottom: 32px;
  border-bottom: 1px dashed var(--border-light);
}

.system-entry:last-child {
  border-bottom: none;
  margin-bottom: 20px;
  padding-bottom: 0;
}

.system-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 8px;
}

.system-title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text-main);
}

.system-title a {
  color: var(--text-main);
  text-decoration: none;
}

.system-title a:hover {
  color: var(--text-link);
  text-decoration: underline;
}

.system-meta {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
}

.system-desc {
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text-main);
  margin-bottom: 16px;
}

.system-desc p {
  margin-bottom: 10px;
}

.system-desc strong {
  font-weight: 600;
}

/* Code Blocks, Inline Commands & Schemas */
code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  font-weight: 600;
  background: var(--bg-code);
  color: var(--text-main);
  padding: 0.12em 0.35em;
  border-radius: 3px;
  border: 1px solid var(--border-light);
}

.code-block {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.5;
  overflow-x: auto;
  margin: 14px 0 18px;
  color: var(--text-main);
}

.code-block code {
  font-family: var(--font-mono);
  font-size: inherit;
  font-weight: 400;
  background: transparent;
  padding: 0;
  border-radius: 0;
  border: none;
  color: inherit;
}

.code-caption {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: -8px;
  margin-bottom: 16px;
}

.system-links {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  display: flex;
  gap: 16px;
  margin-top: 12px;
}

/* Writing / Research Notes List */
.writing-list {
  list-style: none;
  margin-top: 16px;
}

.writing-item {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px dashed var(--border-light);
}

.writing-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.writing-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 4px;
}

.writing-title {
  font-size: 1.15rem;
  font-weight: 600;
}

.writing-date {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  white-space: nowrap;
}

.writing-summary {
  font-size: 0.98rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-top: 6px;
}

/* Timeline / Notes */
.timeline-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.98rem;
}

.timeline-table tr {
  border-bottom: 1px solid var(--border-light);
}

.timeline-table tr:last-child {
  border-bottom: none;
}

.timeline-table td {
  padding: 12px 0;
  vertical-align: top;
}

.timeline-year {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-dim);
  width: 110px;
}

.timeline-content strong {
  font-weight: 600;
  color: var(--text-main);
}

.timeline-content p {
  color: var(--text-muted);
  margin-top: 4px;
  font-size: 0.95rem;
}

/* Principles */
.principles-list {
  padding-left: 20px;
  font-size: 1.05rem;
  line-height: 1.6;
}

.principles-list li {
  margin-bottom: 14px;
}

.principles-list strong {
  font-weight: 600;
  color: var(--text-main);
}

/* Footer */
footer {
  margin-top: 56px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-dim);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

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

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

/* Print Styles */
@media print {
  body {
    background: #ffffff;
    color: #000000;
    padding: 0;
  }
  .theme-toggle-btn, .toc {
    display: none;
  }
  a {
    color: #000000;
    text-decoration: none;
  }
  .code-block {
    border: 1px solid #ccc;
    background: #f9f9f9;
  }
}

/* Mobile responsive */
@media (max-width: 600px) {
  body {
    padding: 24px 16px 44px;
  }
  h1 {
    font-size: 1.8rem;
  }
  .header-top {
    flex-direction: column;
    gap: 8px;
  }
  .system-head {
    flex-direction: column;
    gap: 4px;
  }
  .writing-head {
    flex-direction: column;
    gap: 2px;
  }
  .timeline-table td {
    display: block;
    width: 100%;
    padding: 6px 0;
  }
}
