/* ═══════════════════════════════════════════════════════════════════
   site.css
   Single source of truth for .notion-content styling.
   Used by:
     - Standalone blog posts (via post-chrome.js + <link rel="stylesheet">)
     - index.html (via <link rel="stylesheet">)
   Edit this file to restyle posts in both contexts simultaneously.
   ═══════════════════════════════════════════════════════════════════ */

/* --- Design Tokens --- */
:root {
  --text-primary: #1a1a1a;
  --text-secondary: #666;
  --border-color: #e5e5e5;
  --bg-primary: #ffffff;
  --bg-hover: #fafafa;
  --accent: #c4a574;
}

/* ═══════════════════════════════════════════════════
   STANDALONE POST CHROME
   (Only applies when post-chrome.js has run,
    i.e. in standalone post pages. Has no effect
    inside index.html since these elements don't exist there.)
   ═══════════════════════════════════════════════════ */

html { scroll-behavior: smooth; }
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Work Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 400;
  line-height: 1.6;
  white-space: normal;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  overflow-y: scroll;
  overflow-x: hidden;
}

/* --- Site Header --- */
.site-header {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 24px 4px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0;
}

.site-title {
  font-family: 'EB Garamond', serif;
  font-size: 36px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

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

.site-nav {
  display: flex;
  gap: 12px;
  font-size: 15px;
  align-items: center;
}

.site-nav a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
  font-weight: 300;
}

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

.nav-sep {
  color: var(--border-color);
}

/* --- Back Button --- */
.back-button-wrapper {
  position: sticky;
  top: 0;
  background: var(--bg-primary);
  padding: 8px 24px 8px;
  margin: 0 auto 8px;
  max-width: 800px;
  z-index: 10;
}

.back-button {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  display: inline-block;
  font-family: 'Work Sans', sans-serif;
}

.back-button:hover {
  color: var(--text-primary);
}

/* --- Post Container (standalone only) --- */
.blog-post-container {
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 48px 120px 48px;
  background: var(--bg-hover);
  border-radius: 4px;
  overflow-x: hidden;
  box-sizing: border-box;
}

@media (min-width: 769px) and (max-width: 1024px) {
  .blog-post-container { padding-left: 32px; padding-right: 32px; }
}

/* --- Footer (standalone only) --- */
.site-footer {
  max-width: 800px;
  margin: 0 auto;
  padding: 48px 24px;
  border-top: 1px solid var(--border-color);
}

.site-footer p {
  font-size: 14px;
  color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════════
   NOTION CONTENT
   Applies in both standalone posts and index.html.
   ═══════════════════════════════════════════════════ */

.notion-content {
  width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}

@font-face {
  font-family: 'EB Garamond-Scale';
  src: url('/fonts/EBGaramond-ScaleDegrees-subset.woff') format('woff');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* Undo Notion's header layout so it flows naturally */
.notion-content header,
.notion-content .page.serif > header {
  display: block;
  align-items: initial;
  justify-content: initial;
  padding: 0;
  margin: 0;
  max-width: unset;
}

/* --- Page Title --- */
.notion-content .page-title {
  font-family: 'EB Garamond', serif;
  font-size: 42px;
  font-weight: 600;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
  line-height: 1.2;
  white-space: normal;
  position: static !important;
}

/* --- Hide Notion's empty description --- */
.notion-content .page-description {
  display: none;
}

/* --- Body --- */
.notion-content .page-body {
  font-size: 16px;
  margin-top: 0;
  padding-top: 0;
}
/* --- Poems --- */
.notion-content .poem {
  white-space: pre-wrap;
  margin-left: 2em;
  text-indent: -2em;
  padding-left: 2em;
}

/* --- Headings --- */
.notion-content h1 {
  font-family: 'EB Garamond', serif;
  font-size: 42px;
  font-weight: 600;
  margin: 8px 0 16px;
  letter-spacing: -0.02em;
  line-height: 1.2;
  white-space: normal;
  display: block;
  width: 100%;
  float: none;
}

.notion-content h2 {
  font-family: 'EB Garamond', serif;
  font-size: 26px;
  font-weight: 600;
  margin: 28px 0 16px;
  letter-spacing: -0.01em;
  white-space: normal;
}

.notion-content h3 {
  font-family: 'EB Garamond', serif;
  font-size: 22px;
  font-weight: 600;
  margin: 24px 0 12px;
  letter-spacing: -0.01em;
  white-space: normal;
}

/* Force subtitle h3 to appear below title, not inline */
.notion-content .page-title + h3,
.notion-content h1 + h3 {
  display: block !important;
  clear: both;
  margin-left: 0 !important;
}

/* --- Post Meta (date + tags) --- */
.notion-content .post-meta {
  display: block !important;
  clear: both !important;
  width: 100% !important;
  float: none !important;
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  margin-top: 8px;
  font-family: 'Work Sans', sans-serif;
}

.notion-content h1 + .post-meta,
.notion-content .page-title + .post-meta {
  display: block !important;
  clear: both !important;
}

.post-meta-sep {
  margin: 0 8px;
}

.tag {
  display: inline-block;
  font-size: 12px;
  line-height: 1;
  padding: 2px 4px;
  cursor: pointer;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  margin-right: 4px;
}

/* --- Featured Image --- */
.notion-content .featured-image,
.featured-image {
  max-width: 360px;
  width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 0 0 24px 0;
  display: block;
}

/* --- Paragraphs --- */
.notion-content p {
  font-size: 18px;
  font-family: 'EB Garamond', serif;
  line-height: 1.4;
  color: var(--text-primary);
  margin-bottom: 16px;
  white-space: normal;
}

.notion-content .page-title + p,
.notion-content h1 + p,
.notion-content .page-body > p:first-child {
  margin-top: 0;
}

/* --- Poem variant --- */
.notion-content.poem p {
  font-size: 18px;
  font-family: 'EB Garamond', serif;
  line-height: 1.4;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.notion-content.poem p:empty {
  margin-bottom: 16px; /* stanza breaks */
}

/* --- Links --- */
.notion-content a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.notion-content a:hover {
  border-bottom-color: var(--accent);
}

/* --- Lists --- */
.notion-content ul,
.notion-content ol {
  margin: 16px 0;
  padding-left: 28px;
}

.notion-content li {
  font-size: 16px;
  line-height: 1.7;
  font-family: 'EB Garamond', serif;
  color: var(--text-primary);
  margin-bottom: 8px;
  white-space: normal;
}

/* --- Blockquotes --- */
.notion-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 20px;
  margin: 24px 0;
  color: var(--text-secondary);
  font-family: 'EB Garamond', serif;
  font-weight: 300;
  font-style: normal;
  white-space: normal;
}

/* --- Code --- */
.notion-content code {
  background: var(--bg-hover);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  font-size: 14px;
}

.notion-content pre {
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 16px;
  font-size: 13px;
  overflow-x: auto;
  margin: 24px 0;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
  white-space: pre;
}

/* Chord charts don't need scrolling */
.notion-content pre.chord-chart,
.notion-content pre:has(.chord-chart-wrapper) {
  overflow-x: visible;
  overflow-y: visible;
  white-space: normal;
}

.notion-content pre code {
  background: none;
  padding: 0;
  display: block;
  max-width: 100%;
  width: 100%;
  overflow-wrap: break-word;
  word-wrap: break-word;
  white-space: pre;
}

.notion-content pre.chord-chart code,
.notion-content pre:has(.chord-chart-wrapper) code {
  overflow: visible;
  white-space: normal;
  word-break: normal;
}

/* --- Images --- */
.notion-content img {
  max-width: 360px;
  width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 24px 0;
}

.notion-content figure img {
  margin: 0;
  width: 100%;
}

/* --- Horizontal Rules --- */
.notion-content hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 32px 0;
}

.notion-content hr.nrm-divider.nrm-divider--tight {
  margin: 0.3rem 0;
}

/* --- Inline Formatting --- */
.notion-content em { font-style: italic; }
.notion-content strong { font-weight: 600; }

/* --- Notion's display:contents wrappers --- */
.notion-content [style*="display:contents"] {
  display: contents;
}

/* ═══════════════════════════════════════════════════
   CHORD CHARTS
   ═══════════════════════════════════════════════════ */
.chord-chart-wrapper {
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px;
  line-height: 1.3;
  margin: 1em 0;
  overflow: visible;
}

pre.chord-chart,
pre:has(.chord-chart-wrapper) {
  overflow: visible;
  white-space: normal;
}

pre.chord-chart code,
pre:has(.chord-chart-wrapper) code {
  overflow: visible;
  white-space: normal;
  word-break: normal;
}

.chord-lyric-pair { display: block; margin-bottom: 0.3em; }
.chord-lyric-segment { display: inline-block; vertical-align: top; white-space: pre; }
.chord-line { color: #2563eb; font-weight: 500; white-space: pre; display: block; }
.lyric-line { white-space: pre; display: block; }

/* ═══════════════════════════════════════════════════
   NRM DIAGRAM COMPONENTS
   (Scale/interval/chord diagrams used in music theory posts)
   ═══════════════════════════════════════════════════ */

.nrm-diagram {
  width: auto !important;
  max-width: 100% !important;
  margin-right: 0 !important;
  float: none !important;
}

.nrm-box {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  box-sizing: border-box;
  width: 100%;
  max-width: 605px;
  padding: 1rem 1.5rem;
  margin-bottom: 16px;
}

.nrm-fig-label {
  font-family: 'Work Sans', sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #c4a574;
  margin-bottom: 1rem;
}

.nrm-scale-label {
  font-family: 'Work Sans', sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #999;
  margin-bottom: 0.4rem;
}

.nrm-divider {
  border: none;
  border-top: 1px solid #e0e0e0;
  margin: 0.75rem 0;
}

.nrm-divider.nrm-divider--tight {
  margin: 0.3rem 0;
}

/* Note row (Figs 1-2) */
.nrm-note-row {
  display: flex;
  align-items: center;
  width: 100%;
}
.nrm-note-row .nrm-note {
  flex: 1;
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 1.15rem;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
}

/* Scale row */
.nrm-scale-row {
  display: flex;
  align-items: flex-start;
  width: 100%;
  margin-bottom: 1rem;
}
.nrm-scale-row:last-of-type { margin-bottom: 0; }

.nrm-node {
  flex: 1;
  min-width: 1.6rem;
  display: grid;
  grid-template-rows: auto auto;
  justify-items: center;
  row-gap: 0.2rem;
}

.nrm-degree {
  font-family: 'EB Garamond-Scale', Georgia, serif;
  font-size: 0.9rem;
  color: #1a1a1a;
  line-height: 1;
  text-align: center;
}

.nrm-note {
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1;
  text-align: center;
}

/* Interval row */
.nrm-interval-row {
  display: flex;
  align-items: center;
  width: 100%;
  margin-bottom: 1rem;
}
.nrm-interval-row:last-of-type { margin-bottom: 0; }

.nrm-inode {
  flex: 0 0 0;
  overflow: visible;
  white-space: nowrap;
  display: grid;
  grid-template-rows: auto auto;
  justify-items: center;
  row-gap: 0.2rem;
}

.nrm-segment {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 1.15rem;
}
.nrm-line {
  position: absolute;
  top: 50%; left: 0; right: 0;
  height: 1px;
  background: #bbb;
  transform: translateY(-50%);
}
.nrm-interval {
  position: relative;
  z-index: 1;
  background: #ffffff;
  padding: 0 0.3rem;
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: #666;
  line-height: 1;
}

/* Bracket row */
.nrm-bracket-row {
  display: flex;
  align-items: flex-start;
  width: 100%;
  margin-bottom: 0.25rem;
}

.nrm-bnode {
  flex: 1;
  display: grid;
  grid-template-rows: auto auto;
  justify-items: center;
  row-gap: 0.2rem;
}
.nrm-bnode .nrm-degree { color: #ccc; }
.nrm-bnode .nrm-note   { color: #ccc; font-weight: 400; }
.nrm-bnode.active .nrm-degree { color: #555; }
.nrm-bnode.active .nrm-note   { color: #1a1a1a; font-weight: 700; }

.nrm-chord-name {
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 0.9rem;
  color: #555;
  margin-top: 0.3rem;
  font-style: italic;
}

/* Triad table */
.nrm-triad-table {
  width: 100%;
  border-collapse: collapse;
}
.nrm-triad-table th {
  font-family: 'Work Sans', sans-serif;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #999;
  text-align: center;
  padding: 0 0.5rem 0.5rem;
  border-bottom: 1px solid #e0e0e0;
}
.nrm-triad-table th:first-child { text-align: left; }
.nrm-triad-table td {
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 1.05rem;
  font-weight: 600;
  text-align: center;
  padding: 0.35rem 0.5rem;
  vertical-align: middle;
}
.nrm-triad-table td:first-child {
  font-family: 'EB Garamond-Scale', Georgia, serif;
  font-size: 1rem;
  font-weight: 400;
  color: #666;
  text-align: left;
}
.nrm-triad-table .nrm-quality {
  font-size: 0.95rem;
  font-weight: 400;
  font-style: italic;
  color: #666;
  text-align: left;
}
.nrm-triad-table tr:not(:last-child) td { border-bottom: 1px solid #f0f0f0; }

/* ═══════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════ */

/* Tablet */
@media (min-width: 769px) and (max-width: 1024px) {
  .blog-post-container { padding-left: 32px; padding-right: 32px; }
}/* Mobile */
@media (max-width: 768px) {
  body { overflow-x: hidden; }

  /* Standalone chrome */
  .site-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 24px 16px 8px;
  }

  .site-title { font-size: 28px; margin-bottom: 0; }
  .site-nav { gap: 12px; font-size: 14px; }

  .back-button-wrapper { padding: 16px 16px 8px; }
  .back-button { padding: 12px 0; margin: -12px 0; }

  .blog-post-container { padding: 16px 16px 120px 16px; border-radius: 0; }

  /* Notion content */
  .notion-content figure:not(.nrm-diagram) { width: 100px; margin-right: 16px; }

  .notion-content .page-title,
  .notion-content h1 { font-size: 32px; margin-bottom: 8px; }

  .notion-content h1 { margin-top: 8px; }

  .notion-content h2 { font-size: 22px; margin: 24px 0 12px; }

  .notion-content h3 { font-size: 20px; margin: 20px 0 10px; }

  .notion-content p { font-size: 16px; }

  .notion-content.poem p { font-size: 16px; }

  .tag { font-size: 11px; padding: 2px 6px; }

  /* Code blocks on mobile */
  .notion-content pre {
    line-height: 1.8;
    padding-top: 24px;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
  }

  .notion-content pre code {
    line-height: 1.8;
    font-family: 'Courier New', 'DejaVu Sans Mono', 'Noto Sans Mono', monospace;
    word-break: normal !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    white-space: pre-wrap !important;
    box-sizing: border-box !important;
    max-width: 100% !important;
  }
  /* NRM diagram mobile overrides */
  .nrm-diagram {
    width: auto !important;
    max-width: 100% !important;
    margin-right: 0 !important;
    float: none !important;
  }
  .nrm-box {
    padding: 0.65rem 0.6rem;
    max-width: 100%;
    overflow: hidden;
    width: 100% !important;
  }
  .nrm-fig-label {
    font-size: 0.58rem;
    margin-bottom: 0.5rem;
    overflow: hidden;
    color: #c4a574;
  }
  .nrm-scale-label {
    font-size: 0.58rem;
    white-space: nowrap;
    margin-bottom: 0.3rem;
  }
  .nrm-node { min-width: 0; }
  .nrm-bnode { min-width: 0; }
  .nrm-degree { font-size: 0.72rem; }
  .nrm-note { font-size: 0.88rem; }
  .nrm-note-row .nrm-note { font-size: 0.88rem; }
  .nrm-interval { font-size: 0.68rem; padding: 0 0.1rem; background: transparent; }
  .nrm-line { display: none; }
  .nrm-chord-name { font-size: 0.78rem; }
  .nrm-divider { margin: 0.5rem 0; }
  .nrm-divider.nrm-divider--tight { margin: 0.2rem 0; }
  .nrm-scale-row { margin-bottom: 0.6rem; }
  .nrm-interval-row { margin-bottom: 0.6rem; }
  .nrm-triad-table td { font-size: 0.9rem; padding: 0.2rem 0.25rem; }
  .nrm-triad-table th { font-size: 0.58rem; padding: 0 0.25rem 0.3rem; }
  .nrm-quality { font-size: 0.8rem !important; }
}

/* Small mobile */
@media (max-width: 480px) {
  .site-header { padding: 16px 12px 8px; }
  .site-title { font-size: 24px; }
  .site-nav { flex-wrap: wrap; gap: 8px; font-size: 14px; }

  .back-button-wrapper { padding: 12px 12px 8px; }
  .blog-post-container { padding: 12px 12px 120px 12px; border-radius: 0; }

  .notion-content .page-title,
  .notion-content h1 { font-size: 28px; margin-bottom: 8px; }

  .notion-content h1 { margin-top: 8px; }

  .notion-content h2 { font-size: 20px; }

  .notion-content p,
  .notion-content.poem p { font-size: 18px; line-height: 1.6; }
}
