:root {
  --bg-color: #f4efdf;
  --phi: 1.8;
  --ink: #111;
  --paper: #f4efdf;
  --line: #e3e0c7;
  --link: #b22222;
  --visited: #8F1A1A;
  --theme-transition: background-color 0.2s ease, color 0.2s ease;
}

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

}

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: "UI Serif", 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);
}

.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);
}

.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 18rem;
  height: 100vh;
  padding: 3rem 2rem;
  border-right: 1px solid var(--line);
}

.header-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 1rem;
  gap: 1rem;
}

.hamburger {
  display: none;
}

.site-title {
  margin: 0 0 2rem;
  font-weight: 400;
  letter-spacing: 0.02em;
}

.site-nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav li + li {
  margin-top: 0.9rem;
}

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

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

.content {
  margin-left: 18rem;
  padding: 5rem max(8vw, 3rem);
  max-width: calc(61.8ch + 16vw);
}

.post {
  max-width: 61.8ch;
}

.meta {
  color: var(--meta);
  margin-bottom: 2.5rem;
}

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

img {
  max-width: 100%;
  height: auto;
}

main p {
  font-size: 1.2rem;
  hyphens: auto;
}

/* 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;
}


@media (max-width: 900px) {
  .site-nav {
    position: static;
    width: auto;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .header-controls {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3rem;
    border-bottom: 1px solid var(--line);
    z-index: 100;
  }

  .content {
    margin-left: 0;
    padding: 3rem 1.5rem;
    margin-top: 3rem;
  }
}

@media (max-width: 768px) {
  .header-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3rem;
    padding: 0 1rem;
    border-bottom: 1px solid var(--line);
    background: var(--paper);
    z-index: 1000;
  }

  .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: 3rem;
    left: 0;
    right: 0;
    width: auto;
    height: auto;
    max-height: calc(100vh - 3rem);
    padding: 0;
    margin: 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow-y: auto;
    transform: translateY(-100%);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    pointer-events: none;
    background: var(--paper);
  }

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

  .site-title {
    margin: 0;
    padding: 1.5rem 1.5rem 1rem;
    font-weight: 400;
    letter-spacing: 0.02em;
  }

  .site-nav nav {
    padding: 0 1.5rem 1.5rem;
  }

  .site-nav ul {
    margin: 0;
    padding: 0;
    list-style: none;
  }

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

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

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

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

  .content {
    margin-left: 0;
    margin-top: 3rem;
    padding: 2rem 1rem;
  }

  body {
    padding-top: 0;
  }
}

/* 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;
  }
}

/* Note star widget */
.note-star {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.5rem;
  margin-bottom: 1rem;
}

.note-star__btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--ink);
  display: flex;
  align-items: center;
  transition: color 0.2s ease, transform 0.15s ease;
}

.note-star__btn:hover:not(:disabled) {
  color: goldenrod;
  transform: scale(1.15);
}

.note-star__btn:disabled {
  cursor: default;
}

.note-star__icon--filled {
  display: none;
}

.note-star--starred .note-star__icon--outline {
  display: none;
}

.note-star--starred .note-star__icon--filled {
  display: block;
  color: goldenrod;
  stroke: goldenrod;
}

.note-star__count {
  font-size: 0.95rem;
  color: var(--meta, var(--ink));
}

/* Adjust note-star styling when inside headings */
h2 .note-star {
  margin-top: 0;
  margin-bottom: 0;
  vertical-align: middle;
}

/* 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;
}

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

