:root {
  --bg-color: #f4efdf;
  --phi: 1.8;
  --ink: #111;
  --meta: #555;
  --paper: #f4efdf;
  --card: #fdfaf0;
  --line: #e3e0c7;
  --link: #b22222;
  --visited: #8F1A1A;
  --theme-transition: background-color 0.2s ease, color 0.2s ease;
  --header-height: 3.5rem;
  --hover-bg: #f9f5e8;
  --nav-bg: #e8e3d0;
}

html[data-theme="dark"] {
  --ink: #bbb;
  --bg-color: #0a0a0a;
  --paper: #0a0a0a;
  --card: #161616;
  --line: #333;
  --meta: #aaa;
  --hover: #0ABAB5;
  --link: #b2d5d2;
  --hover-bg: #1f1f1f;
  --nav-bg: #111111;
}

@font-face {
font-family: heliotrope_ot_4_medium;
font-style: normal;
font-weight: 500;
font-stretch: normal;
font-display: swap;
src: url('/assets/fonts/heliotrope/heliotrope_ot_4_medium.woff2') format('woff2');
}

@font-face {
font-family: heliotrope_ot_4_medium_italic;
font-style: italic;
font-weight: 500;
font-stretch: normal;
font-display: swap;
src: url('/assets/fonts/heliotrope/heliotrope_ot_4_medium_italic.woff2') format('woff2');
}

@font-face {
    font-family: ibm-plex-mono;
    src: url('/assets/fonts/ibm-plex-mono/IBMPlexMono-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display:swap;
}

@font-face {
    font-family: ibm-plex-mono-bold;
    src: url('/public/assets/fonts/ibm-plex-mono/IBMPlexMono-Bold.woff2') format('woff2');
    font-weight: 800;
    font-style: normal;
    font-display: swap;
}

html, body {
  background-color: var(--bg-color);
  color: var(--text-color);
  transition: var(--theme-transition);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: heliotrope_ot_4_medium, Georgia, serif;
  line-height: var(--phi);
  transition: background-color 0.3s ease, color 0.3s ease;
}

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

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

a.ext-link::before {
  content: "🔗";
  display: inline-flex;
  margin-right: 0.3em;
  font-size: 0.85em;
  line-height: 1;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  transition: opacity 0.2s ease;
  position: relative;
}

.theme-toggle:hover {
  opacity: 0.7;
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  border-radius: 0.25rem;
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  position: absolute;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.sun-icon {
  opacity: 1;
  transform: rotate(0deg);
}

.moon-icon {
  opacity: 0;
  transform: rotate(-180deg);
}

html[data-theme="dark"] .sun-icon {
  opacity: 0;
  transform: rotate(180deg);
}

html[data-theme="dark"] .moon-icon {
  opacity: 1;
  transform: rotate(0deg);
}

/* Top navigation header */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--nav-bg);
  border-bottom: 1px solid var(--line);
  z-index: 100;
  transition: var(--theme-transition);
}

.header-inner {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 2rem;
  gap: 1.5rem;
}

.site-nav {
  display: flex;
  flex: 1;
  justify-content: center;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}



.hamburger {
  display: none;
}

.site-title {
  font-size: 1.25rem;
  margin: 0;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

aside {
font-family: system-ui, sans-serif;
}

em {
  font-family:heliotrope_ot_4_medium_italic, Georgia, serif;
}

.site-nav ul {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  color: inherit;
  text-decoration: none;
}

.site-nav a[aria-current="page"] {
  text-decoration: underline;
  text-underline-offset: 0.2rem;
}

.content {
  padding: 2rem max(4vw, 2rem);
  padding-top: calc(var(--header-height) + 2rem);
  max-width: 1400px;
  margin: 0 auto;
}

.post {
  max-width: 61.8ch;
  margin-left: auto;
  margin-right: auto;
  position: relative; /* Anchors the desktop side-note */
}

/* 1. Mobile-First Styles (Default for small screens) */
.post-sidenote {
  display: block;
  position: static; 
  width: auto;       
  margin: 1.5em 0 1.5em 2ch; /* Indents it slightly from the left */
  font-family: system-ui, -apple-system, sans-serif; 
  font-size: 14px;
  line-height: 1.8;
  border-left: 1px solid #ccc; 
  padding-left: 10px;          
  box-sizing: border-box;
}

/* 2. Desktop Styles (Pops out to the right on wide screens) */
@media (min-width: 56rem) { 
  .post-sidenote {
    position: absolute;
    top: auto;
    left: 100%;             
    width: 180px;
    margin-left: 2ch;       
    margin-top: 0;
    margin-bottom: 0;
  }
}


/* Posts flex grid */
.posts {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-top: 1rem;
}

.post-preview-link {
  flex: 1 1 calc(33.333% - 1rem);
  min-width: 0;
  text-decoration: none;
  color: inherit;
  display: block;
}

.post-preview {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.375rem;
  padding: 1.5rem;
  min-height: 100%;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.post-preview-link:hover .post-preview {
  background: var(--hover-bg);
  transform: translateY(-2px);
}

.read-more {
  display: inline-block;
  color: var(--link);
  margin-top: 0.5rem;
}

pre {
    font-family: "SF Mono", SF Mono, Consolas, "Liberation Mono", Courier, monospace;
    font-size: 1rem;

}
.meta {
  color: var(--meta);
  margin-bottom: 2.5rem;
 font-family: ibm-plex-mono, monospace;
 font-size: 0.9rem;
}

meta b {
  font-family: ibm-plex-mono-bold, monospace;
}

h1,
h2,
h3 {
  font-weight: 500;
}

h1, h2 {
  line-height: 2rem;
}
img {
  max-width: 100%;
  height: auto;
}


 
main p {
    font-family: heliotrope_ot_4_medium;
    font-size: 1.25rem; /* Reduced from 1.5rem */
    line-height: 1.8;   /* Improved ratio for Heliotrope */
    color: var(--color-text);
    margin-bottom: 1.5rem;
}

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

ol, li {
    font-family: heliotrope_ot_4_medium;
    font-size: 1.5rem;
    line-height: 2.25rem;
}



ul li, ol li {
  font-size: 1.2rem;
  hyphens: none;
  line-height: 1.66;
}

footer {
  margin: 2rem auto;
  font-size: .9rem;
}
footer p {
  font-size: 0.9rem;
}

.site-footer {
  text-align: center;
  font-size: 0.9rem;
  color: var(--meta);
}

.post-excerpt {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  max-height: calc(1.2rem * var(--phi, 1.8) * 3);
  text-overflow: ellipsis;
  overflow: hidden;
}

.recent {
  font-style: all-caps;
  letter-spacing: 0.2em;
}

@supports (line-clamp: 3) {
  .post-excerpt {
    line-clamp: 3;
  }
}

/* Pagination styles */
.pagination,
.post-pagination {
  margin-top: 2rem;
}

.pagination ul,
.post-pagination ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pagination a,
.post-pagination a {
  font-weight: bold;
  text-decoration: none;
}

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

/* HR shortcode styles */
.hr {
  text-align: center;
  margin: 2rem 0;
}

/* YouTube Embeds */
.iframe-wrapper {
    display: flex;               /* Use Flexbox for centering */
    justify-content: center;     /* Center horizontally */
    align-items: center;         /* Center vertically (if needed) */
    height: 100vh;              /* Fill full viewport height for vertical centering */
}

.post-title--center {
    text-align: center;
}

.yt-wrapper {
    width: 110%; /* Magazine "bleed" effect - match figure styling */
    max-width: 110%;
    margin: 4rem 0;
    margin-left: -5%;
}

.yt-wrapper iframe {
    width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
    display: block;
    border: 0;
}

/* Remove margins and padding from paragraphs containing YouTube embeds */
p:empty,
p:has(.yt-wrapper) {
    margin: 0;
    padding: 0;
    display: contents;
}


/* 2-across on medium/tablet screens */
@media (max-width: 1023px) {
  .post-preview-link {
    flex: 1 1 calc(50% - 0.75rem);
  }
}

/* Mobile: hamburger menu + 1-across posts */
@media (max-width: 767px) {
  .hamburger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    background: transparent;
    border: none;
    color: inherit;
    cursor: pointer;
    transition: opacity 0.2s ease;
  }

  .hamburger:hover,
  .theme-toggle:hover {
    opacity: 0.7;
  }

  .hamburger:focus-visible,
  .theme-toggle:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
    border-radius: 0.25rem;
  }

  .hamburger svg {
    width: 24px;
    height: 24px;
  }

  .site-nav {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    flex: unset;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    overflow-y: auto;
    max-height: calc(100vh - var(--header-height));
    transform: translateY(-100%);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    pointer-events: none;
    z-index: 99;
  }

  .site-nav.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .site-nav ul {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 0 1.5rem 1.5rem;
  }

  .site-nav li {
    width: 100%;
    border-top: 1px solid var(--line);
    padding: 0.9rem 0;
  }

  .site-nav li:first-child {
    border-top: none;
    padding-top: 0.5rem;
  }

  .post-preview-link {
    flex: 1 1 100%;
  }

  .content {
    padding: 1.5rem 1rem;
    padding-top: calc(var(--header-height) + 1.5rem);
  }


}

/* Writers list styles */
.writers-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-top: 2rem;
}

.writers-column {
  display: flex;
  flex-direction: column;
}

.writer-item {
  padding: 0.5rem 0;
}

.writer-item a {
  text-decoration: none;
  color: inherit;
}

.writer-item a:hover {
  text-decoration: underline;
}

@media (max-width: 768px) {
  .writers-grid {
    grid-template-columns: 1fr;
  }
}

/* Tags list styles */
.tags-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-top: 2rem;
}

.tags-column {
  display: flex;
  flex-direction: column;
}

.tag-item {
  padding: 0.5rem 0;
}

.tag-item a {
  text-decoration: none;
  color: inherit;
}

.tag-item a:hover {
  text-decoration: underline;
}

.tag-post-count {
  margin: 0.5rem 0 2rem;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

@media (max-width: 768px) {
  .tags-grid {
    grid-template-columns: 1fr;
  }
}

/* Lightbox */
img.lightbox-trigger {
  cursor: zoom-in;
}

#lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 9000;
  align-items: center;
  justify-content: center;
}

#lightbox-overlay.lightbox-open {
  display: flex;
}

#lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  display: block;
  box-shadow: 0 0 2rem rgba(0, 0, 0, 0.6);
}

#lightbox-close {
  position: fixed;
  top: 1rem;
  right: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 0.25rem;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  z-index: 9001;
  padding: 0;
}

#lightbox-close:hover {
  background: var(--ink);
  color: var(--paper);
}
