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

:root {
  --text:    #1a1a1a;
  --muted:   #555;
  --accent:  #2a5caa;
  --border:  #ddd;
  --bg-alt:  #f7f7f5;
  --bg-code: #f0f0ee;
}

body {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
  background: #fff;
}

.container {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
header {
  border-bottom: 2px solid var(--text);
  padding: 48px 0 28px;
}

header h1 {
  font-size: 2.4rem;
  font-weight: 600;
  letter-spacing: -0.5px;
}

.clef {
  font-size: 2.8rem;
  line-height: 1;
  vertical-align: middle;
  margin-right: 4px;
}

header .subtitle {
  margin-top: 8px;
  color: var(--muted);
  font-size: 1.05rem;
  font-style: italic;
}

/* Main sections */
main {
  padding: 48px 24px 64px;
}

section {
  margin-bottom: 52px;
}

h2 {
  font-size: 1.35rem;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 24px 0 10px;
}

p {
  margin-bottom: 14px;
}

ul, ol {
  padding-left: 1.5em;
  margin-bottom: 14px;
}

li {
  margin-bottom: 6px;
}

/* Table */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 0.95rem;
}

th {
  text-align: left;
  padding: 8px 12px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  font-weight: 600;
}

td {
  padding: 8px 12px;
  border: 1px solid var(--border);
  vertical-align: top;
}

tr:nth-child(even) td {
  background: var(--bg-alt);
}

/* Code */
code {
  font-family: 'Courier New', monospace;
  font-size: 0.88em;
  background: var(--bg-code);
  padding: 1px 5px;
  border-radius: 3px;
}

.code-block {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 16px 20px;
  overflow-x: auto;
  margin: 16px 0;
}

.code-block pre {
  font-family: 'Courier New', monospace;
  font-size: 0.83rem;
  line-height: 1.6;
  white-space: pre;
}

.caption {
  font-size: 0.9rem;
  color: var(--muted);
  font-style: italic;
  margin-top: 4px;
}

.workflow-figure {
  margin: 20px 0 22px;
}

.workflow-figure img {
  display: block;
  width: min(100%, 660px);
  height: auto;
  margin: 0 auto;
  border: 1px solid var(--border);
  border-radius: 3px;
}

.workflow-figure figcaption {
  text-align: center;
}

.diff-legend {
  margin-top: 20px;
  font-size: 0.9rem;
}

.score-comparison {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 20px 0;
}

.score-comparison figure {
  margin: 0;
}

.score-comparison img {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 3px;
}

.score-comparison figcaption {
  font-size: 0.88rem;
  color: var(--muted);
  margin-top: 6px;
  font-style: italic;
  text-align: center;
}

.score-comparison figure {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.score-comparison--row {
  flex-direction: row;
}

/* Footer */
footer {
  border-top: 1px solid var(--border);
  padding: 20px 0;
  font-size: 0.9rem;
  color: var(--muted);
}

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

footer a:hover {
  text-decoration: underline;
}

/* Nav */
.site-nav {
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}
.site-nav .container {
  display: flex;
  gap: 28px;
  padding: 10px 24px;
}
.site-nav a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.site-nav a:hover { text-decoration: underline; }
.site-nav a.active {
  color: var(--text);
  font-weight: 600;
  pointer-events: none;
}

/* Demo — example cards */
.example-card {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 24px;
  margin-bottom: 32px;
  background: var(--bg-alt);
}
.example-card h3 { border-bottom: none; margin-top: 0; font-size: 1.1rem; }

.score-links {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin: 12px 0;
}
.score-links a {
  display: inline-block;
  padding: 5px 12px;
  border: 1px solid var(--accent);
  border-radius: 3px;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.88rem;
}
.score-links a:hover { background: var(--accent); color: #fff; }

.diff-stats {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 10px;
}

/* Scrollable diff block */
.diff-scroll {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 14px 18px;
  overflow-x: auto;
  overflow-y: auto;
  margin: 12px 0;
}
.diff-scroll pre {
  font-family: 'Courier New', monospace;
  font-size: 0.80rem;
  line-height: 1.55;
  white-space: pre;
}

/* Filosax pair selector */
.pair-selector {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 20px 0 16px;
}
.pair-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 6px 16px;
  font-size: 0.9rem;
  font-family: Georgia, serif;
  color: var(--muted);
  cursor: pointer;
}
.pair-btn:hover { border-color: var(--accent); color: var(--accent); }
.pair-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.pending {
  color: var(--muted);
  font-style: italic;
}

.slide-embed {
  margin: 24px 0;
}
.slide-embed figcaption {
  font-size: 0.88rem;
  color: var(--muted);
  font-style: italic;
  margin-top: 8px;
  text-align: center;
}

.ref-list {
  padding-left: 1.4em;
}
.ref-list li {
  margin-bottom: 14px;
  line-height: 1.65;
}
.ref-list a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9em;
}
.ref-list a:hover { text-decoration: underline; }

/* Responsive */
@media (max-width: 560px) {
  header h1 { font-size: 1.8rem; }
  .distance-cards { grid-template-columns: 1fr; }
  .code-block pre { font-size: 0.75rem; }
  .pair-selector { gap: 6px; }
  .pair-btn { font-size: 0.82rem; padding: 5px 10px; }
}