:root {
  --text-primary: #1a1a1a;
  --text-secondary: #666;
  --accent-blue: #4a7c9e;
  --background: #fff;
  --border-light: #e0e0e0;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

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

body {
  font-family: var(--font-sans);
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--background);
  max-width: 1200px;
  margin: 0 auto;
  padding: 0;
  overflow-x: hidden;
}

/* Site-wide link styling - same colour whether visited or not */
a,
a:visited {
  color: var(--accent-blue);
  text-decoration: underline;
}

a:hover {
  text-decoration: none;
}

/* Header */
header {
  padding: 20px 0 10px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 0;
  font-family: var(--font-sans);
  position: sticky;
  top: 0;
  background: var(--background);
  z-index: 1000;
  transition: box-shadow 0.3s ease, padding 0.3s ease;
}

header.scrolled {
  box-shadow: 0 2px 8px rgba(74, 124, 158, 0.15);
  padding: 15px 0 8px;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  position: relative;
}

.site-title {
  font-size: 2em;
  font-weight: 500;
  margin-bottom: 0;
  letter-spacing: 0.03em;
}

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

/* Hamburger toggle - hidden by default (desktop) */
.nav-toggle {
  display: none;
}

.nav-toggle-label {
  display: none;
}

.site-header-image {
  width: 100%;
  height: 150px;
  object-fit: cover;
  object-position: center bottom;
  margin: 10px 0;
  display: block;
  margin-left: calc(-50vw + 50%);
  margin-right: calc(-50vw + 50%);
  width: 100vw;
}

body:has(.home-content) .site-header-image {
  filter: saturate(0.5);
}

/* Video page - slight warm shift */
body:has(#video-page) .site-header-image {
  filter: hue-rotate(10deg);
}

/* Sound page - slight cool shift */
body:has(#sound-page) .site-header-image {
  filter: hue-rotate(-15deg);
}

/* Index page - slightly brighter */
body:has(#index-page) .site-header-image {
  filter: brightness(1.05);
}

/* Contact page - subtle warm sepia */
body:has(#contact-page) .site-header-image {
  filter: sepia(0.2);
}

nav {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 20px;
  font-family: var(--font-sans);
  position: sticky;
  top: 0;
  background: var(--background);
  z-index: 999;
  transition: padding 0.3s ease, top 0.3s ease;
}

nav.scrolled {
  padding: 8px 20px;
}

nav ul {
  list-style: none;
  display: flex;
  gap: 0;
}

nav li:not(:last-child)::after {
  content: "·";
  margin: 0 20px;
  color: var(--text-secondary);
}

nav a,
nav a:visited {
  color: var(--text-primary);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.85em;
}

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

/* Main content */
main {
  min-height: 60vh;
  padding: 0 20px 40px;
  position: relative;
  z-index: 1;
}

h1 {
  font-size: 2em;
  font-weight: normal;
  margin-bottom: 30px;
  color: var(--text-primary);
}

/* Grid layout */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px;
  margin-top: 30px;
}

.post-card,
.post-card:visited {
  text-decoration: none;
  color: var(--text-primary);
  display: block;
}

.post-thumbnail {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  margin-bottom: 15px;
  background: #f5f5f5;
}

.post-card h2 {
  font-size: 1.2em;
  font-weight: normal;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.post-card:hover h2 {
  color: var(--accent-blue);
}

.post-meta {
  font-size: 0.9em;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.post-categories {
  font-size: 0.85em;
  color: var(--accent-blue);
  margin-bottom: 8px;
}

.post-categories a,
.post-categories a:visited {
  color: inherit;
  text-decoration: none;
}

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

.post-excerpt {
  font-size: 0.95em;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* Single post page */
.back-link,
.back-link:visited {
  display: inline-block;
  margin-bottom: 12px;
  color: var(--text-secondary);
  text-decoration: none;
  font-family: var(--font-sans);
  font-size: 0.9em;
}

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

.post-header {
  margin-bottom: 18px;
}

.post-title {
  font-size: 2em;
  font-weight: normal;
  margin-bottom: 15px;
}

.post-content {
  font-size: 1.05em;
  line-height: 1.8;
  hyphens: auto;
}

.post-content p {
  margin-bottom: 1.2em;
}

.post-content img {
  max-width: 100%;
  height: auto;
  margin: 30px 0;
}

/* Cap the first image in a post (typically a cover/header) at 400px */
.post-content > p:first-child img {
  max-width: 400px;
}

/* Home page */
.home-content {
  font-size: 1.05em;
  line-height: 1.8;
  max-width: 800px;
  text-align: justify;
  hyphens: auto;
}

.home-content .site-header-image {
  filter: saturate(0.5);
}

.home-content p {
  margin-bottom: 1.2em;
}

.home-content img {
  max-width: 100%;
  height: auto;
  margin: 30px 0;
}

.home-content blockquote {
  margin: 30px 0;
  padding-left: 20px;
  border-left: 3px solid var(--accent-blue);
  font-style: italic;
  color: var(--text-secondary);
  text-align: left;
}

/* Audio players */
.audio-player-wrapper {
  margin: 25px 0;
}

.audio-title {
  font-size: 1.15em;
  font-weight: normal;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.audio-player-wrapper audio {
  width: 300px;
  display: block;
}

/* Footer */
footer {
  border-top: 1px solid var(--border-light);
  padding: 20px 0;
  margin-top: 40px;
  font-size: 0.9em;
  color: var(--text-secondary);
}

/* Alphabetical Index */
.alphabetical-index {
  font-family: var(--font-sans);
}

.index-section {
  margin-bottom: 40px;
}

.index-letter {
  font-size: 1.8em;
  font-weight: normal;
  color: var(--accent-blue);
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-light);
}

.index-list {
  list-style: none;
  padding: 0;
}

.index-list li {
  margin-bottom: 12px;
  line-height: 1.6;
}

.index-list a,
.index-list a:visited {
  color: var(--text-primary);
  text-decoration: none;
  font-size: 1.1em;
}

.index-list a:hover {
  color: var(--accent-blue);
}

.index-meta {
  color: var(--text-secondary);
  font-size: 0.95em;
  margin-left: 8px;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .posts-grid {
    grid-template-columns: 1fr;
    gap: 30px;
  }
  
  header {
    padding: 15px 0 12px;
  }

  /* Shrink title on mobile + reserve space for hamburger on the right */
  .site-title {
    font-size: 1.5em;
    padding-right: 50px;
  }

  /* Shorter header image on mobile */
  .site-header-image {
    height: 90px;
    margin: 6px 0;
  }

  /* Show hamburger label (3 bars), top-right of header */
  .nav-toggle-label {
    display: block;
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    width: 28px;
    height: 22px;
    cursor: pointer;
    z-index: 1001;
  }

  .nav-toggle-label span {
    display: block;
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--text-primary);
    transition: transform 0.25s ease, opacity 0.2s ease, top 0.25s ease;
  }

  .nav-toggle-label span:nth-child(1) { top: 3px; }
  .nav-toggle-label span:nth-child(2) { top: 10px; }
  .nav-toggle-label span:nth-child(3) { top: 17px; }

  /* Hamburger animates to X when menu is open */
  .nav-toggle:checked ~ .nav-toggle-label span:nth-child(1) {
    top: 10px;
    transform: rotate(45deg);
  }
  .nav-toggle:checked ~ .nav-toggle-label span:nth-child(2) {
    opacity: 0;
  }
  .nav-toggle:checked ~ .nav-toggle-label span:nth-child(3) {
    top: 10px;
    transform: rotate(-45deg);
  }

  /* Collapse nav by default on mobile; keep sticky + underneath header */
  nav {
    max-height: 0;
    overflow: hidden;
    padding: 0 20px;
    margin-bottom: 0;
    border-bottom: none;
    transition: max-height 0.3s ease, padding 0.3s ease, margin 0.3s ease, border-color 0.3s ease;
  }

  /* When toggle is checked, expand the nav inline */
  body:has(.nav-toggle:checked) nav {
    max-height: 400px;
    padding: 10px 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-light);
  }

  nav ul {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }

  /* Remove the dot separators on mobile (they don't make sense stacked) */
  nav li:not(:last-child)::after {
    content: "";
    margin: 0;
  }

  nav a,
  nav a:visited {
    font-size: 1em;
    padding: 4px 0;
    display: block;
  }

  .post-title {
    font-size: 1.6em;
  }
}

/* Ensure post-meta doesn't pick up positioning from elsewhere */
.post-header,
.post-meta,
.post-header .post-categories {
  position: static !important;
}
