/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; }

/* ── Variables ── */
:root {
  --bg:                 #0d1221;
  --bg-card:            #0a1220;
  --bg-nav:             #111827;
  --bg-code:            #080e18;
  --accent:             #4dd9c0;
  --accent-rgb:         077, 217, 192;
  --accent-dark:        #0d7a6a;
  --border:             #1e2f45;
  --border-rgb:         030, 047, 069;
  --border-sep:         #2a3f58;
  --border-sep-rgb:     042, 063, 088;
  --fav-bright:         #e6c878;
  --fav-bright-rgb:     230, 200, 120;
  --fav-hover:          #c8aa5a;
  --overlay-border:     #b4d2f0;
  --overlay-border-rgb: 180, 210, 240;
  --fav-border:         #b89a4a;
  --text-title:         #ddeaf8;
  --text-body:          #a8bfd4;
  --text-desc:          #7a96b0;
  --text-date:          #6a8faa;
  --text-dim:           #5c7a96;
  --text-nav:           #8fb3d0;
  --text-code:          #7ab3d4;
  --text-comment:       #4d7a96;
  --text-keyword:       #4dd9c0;
  --text-string:        #a8c8a0;
  --font-mono:          'Courier Prime', 'Courier New', Courier, monospace;
  --font-title:         'Quantico', sans-serif;
  --font-contents:      'JetBrains Mono Variable', monospace;
  --inner-width:        1200px;
  --inner-pad:          3.5rem;
  
  --tab-line-height:       1px;
  --tab-line-hover-height: 2px;
  --tab-fade-duration:     0.12s;
  --line-hover-duration:   0.3s;
  --line-hover-ease:       cubic-bezier(0.3, 1, 0.3, 1);
  --sg-badge-gap:          0.2rem;
}

/* ── Base ── */
html { font-size: 18px; }
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text-body);
  font-family: var(--font-mono);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
.w-100 { font-weight: 100; }
.w-200 { font-weight: 200; }
.w-300 { font-weight: 300; }
.w-400 { font-weight: 400; }
.w-500 { font-weight: 500; }
.w-600 { font-weight: 600; }
.w-700 { font-weight: 700; }
.w-800 { font-weight: 800; }
.w-900 { font-weight: 900; }

/* ── Shared inner centering ── */
.header-inner,
.main-inner {
  max-width: var(--inner-width);
  margin: 0 auto;
  padding: 0 var(--inner-pad);
}

/* ── Header ── */
#site-header {
  padding-top: 1.6rem;
  position: relative;
  z-index: 100;
}
#site-title {
  font-family: var(--font-title);
  font-size: 2.6rem;
  font-weight: 400;
  color: var(--text-title);
  letter-spacing: 0.06em;
  display: block;
  text-shadow: 0 0 6px rgba(var(--accent-rgb), 0.5);
}
#site-tagline {
  cursor: default;
  color: var(--text-dim);
  font-size: 0.95rem;
  margin-top: 0.1rem;
  text-shadow:
    0 0 2px rgba(var(--accent-rgb), 0.1),
    0 0 6px rgba(var(--accent-rgb), 0.35);
}
.tagline-prefix {
  color: var(--accent);
  font-size: 1.37rem;
  letter-spacing: -0.3rem;
  margin-right: 0.5rem;
  text-shadow:
    0 0 2px rgba(var(--accent-rgb), 1),
    0 0 6px rgba(var(--accent-rgb), 0.5);
}

/* ── Nav ── */
#site-nav {
  position: relative;
  background: #111827;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-top: 1.3rem;
  width: 100%;
  overflow: visible;
}
/* ── Nav glass effect — keep this, just uncomment to enable ── */
/*
#site-nav::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;

  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.03) 0%,
    rgba(255, 255, 255, 0.012) 18%,
    rgba(255, 255, 255, 0) 42%
  );

  -webkit-mask-image: linear-gradient(
    to right,
    transparent 0%,
    black 25%,
    black 75%,
    transparent 100%
  );
  mask-image: linear-gradient(
    to right,
    transparent 0%,
    black 25%,
    black 75%,
    transparent 100%
  );
}
*/

.nav-inner {
  position: relative;
  z-index: 1;
  display: flex;
  max-width: var(--inner-width);
  margin: 0 auto;
  padding: 0 var(--inner-pad);
}

.nav-underline {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  pointer-events: none;
  z-index: 2;
}

.nav-underline.ready {
  transition: left 0.3s ease, width 0.3s ease;
}

.nav-label {
  display: inline-block;
}

@supports (-webkit-appearance: none) and (not (-moz-appearance: none)) {
  .nav-label {
    transform: translateY(0.05em);
  }
}

#site-nav a:not(.search-result) {
  color: var(--text-nav);
  font-size: 0.88rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.75rem 1.1rem;
  display: block;
  position: relative;
  transition: color 0.15s ease;
}

#site-nav a:not(.search-result)::after {
  display: none;
}

#site-nav a:first-child:not(.search-result) { padding-left: 0; }
#site-nav a.active { color: var(--accent); }
#site-nav a.active::after { background: var(--accent); }
#site-nav a:not(.search-result):hover { color: var(--accent); }

/* ── Main ── */
#site-main { padding: 2.2rem 0; flex: 1; }

/* ── Gallery ── */
.gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.4rem;
}
.card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg-card);
  display: block;
}
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid var(--border-sep);
  border-radius: inherit;
  opacity: 0;
  pointer-events: none;
  z-index: 10;
  transition: opacity 0.3s ease;
}
.card:hover::after {
  opacity: 1;
}
.card-img {
  margin: 7px 7px 0;
  border-radius: 3px;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--bg-code);
}
.card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-body { padding: 1rem 1.1rem; }
.card-date {
  display: flex;
  align-items: center;
  justify-content: space-between;

  color: var(--text-date);
  font-size: 0.8rem;
  margin-bottom: 0.35rem;
}
.card-title { color: var(--text-title); font-size: 1rem; line-height: 1.45; }
.card-desc { color: var(--text-desc); font-size: 0.8rem; margin-top: 0.45rem; line-height: 1.55; }

/* ── Card preview popup ── */
.card-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  cursor: pointer;
}

.card-popup-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.card-popup-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: default;
  position: relative;
  overflow: visible;
  transform: scale(0.92);
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.card-popup-overlay.is-visible .card-popup-wrap {
  transform: scale(1);
  opacity: 1;
}

.card-popup {
  width: min(calc(var(--inner-width) * 0.7), 90vw);
  pointer-events: auto;
  position: relative;
}

.card-popup-overlay.is-visible .card-popup {
  /* animation handled by parent .card-popup-wrap */
}

.card-popup-card {
  width: 100%;
}

.card-popup-close {
  position: absolute;
  top: 0;
  right: calc(-2.5rem - 0.75rem);
  background: rgba(0,0,0,0.95);
  border: 1px solid rgba(var(--overlay-border-rgb), 0.25);
  color: #fff;
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
  width: 2.2rem;
  height: 2.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 3px;
  opacity: 0.85;
  padding: 0;
  z-index: 302;
  transition: color 0.15s ease, opacity 0.15s ease;
}

.card-popup-card {
  width: 100%;
}

.card-popup-card .card {
  width: 100%;
  background: rgba(0,0,0,0.92);
}

/* Disable hover border effect inside popup */
.card-popup-card .card::after {
  display: none;
}

.card-popup-card .card-img {
  margin: 17px 17px 0;
  aspect-ratio: 16 / 10;
}

.card-popup-card .card-disabled .card-img img {
  filter: none;
}

.card-popup-card .card-disabled {
  border-color: var(--border);
}

.card-popup-prev,
.card-popup-next,
.card-popup-close {
  border-color: var(--border) !important;
}
  font-size: 1.15rem;
  line-height: 1.45;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-popup-card .card-date {
  margin-bottom: 0.35rem; /* same as original */
}

.card-popup-card .card-desc {
  font-size: 0.92rem;
  margin-top: 0.45rem; /* same as original card */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Link zone covering title+desc in popup */
.card-popup-link {
  display: block;
  text-decoration: none;
  color: inherit;
  margin: 0 -1.1rem -1rem;
  padding: 0 1.1rem 1rem;
}

.card-popup-link:hover .card-title {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Prev/next nav — exact same as .sg-prev/.sg-next */
.card-popup-prev,
.card-popup-next {
  position: static;
  background: rgba(0,0,0,0.95);
  border: 1px solid rgba(var(--overlay-border-rgb), 0.25);
  color: #fff;
  font-size: 2.5rem;
  font-weight: 500;
  line-height: 1;
  width: 2.5rem;
  height: 3.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 3px;
  opacity: 0.85;
  padding-bottom: 0.91rem;
  transition: color 0.15s ease, opacity 0.15s ease;
  flex-shrink: 0;
}

.card-popup-prev:hover,
.card-popup-next:hover { opacity: 1; color: var(--accent); }

@supports (-webkit-appearance: none) and (not (-moz-appearance: none)) {
  .card-popup-prev,
  .card-popup-next {
    font-family: var(--font-contents);
    font-size: 1.7rem;
    padding-bottom: 0.35rem;
    padding-right: 0.25rem;
  }
}

/* Close button — same as .sg-lightbox-close, aligned top-right of card */
.card-popup-close {
  position: absolute;
  top: 0;
  right: calc(-2.5rem - 0.75rem);
  background: rgba(0,0,0,0.95);
  border: 1px solid var(--border);
  color: #fff;
  line-height: 1;
  width: 2.2rem;
  height: 2.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 3px;
  opacity: 0.85;
  padding: 0;
  z-index: 302;
  transition: color 0.15s ease, opacity 0.15s ease;
}


.card-popup-close:hover { opacity: 1; color: var(--accent); }

/* Suppress Firefox/mobile long-press preview on cards */
.card[data-title],
.tl-entry-row[data-title] {
  -webkit-touch-callout: none;
  user-select: none;
}

/* ── Timeline ── */
.timeline { display: flex; flex-direction: column; margin-top: -0.3rem; }
.tl-row { display: flex; align-items: center; }
.tl-rail {
  width: 40px; flex-shrink: 0; align-self: stretch;
  display: flex; flex-direction: column; align-items: center;
}
.spine { width: 3px; background: var(--border); border-radius: 2px; flex: 1; min-height: 0; }
.spine.gap { background: transparent; flex: none; height: 7px; }
.spine.hidden { background: transparent; flex: 1; }
.dot-year {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent-dark); border: 3px solid var(--accent);
  flex-shrink: 0;
}
.dot-entry {
  width: 12px; height: 12px; border-radius: 50%;
  background: #1a3a52; border: 2px solid #4d7a96;
  flex-shrink: 0;
}
.tl-content { flex: 1; padding-left: 1.6rem; display: flex; align-items: center; }
.year-row { display: flex; align-items: center; width: 100%; }
.year-label { color: var(--accent); font-size: 1.5rem; letter-spacing: 0.08em; line-height: 1; font-weight: 500; transform: translateY(0); font-family: var(--font-contents); cursor: default; }
@supports (-webkit-appearance: none) and (not (-moz-appearance: none)) {
  .year-label { transform: translateY(0.04em); }
}
.entry-row { width: 100%; padding: 0.75rem 0; display: flex; gap: 2rem; align-items: center; }
.entry-row.sep { border-bottom: 1px solid var(--border-sep); }
.entry-date { color: var(--text-date); font-size: 0.85rem; min-width: 50px; flex-shrink: 0; line-height: 1; transform: translateY(0.08em); }
.entry-title {
  color: var(--text-title);
  font-size: 0.95rem;
  line-height: 1;
  transform: translateY(0.17em);
  transition: color 0.15s ease;
}
.entry-readtime { color: var(--text-date); font-size: 0.8rem; }
.entry-desc { color: var(--text-desc); font-size: 0.8rem; margin-top: 0.25rem; line-height: 1.4; transform: translateY(0.17em); }
.entry-row a {
  display: block;
}
.entry-row a:hover .entry-title {
  color: var(--accent);
}

/* ── Article ── */
.article-header { margin-bottom: 1.8rem; margin-top: -0.3rem; }
.article-date {
  color: var(--text-date);
  font-size: 0.9rem;
  margin: 0 0 0.75rem 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.article-date-left {
  display: flex;
  align-items: baseline;
  gap: 0.5em;
  flex-wrap: wrap;
}

.article-date-sep {
  opacity: 0.5;
}

.article-pubdate {
  color: var(--text-date);
}

.article-date-right {
  flex-shrink: 0;
  margin-left: auto;
}
.article-title { color: var(--text-title); font-size: 1.6rem; line-height: 1.3; margin: 0; }
.article-subtitle { color: var(--text-desc); font-size: 0.95rem; margin: 0 0 0.3rem 0; }
.article-body { max-width: 100%; font-family: var(--font-contents); }
.article-body p { margin-bottom: 0.9rem; font-size: 0.9rem; line-height: 1.85; }
.article-body h2 {
  display: inline-block;
  background: #1a2a3a;
  color: var(--accent);
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 0.275rem 0.9rem 0.35rem 0.9rem;
  margin: 0.6rem 0;
  border-left: 3px solid var(--accent);
  font-weight: 400;
}
.article-body h3 {
  color: #7ab3d4;
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  border-left: 3px solid #7ab3d4;
  padding: 0rem 0 0 0.8rem;
  margin: 1.2rem 0 0.4rem;
  font-weight: 400;
}
.article-body pre,
pre:has(code.language-ascii),
pre:has(code.language-asciiart) {
  background: var(--bg-code);
  border: 0.5px solid var(--border);
  padding: 1.2rem 1.4rem;
  font-size: 0.8rem;
  line-height: 1.7;
  color: var(--text-code);
  margin-bottom: 1.5rem;
  margin-top: 1.4rem;
  border-radius: 4px;
  overflow-x: auto;
}
.highlight { background: var(--bg-code) !important; border-radius: 4px; margin-bottom: 1.4rem; }
.highlight pre { background: var(--bg-code) !important; margin: 0; border: 0.5px solid var(--border); border-radius: 4px; padding: 1.2rem 1.4rem; font-size: 0.8rem; line-height: 1.7; overflow-x: auto; }
.article-body code {
  background: var(--bg-code);
  color: var(--accent);
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  font-size: 0.85em;
  border: 0.5px solid var(--border);
}
.article-body pre code {
  background: none;
  color: inherit;
  padding: 0;
  border: none;
  border-radius: 0;
  font-size: inherit;
}
.article-body img {
  max-width: 100%;
  border-radius: 3px;
  margin: 1rem 0;
  border: 1px solid var(--border);
  padding: 6px;
  background: var(--bg-card);
  box-sizing: border-box;
  display: block;
}

@keyframes crt-flicker {
  0%   { opacity: 1; }
  18%  { opacity: 0.97; }
  41%  { opacity: 1; }
  63%  { opacity: 0.99; }
  79%  { opacity: 1; }
  100% { opacity: 0.94; }
}

pre:has(code.language-ascii),
pre:has(code.language-asciiart) {
  width: fit-content;
  max-width: calc(100vw - 2rem);
  margin-left: auto;
  margin-right: auto;
  overflow-x: auto;
  line-height: 1.2;
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(var(--fav-bright-rgb),0.05),
    rgba(var(--fav-bright-rgb),0.05) 1px,
    transparent 1px,
    transparent 3px
  );
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.35);
  border-radius: 2% / 50%;
}

pre:has(code.language-ascii) code,
pre:has(code.language-asciiart) code {
  text-shadow: 0 0 4px rgba(var(--fav-bright-rgb), 0.5);
  color: var(--fav-bright);
  animation: crt-flicker 0.5s infinite;
}

@keyframes ascii-pulse {
  0%, 100% {
    text-shadow:
      0 0 8px rgba(var(--fav-bright-rgb), 0.8),
      0 0 16px rgba(var(--fav-bright-rgb), 0.7),
      0 0 28px rgba(var(--fav-bright-rgb), 0.6);
  }
  50% {
    text-shadow:
      0 0 14px rgba(var(--fav-bright-rgb), 1),
      0 0 28px rgba(var(--fav-bright-rgb), 1),
      0 0 50px rgba(var(--fav-bright-rgb), 0.9),
      0 0 80px rgba(var(--fav-bright-rgb), 0.7);
  }
}

.ascii-link {
  display: inline-block;
  color: var(--fav-bright) !important;
  text-decoration: none;
  cursor: pointer;
  text-shadow: none;
  animation: none;
  transition:
    color 0.12s ease,
    text-shadow 0.12s ease;
}

.ascii-link:hover {
  color: #ffffff !important;
  text-shadow:
    0 0 10px rgba(var(--fav-bright-rgb), 1),
    0 0 20px rgba(var(--fav-bright-rgb), 0.9),
    0 0 35px rgba(var(--fav-bright-rgb), 0.8),
    0 0 55px rgba(var(--fav-bright-rgb), 0.6);
  animation: ascii-pulse 1.6s ease-in-out infinite;
}

/* ── Article tags + footer ── */
.article-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.15rem; }
.article-tags .tag {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.125rem 0.45rem 0.01rem;
  background: var(--accent);
  color: var(--bg);
  border: 1px solid var(--bg);
  letter-spacing: 0.08em;
  border-radius: 3px;
  transition: background 0.2s ease, color 0.15s ease, border-color 0.15s ease;
  -webkit-font-smoothing: antialiased;
}
.article-tags .tag:hover {
  background: var(--bg);
  color: var(--accent);
  border-color: var(--accent-dark);
}
.article-footer { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.article-nav { display: flex; gap: 2rem; }
.article-nav-prev, .article-nav-next {
  color: var(--text-date);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: color 0.15s ease;
}
.article-nav-prev:hover, .article-nav-next:hover { color: var(--accent); }
.article-nav-title { max-width: 30ch; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: inline-block; }
.back-link {
  color: var(--text-date);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  transition: color 0.15s ease;
}
.back-link:hover { color: var(--accent); }

/* ── Video ── */
.article-video {
  width: 100%;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  margin: 1rem 0;
  display: block;
  padding: 6px;
  box-sizing: border-box;
}

/* ── Shortcode Gallery Carousel ── */
.sg-gallery {
  position: relative;
  margin: 1rem 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-card);
  padding: 6px;
}
.sg-viewport {
  overflow: hidden;
  border-radius: 3px;
  transition: height 0.3s ease;
  line-height: 0;
  aspect-ratio: 16 / 9;
}
.sg-viewport[style*="height"] {
  aspect-ratio: auto;
}
.sg-track {
  display: flex;
  transition: transform 0.3s ease;
}
.sg-slide {
  min-width: 100%;
  overflow: hidden;
  font-size: 0;
}
.sg-slide img {
  width: 100%;
  display: block;
  border-radius: 3px;
  border: none;
  margin: 0;
  padding: 0;
  vertical-align: top;
}
.sg-prev, .sg-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.95);
  border: 1px solid rgba(var(--overlay-border-rgb), 0.25);
  color: #fff;
  font-size: 2.5rem;
  font-weight: 500;
  line-height: 1;
  width: 2.5rem;
  height: 3.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 3px;
  z-index: 2;
  opacity: 0.85;
  padding-bottom: 0.91rem;
  transition: color 0.15s ease, opacity 0.15s ease;
  will-change: opacity;
}
@supports (-webkit-appearance: none) and (not (-moz-appearance: none)) {
  .sg-prev, .sg-next {
    font-family: var(--font-contents);
    font-size: 1.7rem;
    padding-bottom: 0.35rem;
    padding-right: 0.25rem;
  }
}
.sg-prev { left: 0.5rem; }
.sg-next { right: 0.5rem; }
.sg-prev:hover, .sg-next:hover { opacity: 1; color: var(--accent); }
/* Counter wrap — handles positioning */
.sg-counter-wrap {
  position: absolute;
  bottom: 0.6rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: var(--sg-badge-gap);
  transition: top 0.2s ease, bottom 0.2s ease;
}

.sg-counter-wrap.sg-counter-top {
  bottom: auto;
  top: 0.6rem;
}

.sg-counter {
  background: rgba(0,0,0,0.95);
  border: 1px solid rgba(var(--overlay-border-rgb), 0.25);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0 0.7rem 0 0.6rem;
  border-radius: 3px;
  font-family: var(--font-mono);
  opacity: 0.85;
  height: 2.1rem;
  display: flex;
  align-items: center;
  box-sizing: border-box;
}

.sg-shuffle-icon {
  background: rgba(0,0,0,0.95);
  border: 1px solid rgba(var(--overlay-border-rgb), 0.25);
  color: #fff;
  border-radius: 3px;
  opacity: 0.85;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.1rem;
  height: 2.1rem;
  box-sizing: border-box;
}

@supports (-webkit-appearance: none) and (not (-moz-appearance: none)) {
  .sg-counter {
    font-family: var(--font-mono);
    font-weight: 600;
    padding: 0 0.715rem 0 0.675rem;
    transform: translateY(0.05em);
    height: 2.2rem;
  }
  .sg-shuffle-icon {
    height: 2.2rem;
    width: 2.2rem;
  }
}

.sg-shuffle-icon svg {
  width: 75%;
  height: 75%;
  display: block;
  transform: translateX(0) translateY(0.027em);
}

/* Firefox — lightbox shuffle SVG (Chrome overrides below) */
.sg-lightbox .sg-counter-wrap .sg-shuffle-icon svg {
  transform: translateX(-0.03em) translateY(-0.035em);
}

@supports (-webkit-appearance: none) and (not (-moz-appearance: none)) {
  .sg-shuffle-icon svg {
    transform: translateY(-0.025em);
  }
  .sg-lightbox .sg-counter-wrap .sg-shuffle-icon svg {
    transform: translateY(-0.025em);
  }
  .sg-lightbox .sg-counter-wrap .sg-shuffle-icon {
    transform: translateY(0.069em);
  }
}

.sg-counter span {
  display: block;
  transform: translateY(0.1em);
}

@supports (-webkit-appearance: none) and (not (-moz-appearance: none)) {
  .sg-counter span {
    transform: translateY(0.04em);
  }
}

/* Host container — invisible wrapper, JS builds rows inside */
.sg-badge-host {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

.sg-lb-badge-host {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 201;
}

/* Each row — centered, inline badges, top/bottom set by JS */
.sg-badge-row {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: var(--sg-badge-gap);
  pointer-events: auto;
}

/* Inside lightbox host, rows need fixed positioning */
.sg-lb-badge-host .sg-badge-row {
  position: fixed;
}

.sg-badge-row-bottom {
  top: auto;
}

.sg-meta-badge {
  background: rgba(0,0,0,0.95);
  border: 1px solid rgba(var(--overlay-border-rgb), 0.25);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.3rem 0.6rem 0.15rem 0.6rem;
  border-radius: 3px;
  font-family: var(--font-mono);
  opacity: 0.85;
  white-space: nowrap;
}

/* Hide empty badges */
.sg-meta-badge:empty { display: none; }

.sg-meta-badge span {
  display: block;
  transform: translateY(0.1em);
}

@supports (-webkit-appearance: none) and (not (-moz-appearance: none)) {
  .sg-meta-badge span {
    transform: translateY(0.04em);
  }
}



/* Download button — same style as sg-expand, positioned below it */
.sg-download {
  position: absolute;
  top: calc(0.5rem + 2.24rem + 0.4rem);
  right: 0.5rem;
  z-index: 20;
  font-family: var(--font-contents);
  background: rgba(0,0,0,0.95);
  border: 1px solid rgba(var(--overlay-border-rgb), 0.25);
  color: #fff;
  font-size: 1.5rem;
  font-weight: 1000;
  line-height: 1;
  width: 2.25rem;
  height: 2.24rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 3px;
  opacity: 0.85;
  text-decoration: none;
  transition: color 0.15s ease, opacity 0.15s ease;
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: none;
}

.sg-lb-download {
  position: fixed;
  top: calc(1rem + 2.1rem + 0.4rem);
  right: 1rem;
  z-index: 201;
  font-family: var(--font-contents);
  background: rgba(0,0,0,0.95);
  border: 1px solid rgba(var(--overlay-border-rgb), 0.25);
  color: #fff;
  font-size: 1.5rem;
  font-weight: 1000;
  line-height: 1;
  width: 2.2rem;
  height: 2.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 3px;
  opacity: 0.85;
  text-decoration: none;
  transition: color 0.15s ease, opacity 0.15s ease;
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: none;
}

.sg-download svg,
.sg-lb-download svg {
  display: block;
  fill: currentColor;
  width: 1.35rem;
  height: 1.35rem;
  overflow: visible;
}

@supports (-webkit-appearance: none) and (not (-moz-appearance: none)) {
  .sg-download svg,
  .sg-lb-download svg {
    width: 1.38rem;
    height: 1.38rem;
    transform: translateY(-0.02em);
  }
}

.sg-download:hover,
.sg-lb-download:hover { opacity: 1; color: var(--accent); }

@supports (-webkit-appearance: none) and (not (-moz-appearance: none)) {
  .sg-meta-badge {
    font-weight: 600;
    padding: 0.28rem 0.675rem 0.18rem 0.675rem;
  }
  .sg-download,
  .sg-lb-download {
    font-size: 1.47rem;
    font-weight: 700;
  }
}
@supports (-webkit-appearance: none) and (not (-moz-appearance: none)) {
  .sg-counter {
    padding: 0 0.715rem 0 0.675rem;
  }
  .sg-shuffle-icon {
    transform: translateY(0.048em);
  }
}
.sg-expand,
.embed-expand {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(0,0,0,0.95);
  border: 1px solid rgba(var(--overlay-border-rgb), 0.25);
  color: #fff;
  line-height: 1;
  width: 2.25rem;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 3px;
  z-index: 20;
  opacity: 0.85;
  transition: color 0.15s ease, opacity 0.15s ease;
  box-sizing: border-box;
  flex-shrink: 0;
}

.sg-expand svg,
.embed-expand svg {
  width: 1.3rem;
  height: 1.3rem;
  display: block;
}

.sg-expand:hover,
.embed-expand:hover { opacity: 1; color: var(--accent); }

/* ── Hide nav controls for single-image galleries ── */
.sg-gallery[data-count="1"] .sg-prev,
.sg-gallery[data-count="1"] .sg-next,
.sg-gallery[data-count="1"] .sg-counter-wrap {
  display: none;
}

.sg-lightbox[data-count="1"] .sg-lb-prev,
.sg-lightbox[data-count="1"] .sg-lb-next,
.sg-lightbox[data-count="1"] .sg-lb-counter {
  display: none;
}

/* ── Lightbox ── */
.sg-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 0 calc(1rem + 2.5rem + 1rem); /* edge + arrow width + gap each side */
  box-sizing: border-box;
}
.sg-lightbox.active { display: flex; }
.sg-lightbox-img {
  max-width: 100%;
  max-height: 90vh;
  width: auto;
  height: auto;
  border-radius: 4px;
  display: block;
  object-fit: contain;
}
.sg-lightbox-close,
.embed-lightbox-close {
  position: fixed;
  top: 1rem;
  right: 1rem;
  background: rgba(0,0,0,0.95);
  border: 1px solid rgba(var(--overlay-border-rgb), 0.25);
  color: #fff;
  line-height: 1;
  width: 2.2rem;
  height: 2.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 3px;
  opacity: 0.85;
  padding: 0;
  z-index: 201;
  transition: color 0.15s ease, opacity 0.15s ease;
}
.sg-lightbox-close svg,
.embed-lightbox-close svg,
.card-popup-close svg {
  width: 1rem;
  height: 1rem;
  display: block;
}
.sg-lightbox-close:hover,
.embed-lightbox-close:hover { opacity: 1; color: var(--accent); }
.sg-lb-prev { position: fixed; left: 1rem; top: 50%; transform: translateY(-50%); z-index: 201; }
.sg-lb-next { position: fixed; right: 1rem; top: 50%; transform: translateY(-50%); z-index: 201; }
.sg-lb-counter {
  /* positioning handled by .sg-counter-wrap */
}

/* Lightbox counter wrap */
.sg-lightbox .sg-counter-wrap {
  position: fixed;
  bottom: 1rem;
  top: auto;
}

.sg-lightbox .sg-counter-wrap.sg-counter-top {
  bottom: auto;
  top: 1rem;
}

/* ── Search ── */
.nav-search {
  margin-left: auto;
  position: relative;
  display: flex;
  align-items: center;
}
#search-input {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-nav);
  font-family: var(--font-contents);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  padding: 0.25rem 0.6rem;
  width: 220px;
  outline: none;
  transition: width 0.2s ease, border-color 0.2s ease;
}
#search-input::placeholder { color: var(--text-dim); }
#search-input:focus {
  width: 300px;
  border-color: var(--accent);
  color: var(--text-title);
}
#search-results {
  display: none;
  position: absolute;
  top: calc(100% + 0.75rem);
  right: 0;
  width: 320px;
  background: var(--bg-nav);
  border: 1px solid var(--border);
  border-radius: 4px;
  z-index: 150;
  max-height: 400px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
#search-results.active { display: block; }
.search-result {
  display: block;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-body);
  text-transform: none;
  letter-spacing: normal;
  transition: background 0.15s ease, color 0.1s ease;
}
.search-result:last-child { border-bottom: none; }
.search-result:hover { background: var(--bg-card); color: var(--text-body); }
.search-result-title { color: var(--text-title); font-size: 0.85rem; margin-bottom: 0.2rem; text-transform: none; letter-spacing: normal; font-weight: 400; }
.search-result-desc { color: var(--text-desc); font-size: 0.75rem; text-transform: none; letter-spacing: normal; }
.search-result-date { color: var(--text-date); font-size: 0.72rem; margin-top: 0.2rem; text-transform: none; letter-spacing: normal; }
.search-empty { padding: 0.7rem 1rem; color: var(--text-dim); font-size: 0.8rem; }
#site-footer {
  cursor: default;
  position: relative;
  border-top: none;
  padding: 1.2rem 0;
  margin-top: 2rem;
  overflow: visible;
}
#site-footer::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: 42px;
  pointer-events: none;
  z-index: 0;

  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.25) 0%,
    rgba(0, 0, 0, 0.08) 14%,
    rgba(0, 0, 0, 0.01) 50%,
    rgba(0, 0, 0, 0) 100%
  );
}
#site-footer::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 1px;
  background: var(--border);
  pointer-events: none;
  z-index: 2;
}
.footer-inner {
  max-width: var(--inner-width);
  margin: 0 auto;
  padding: 0 var(--inner-pad);
  color: var(--text-dim);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
}
.footer-inner a {
  color: var(--accent);
  transition: color 0.15s ease;
}
.footer-inner a:hover { color: var(--text-title); }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  color: var(--border-sep);
  font-size: 1rem;
  letter-spacing: 0.1em;
  padding-top: 2rem;
}

/* ── 404 ── */
.notfound {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 5rem;
  cursor: default;
}
.notfound-code {
  font-family: var(--font-contents);
  font-size: 8rem;
  font-weight: 200;
  color: var(--border-sep);
  line-height: 1;
  letter-spacing: 0.05em;
}
.notfound-text {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  color: var(--border-sep);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-top: 0.3rem;
  margin-right: 0.35rem;
}
.notfound-back {
  margin-top: 1.5rem;
  color: var(--text-date);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  margin-right: 0.5rem;
  transition: color 0.15s ease;
}
.notfound-back:hover { color: var(--accent); }

/* Flipped second 4 in 404 */
.notfound-flip {
  display: inline-block;
  transform:
    scaleX(-1)
    translateX(0.05em);
}

/* ── Static pages ── */
.static-page-body {
  max-width: 100%;
  margin-top: -0.15rem;
  font-family: var(--font-contents);
}
.static-page-body p {
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
  line-height: 1.85;
}
.static-page-body p,
.static-page-body li,
.static-page-body blockquote {
  font-weight: var(--page-fw, 400);
}
.static-page-body strong,
.static-page-body b {
  font-weight: var(--page-fw-bold, 600);
}
.static-page-title, .static-page-body h2 {
  color: var(--text-title);
  font-size: 1.6rem;
  line-height: 1;
  margin: 0 0 1.25rem 0;
  font-family: var(--font-mono);
}
.static-page-body h2 {
  margin-top: 2.5rem;
}
.static-page-title,
.static-page-body h2 {
  color: var(--text-title);
  font-size: 1.6rem;
  line-height: 1;
  margin: 0 0 1.25rem 0;
  font-family: var(--font-mono);

  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.static-page-title::after,
.static-page-body h2::after {
  content: "";
  flex: 1;
  height: var(--tab-line-height);
  background: var(--border);
  opacity: 1;
}
.static-page-body h2 {
  margin-top: 2rem;
}
.static-page-title::after,
.static-page-body h2::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
  transition:
    background-color var(--line-hover-duration) ease,
    height var(--line-hover-duration) var(--line-hover-ease);
}
.static-page-title:hover::after,
.static-page-body h2:hover::after {
  background: var(--border-sep);
  height: var(--tab-line-hover-height);
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.static-page-body > h1.visually-hidden + h2 {
  margin-top: 0;
}

/* ── Mini media grid ── */
.mini-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin: 1.75em 0;
  padding-top: 2px;
}

.mini-card {
  position: relative;
  display: block;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: visible;
  background: var(--bg-card);
  text-decoration: none;
  color: inherit;
  outline: 1px solid transparent;
  outline-offset: 0px;
  transition: outline-color 0.3s ease;
}

.mini-card-link:not(.mini-card-fav):hover {
  box-shadow: 0 0 0 1px var(--border-sep);
}

.mini-card-media {
  padding: 6px;
  position: relative; 
  overflow: hidden;
  border-radius: 3px 3px 0 0;
}

.mini-card-media img {
  display: block;
  width: 100%;
  aspect-ratio: 5 / 7;
  object-fit: cover;
  border-radius: 2px;
}

.mini-card-label {
  padding: 0.35rem 0.65rem 0.6rem 0.65rem;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--text-title);
}

.mini-card-title {
  color: var(--text-title);
  font-size: 0.8rem;
  line-height: 1.35;
}

.mini-card-meta {
  color: var(--text-date);
  font-size: 0.72rem;
  margin-top: 0.15rem;
}

.mini-card-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25em;
  width: 100%;
  margin-top: 0.6rem;
  padding: 0.11em 0.35em 0.1em 0.5em;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.4;
  color: #fff;
  border: 1px solid var(--fav-bright);
  border-radius: 3px;
  letter-spacing: 0.05em;
  box-sizing: border-box;
  white-space: nowrap;
}

.mini-card-badge-star {
  display: inline-block;
  transform: translateY(0px); /* Firefox: leave at 0 */
  margin-left: 0.25em;
}

/* Easter egg hint — same as badge but dimmer */
.mini-card-badge--hint {
  color: var(--text-date);
  border-color: var(--text-date);
  font-weight: 500;
  padding: 0.11em 0.35em 0.1em 0.35em;
  animation: hint-badge-in 0.4s ease forwards;
}

@keyframes hint-badge-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

@supports (-webkit-appearance: none) and (not (-moz-appearance: none)) {
  .mini-card-badge-star {
    transform: translateY(-0.04em); /* Chrome only */
  }
  .mini-card-badge {
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    padding: 0.05em 0.35em 0em 0.5em;
    margin-bottom: 0.01em;
  }
}

@supports (-webkit-appearance: none) and (hanging-punctuation: first) {
  .mini-card-badge {
    font-size: 0.69rem;
  }
}

/* ── Favorite tile ── */
.mini-card-fav {
  border: none;
  background: linear-gradient(
    50deg,
    rgba(var(--fav-bright-rgb), 0.85),
    rgba(var(--border-rgb), 1),
    rgba(var(--fav-bright-rgb), 0.65)
  );
  padding: 1px;
  transition: outline-color 0.3s ease;
  outline: 1px solid transparent;
  outline-offset: 0px;
}

.mini-card-fav::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 5px;
  padding: 1px;
  pointer-events: none;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.3s ease;
  transform: translateZ(0);
  background: linear-gradient(
    50deg,
    rgba(var(--fav-bright-rgb), 0.95),
    rgba(var(--border-rgb), 1),
    rgba(var(--fav-bright-rgb), 0.75)
  );
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  mask-composite: exclude;
}

.mini-card-fav:hover::after {
  opacity: 1;
}

.mini-card-inner {
  background: var(--bg-card);
  border-radius: 3px;
  width: 100%;
  height: 100%;
}

/* ── Static page h2 tabs ── */
.static-page-body h2.has-tabs {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.static-page-body h2.has-tabs::after {
  display: none;
}

.static-page-h2-label {
  color: var(--text-title);
  font-size: 1.6rem;
  line-height: 1;
  font-family: var(--font-mono);
  flex: 0 0 auto;
}

.static-page-tabs-line {
  position: relative;
  flex: 1;
  height: 1px;
  background: var(--border);
  min-width: 1.5rem;
  transition:
    background-color var(--line-hover-duration) ease,
    box-shadow var(--line-hover-duration) var(--line-hover-ease);
}

.static-page-tab-sep {
  position: relative;
  width: 0.9rem;
  height: 1px;
  background: var(--border);
  flex: 0 0 auto;
  transition:
    background-color var(--line-hover-duration) ease,
    box-shadow var(--line-hover-duration) var(--line-hover-ease);
}

.static-page-body h2.has-tabs:hover .static-page-tabs-line,
.static-page-body h2.has-tabs:hover .static-page-tab-sep {
  background: var(--border-sep);
  box-shadow: 0 1px 0 0 var(--border-sep);
}


.static-page-tabs-nav {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex: 0 0 auto;
  flex-wrap: wrap;
}

.static-page-tab {
  font: inherit;
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 400;
  line-height: 1;
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.2s ease;
  transform: translateY(0.03em);
}

.static-page-tab:hover {
  color: var(--text-title);
}

.static-page-tab.is-active {
  color: var(--text-title);
}

.static-page-tab-panels {
  position: relative;
}

.static-page-tab-panel {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity var(--tab-fade-duration) ease,
    visibility var(--tab-fade-duration) ease;
}

.static-page-tab-panel.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.static-page-tab-panel > h3:first-child {
  display: none;
}

.static-page-tab-static {
  cursor: default;
}

.static-page-tab-static:hover {
  color: var(--text-title);
}

/* ── Article badges ── */
.article-status-badge {
  display: inline-block;
  margin-left: 0.45rem;
  padding: 0.12rem 0.36rem 0.1rem 0.42rem;
  border-radius: 3px;
  background: #5f6771;
  opacity: 0.7;
  color: #ffffff;
  font-family: var(--font-contents);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.1;
  vertical-align: middle;
  transform: translateY(-0.19em);
}
@supports (-webkit-appearance: none) and (not (-moz-appearance: none)) {
  .article-status-badge { padding: 0.175rem 0.36rem 0.11rem 0.36rem; line-height: 1.2; transform: translateY(-0.23em); }
}

.article-meta-badge {
  display: inline-block;
  margin-left: 0.45rem;
  padding: 0.12rem 0.36rem 0.1rem 0.42rem;
  border-radius: 3px;
  background: #3f9792;
  opacity: 0.85;
  color: #ffffff;
  font-family: var(--font-contents);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.1;
  vertical-align: middle;
  transform: translateY(-0.19em);
}
@supports (-webkit-appearance: none) and (not (-moz-appearance: none)) {
  .article-meta-badge { padding: 0.175rem 0.36rem 0.11rem 0.36rem; line-height: 1.2; transform: translateY(-0.23em); }
}

/* ── Disabled cards ── */
.card-disabled {
  cursor: default;
  border-color: rgba(var(--border-rgb), 0.6);
}

.card-disabled:hover::after {
  opacity: 0;
}

.card-disabled .card-title {
  opacity: 0.5;
}

.card-disabled .card-desc {
  opacity: 0.5;
}

.card-disabled .card-date-text {
  opacity: 0.5;
}

.card-disabled .card-img img {
  filter: grayscale(75%);
}

.card-disabled .card-title,
.card-disabled .card-desc,
.card-disabled .card-date-text,
.card-disabled .card-img img {
  transition: opacity 0.2s ease, filter 0.2s ease;
}

/* ── Timeline entries ── */
.entry-row-disabled {
  cursor: default;
}

.entry-content {
  display: block;
}

.entry-row-disabled .entry-title-text {
  opacity: 0.5;
}

.entry-row-disabled .entry-desc {
  opacity: 0.5;
}

.tl-entry-row .entry-date-text {
  display: inline-block;
  cursor: default;
}

.tl-entry-row .entry-title-text {
  display: inline-block;
}

.tl-entry-row.is-unpublished .entry-date-text {
  opacity: 0.5;
}

.tl-entry-row.is-unpublished .dot-entry {
  background: rgba(26, 58, 82, 0.5);
  border-color: rgba(77, 122, 150, 0.5);
}

.entry-title .article-meta-badge,
.entry-title .article-status-badge {
  transform: translateY(-0.08em);
}
@supports (-webkit-appearance: none) and (not (-moz-appearance: none)) {
  .entry-title .article-meta-badge,
  .entry-title .article-status-badge {
    padding: 0.175rem 0.36rem 0.11rem 0.36rem;
    line-height: 1.2;
    transform: translateY(-0.12em);
  }
}
@supports (-webkit-appearance: none) and (hanging-punctuation: first) {
  .entry-title .article-meta-badge,
  .entry-title .article-status-badge {
    padding-top: 0.105rem; padding-bottom: 0.18rem;
  }
}

/* ── Homepage article filter bar ── */
.article-filter-bar {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-card);
  padding: 0.45rem 0.55rem;
  margin-bottom: 1.4rem;
  position: relative;
}

.filter-clear,
.filter-expand {
  flex: 0 0 auto;
  width: 1.7rem;
  height: 1.7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: transparent;
  color: var(--text-dim);
  line-height: 1;
  cursor: pointer;
  transition:
    color 0.15s ease,
    border-color 0.15s ease,
    background-color 0.15s ease,
    opacity 0.15s ease;
}

.filter-clear {
  font-family: var(--font-contents);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: 0;
  padding: 0 0 0.1rem 0.05rem;
}
@supports (-webkit-appearance: none) and (not (-moz-appearance: none)) {
  .filter-clear,
  .filter-expand { width: calc(1.7rem - 1px); }
  .filter-clear-icon { display: block; transform: translate(-0.0215em, 0.0368em); }
}

.filter-clear:disabled {
  color: var(--text-dim);
  border-color: var(--border);
  opacity: 0.45;
  cursor: default;
  background: transparent;
}

.filter-clear:disabled:hover {
  color: var(--text-dim);
  border-color: var(--border);
  background: transparent;
}

.filter-clear.is-active {
  color: var(--text-nav);
  border-color: var(--border);
  background: transparent;
}

.filter-clear.is-active:hover {
  color: var(--text-title);
  border-color: var(--border-sep);
  background: transparent;
}

.filter-tags-viewport {
  position: relative;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  padding: 0.1rem 0;
  max-height: 1.7rem;
  transition: max-height 0.22s cubic-bezier(0.3, 1, 0.3, 1);
}

.filter-tags-viewport.has-overflow::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 4.5rem;
  height: 100%;
  pointer-events: none;
  background: linear-gradient(to right, rgba(10, 18, 32, 0), var(--bg-card));
}

.filter-tags {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  min-width: max-content;
}

.article-filter-bar.is-expanded .filter-tags-viewport {
  overflow: hidden;
}

.article-filter-bar.is-expanded .filter-tags-viewport::after {
  display: none;
}

.article-filter-bar.is-expanded .filter-tags {
  flex-wrap: wrap;
  white-space: normal;
  min-width: 0;
}

.filter-tag {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: transparent;
  color: var(--text-nav);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1;
  padding: 0.38rem 0.55rem 0.24rem;
  cursor: pointer;
  transition:
    color 0.15s ease,
    border-color 0.15s ease,
    background-color 0.15s ease,
    opacity 0.15s ease;
  backface-visibility: hidden;
  transform: translateZ(0);
}

/* Safari only */
@supports (-webkit-appearance: none) and (hanging-punctuation: first) {
  .filter-tag {
    transform: translateZ(0) translateY(-0.14em);
  }
}

/* Firefox only */
@supports (-moz-appearance: none) {
  .filter-tag {
    padding-bottom: 0.23rem;
  }
}

.filter-tag:hover {
  color: var(--text-title);
  border-color: var(--border-sep);
}

.filter-tag.is-active {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.1);
}

.filter-tag.is-disabled {
  color: var(--text-dim);
  border-color: var(--border);
  opacity: 0.45;
  cursor: default;
}

.filter-tag.is-disabled:hover {
  color: var(--text-dim);
  border-color: var(--border);
  background: transparent;
}

.tag-count {
  color: var(--text-date);
  font-family: var(--font-contents);
  font-size: 0.72rem;
  line-height: 1;
  display: inline-block;
  transform: translateY(-0.15em);
}
@supports (-webkit-appearance: none) and (not (-moz-appearance: none)) {
  .tag-count { transform: translateY(0em); }
}
@supports (-webkit-appearance: none) and (hanging-punctuation: first) {
  .tag-count { transform: translateY(-0.22em); }
}

.filter-tag.is-active .tag-count {
  color: var(--accent);
}

/* Sort button inherits .filter-tag */
.filter-sort.is-active {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.1);
}

.card-pubdate-icon {
  width: 1.2em;
  height: 1.2em;
  display: inline-block;
  vertical-align: middle;
  margin-right: 0.7em;
  opacity: 0.7;
  transform: translateY(-0.15em);
}

@supports (-moz-appearance: none) {
  .card-pubdate-icon {
    transform: translateY(-0.22em);
  }
}

.filter-expand {
  position: relative;
  font-family: var(--font-contents);
  padding: 0;
  opacity: 1;
  pointer-events: auto;
}

.filter-expand:not(.is-visible) {
  pointer-events: none;
}

.filter-expand-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.filter-expand-svg {
  width: 0.78rem;
  height: 0.78rem;
  display: block;
  transform: none;
}

.filter-expand-svg path {
  fill: none;
  stroke: var(--text-dim);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: d 0.22s cubic-bezier(0.3, 1, 0.3, 1), stroke 0.15s ease;
}

.filter-expand:hover .filter-expand-svg path {
  stroke: var(--text-title);
}
@supports (-webkit-appearance: none) and (not (-moz-appearance: none)) {
  .filter-expand-svg {
    width: calc(0.78rem - 1px);
    transform: translateX(0.04em);
  }
}

.tag-card {
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
  will-change: opacity, transform;
}

.tag-card.is-filtering-out {
  opacity: 0;
  transform: translateY(6px);
}

.tag-card.is-filtering-in {
  opacity: 0;
  transform: translateY(6px);
}

.tag-card.is-hidden {
  display: none;
}

/* ── Timeline tag filter ── */
.timeline-filter-bar {
  margin-bottom: 1.4rem;
}

.tl-row.is-hidden {
  display: none;
}

.tl-entry-row {
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
  will-change: opacity, transform;
}

.tl-entry-row.is-filtering-out {
  opacity: 0;
  transform: translateY(6px);
}

.tl-entry-row.is-filtering-in {
  opacity: 0;
  transform: translateY(6px);
}

.tl-row.is-hidden {
  display: none;
}

/* ── Generic iframe embeds ── */
.embed-container {
  position: relative;
  width: 100%;
  margin: 1.75em auto;
}

.embed-container-wide {
  --embed-extra: clamp(0px, 4vw, 5rem);
  width: calc(100% + (var(--embed-extra) * 2));
  margin-left: calc(var(--embed-extra) * -1);
  margin-right: calc(var(--embed-extra) * -1);
}

.media-frame {
  --frame-pad: 6px;
  width: 100%;
  height: 100%;
  padding: var(--frame-pad);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-sizing: border-box;
}

.embed-container .media-frame {
  position: relative;
  width: 100%;
  overflow: hidden;
  z-index: 1;
}

.embed-container .media-frame iframe {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.media-frame iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.embed-container iframe {
  transform-origin: center center;
}

/* .embed-expand shares rules with .sg-expand above */

.embed-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.embed-lightbox.active {
  display: flex;
}

/* .embed-lightbox-close shares rules with .sg-lightbox-close above */

.embed-is-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  z-index: 200;
  background: rgba(0, 0, 0, 0.92);
}

.embed-is-fullscreen .media-frame {
  position: absolute !important;
  inset: 2rem !important;
  width: auto !important;
  height: auto !important;
  z-index: 201 !important;
}

.embed-is-fullscreen .embed-expand {
  display: none;
}

.embed-is-fullscreen + .embed-lightbox,
.embed-is-fullscreen ~ .embed-lightbox {
  display: block;
  position: fixed;
  inset: 0;
  background: transparent;
  z-index: 202;
  pointer-events: none;
}

.embed-is-fullscreen + .embed-lightbox .embed-lightbox-close,
.embed-is-fullscreen ~ .embed-lightbox .embed-lightbox-close {
  pointer-events: auto;
}

.embed-is-fullscreen iframe {
  width: 100% !important;
  height: 100% !important;
}

/* ── Pinball fullscreen overlay ── */
.pinball-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 200;
  align-items: center;
  justify-content: center;
  /* opacity/transform animated by JS via inline styles */
}

.pinball-overlay-inner {
  --frame-pad: 6px;
  --pinball-border-w: 2px;
  /*
    Fixed 610:416 aspect ratio (the game's native resolution).
    Height fills viewport minus margins; width derives from height.
    max-width prevents overflow on wide-short viewports.
  */
  position: relative;
  height: calc(100vh - 4rem);
  width: calc((100vh - 4rem) * (610 / 416));
  max-width: calc(100vw - 4rem);
  /* When width hits max-width, cap the height to maintain ratio */
  max-height: calc((100vw - 4rem) * (416 / 610));
  padding: calc(var(--frame-pad) + var(--pinball-border-w));
  border: none;
  border-radius: 4px;
  /* Gradient border via background — same technique as .mini-card-fav */
  background: linear-gradient(
    50deg,
    rgba(var(--fav-bright-rgb), 0.85),
    rgba(var(--border-rgb), 1),
    rgba(var(--fav-bright-rgb), 0.65)
  );
}

/* Inner black background — sits inside the gradient border */
.pinball-overlay-inner::before {
  content: "";
  position: absolute;
  inset: var(--pinball-border-w);
  border-radius: 3px;
  background: #000;
  z-index: 0;
}

/* Brighter gradient on hover, same as .mini-card-fav::after */
.pinball-overlay-inner::after {
  content: "";
  position: absolute;
  inset: calc(var(--pinball-border-w) * -1);
  border-radius: 5px;
  padding: var(--pinball-border-w);
  pointer-events: none;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.3s ease;
  background: linear-gradient(
    50deg,
    rgba(var(--fav-bright-rgb), 0.95),
    rgba(var(--border-rgb), 1),
    rgba(var(--fav-bright-rgb), 0.75)
  );
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  mask-composite: exclude;
}



/* iframe sits above the ::before black bg */
.pinball-overlay-inner iframe {
  position: relative;
  z-index: 1;
}

.pinball-overlay-inner iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.pinball-overlay.is-active {
  display: flex;
}

.pinball-overlay .embed-lightbox-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 202;
}
.pinball-overlay .embed-lightbox-close:hover {
  color: var(--fav-bright);
}

/* ── Games tab sheen effect ─────────────────────────────────── */
.games-tab-sheen {
  position: relative;
  transition: none;
}

.games-tab-sheen:hover {
  transition: none;
  color: transparent;
}

.static-page-tab-label {
  display: inline-block;
}

@supports (-webkit-appearance: none) and (hanging-punctuation: first) {
  .static-page-tab {
    transform: translateY(-0.02em);
  }
  .games-tab-sheen:hover {
    transform: translateY(0);
  }
}

.games-tab-sheen:hover .static-page-tab-label {
  display: inline-block;
  -webkit-text-fill-color: transparent;
  background: linear-gradient(
    135deg,
    var(--text-title) 0%,
    var(--text-title) 25%,
    var(--fav-bright) 50%,
    var(--text-title) 75%,
    var(--text-title) 100%
  );
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  animation: games-tab-sheen-slide 1.6s linear infinite;
  clip-path: inset(-10px 0 2px 0);
}

@keyframes games-tab-sheen-slide {
  0%   { background-position: 150% 0; }
  100% { background-position: -50% 0; }
}

/* ── Rotating border when video is playing ── */
@keyframes mini-card-border-rotate {
  from { --mini-card-border-angle: 50deg; }
  to   { --mini-card-border-angle: 410deg; }
}

@property --mini-card-border-angle {
  syntax: '<angle>';
  inherits: false;
  initial-value: 50deg;
}

.mini-card--video-active {
  border: none !important;
  padding: 1px;
  background: conic-gradient(
    from var(--mini-card-border-angle),
    rgba(var(--fav-bright-rgb), 0.65),
    rgba(var(--border-rgb), 1),
    rgba(var(--fav-bright-rgb), 0.85),
    rgba(var(--border-rgb), 1),
    rgba(var(--fav-bright-rgb), 0.65)
  ) !important;
}

/* ── Video hover on media tiles ── */
.mini-card-video {
  position: absolute;
  inset: 6px;
  width: calc(100% - 12px);
  height: calc(100% - 12px);
  object-fit: cover;
  object-position: center;
  border-radius: 2px;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.mini-card-img {
  transition: opacity 0.3s ease;
}

.mini-card--video-active .mini-card-img { opacity: 0; }
.mini-card--video-active .mini-card-video { opacity: 1; }

/* ── Pinball card lit state (triggered by Games tab hover) ── */
.mini-card-fav--lit::after {
  opacity: 1;
}

.mini-card-fav--lit {
  background: conic-gradient(
    from var(--mini-card-border-angle),
    rgba(var(--fav-bright-rgb), 0.65),
    rgba(var(--border-rgb), 1),
    rgba(var(--fav-bright-rgb), 0.85),
    rgba(var(--border-rgb), 1),
    rgba(var(--fav-bright-rgb), 0.65)
  ) !important;
}


/* ── Photos type badge ── */
.article-photos-badge {
  display: inline-block;
  margin-left: 0.45rem;
  padding: 0.12rem 0.36rem 0.1rem 0.42rem;
  border-radius: 3px;
  background: #7048a0;
  opacity: 0.85;
  color: #ffffff;
  font-family: var(--font-contents);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.1;
  vertical-align: middle;
  transform: translateY(-0.19em);
}
@supports (-webkit-appearance: none) and (not (-moz-appearance: none)) {
  .article-photos-badge { padding: 0.175rem 0.36rem 0.11rem 0.36rem; line-height: 1.2; transform: translateY(-0.23em); }
}

@supports (-webkit-appearance: none) and (hanging-punctuation: first) {
  .article-status-badge,
  .article-meta-badge,
  .article-photos-badge { padding-top: 0.105rem; padding-bottom: 0.18rem; }
}
/* ── Unpublished toggle — inherits .filter-tag, no overrides needed ── */

/* ── Type filter tags (#article, #photos) ── */
.filter-tag.filter-tag-type {
  font-style: italic;
}
