:root {
  --bg: #fafafa;
  --text: #222;
  --accent: #2c5f8a;
  --accent-light: #e8f0f8;
  --border: #d0d0d0;
  --card-bg: #fff;
  --mitigation: #2c5f8a;
  --suppression: #6b4c8a;

}

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

body {
  font-family: "Palatino Linotype", Palatino, Georgia, serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  max-width: 960px;
  margin: 0 auto;
  padding: 1rem 2rem 3rem;
}

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

/* Header */
header {
  text-align: center;
  padding: 2rem 0 1rem;
  border-bottom: 2px solid var(--accent);
  margin-bottom: 1.5rem;
}

header h1 {
  font-size: 2.4rem;
  color: var(--accent);
  letter-spacing: 0.04em;
}

header h1 a {
  color: inherit;
  text-decoration: none;
}

header h1 a:hover {
  text-decoration: underline;
}

header .subtitle {
  font-style: italic;
  color: #555;
  margin-top: 0.3rem;
}

header .description {
  margin-top: 1rem;
  font-size: 0.95rem;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

/* Site navigation */
nav.site-nav {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

nav.site-nav a {
  padding: 0.4rem 1rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  text-decoration: none;
  font-size: 0.95rem;
  color: var(--text);
  font-family: system-ui, -apple-system, sans-serif;
}

nav.site-nav a:hover {
  background: var(--accent-light);
}

nav.site-nav a.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Filters */
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.category-filters {
  display: flex;
  gap: 0.4rem;
}

.filter-btn {
  padding: 0.35rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--text);
}

.filter-btn:hover {
  background: var(--accent-light);
}

.filter-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.search-container {
  flex: 1;
  min-width: 200px;
}

.search-container input {
  width: 100%;
  padding: 0.45rem 0.8rem;
  font-size: 0.95rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: inherit;
}

.search-container input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}

/* Alphabet nav */
nav.alpha-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.3rem;
  margin-bottom: 1.5rem;
}

nav.alpha-nav a {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  background: var(--accent-light);
  color: var(--accent);
  text-decoration: none;
  border-radius: 3px;
  font-weight: bold;
  font-size: 0.95rem;
}

nav.alpha-nav a:hover {
  background: var(--accent);
  color: #fff;
}

nav.alpha-nav a.disabled {
  color: #aaa;
  background: #eee;
  pointer-events: none;
}

/* Letter headings */
h2.letter-heading {
  font-size: 1.6rem;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.2rem;
  margin: 2rem 0 1rem;
}

/* Technique cards */
.technique {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1.2rem 1.5rem;
  margin-bottom: 1.2rem;
}

.technique h3 {
  font-size: 1.25rem;
  color: var(--accent);
  margin-bottom: 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.technique h3 a {
  color: inherit;
  text-decoration: none;
}

.technique h3 a:hover {
  text-decoration: underline;
}

/* Category badges */
.badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: system-ui, -apple-system, sans-serif;
}

.badge-mitigation {
  background: #e8f0f8;
  color: var(--mitigation);
}

.badge-suppression {
  background: #f0e8f8;
  color: var(--suppression);
}

.badge-technique {
  background: #e8f8f0;
  color: #3a7a5a;
}

.badge-incoherent {
  background: #fff3e8;
  color: #a66b2a;
}

.badge-coherent {
  background: #e8f3ff;
  color: #2a6ba6;
}

.badge-noise {
  background: #ffe8e8;
  color: #a62a2a;
}

.badge-scaling {
  background: #e8f5e8;
  color: #2a7a3a;
}

.badge-extrapolation {
  background: #f5e8f0;
  color: #7a2a6a;
}

.badge-benchmarking {
  background: #e8f0f5;
  color: #2a5a7a;
}

.badge-chemistry {
  background: #e8f5ea;
  color: #2a6a3a;
}

.badge-optimization {
  background: #f5f0e8;
  color: #7a5a2a;
}

.badge-simulation {
  background: #f0e8f5;
  color: #5a2a7a;
}

.badge-machine-learning {
  background: #e8f5f5;
  color: #2a6a6a;
}

.badge-demonstration {
  background: #f5e8e8;
  color: #7a2a2a;
}

.technique .aka {
  font-style: italic;
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 0.6rem;
}

.technique .summary {
  margin-bottom: 0.8rem;
}

.technique .properties {
  margin-bottom: 0.8rem;
}

.technique .properties table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.technique .properties th {
  text-align: left;
  width: 180px;
  padding: 0.25rem 0.5rem;
  background: var(--accent-light);
  border: 1px solid var(--border);
  font-weight: 600;
}

.technique .properties td {
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--border);
}

.technique .references {
  font-size: 0.9rem;
}

.technique .references a {
  color: var(--accent);
  text-decoration: none;
  margin-right: 0.15rem;
}

.technique .references a:hover {
  text-decoration: underline;
}

.technique .qem-techniques {
  font-size: 0.9rem;
  margin-bottom: 0.6rem;
}

.technique .key-results {
  font-size: 0.9rem;
  margin-bottom: 0.6rem;
}

.technique .key-results ul {
  margin: 0.3rem 0 0 1.2rem;
  padding: 0;
}

.technique .key-results li {
  margin-bottom: 0.2rem;
}

/* References section */
#references-section {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

#references-section h2 {
  font-size: 1.4rem;
  color: var(--accent);
  margin-bottom: 0.8rem;
}

#references-list {
  font-size: 0.88rem;
  line-height: 1.7;
  padding-left: 2.5rem;
}

#references-list li {
  margin-bottom: 0.3rem;
}

#references-list a {
  color: var(--accent);
}

/* Noise Scaling Methods */
.noise-scaling-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.2rem;
}

.noise-scaling-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.2rem;
}

.noise-scaling-card h3 {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.1rem;
  color: var(--accent);
  margin-bottom: 0.4rem;
}

.noise-scaling-card .aliases {
  font-size: 0.8rem;
  color: #888;
  font-style: italic;
  margin-bottom: 0.6rem;
}

.noise-scaling-card .summary {
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 0.8rem;
}

.noise-scaling-card .properties {
  font-size: 0.82rem;
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 0.8rem;
}

.noise-scaling-card .properties th {
  text-align: left;
  padding: 0.3rem 0.5rem 0.3rem 0;
  color: #555;
  font-weight: 600;
  width: 40%;
  vertical-align: top;
}

.noise-scaling-card .properties td {
  padding: 0.3rem 0;
  vertical-align: top;
}

.noise-scaling-card .references {
  font-size: 0.8rem;
  color: #666;
}

.noise-scaling-card .references a {
  color: var(--accent);
  text-decoration: none;
}

.noise-scaling-card .references a:hover {
  text-decoration: underline;
}

/* Footer */
footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 2px solid var(--accent);
  text-align: center;
  font-size: 0.85rem;
  color: #666;
}

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

footer .attribution {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: #999;
}

/* No results */
.no-results {
  text-align: center;
  padding: 2rem;
  color: #888;
  font-style: italic;
  display: none;
}

/* Breadcrumb */
nav.breadcrumb {
  font-size: 0.9rem;
  font-family: system-ui, -apple-system, sans-serif;
  color: #666;
  margin-bottom: 1.5rem;
}

nav.breadcrumb a {
  color: var(--accent);
  text-decoration: none;
}

nav.breadcrumb a:hover {
  text-decoration: underline;
}

/* Detail page */
.detail-page {
  max-width: 960px;
}

.detail-title {
  font-size: 1.8rem;
  color: var(--accent);
  margin-bottom: 0.3rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.detail-abbr {
  font-weight: normal;
  color: #666;
}

.detail-page .aka {
  font-style: italic;
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.detail-section {
  margin-bottom: 2rem;
}

.detail-section h3 {
  font-size: 1.2rem;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.2rem;
  margin-bottom: 0.8rem;
}

.detail-section p {
  margin-bottom: 0.6rem;
}

/* Steps list */
ol.steps-list {
  padding-left: 1.5rem;
  margin-bottom: 0.5rem;
}

ol.steps-list li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

/* Equation blocks */
.equation-block {
  background: var(--accent-light);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.8rem 1rem;
  margin-bottom: 0.8rem;
}

.equation-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #555;
  font-family: system-ui, -apple-system, sans-serif;
  margin-bottom: 0.3rem;
}

.equation-math {
  text-align: center;
}

/* Properties table (detail page) */
.properties-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.properties-table th {
  text-align: left;
  width: 200px;
  padding: 0.35rem 0.6rem;
  background: var(--accent-light);
  border: 1px solid var(--border);
  font-weight: 600;
}

.properties-table td {
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--border);
}

/* Pros/Cons grid */
.pros-cons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
}

@media (max-width: 600px) {
  .pros-cons { grid-template-columns: 1fr; }
}

.pros-cons h4 {
  font-size: 1rem;
  margin-bottom: 0.4rem;
}

.pros h4 { color: #2c8a4c; }
.cons h4 { color: #c44; }

.pros-cons ul {
  padding-left: 1.3rem;
  font-size: 0.95rem;
}

.pros-cons li {
  margin-bottom: 0.3rem;
}

/* Circuit diagrams */
.circuit-diagrams {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: center;
  margin: 1rem 0;
}

.circuit-figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 100%;
}

.circuit-diagram {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  padding: 0.5rem;
}

.circuit-figure figcaption {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: #555;
  text-align: center;
  font-style: italic;
}

@media (max-width: 600px) {
  .circuit-diagrams {
    flex-direction: column;
    align-items: center;
  }
}

/* Bloch sphere figures */
.bloch-figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 100%;
  margin: 1rem 0;
}

.bloch-diagram {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #fff;
}

.bloch-figure figcaption {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: #555;
  text-align: center;
  font-style: italic;
  max-width: 800px;
  line-height: 1.4;
}

/* Related techniques grid */
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.8rem;
}

.related-card {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  text-decoration: none;
  color: var(--text);
  background: #fff;
}

.related-card:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.related-name {
  font-weight: 600;
  color: var(--accent);
}

.related-reason {
  font-size: 0.82rem;
  color: #666;
  font-style: italic;
}

/* Tradeoff mini chart */
.tradeoff-mini {
  max-width: 420px;
}

.tradeoff-mini svg {
  width: 100%;
  height: auto;
}

.tradeoff-notes {
  font-size: 0.9rem;
  color: #555;
  margin-top: 0.5rem;
}

/* Detail page references */
ol.detail-refs {
  font-size: 0.88rem;
  line-height: 1.7;
  padding-left: 2rem;
}

ol.detail-refs li {
  margin-bottom: 0.3rem;
}

ol.detail-refs a {
  color: var(--accent);
}

/* Demonstration blocks for applications */
.demonstration {
  background: var(--accent-light);
  border-left: 3px solid var(--accent);
  padding: 1rem 1.2rem;
  margin-bottom: 1rem;
  border-radius: 0 5px 5px 0;
}

.demonstration h4 {
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
  color: var(--accent);
}

.demonstration p {
  margin: 0.3rem 0;
  font-size: 0.92rem;
}

.demonstration p:first-of-type {
  margin-bottom: 0.6rem;
}

/* Application diagrams */
.diagram-section {
  text-align: center;
  margin: 1.5rem 0;
}

.application-diagram {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  background: #fff;
}

/* Tradeoff scatter plot (catalog page) */
.tradeoff-section {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.tradeoff-section h2 {
  font-size: 1.4rem;
  color: var(--accent);
  margin-bottom: 0.8rem;
}

#tradeoff-chart {
  max-width: 700px;
  margin: 0 auto;
}

#tradeoff-chart svg {
  width: 100%;
  height: auto;
}

.tradeoff-section .tradeoff-description {
  font-size: 0.9rem;
  color: #555;
  text-align: center;
  margin-bottom: 1rem;
}

/* Chart sections */
.chart-section {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.chart-section h2 {
  font-size: 1.4rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.chart-description {
  font-size: 0.9rem;
  color: #555;
  margin-bottom: 1rem;
}

#adoption-chart svg,
#composability-chart svg {
  width: 100%;
  height: auto;
}

/* Comparison table */
.comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  font-family: system-ui, -apple-system, sans-serif;
}

.comparison-table th {
  background: var(--accent-light);
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 600;
  text-align: center;
  color: #333;
}

.comparison-table th:first-child {
  text-align: left;
  width: 80px;
}

.comparison-table td {
  padding: 0.35rem 0.4rem;
  border: 1px solid var(--border);
}

.comparison-table td:first-child {
  white-space: nowrap;
}

.comparison-table tr:hover {
  background: var(--accent-light);
}

.error-msg {
  color: #c44;
  padding: 2rem;
  text-align: center;
}

.detail-loading {
  color: #888;
  padding: 2rem;
  text-align: center;
  font-style: italic;
}

/* Noise page styles */
.noise-filters {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

/* Bloch sphere summary on noise page */
.bloch-summary-section {
  margin-bottom: 2rem;
  text-align: center;
}

.bloch-summary-section h2 {
  font-size: 1.4rem;
  margin-bottom: 0.5rem;
}

.bloch-summary-figure {
  margin: 1rem auto;
  max-width: 1000px;
}

.bloch-summary-img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}

.noise-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.2rem;
}

.noise-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.2rem;
  position: relative;
}

.noise-card h3 {
  font-size: 1.15rem;
  margin-bottom: 0.5rem;
  padding-right: 80px;
}

.noise-card h3 a {
  color: var(--accent);
  text-decoration: none;
}

.noise-card h3 a:hover {
  text-decoration: underline;
}

.noise-card .badge {
  position: absolute;
  top: 1.2rem;
  right: 1.2rem;
}

.noise-card .aka {
  font-style: italic;
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 0.6rem;
}

.noise-card .summary {
  margin-bottom: 0.8rem;
  font-size: 0.95rem;
}

.noise-card .bloch-effect {
  font-size: 0.9rem;
  color: #555;
  margin-bottom: 0.6rem;
}

.technique .mitigated-by,
.noise-card .mitigated-by {
  font-size: 0.9rem;
  margin-bottom: 0.6rem;
}

.technique .tech-link,
.noise-card .tech-link {
  display: inline-block;
  background: var(--accent-light);
  color: var(--accent);
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  text-decoration: none;
  font-size: 0.85rem;
  margin: 0.15rem 0.1rem;
}

.technique .tech-link:hover,
.noise-card .tech-link:hover {
  background: var(--accent);
  color: #fff;
}

.noise-card .references {
  font-size: 0.85rem;
  color: #666;
}
