/* ==========================================================================
   MINIMALIST PERSONAL WEBSITE STYLESHEET
   Aesthetic: Content-first, timeless typography, zero animations.
   ========================================================================== */

:root {
  /* Light Theme (Warm Paper & Rich Ink) */
  --bg: #faf9f6;
  --bg-secondary: #f2f0eb;
  --text: #1c1917;
  --text-muted: #66625c;
  --text-subtle: #8a857e;
  --link: #1d4ed8;
  --link-hover: #1e40af;
  --border: #e4e1d9;
  --code-bg: #eeebe3;
  --card-bg: #ffffff;
  --accent: #2c5282;
  --selection: #dbeafe;

  /* Typography Stacks */
  --font-serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "Source Code Pro", Menlo, Consolas, monospace;

  /* Layout */
  --max-width: 680px;
  --line-height: 1.7;
}

[data-theme="dark"] {
  /* Dark Theme (Deep Charcoal & Warm Muted Off-White) */
  --bg: #141416;
  --bg-secondary: #1d1d21;
  --text: #e4e4e7;
  --text-muted: #a1a1aa;
  --text-subtle: #71717a;
  --link: #93c5fd;
  --link-hover: #bfdbfe;
  --border: #2a2a30;
  --code-bg: #222228;
  --card-bg: #19191d;
  --accent: #60a5fa;
  --selection: #1e3a8a;
}

/* Zero Animations & Instant Transitions */
*, *::before, *::after {
  box-sizing: border-box;
  transition: none !important;
  animation: none !important;
}

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

html {
  font-size: 17px;
  background-color: var(--bg);
  color: var(--text);
  color-scheme: light dark;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-serif);
  line-height: var(--line-height);
  background-color: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --------------------------------------------------------------------------
   Layout Container
   -------------------------------------------------------------------------- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem 1.25rem;
}

/* --------------------------------------------------------------------------
   Navigation & Header
   -------------------------------------------------------------------------- */
.site-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.site-title {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.15rem;
  flex-wrap: wrap;
}

.nav-links {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 1.15rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
}

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

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.nav-links a.active {
  font-weight: 600;
}

/* Minimalist Theme Toggle */
.theme-toggle-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  cursor: pointer;
  line-height: 1.2;
}

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

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */
h1, h2, h3, h4 {
  color: var(--text);
  line-height: 1.3;
  margin-top: 2rem;
  margin-bottom: 0.8rem;
  letter-spacing: -0.015em;
}

h1 {
  font-size: 1.85rem;
  font-weight: 700;
  margin-top: 0;
}

h2 {
  font-size: 1.35rem;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.35rem;
  margin-top: 2.5rem;
}

h3 {
  font-size: 1.15rem;
  font-weight: 600;
}

p {
  margin-top: 0;
  margin-bottom: 1.2rem;
}

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

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

strong {
  font-weight: 600;
  color: var(--text);
}

em {
  font-style: italic;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

/* Blockquotes */
blockquote {
  margin: 1.5rem 0;
  padding: 0.5rem 0 0.5rem 1.25rem;
  border-left: 3px solid var(--border);
  color: var(--text-muted);
  font-style: italic;
}

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

/* Lists */
ul, ol {
  margin: 0 0 1.25rem 0;
  padding-left: 1.4rem;
}

li {
  margin-bottom: 0.4rem;
}

/* Code */
code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background-color: var(--code-bg);
  padding: 0.15em 0.35em;
  border-radius: 3px;
}

pre {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background-color: var(--code-bg);
  padding: 1rem;
  border-radius: 4px;
  overflow-x: auto;
  border: 1px solid var(--border);
  line-height: 1.5;
  margin: 1.5rem 0;
}

pre code {
  background: none;
  padding: 0;
}

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

.article-title {
  margin-bottom: 0.5rem;
}

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

.article-meta .separator {
  color: var(--text-subtle);
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  padding: 0.1rem 0.45rem;
  border-radius: 3px;
  color: var(--text-muted);
  text-decoration: none;
}

.tag:hover {
  color: var(--text);
  text-decoration: none;
  border-color: var(--text-muted);
}

/* Post list on Home & Writings index */
.post-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 2rem 0;
}

.post-item {
  margin-bottom: 1.4rem;
}

.post-item-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.post-item-title {
  font-size: 1.08rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--text);
}

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

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

.post-item-desc {
  margin-top: 0.25rem;
  margin-bottom: 0;
  font-size: 0.95rem;
  color: var(--text-muted);
}

/* Year group header on writings index */
.year-heading {
  font-family: var(--font-sans);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.25rem;
}

/* Filter tags bar */
.filter-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.filter-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  padding: 0.25rem 0.65rem;
  border-radius: 4px;
  cursor: pointer;
}

.filter-btn.active,
.filter-btn:hover {
  background-color: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

/* --------------------------------------------------------------------------
   Sidenotes & Marginalia
   -------------------------------------------------------------------------- */
.sidenote-box {
  background-color: var(--bg-secondary);
  border-left: 3px solid var(--border);
  padding: 0.8rem 1rem;
  margin: 1.5rem 0;
  font-size: 0.92rem;
  color: var(--text-muted);
}

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

.sidenote-label {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text);
  margin-bottom: 0.35rem;
  display: block;
}

/* Footnotes */
.footnotes {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.88rem;
  color: var(--text-muted);
}

.footnotes ol {
  padding-left: 1.2rem;
}

/* --------------------------------------------------------------------------
   Random Page Specifics
   -------------------------------------------------------------------------- */
.random-box {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  padding: 1.5rem;
  border-radius: 6px;
  margin: 1.5rem 0 2.5rem 0;
  text-align: center;
}

.random-btn {
  background-color: var(--text);
  color: var(--bg);
  border: 1px solid var(--text);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.6rem 1.25rem;
  border-radius: 4px;
  cursor: pointer;
}

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

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

.curio-card:last-child {
  border-bottom: none;
}

.curio-category {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-subtle);
  letter-spacing: 0.05em;
  margin-bottom: 0.3rem;
}

.curio-quote {
  font-size: 1.05rem;
  font-style: italic;
  margin-bottom: 0.5rem;
}

.curio-author {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.site-footer {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.footer-links {
  display: flex;
  gap: 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

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

.footer-links a:hover {
  color: var(--text);
  text-decoration: underline;
}

.footer-note {
  font-size: 0.8rem;
  color: var(--text-subtle);
}

/* --------------------------------------------------------------------------
   Mobile Responsiveness
   -------------------------------------------------------------------------- */
@media (max-width: 600px) {
  html {
    font-size: 16px;
  }

  .container {
    padding: 1.5rem 1rem 3rem 1rem;
  }

  .site-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .site-nav {
    width: 100%;
    justify-content: space-between;
  }

  .post-item-header {
    flex-direction: column;
    gap: 0.15rem;
  }
}
