.post-content pre,
.post-content pre code {
    border-radius: var(--radius);
}
.post-content pre code > table {
    display: table;
    margin: 10px auto;
    border-radius: var(--radius);
    border-spacing: 0;
    border-collapse: collapse;
    table-layout: fixed;
    width: 100%;
}
.post-content pre code > table td {
    vertical-align: top;
    padding: 0;
    margin: 0;
    border: 0;
}
.post-content pre code > table td:first-child {
    white-space: pre;
    user-select: none;
    margin: 0;
    padding: 0 1em 0 0;
    color: #7f7f7f;
    text-align: right;
    display: table-cell;
    max-width: 10%;
}
.post-content pre code > table td:nth-child(2) {
    width: 92%;
}
#searchbox input {
    background-color: var(--theme);
}
.dark #searchbox input {
    background-color: var(--tertiary);
}
.single-article article > .container > h1 {
    margin-bottom: 16px;
}

.light-only {
  display: block;
}
.dark-only {
  display: none;
}
.dark .light-only {
  display: none;
}
.dark .dark-only {
  display: block;
}

.diagram-title {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  white-space: nowrap;
}

.diagrams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
  padding: 1rem;
}

.diagram-entry {
  text-align: center;
  border: none;
  margin: 0;
  padding: 0;
}

.diagram-thumb {
  display: block;
  margin: 0 auto;
  border: none;
  vertical-align: middle
}

.diagram-link {
  display: inline-block;
  line-height: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
}

.diagram-desc {
  margin-top: 0.5rem;
  font-size: 0.95rem;
  color: #111
}

.dark .diagram-desc {
  color: #fff;
}

.diagrams-grid a {
  text-decoration: none;
  border: none;
  background: none;
}

/* Contact Page Styles */
.contact-intro {
  text-align: center;
  margin-bottom: 2rem;
}

.contact-intro p {
  font-size: 1.1rem;
  color: var(--secondary);
}

/* Basic card layout for simple contact cards */
.basic-card .contact-header {
  margin-bottom: 0.75rem;
}

.basic-card .contact-link {
  margin-top: 0;
}

.contact-cards {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 600px;
  margin: 0 auto;
}

.contact-card {
  background: var(--theme);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  position: relative;
}

.contact-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  border-color: var(--primary);
}

.dark .contact-card {
  background: var(--entry);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.dark .contact-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.contact-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.contact-icon {
  width: 28px;
  height: 28px;
  color: var(--primary);
  flex-shrink: 0;
}

.contact-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary);
}

.contact-description {
  color: var(--secondary);
  margin: 0 0 1rem 0;
  font-size: 0.95rem;
}

.contact-link {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: var(--primary);
  color: var(--theme) !important;
  text-decoration: none !important;
  border-radius: 6px;
  font-weight: 500;
  transition: all 0.2s ease;
  border: none;
  width: fit-content;
}

.contact-link:hover {
  background: var(--tertiary);
  transform: translateY(-1px);
}

.nostr-split-container {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

.nostr-left {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.nostr-right {
  flex-shrink: 0;
}

.nostr-content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.nostr-qr {
  width: 150px;
  height: 150px;
  flex-shrink: 0;
  border-radius: 6px;
  border: 1px solid var(--border);
  margin-top: 0.25rem;
}

.npub-clickable {
  background: var(--tertiary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 0.5rem;
}

.npub-clickable:hover {
  background: var(--primary);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.npub-clickable:active {
  transform: translateY(0);
}

#npub-text {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.75rem;
  color: var(--content);
  background: none;
  border: none;
  word-break: break-all;
  line-height: 1.3;
  display: block;
}

.npub-clickable:hover #npub-text {
  color: var(--theme);
}

.copy-success {
  background: var(--tertiary) !important;
  border-color: var(--primary) !important;
}

@media (max-width: 600px) {
  .contact-cards {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .contact-card {
    padding: 1.25rem;
  }
  
  #npub-text {
    font-size: 0.8rem;
  }

  .nostr-split-container {
    flex-direction: column;
    align-items: center;
  }

  .nostr-qr {
    margin-top: 1rem;
  }
}

/* Table of Contents Styling Override */
.toc {
  background: var(--theme) !important;
}

.dark .toc {
  background: var(--entry) !important;
}

.contact-header img.contact-icon {
  display: inline-block;    /* match SVG inline behavior */
  vertical-align: middle;   /* align to text center like SVG */
  margin: 0;                /* remove any default gaps */
}

/* General icon styling */
.contact-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

/* GitHub */
.github-icon {
  content: url("/images/contact/github-black.png");
}
.dark .github-icon {
  content: url("/images/contact/github-white.png");
}

/* Nostr */
.nostr-icon {
  content: url("/images/contact/nostr-black.png");
}
.dark .nostr-icon {
  content: url("/images/contact/nostr-white.png");
}

/* Media Page Styles */
.media-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  padding: 1rem;
  max-width: 800px;
  margin: 0 auto;
}

.media-entry {
  text-align: center;
  border: none;
  margin: 0;
  padding: 0;
}

.media-title {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  margin-bottom: 1rem;
}

.media-video {
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.dark .media-video {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.video-thumbnail {
  width: 100%;
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, var(--primary) 0%, var(--tertiary) 100%);
  border-radius: 8px;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  overflow: hidden;
}

.video-thumbnail:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.dark .video-thumbnail {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.dark .video-thumbnail:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.play-button {
  position: absolute;
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--primary);
  z-index: 2;
  transition: all 0.3s ease;
}

.video-thumbnail:hover .play-button {
  background: rgba(255, 255, 255, 1);
  transform: scale(1.1);
}

.video-placeholder {
  position: absolute;
  bottom: 20px;
  left: 20px;
  right: 20px;
  text-align: center;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
  font-size: 0.9rem;
  z-index: 1;
}

.media-desc {
  margin-top: 0.5rem;
  font-size: 0.95rem;
  color: var(--secondary);
}

/* Epoch Lifecycle Article Styles (articles/mining-epochs) */

/* Diagram figures: epoch colors are theme-aware CSS variables; the SVG markup
   carries light-mode presentation attributes as a fallback (feeds, no CSS),
   and these classes override them so both site themes render correctly. */
.epoch-fig {
  --epA: #b45309; /* epoch A: amber */
  --epB: #0d9488; /* epoch B: teal */
  margin: 28px auto 32px;
  text-align: center;
}

.dark .epoch-fig {
  --epA: #d97706;
}

.epoch-fig svg {
  display: block;
  width: 100%;
  margin: 0 auto;
  max-width: 100%;
  height: auto;
}

.epoch-fig text {
  fill: var(--content);
}

.epoch-fig .t1 {
  fill: var(--primary);
}

.epoch-fig .t2 {
  fill: var(--secondary);
}

.epoch-fig .fA {
  fill: var(--epA);
}

.epoch-fig .sA {
  stroke: var(--epA);
}

.epoch-fig .fB {
  fill: var(--epB);
}

.epoch-fig .sB {
  stroke: var(--epB);
}

.epoch-fig .fN {
  fill: var(--secondary);
}

.epoch-fig .sN {
  stroke: var(--secondary);
}

.epoch-fig .fI {
  fill: var(--primary);
}

.epoch-fig .lnk {
  fill: var(--secondary);
}

.epoch-fig .card,
.epoch-fig .blk {
  fill: var(--theme);
}

.epoch-fig .card {
  stroke: var(--border);
}

.epoch-fig .blk {
  stroke: var(--secondary);
}

.dark .epoch-fig .card,
.dark .epoch-fig .blk {
  fill: var(--entry);
}

.dark .epoch-fig .sBd {
  stroke: var(--tertiary);
}

.epoch-fig marker path {
  fill: var(--secondary);
}

/* Animated figures. Every animated element also reads correctly when frozen:
   the markup is authored in its final, fully-annotated state, and the
   animations replay how it got there. With animations off (reduced motion,
   print, or no CSS at all) the figures are complete static diagrams. */

.epoch-fig .an {
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

/* -- maturity window figure: 14s loop -- */

.epoch-fig .a-p1,
.epoch-fig .a-p2,
.epoch-fig .a-p3,
.epoch-fig .a-p4,
.epoch-fig .a-p5,
.epoch-fig .a-c1,
.epoch-fig .a-c2,
.epoch-fig .a-c3,
.epoch-fig .a-c4,
.epoch-fig .a-c5,
.epoch-fig .a-c6,
.epoch-fig .a-pre,
.epoch-fig .a-fin,
.epoch-fig .a-dim,
.epoch-fig .a-lit {
  animation-duration: 14s;
}

.epoch-fig .a-p1 { animation-name: epm-p1; }
.epoch-fig .a-p2 { animation-name: epm-p2; }
.epoch-fig .a-p3 { animation-name: epm-p3; }
.epoch-fig .a-p4 { animation-name: epm-p4; }
.epoch-fig .a-p5 { animation-name: epm-p5; }
.epoch-fig .a-c1 { animation-name: epm-c1; }
.epoch-fig .a-c2 { animation-name: epm-c2; }
.epoch-fig .a-c3 { animation-name: epm-c3; }
.epoch-fig .a-c4 { animation-name: epm-c4; }
.epoch-fig .a-c5 { animation-name: epm-c5; }
.epoch-fig .a-c6 { animation-name: epm-c6; }
.epoch-fig .a-pre { animation-name: epm-pre; }
.epoch-fig .a-fin { animation-name: epm-fin; }
.epoch-fig .a-dim { animation-name: epm-dim; }
.epoch-fig .a-lit { animation-name: epm-lit; }

@keyframes epm-p1 { 0%, 7% { opacity: 0; } 9%, 95% { opacity: 1; } 99%, 100% { opacity: 0; } }
@keyframes epm-p2 { 0%, 14% { opacity: 0; } 16%, 95% { opacity: 1; } 99%, 100% { opacity: 0; } }
@keyframes epm-p3 { 0%, 21% { opacity: 0; } 23%, 95% { opacity: 1; } 99%, 100% { opacity: 0; } }
@keyframes epm-p4 { 0%, 28% { opacity: 0; } 30%, 95% { opacity: 1; } 99%, 100% { opacity: 0; } }
@keyframes epm-p5 { 0%, 35% { opacity: 0; } 37%, 95% { opacity: 1; } 99%, 100% { opacity: 0; } }
@keyframes epm-c1 { 0%, 7% { opacity: 1; } 9%, 98% { opacity: 0; } 100% { opacity: 1; } }
@keyframes epm-c2 { 0%, 7% { opacity: 0; } 9%, 14% { opacity: 1; } 16%, 100% { opacity: 0; } }
@keyframes epm-c3 { 0%, 14% { opacity: 0; } 16%, 21% { opacity: 1; } 23%, 100% { opacity: 0; } }
@keyframes epm-c4 { 0%, 21% { opacity: 0; } 23%, 28% { opacity: 1; } 30%, 100% { opacity: 0; } }
@keyframes epm-c5 { 0%, 28% { opacity: 0; } 30%, 35% { opacity: 1; } 37%, 100% { opacity: 0; } }
@keyframes epm-c6 { 0%, 35% { opacity: 0; } 37%, 95% { opacity: 1; } 99%, 100% { opacity: 0; } }
@keyframes epm-pre { 0%, 44% { opacity: 1; } 47%, 98% { opacity: 0; } 100% { opacity: 1; } }
@keyframes epm-fin { 0%, 44% { opacity: 0; } 47%, 95% { opacity: 1; } 99%, 100% { opacity: 0; } }
@keyframes epm-dim { 0%, 44% { opacity: 1; } 47%, 95% { opacity: 0.25; } 99%, 100% { opacity: 1; } }
@keyframes epm-lit { 0%, 44% { opacity: 0.25; } 47%, 95% { opacity: 1; } 99%, 100% { opacity: 0.25; } }

/* -- reorg figure: 18s loop -- */

.epoch-fig .a-up1,
.epoch-fig .a-up2,
.epoch-fig .a-orph,
.epoch-fig .a-rpre,
.epoch-fig .a-rfin,
.epoch-fig .a-slide,
.epoch-fig .a-s1,
.epoch-fig .a-s2,
.epoch-fig .a-s3 {
  animation-duration: 18s;
}

.epoch-fig .a-up1 { animation-name: epr-up1; }
.epoch-fig .a-up2 { animation-name: epr-up2; }
.epoch-fig .a-orph { animation-name: epr-orph; }
.epoch-fig .a-rpre { animation-name: epr-pre; }
.epoch-fig .a-rfin { animation-name: epr-fin; }
.epoch-fig .a-slide { animation-name: epr-slide; }
.epoch-fig .a-s1 { animation-name: epr-s1; }
.epoch-fig .a-s2 { animation-name: epr-s2; }
.epoch-fig .a-s3 { animation-name: epr-s3; }

@keyframes epr-pre { 0%, 38% { opacity: 1; } 43%, 97% { opacity: 0; } 100% { opacity: 1; } }
@keyframes epr-up1 { 0%, 15% { opacity: 0; } 18%, 94% { opacity: 1; } 98%, 100% { opacity: 0; } }
@keyframes epr-up2 { 0%, 29% { opacity: 0; } 32%, 94% { opacity: 1; } 98%, 100% { opacity: 0; } }
@keyframes epr-orph { 0%, 41% { opacity: 0; } 44%, 94% { opacity: 1; } 98%, 100% { opacity: 0; } }
@keyframes epr-fin { 0%, 49% { opacity: 0; } 53%, 94% { opacity: 1; } 98%, 100% { opacity: 0; } }
@keyframes epr-slide {
  0%, 52% { opacity: 0; transform: translate(322px, -30px); }
  56% { opacity: 0.6; transform: translate(322px, -30px); }
  66%, 94% { opacity: 1; transform: translate(0, 0); }
  98%, 100% { opacity: 0; transform: translate(322px, -30px); }
}
@keyframes epr-s1 { 0%, 29% { opacity: 1; } 33%, 96% { opacity: 0.35; } 100% { opacity: 1; } }
@keyframes epr-s2 { 0%, 29% { opacity: 0.35; } 33%, 49% { opacity: 1; } 53%, 100% { opacity: 0.35; } }
@keyframes epr-s3 { 0%, 49% { opacity: 0.35; } 53%, 94% { opacity: 1; } 98%, 100% { opacity: 0.35; } }

/* Frozen fallback: the authored markup is the final state, so simply stop. */
@media (prefers-reduced-motion: reduce), print {
  .epoch-fig .an {
    animation: none !important;
  }
}

.logo,
.logo-switches {
  flex-wrap: nowrap;
}
.logo {
  flex-shrink: 0;
}
#menu {
  flex-wrap: wrap;
  overflow-x: visible;
  column-gap: var(--gap);
  line-height: 36px;
}
#menu li + li {
  margin-inline-start: 0;
}

/* 56em is the width at which the menu stops fitting beside the title: raise
   it when a link is added. The script in header.html sets .collapsible, so
   without scripts the links are never hidden. */
#menu-toggle {
  display: none;
  margin: auto var(--gap);
  font-size: 26px;
}
@media (max-width: 56em) {
  .nav.collapsible {
    position: relative;
  }
  .nav.collapsible #menu-toggle {
    display: block;
  }
  .nav.collapsible #menu {
    display: none;
    position: absolute;
    z-index: 10;
    top: 100%;
    inset-inline-end: var(--gap);
    flex-direction: column;
    min-width: 12rem;
    margin: 0;
    padding: 4px 20px;
    line-height: 44px;
    background: var(--entry);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  }
  .nav.collapsible #menu.open {
    display: flex;
  }
}
