/* ============================================================
   JOURNAL THEME
   Custom theme - no external dependencies
   ============================================================ */

/* --- CSS Variables --- */
:root {
  --bg:           #f5f2ed;
  --bg-secondary: #ebe6de;
  --surface:      #ddd8cf;
  --text:         #2c2825;
  --text-muted:   #7a7068;
  --text-faint:   #a09890;
  --accent:       #8b6f47;
  --accent-hover: #6b5235;
  --border:       #cdc7bc;
  --code-bg:      #e4dfd7;
  --shadow:       rgba(0,0,0,0.08);

  --font-body: 'Georgia', 'Times New Roman', serif;
  --font-mono: 'Courier New', 'Courier', monospace;
  --font-ui:   system-ui, -apple-system, sans-serif;

  --max-width: 720px;
  --radius: 4px;
}

[data-theme="dark"] {
  --bg:           #13120f;
  --bg-secondary: #1a1815;
  --surface:      #221f1b;
  --text:         #d4cfc8;
  --text-muted:   #8c8378;
  --text-faint:   #5c5650;
  --accent:       #c49a5a;
  --accent-hover: #dbb878;
  --border:       #2e2b26;
  --code-bg:      #1e1c18;
  --shadow:       rgba(0,0,0,0.4);
}

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

html {
  font-size: 18px;
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.75;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* --- Layout --- */
.site-wrapper {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  width: 100%;
}

main {
  flex: 1;
  padding: 3rem 0;
}

/* --- Header --- */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 1.5rem 0;
  position: sticky;
  top: 0;
  background-color: var(--bg);
  z-index: 100;
  transition: background-color 0.3s ease;
}

.site-header .site-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-title {
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

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

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

.site-nav a {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

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

/* --- Dark Mode Toggle --- */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  padding: 0.3rem 0.7rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: all 0.2s;
  line-height: 1;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.theme-toggle .icon-dark  { display: inline; }
.theme-toggle .icon-light { display: none;   }

[data-theme="dark"] .theme-toggle .icon-dark  { display: none;   }
[data-theme="dark"] .theme-toggle .icon-light { display: inline; }

/* --- Footer --- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--text-faint);
  letter-spacing: 0.04em;
}

/* --- Home Page --- */
.home-intro {
  padding: 4rem 0 3rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 3rem;
}

.home-intro h1 {
  font-size: 2rem;
  font-weight: normal;
  letter-spacing: -0.01em;
  margin-bottom: 1rem;
  color: var(--text);
}

.home-intro p {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 520px;
}

/* --- Post List --- */
.post-list {
  list-style: none;
}

.post-list-item {
  padding: 1.75rem 0;
  border-bottom: 1px solid var(--border);
}

.post-list-item:first-child {
  padding-top: 0;
}

.post-list-meta {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--text-faint);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}

.post-list-title {
  font-size: 1.2rem;
  font-weight: normal;
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.post-list-title a {
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s;
}

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

.post-list-summary {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

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

.post-meta {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--text-faint);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.post-title {
  font-size: 2rem;
  font-weight: normal;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin-bottom: 0.75rem;
}

.post-description {
  color: var(--text-muted);
  font-size: 1rem;
  font-style: italic;
}

/* --- Post Content --- */
.post-content {
  margin-bottom: 3rem;
}

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

.post-content h2 {
  font-size: 1.4rem;
  font-weight: normal;
  margin: 2.5rem 0 1rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem;
}

.post-content h3 {
  font-size: 1.15rem;
  font-weight: normal;
  margin: 2rem 0 0.75rem;
  color: var(--text);
}

.post-content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s;
}

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

.post-content blockquote {
  border-left: 3px solid var(--accent);
  margin: 2rem 0;
  padding: 0.75rem 1.5rem;
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-style: italic;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.post-content ul,
.post-content ol {
  margin: 1.25rem 0 1.25rem 1.5rem;
}

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

.post-content code {
  font-family: var(--font-mono);
  font-size: 0.82em;
  background: var(--code-bg);
  padding: 0.15em 0.4em;
  border-radius: var(--radius);
  color: var(--accent);
}

.post-content pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  overflow-x: auto;
  margin: 1.75rem 0;
}

.post-content pre code {
  background: none;
  padding: 0;
  color: var(--text);
  font-size: 0.85rem;
}

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

/* --- Media: Images --- */
.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin: 1.5rem 0;
  display: block;
}

.post-content figure {
  margin: 2rem 0;
}

.post-content figure img {
  margin: 0 0 0.5rem;
}

.post-content figcaption {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--text-faint);
  text-align: center;
  font-style: italic;
}

/* Cover image at top of post */
.post-cover {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 2rem;
  display: block;
}

/* --- Media: Audio --- */
.post-content audio,
audio {
  width: 100%;
  margin: 1.5rem 0;
  accent-color: var(--accent);
}

/* Styled audio wrapper */
.audio-embed {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
}

.audio-embed p {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--text-faint);
  margin: 0 0 0.5rem;
  letter-spacing: 0.03em;
}

.audio-embed audio {
  margin: 0;
}

/* --- Media: Video --- */
.post-content video {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin: 1.5rem 0;
  display: block;
}

/* Responsive YouTube / iframe embeds */
.video-embed {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
  overflow: hidden;
  border-radius: var(--radius);
  margin: 1.5rem 0;
  background: var(--surface);
}

.video-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* --- Post Nav (prev/next) --- */
.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-ui);
  font-size: 0.82rem;
}

.post-nav a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
  max-width: 45%;
}

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

.post-nav .nav-label {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 0.25rem;
}

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

/* --- Page (about etc.) --- */
.page-title {
  font-size: 1.8rem;
  font-weight: normal;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

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

  .post-title { font-size: 1.5rem; }
  .home-intro h1 { font-size: 1.5rem; }

  .site-nav a {
    display: none;
  }

  .site-nav a.always-show {
    display: inline;
  }

  .post-nav {
    flex-direction: column;
  }

  .post-nav a {
    max-width: 100%;
  }

  .post-nav .next {
    text-align: left;
    margin-left: 0;
  }
}
