/* Guides / post page (extracted from prototype/post.html) */

.post-header {
  padding-top: 32px;
}

.post-hero-img {
  width: 100%;
  aspect-ratio: 21/9;
  background: linear-gradient(135deg, #0f1520 0%, #1a1f35 50%, #252840 100%);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 36px;
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.post-hero-img::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(108,114,255,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(108,114,255,0.06) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
}
/* Grid overlay is for icon/placeholder heroes only — on photos it reads as a “vertical line” seam.
   Use .post-hero-img--photo from the template (don’t rely on :has() — older browsers ignore it). */
.post-hero-img--photo::before {
  display: none;
}
.post-hero-img:has(img)::before {
  display: none;
}
.post-hero-img--photo {
  /* Solid fill avoids a hairline of the gradient showing at rounded corners with object-fit: cover */
  background: #0f1520;
}
.post-hero-img > * { position: relative; z-index: 1; }
.post-hero-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  /* Reduce subpixel seam / hairline artifacts at edges after border-radius + cover */
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  transform: translateZ(0);
}
.post-hero-img--photo img {
  border-radius: var(--radius-lg);
  /* Slight scale hides 1px anti-aliasing gaps between border-radius clip and image in some engines */
  transform: translateZ(0) scale(1.003);
}

.post-meta-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
}
.post-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.83rem;
  color: var(--text-muted);
}
.post-meta-item strong { color: var(--text); }

.post-title {
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 16px;
}
.post-excerpt {
  font-size: 1.05rem;
  color: var(--text-muted);
  line-height: 1.75;
  max-width: 720px;
  margin-bottom: 28px;
}

.post-quick-stats {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  width: fit-content;
  margin-bottom: 36px;
}
.post-stat {
  padding: 12px 22px;
  border-right: 1px solid var(--border);
  background: var(--surface);
}
.post-stat:last-child { border-right: none; }
.post-stat-val {
  font-size: 1.05rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text);
  display: block;
}
.post-stat-key {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-dim);
}

/* ── Content layout ─────────────────────────────────────── */
.post-layout {
  padding-bottom: 80px;
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 48px;
  align-items: start;
}

/* Sticky right sidebar (TOC always visible) */
.post-layout > aside {
  position: sticky;
  top: calc(var(--nav-h) + 16px);
  align-self: start;
  max-height: none;
  overflow: visible;
  padding-bottom: 0;
}

/* ── Article content ────────────────────────────────────── */
.article-body h2 {
  font-size: 1.45rem;
  margin: 40px 0 14px;
  padding-top: 8px;
  color: var(--text);
}
.article-body h2:first-child { margin-top: 0; }
.article-body h3 {
  font-size: 1.15rem;
  margin: 28px 0 10px;
  color: var(--text);
}
.article-body h2[id],
.article-body h3[id],
.article-body h4[id] {
  scroll-margin-top: calc(var(--nav-h) + 18px);
}
.article-body p {
  margin-bottom: 16px;
  color: var(--text-muted);
  line-height: 1.8;
}
.article-body ul,
.article-body ol {
  margin: 0 0 16px;
  color: var(--text-muted);
  line-height: 1.8;
}
.article-body li { margin-bottom: 5px; }
.article-body ul,
.article-body ol {
  /* Use padding-based indent so ordered list numbers don't hang left */
  list-style-position: outside;
}
.article-body ul { padding-left: 22px; }
.article-body ol { padding-left: 32px; }
.article-body ul.task-list,
.article-body ul:has(> li > input[type="checkbox"]) {
  list-style: none;
  padding-left: 0;
  margin: 12px 0 18px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 70%, var(--surface2));
  border-radius: var(--radius);
  padding: 12px 14px;
}
.article-body ul.task-list > li,
.article-body ul:has(> li > input[type="checkbox"]) > li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  padding: 8px 6px;
  border-radius: 10px;
}
.article-body ul.task-list > li + li,
.article-body ul:has(> li > input[type="checkbox"]) > li + li {
  border-top: 1px solid var(--border);
}
.article-body ul.task-list input[type="checkbox"],
.article-body ul:has(> li > input[type="checkbox"]) input[type="checkbox"] {
  margin: 2px 0 0;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  appearance: none;
  -webkit-appearance: none;
  border-radius: 6px;
  border: 1px solid color-mix(in srgb, var(--border2) 75%, var(--accent));
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
  position: relative;
}
.article-body ul.task-list input[type="checkbox"][checked],
.article-body ul:has(> li > input[type="checkbox"]) input[type="checkbox"][checked] {
  background: var(--accent-dim);
  border-color: color-mix(in srgb, var(--accent) 70%, var(--border2));
}
.article-body ul.task-list input[type="checkbox"][checked]::after,
.article-body ul:has(> li > input[type="checkbox"]) input[type="checkbox"][checked]::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 5px;
  height: 9px;
  border: solid var(--accent);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.article-body ul:has(> li > input[type="checkbox"]) {
  color: var(--text);
}
.article-body ul:has(> li > input[type="checkbox"]) > li:has(input[type="checkbox"][checked]) { color: var(--text); }
.article-body li::marker {
  color: var(--text-dim);
  font-weight: 600;
}
.article-body ol li::marker {
  font-family: var(--font-mono);
  font-weight: 700;
}
.article-body a { color: var(--accent); border-bottom: 1px solid rgba(108,114,255,0.3); }
.article-body a:hover { border-color: var(--accent); }
.article-body strong { color: var(--text); font-weight: 600; }
.article-body pre { margin: 20px 0; }
.article-body .code-snippet pre {
  position: relative;
  margin: 20px 0;
  padding-top: 30px;
}
.article-body .code-snippet .code-snippet-tools {
  position: absolute;
  top: 7px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  white-space: nowrap;
  gap: 6px;
}
.article-body .code-snippet .code-copy-btn {
  border: 1px solid var(--border2);
  border-radius: 999px;
  height: 21px;
  min-height: 21px;
  display: grid;
  place-items: center;
  line-height: 1;
  color: var(--text-muted);
  background: color-mix(in srgb, var(--surface2) 70%, transparent);
  cursor: pointer;
  padding: 0;
  box-sizing: border-box;
  align-self: center;
}
.article-body .code-snippet .code-copy-btn:not(.copied) {
  width: 21px;
  min-width: 21px;
}
.article-body .code-snippet .code-copy-btn .code-copy-icon {
  width: 13px;
  height: 13px;
  display: block;
}
.article-body .code-snippet .code-copy-btn .code-copy-text {
  display: none;
  font-size: 0.62rem;
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  line-height: 1;
  padding: 0 8px;
}
.article-body .code-snippet .code-copy-btn:hover {
  border-color: rgba(108,114,255,0.45);
  color: var(--text);
}
.article-body .code-snippet .code-copy-btn.copied {
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 55%, var(--border2));
  width: auto;
  min-width: 21px;
}
.article-body .code-snippet .code-copy-btn.copied .code-copy-icon {
  display: none;
}
.article-body .code-snippet .code-copy-btn.copied .code-copy-text {
  display: inline-block;
}
.article-body .code-snippet .pre-label {
  position: static;
  top: auto;
  right: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 21px;
  min-height: 21px;
  box-sizing: border-box;
  font-size: 0.68rem;
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  border: 1px solid var(--border2);
  border-radius: 999px;
  padding: 0 7px;
  background: color-mix(in srgb, var(--surface2) 70%, transparent);
  line-height: 1;
  pointer-events: none;
  align-self: center;
}

/* Hugo's youtube shortcode outputs an inline-styled responsive wrapper + iframe. */
.article-body div[style*="padding-bottom: 56.25%"] {
  border-radius: var(--radius-lg);
}
.article-body div[style*="padding-bottom: 56.25%"] iframe {
  border-radius: var(--radius-lg);
}

/* ── Gallery shortcode ──────────────────────────────────── */
.gallery {
  margin: 14px 0 18px;
  display: grid;
  gap: 12px;
}
.gallery.cols-1 {
  grid-template-columns: 1fr;
  justify-items: center;
  /* Make single-image galleries match a 2-col tile height by
     constraining width to a single column's width. */
  max-width: calc((100% - 12px) / 2);
  margin-left: auto;
  margin-right: auto;
}
.gallery.cols-1.full {
  max-width: 100%;
}
.gallery.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.gallery.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* markdownify wraps images in <p>; make them grid items */
.gallery > p {
  margin: 0;
  display: contents;
}
.gallery img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface2);
}
.gallery.cols-1 img {
  width: 100%;
}

@media (max-width: 760px) {
  .gallery.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .gallery.cols-1 { max-width: 100%; }
  .gallery.cols-1 img { width: 100%; }
  .gallery.cols-2,
  .gallery.cols-3 { grid-template-columns: 1fr; }
}

/* ── Steps component ────────────────────────────────────── */
.steps { margin: 18px 0 6px; }
.step {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 14px;
  align-items: start;
  margin: 18px 0;
}
.step-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}
.step-dot {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--accent-glow);
  border: 1px solid rgba(108,114,255,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
  flex: 0 0 auto;
}
.step-line {
  width: 2px;
  background: linear-gradient(to bottom, rgba(108,114,255,0.35), rgba(108,114,255,0));
  flex: 1 1 auto;
  margin-top: 10px;
  border-radius: 999px;
}
.step:last-child .step-line { display: none; }

.step-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  margin: 2px 0 8px;
  letter-spacing: -0.02em;
}
.step-content > :first-child { margin-top: 0; }
.step-content > :last-child { margin-bottom: 0; }
.step-media {
  margin: 12px 0 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.step-media img { width: 100%; height: auto; display: block; }

/* ── Image modal (guide lightbox) ───────────────────────── */
.img-modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 2200;
}
.img-modal.open {
  display: block;
}
.img-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.68);
  backdrop-filter: blur(6px);
  z-index: 0;
}
.img-modal-dialog {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  width: min(1100px, calc(100vw - 28px));
  height: min(820px, calc(100vh - 28px));
  background: rgba(33,34,46,0.92);
  border: 1px solid var(--modal-border, var(--border));
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 24px 90px rgba(0,0,0,0.6);
  display: grid;
  place-items: center;
}
.img-modal-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.img-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(0,0,0,0.35);
  color: rgba(255,255,255,0.95);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.img-modal-close:hover { border-color: rgba(108,114,255,0.5); }

/* ── TOC ───────────────────────────────────────────────── */
.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  position: static;
}
.toc-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 14px;
  font-family: var(--font-mono);
}
.toc-inner nav#TableOfContents ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
}
.toc-inner nav#TableOfContents a {
  display: block;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  color: var(--text-muted);
  transition: all 0.15s;
  border-left: 2px solid transparent;
}
.toc-inner nav#TableOfContents a:hover {
  color: var(--text);
  background: var(--surface2);
}
.toc-inner nav#TableOfContents ul ul { padding-left: 14px; }
.toc-inner nav#TableOfContents ul ul a { font-size: 0.8rem; }

/* ── Aside cards ───────────────────────────────────────── */
.aside-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-top: 16px;
}
.aside-card h5 {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 12px;
  font-family: var(--font-mono);
}

.aside-parts-store .aside-parts-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.aside-parts-store .aside-parts-title-row .material-symbols-outlined {
  font-size: 20px;
  color: var(--accent);
}
.aside-parts-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
}
.aside-parts-desc {
  font-size: 0.82rem;
  margin: 0 0 12px;
  color: var(--text-muted);
  line-height: 1.7;
}
.aside-parts-btn {
  width: 100%;
  justify-content: center;
}

.aside-kit-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.aside-kit-thumb {
  width: 48px;
  height: 48px;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
}
.aside-kit-thumb .material-symbols-outlined { font-size: 22px; color: var(--text-muted); }
.aside-kit-title { font-size: 0.88rem; font-weight: 700; color: var(--text); }
.aside-kit-price { font-size: 1.1rem; font-weight: 800; color: var(--accent); font-family: var(--font-mono); }
.aside-kit-desc { font-size: 0.82rem; margin: 0 0 12px; color: var(--text-muted); line-height: 1.7; }

.aside-related-list { display: flex; flex-direction: column; gap: 10px; }
.aside-related-link { display: flex; gap: 10px; text-decoration: none; align-items: flex-start; }
.aside-related-thumb {
  width: 40px;
  height: 30px;
  background: var(--surface2);
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.aside-related-thumb .material-symbols-outlined { font-size: 18px; color: var(--text-muted); }
.aside-related-title { font-size: 0.82rem; font-weight: 700; color: var(--text); line-height: 1.35; }
.aside-related-sub { font-size: 0.73rem; color: var(--text-dim); }

/* ── Share bar ─────────────────────────────────────────── */
.share-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin: 32px 0 0;
  flex-wrap: wrap;
}
.share-label { font-size: 0.82rem; color: var(--text-muted); }
.share-btn {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.share-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── Prev / Next navigation ─────────────────────────────── */
.guide-prev-next {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 420px));
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 40px;
}
.guide-prev-next-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border));
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 78%, var(--accent-dim));
  text-decoration: none;
  box-shadow: 0 2px 12px rgba(0,0,0,0.14);
  transition: border-color 0.15s, transform 0.15s, background-color 0.15s, box-shadow 0.15s;
}
.guide-prev-next-card:hover {
  border-color: color-mix(in srgb, var(--accent) 65%, var(--border));
  background: color-mix(in srgb, var(--surface2) 70%, var(--accent-dim));
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.18);
}
.guide-prev-next-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--accent) 45%, var(--text-dim));
  line-height: 1.1;
}
.guide-prev-next-icon {
  font-size: 1.05rem;
  line-height: 1;
  color: color-mix(in srgb, var(--accent) 55%, var(--text-dim));
  opacity: 0.95;
  transform: translateY(0.5px);
}
.guide-prev-next-card:hover .guide-prev-next-icon {
  color: var(--accent);
  opacity: 1;
}
.guide-prev-next-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
}
.guide-prev-next-card.is-next {
  text-align: right;
  align-items: flex-end;
}
.guide-prev-next-card.is-next .guide-prev-next-kicker {
  justify-content: flex-end;
}

/* ── Related section ────────────────────────────────────── */
.related-section {
  padding-bottom: 60px;
  border-top: 1px solid var(--border);
  padding-top: 48px;
}
.guide-related-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-decoration: none;
  transition: transform 0.18s, border-color 0.18s;
}
.guide-related-card:hover { transform: translateY(-2px); border-color: rgba(108,114,255,0.35); }
.guide-related-hero {
  position: relative;
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, #0f1520, #1a1f35);
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.guide-related-hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.guide-related-body { padding: 16px 18px; }
.guide-related-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.guide-related-title { font-size: 0.95rem; font-weight: 800; color: var(--text); margin-bottom: 6px; }
.guide-related-excerpt { font-size: 0.82rem; margin: 0; color: var(--text-muted); line-height: 1.65; }

@media (max-width: 860px) {
  .post-layout { grid-template-columns: 1fr; }
  .post-layout > aside {
    position: static;
    max-height: none;
    overflow: visible;
    padding-bottom: 0;
  }
}
@media (max-width: 640px) {
  .post-quick-stats { flex-wrap: wrap; }
  .post-stat { flex: 1; min-width: 100px; }
  .guide-prev-next { grid-template-columns: 1fr; }
}

