/* ═══════════════════════════════════════════════════════════════════════════
   MASTER DESIGN FILE — edit these variables to restyle the entire site
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* ── Typography ── */
  --font-body:      Georgia, "Times New Roman", serif;
  --font-mono:      "Courier New", Courier, monospace;
  --font-size-base: 17px;
  --line-height:    1.75;

  /* ── Color palette ── */
  --color-bg:#eee5cd;   /*  page background */
  --color-bg-sidebar:#eee5cd;   
  --color-bg-code:    #ccc4ad; /* idk */
  --color-text:       #18010a;   /*  body text */
  --color-text-muted: #6e6753; /* dates */
  --color-accent:#6c1335;   /*  links, active nav, headings */
  --color-border:     #ccc4ad;   /* borders and lines */


  /* ── Layout ── */
  --sidebar-width:       200px;
  --sidebar-right-width: 280px;
  --content-max-width:   740px;
  --gap:                 2rem;

  /* ── Audio player ── */
  --audio-bg:       #e7dcbb;
  --audio-border:   var(--color-border);
  --audio-filled:   var(--color-accent);
  --audio-btn-size: 2.2rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════════════════════════════════════════ */

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

/* Hide scrollbars everywhere while keeping scroll functional */
* {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
*::-webkit-scrollbar {
  display: none;
}

html {
  font-size: var(--font-size-base);
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: var(--line-height);
  min-height: 100vh;
}

a {
  color: var(--color-accent);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

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

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

/* ═══════════════════════════════════════════════════════════════════════════
   LAYOUT — sidebar + main
   ═══════════════════════════════════════════════════════════════════════════ */

.site-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ── Left navigation sidebar ── */
.sidebar-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--color-bg-sidebar);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  padding: 2rem 1.25rem;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-nav__title {
  display: block;
  font-size: 1.05rem;
  font-weight: bold;
  color: var(--color-text);
  letter-spacing: 0.03em;
  margin-bottom: calc(0.35rem + 0.1rem + 0.35rem);
  line-height: 1.3;
  text-decoration: none;
  transition: opacity 0.15s;
}

.sidebar-nav__title:hover {
  text-decoration: none;
  color: var(--color-accent);
  opacity: 0.88;
}

.sidebar-nav__subtitle {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  margin-bottom: 2rem;
  font-style: italic;
}

.sidebar-nav__links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.sidebar-nav__links a {
  display: block;
  padding: 0.35rem 0;
  font-size: 0.95rem;
  color: var(--color-text);
  transition: color 0.15s;
}

.sidebar-nav__links a:hover {
  color: var(--color-accent);
  text-decoration: none;
}

.sidebar-nav__links a.active {
  font-weight: bold;
}

.sidebar-nav__photo {
  position: absolute;
  bottom: 0;
  left: 10px;
  right: 10px;
}

.sidebar-nav__photo img {
  width: 100%;
  height: auto;
  display: block;
}

/* ── Main content area ── */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
}

/* ── Writing page: main + right sidebar ── */
.writing-layout {
  display: flex;
  min-height: 100vh;
}

.writing-main {
  flex: 1;
  min-width: 0;
  padding: var(--gap) calc(var(--gap) * 2.5);
}

.sidebar-posts {
  width: var(--sidebar-right-width);
  max-width: 400px;
  flex-shrink: 0;
  border-left: 1px solid var(--color-border);
  padding: var(--gap) 1.25rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--color-bg-sidebar);
}

.sidebar-posts__heading {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
}

a.sidebar-posts__chrono-link {
  text-decoration: none;
}

a.sidebar-posts__chrono-link:hover {
  color: var(--color-accent);
  text-decoration: none;
}

.sidebar-posts__list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.sidebar-posts__list li a {
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--color-text);
}

.sidebar-posts__list li a:hover {
  color: var(--color-accent);
  text-decoration: none;
}

.sidebar-posts__list li .post-date-small {
  display: block;
  font-size: 0.72rem;
  color: var(--color-text-muted);
}

/* ── Single page / home / music ── */
.page-content {
  padding: var(--gap) calc(var(--gap) * 1.5);
  max-width: var(--content-max-width);
}

/* ═══════════════════════════════════════════════════════════════════════════
   TYPOGRAPHY
   ═══════════════════════════════════════════════════════════════════════════ */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-body);
  font-weight: bold;
  color: var(--color-text);
  line-height: 1.3;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

h1 { font-size: 2rem; margin-top: 0; }
h2 { font-size: 1.45rem; border-bottom: 1px solid var(--color-border); padding-bottom: 0.3rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1rem; }

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

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

ul, ol {
  margin: 0 0 1.2rem 1.5rem;
}

li { margin-bottom: 0.3rem; }

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--color-bg-code);
  padding: 0.1em 0.35em;
  border-radius: 2px;
  border: 1px solid var(--color-border);
}

pre {
  background: var(--color-bg-code);
  border: 1px solid var(--color-border);
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  font-size: 0.85rem;
}

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

/* ═══════════════════════════════════════════════════════════════════════════
   MUSICAL SYMBOLS — inline helper spans
   Usage: <span class="sym sharp"></span> etc.
   ═══════════════════════════════════════════════════════════════════════════ */

.sym { font-style: normal; }
.sym.sharp::before    { content: "♯"; }
.sym.flat::before     { content: "♭"; }
.sym.natural::before  { content: "♮"; }
.sym.note-quarter::before  { content: "♩"; }
.sym.note-eighth::before   { content: "♪"; }
/* whole/half/sixteenth note Unicode (SMP plane) not reliably in system fonts — omitted */

/* ═══════════════════════════════════════════════════════════════════════════
   FIGURES & IMAGES
   ═══════════════════════════════════════════════════════════════════════════ */

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

figure.post-figure img {
  width: 100%;
  border: 1px solid var(--color-border);
}

figure.post-figure figcaption {
  font-size: 0.83rem;
  color: var(--color-text-muted);
  font-style: italic;
  margin-top: 0.5rem;
  text-align: center;
}

/* Flexible image sizing helpers */
.img-small  { max-width: 320px; margin: 0 auto; }
.img-medium { max-width: 500px; margin: 0 auto; }
.img-full   { max-width: 100%; }
.img-float-right { float: right; margin: 0 0 1rem 1.5rem; max-width: 45%; }
.img-float-left  { float: left;  margin: 0 1.5rem 1rem 0; max-width: 45%; }
.clearfix::after { content: ""; display: table; clear: both; }

/* ═══════════════════════════════════════════════════════════════════════════
   AUDIO PLAYER
   ═══════════════════════════════════════════════════════════════════════════ */

.audio-wrap {
  background: var(--audio-bg);
  border: 1px solid var(--audio-border);
  border-radius: 6px;
  padding: 0.55rem 0.85rem 0.55rem 1rem;
  margin: 1rem 0;
}

.audio-player {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 2.5rem;
  width: 100%;
  min-width: 0;
}

.audio-wrap__title {
  flex: 1;
  min-width: 0;
  font-size: 0.85rem;
  font-style: italic;
  color: var(--color-text);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.audio-btn {
  flex-shrink: 0;
  width: var(--audio-btn-size);
  height: var(--audio-btn-size);
  border: none;
  border-radius: 50%;
  background: var(--audio-filled);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  color: #fcfaf0;
}

.audio-btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.audio-btn__ic {
  grid-area: 1 / 1;
  display: block;
}

.audio-btn__ic--play {
  width: 0;
  height: 0;
  margin-left: 3px;
  border-style: solid;
  border-width: 7px 0 7px 11px;
  border-color: transparent transparent transparent currentColor;
}

.audio-btn__ic--pause {
  display: none;
  width: 12px;
  height: 14px;
  background: linear-gradient(
    90deg,
    currentColor 0 31%,
    transparent 31% 69%,
    currentColor 69% 100%
  );
}

.audio-player.is-playing .audio-btn__ic--play {
  display: none;
}

.audio-player.is-playing .audio-btn__ic--pause {
  display: block;
}

.audio-time {
  flex-shrink: 0;
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  font-size: 0.82rem;
  color: var(--color-text-muted);
  min-width: 2.75em;
  text-align: right;
}

.audio-player audio {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MATH (KaTeX)
   ═══════════════════════════════════════════════════════════════════════════ */

.math-block {
  overflow-x: auto;
  margin: 1.5rem 0;
  text-align: center;
}

/* KaTeX inline math */
.katex { font-size: 1.05em; }

/* ═══════════════════════════════════════════════════════════════════════════
   ABC NOTATION (abcjs)
   ═══════════════════════════════════════════════════════════════════════════ */

.abc-notation {
  margin: 1.5rem 0;
  border: 1px solid var(--color-border);
  background: white;
  padding: 1rem;
  overflow-x: auto;
}

.abc-notation svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Hide the raw source once rendered */
.abc-notation.rendered .abc-source { display: none; }
.abc-notation .abc-source {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

/* ═══════════════════════════════════════════════════════════════════════════
   BLOG POSTS LIST (writing index)
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Writing index: full-post feed ── */
.post-feed {
  display: flex;
  flex-direction: column;
}

.post-feed .post-full .post-header {
  margin-bottom: 1.5rem;
  padding-bottom: 0;
  border-bottom: none;
  max-width: none;
}

.post-feed .post-full .post-header h2 {
  margin-top: 0.25rem;
  margin-bottom: 0;
  font-size: 1.4rem;
  border-bottom: none;
}

.post-feed .post-full .post-header h2 a {
  color: var(--color-text);
}

.post-feed .post-full .post-header h2 a:hover {
  color: var(--color-accent);
  text-decoration: none;
}

.post-divider {
  margin: 2.5rem 0;
}

.post-loading {
  height: 1.5rem;
}

.post-list {
  list-style: none;
}

.post-list-item {
  border-bottom: 1px solid var(--color-border);
  padding: 2rem 0;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.post-list-item.visible {
  opacity: 1;
  transform: none;
}

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

.post-list-item__date {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-bottom: 0.3rem;
  font-style: italic;
}

.post-list-item__title {
  font-size: 1.3rem;
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.post-list-item__title a {
  color: var(--color-text);
}

.post-list-item__title a:hover {
  color: var(--color-accent);
  text-decoration: none;
}

.post-list-item__excerpt {
  font-size: 0.93rem;
  color: var(--color-text-muted);
  margin-bottom: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SINGLE BLOG POST PAGE
   ═══════════════════════════════════════════════════════════════════════════ */

.post-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border);
  max-width: 62ch;
}

.post-header h1 { margin-bottom: 0.4rem; }

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

.post-body {
  /* font-family: "EB Garamond", Garamond, serif; */
  font-size: 1.08rem;
  line-height: 1.9;
  max-width: 64ch;
  hyphens: auto;
  -webkit-hyphens: auto;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1, "liga" 1;
}

.post-body p {
  margin-bottom: 1.6rem;
}

/* Post topic tags */
.post-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.6rem;
}

.post-topic-tag {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  padding: 0.15rem 0.5rem;
  border-radius: 2px;
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s;
}

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

/* Back link */
.back-link {
  display: inline-block;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 1.75rem;
}
.back-link:hover { color: var(--color-accent); text-decoration: none; }

/* ═══════════════════════════════════════════════════════════════════════════
   EMBED wrappers (YouTube, Bandcamp, etc.)
   ═══════════════════════════════════════════════════════════════════════════ */

.embed-wrap {
  margin: 2rem 0;
}

.embed-responsive {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
  overflow: hidden;
}

.embed-responsive iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: 1px solid var(--color-border);
}

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE — persistent top nav bar, hide left sidebar
   ═══════════════════════════════════════════════════════════════════════════ */

/* Mobile top nav — hidden on wide screens */
.mobile-top-nav {
  display: none;
}

@media (max-width: 900px) {
  .mobile-top-nav {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 200;
    background: var(--color-bg-sidebar);
    border-bottom: 1px solid var(--color-border);
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    height: 2.75rem;
  }

  .mobile-top-nav a {
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--color-text);
    text-decoration: none;
  }

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

  .mobile-top-nav__title {
    font-weight: bold;
    letter-spacing: 0.01em;
  }

  .sidebar-nav {
    display: none;
  }

  .main-content {
    margin-left: 0;
    padding-top: 2.75rem;
  }

  .writing-layout {
    flex-direction: column;
  }

  .sidebar-posts {
    display: none;
  }

  .page-content,
  .writing-main {
    padding: 1rem;
    padding-top: 3.75rem;
  }

  .img-float-right,
  .img-float-left {
    float: none;
    max-width: 100%;
    margin: 1rem 0;
  }
}

@media (max-width: 480px) {
  :root {
    --font-size-base: 16px;
    --gap: 1.25rem;
  }

  h1 { font-size: 1.6rem; }
  h2 { font-size: 1.25rem; }
}

/* ── Image lightbox ── */
.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 1000;
  cursor: zoom-out;
  align-items: center;
  justify-content: center;
}

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

.lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
}
