/* Post article page */

.article-layout {
  display: grid;
  grid-template-columns: 1fr var(--sidebar-width);
  grid-template-rows: auto 1fr auto;
  column-gap: var(--space-12);
  align-items: start;
  padding-block: var(--space-16);
}

.article-header {
  grid-column: 1;
  grid-row: 1;
}

.article-body {
  grid-column: 1;
  grid-row: 2;
}

.article-comments {
  grid-column: 1;
  grid-row: 3;
}

.article-sidebar {
  grid-column: 2;
  grid-row: 1 / -1;
  position: sticky;
  top: var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  min-width: 0;
}

.article-header {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-10);
  background: var(--clr-hero-bg);
  min-height: 340px;
  display: flex;
  flex-direction: column;
}

.article-header__cover-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.article-header__cover-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.article-header__overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    160deg,
    rgba(var(--clr-scrim-rgb), 0.45) 0%,
    rgba(var(--clr-scrim-rgb), 0.72) 55%,
    rgba(var(--clr-scrim-rgb), 0.88) 100%
  );
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.article-header--no-cover .article-header__overlay {
  background: linear-gradient(
    135deg,
    rgba(var(--clr-accent-shadow), 0.12) 0%,
    rgba(var(--clr-scrim-rgb), 0.0) 60%
  );
}

.article-header__content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: var(--space-6) var(--space-10);
  gap: var(--space-4);
}

.article-header__zone {
  display: flex;
  align-items: center;
}

.article-header__zone--title {
  flex: 1;
  align-items: center;
}

.article-header__zone--meta {
  padding-top: var(--space-4);
  border-top: 1px solid rgba(var(--clr-hero-text-rgb), 0.18);
}

.article-header__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.article-header__tag {
  background: rgba(var(--clr-accent-shadow), 0.25);
  color: var(--clr-tag-fg);
  border: 1px solid rgba(var(--clr-accent-shadow), 0.40);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.article-header__tag:hover {
  background: var(--clr-accent);
  color: var(--clr-btn-primary-text);
}

.article-header__title {
  font-size: clamp(var(--text-2xl), 3.8vw, var(--text-3xl));
  font-weight: var(--weight-bold);
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--clr-hero-text);
  margin: 0;
  text-shadow: 0 2px 20px rgba(var(--clr-scrim-rgb),0.50);
  padding-bottom: 0.25em;
}

.article-header__title em {
  font-style: italic;
  color: var(--clr-tag-fg);
}

.article-meta {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
  width: 100%;
}

.article-meta__author {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: 1;
}

.article-meta__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1.5px solid rgba(var(--clr-hero-text-rgb), 0.30);
}

.article-meta__name {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--clr-hero-text);
}

.article-meta__author-link {
  color: var(--clr-hero-text);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out);
}

.article-meta__author-link:hover {
  color: var(--clr-tag-fg);
}

.article-meta__avatar-link {
  display: flex;
  flex-shrink: 0;
  border-radius: 50%;
  transition: opacity var(--dur-fast) var(--ease-out);
}

.article-meta__avatar-link:hover {
  opacity: 0.85;
}

.article-meta__date {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: rgba(var(--clr-hero-text-rgb), 0.75);
}

.article-meta__reading-time {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: rgba(var(--clr-hero-text-rgb), 0.75);
  white-space: nowrap;
}

.article-meta__actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.article-body {
  font-family: var(--font-body);
  font-size: var(--text-md);
  line-height: var(--leading-loose);
  color: var(--clr-ink);
  padding-top: var(--space-8);
  min-width: 0;
}

.article-body > * + * {
  margin-top: var(--space-6);
}

.article-body h2 {
  font-size: var(--text-xl);
  margin-top: var(--space-16);
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-3);
  position: relative;
}

.article-body h3 {
  font-size: var(--text-lg);
  margin-top: var(--space-10);
  margin-bottom: var(--space-3);
}

.article-body p {
  line-height: var(--leading-loose);
}

.article-body a {
  color: var(--clr-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.article-body a:hover {
  color: var(--clr-accent-hover);
}

.article-body blockquote {
  border-left: 3px solid var(--clr-accent);
  padding-left: var(--space-6);
  margin-left: 0;
  font-style: italic;
  color: var(--clr-ink-muted);
}

.article-body ul,
.article-body ol {
  list-style: revert;
  padding-left: var(--space-6);
}

.article-body li + li {
  margin-top: var(--space-2);
}

.article-body hr {
  border: none;
  height: 3px;
  background-color: var(--clr-divider-alt);
  margin-block: var(--space-10);
}

.article-body figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-block: var(--space-10);
  margin-inline: auto;
  width: var(--img-w, 100%);
  border-radius: var(--radius-lg);
  overflow: hidden;
  padding: var(--space-4);
  background: linear-gradient(135deg,
    rgba(var(--clr-accent-shadow), 0.03) 0%,
    rgba(var(--clr-accent-shadow), 0.01) 100%);
}

.article-body figure img,
.article-body figure svg {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid rgba(var(--clr-accent-shadow), 0.12);
  box-shadow: 0 2px 12px rgba(var(--clr-ink-rgb), 0.06),
              0 0 0 1px rgba(var(--clr-accent-shadow), 0.08);
  background: linear-gradient(135deg,
    var(--clr-figure-tint-start) 0%,
    var(--clr-figure-tint-end) 100%);
  margin-bottom: var(--space-3);
}

.article-body figcaption {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--clr-ink-faint);
  text-align: center;
  line-height: var(--leading-loose);
  letter-spacing: 0.02em;
}

.article-body img {
  width: var(--img-w, auto);
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-md);
  border: 1px solid rgba(var(--clr-accent-shadow), 0.12);
  box-shadow: 0 2px 12px rgba(var(--clr-ink-rgb), 0.06),
              0 0 0 1px rgba(var(--clr-accent-shadow), 0.08);
  background: linear-gradient(135deg,
    var(--clr-figure-tint-start) 0%,
    var(--clr-figure-tint-end) 100%);
}

.article-body table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  margin: var(--space-10) 0;
  display: table;
}

.article-body th {
  font-size: 1.15rem;
  font-weight: var(--weight-semibold);
  text-align: center;
  padding: 1rem;
  background: rgba(var(--clr-accent-shadow), 0.18);
  color: var(--clr-ink);
}

.article-body td {
  font-family: var(--font-ui);
  padding: 0.9rem 1rem;
}

.article-body th,
.article-body td {
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
  transition: background 0.1s ease;
  border: 2px solid rgba(var(--clr-accent-shadow), 0.35);
}

@media (max-width: 640px) {
  .article-body table {
    font-size: var(--text-sm);
  }

  .article-body th {
    font-size: 0.9rem;
    padding: 0.6rem 0.4rem;
    line-height: 1.25;
  }

  .article-body td {
    padding: 0.6rem 0.5rem;
    font-size: 0.85rem;
    line-height: 1.35;
  }
}

@media (max-width: 420px) {
  .article-body th {
    font-size: 0.8rem;
    padding: 0.5rem 0.3rem;
  }

  .article-body td {
    padding: 0.5rem 0.35rem;
    font-size: 0.78rem;
  }
}

.article-body th:hover {
  background: rgba(var(--clr-accent-shadow), 0.30);
}

.article-body td:hover {
  background: rgba(var(--clr-accent-shadow), 0.04);
}

.article-body .row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-4);
  margin-block: var(--space-10);
  align-items: center;
}

.article-body .row img {
  width: 100%;
  margin: 0;
}

@media (max-width: 640px) {
  .article-body img {
    width: var(--img-w-mobile, 100%);
    border-radius: var(--radius-sm);
    margin-inline: 0;
  }
}

:not(pre) > code {
  background: var(--clr-accent-soft);
  color: var(--clr-accent-hover);
  padding: 0.15em 0.4em;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(var(--clr-accent-shadow), 0.15);
}

/* Code block chrome */

pre {
  position: relative;
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #161b22;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  padding: var(--space-2) var(--space-3);
}

.code-block-header__label {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
}

.code-block-header + pre {
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-top: none;
  margin-top: 0 !important;
  overflow: hidden;
}

.code-block-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.code-zoom-controls {
  display: flex;
  align-items: center;
  gap: 2px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-pill);
  padding: 2px;
}

.code-zoom-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}

.code-zoom-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.95);
}

.code-zoom-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.code-copy-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 26px;
  padding: 0 var(--space-3);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-pill);
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  transition: background var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}

.code-copy-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.25);
  color: rgba(255, 255, 255, 0.9);
}

.code-copy-btn:active {
  transform: scale(0.96);
}

.code-copy-btn.is-copied {
  color: #6fd894;
  border-color: rgba(111, 216, 148, 0.35);
}

.code-block-wrapper {
  margin-top: var(--space-6);
}

.article-body > .code-block-wrapper + * ,
#article-body-slot > .code-block-wrapper + * {
  margin-top: var(--space-6);
}

.code-block-wrapper .code-block-header {
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.code-block-wrapper pre {
  margin-top: 0 !important;
  border-radius: 0;
}

.code-block-wrapper pre.code-block--clamped:not(.code-block--expanded) {
  max-height: var(--code-clamp-height, calc(16 * 1.55em + 2 * var(--space-4)));
  overflow: hidden;
  position: relative;
}

.code-block-wrapper pre.code-block--wrap,
.code-block-wrapper pre.code-block--wrap code {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.code-block-wrapper pre.code-block--clamped:not(.code-block--expanded)::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 48px;
  background: linear-gradient(to bottom, transparent, #0d1117 85%);
  pointer-events: none;
}

.code-block-wrapper pre.code-block--expanded {
  max-height: none;
}

.code-block-expand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  background: #161b22;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  color: rgba(255, 255, 255, 0.55);
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}

.code-block-expand:hover {
  background: #1c2128;
  color: rgba(255, 255, 255, 0.9);
}

.code-block-expand__chevron {
  transition: transform var(--dur-normal) var(--ease-out);
}

.code-block-expand.is-expanded .code-block-expand__chevron {
  transform: rotate(180deg);
}

.code-view-toggle {
  display: flex;
  align-items: center;
  gap: 2px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: var(--radius-pill);
  padding: 2px;
  margin-right: var(--space-1);
}

.code-view-toggle__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 22px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.45);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}

.code-view-toggle__btn:hover {
  color: rgba(255, 255, 255, 0.8);
}

.code-view-toggle__btn.is-active {
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.9);
}

.code-render-pane {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  overflow: hidden;
  background: #fff;
}

.code-render-frame {
  display: block;
  width: 100%;
  border: none;
}

.code-render-pane {
  overflow: auto;
}

/* Related posts section wrapper */

.related-posts {
  margin-top: var(--space-16);
}

/* Reading progress widget */

.reading-progress-widget {
  transition:
    border-color var(--dur-normal) ease,
    box-shadow var(--dur-normal) ease,
    transform var(--dur-normal) ease;
}

.reading-progress-widget:hover {
  border-color: var(--clr-hover-border-alt);
  box-shadow:
    0 12px 32px rgba(var(--clr-ink-rgb), 0.08),
    0 2px 8px rgba(var(--clr-ink-rgb), 0.05);
  transform: translateY(-2px);
}

.reading-progress-widget__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--clr-border);
}

.reading-progress-widget__title {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
}

.reading-progress-widget__pct {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--clr-accent);
  min-width: 2.5rem;
  text-align: right;
  transition: opacity var(--dur-normal) var(--ease-out);
}

.reading-progress-widget__track {
  width: 100%;
  height: 4px;
  background: var(--clr-border);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: var(--space-5);
}

.reading-progress-widget__fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--clr-accent), var(--clr-fill-gradient-end));
  border-radius: var(--radius-pill);
  transition: width 120ms linear;
  transform-origin: left center;
}

.reading-progress-widget__sections {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.reading-progress-widget__section-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: background var(--dur-fast) var(--ease-out);
  margin-inline: calc(-1 * var(--space-2));
}

.reading-progress-widget__section-item:hover {
  background: var(--clr-accent-soft);
}

.reading-progress-widget__section-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--clr-border);
  flex-shrink: 0;
  transition: background var(--dur-normal) var(--ease-out),
              transform var(--dur-normal) var(--ease-out);
}

.reading-progress-widget__section-item.is-passed .reading-progress-widget__section-dot {
  background: rgba(var(--clr-accent-shadow), 0.4);
}

.reading-progress-widget__section-item.is-active .reading-progress-widget__section-dot {
  background: var(--clr-accent);
  transform: scale(1.6);
}

.reading-progress-widget__section-label {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  color: var(--clr-ink-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color var(--dur-fast) var(--ease-out),
              font-weight var(--dur-fast) var(--ease-out);
  line-height: var(--leading-normal);
}

.reading-progress-widget__section-item:hover .reading-progress-widget__section-label {
  color: var(--clr-accent);
}

.reading-progress-widget__section-item.is-active .reading-progress-widget__section-label {
  color: var(--clr-accent);
  font-weight: var(--weight-medium);
}

.reading-progress-widget__section-item.is-passed .reading-progress-widget__section-label {
  color: var(--clr-ink-muted);
}

/* Comment form */

.comment-section {
  margin-top: var(--space-16);
  padding-top: var(--space-12);
  border-top: 1px solid var(--clr-border);
}

.comment-section__subheading {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  color: var(--clr-ink-muted);
  margin-top: var(--space-4);
  margin-bottom: var(--space-8);
  line-height: var(--leading-loose);
  max-width: 52ch;
}

.comment-form {
  max-width: 640px;
}

.comment-error {
  display: none;
  background: var(--clr-error-bg);
  border: 1px solid var(--clr-error-border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  margin-top: var(--space-6);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  color: var(--clr-error-text);
}

.comment-signin-prompt {
  margin-bottom: var(--space-8);
}

.comment-form__user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.comment-form__username {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--clr-ink);
}

.comment-item__author {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.comment-item__avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.comment-item__avatar--placeholder {
  background: var(--clr-accent-soft);
  border: 1px solid var(--clr-border);
}

.comment-item__meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.comment-delete-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: var(--clr-ink-faint);
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  transition: background var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}

.comment-delete-btn:hover {
  background: var(--clr-error-bg);
  color: var(--clr-error-text);
}

[data-theme="dark"] .comment-delete-btn:hover {
  background: #2e1a18;
  color: #f2a49c;
}

.comment-list-wrap {
  max-width: 640px;
  margin-top: var(--space-10);
}

.comment-list__heading {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--clr-ink);
  margin-bottom: var(--space-5);
}

.comment-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  max-height: 420px;
  overflow-y: auto;
  padding-right: var(--space-3);
  scrollbar-width: thin;
  scrollbar-color: var(--clr-border) transparent;
}

.comment-item {
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--clr-border);
}

.comment-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.comment-item__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.comment-item__name {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--clr-ink);
}

.comment-item__date {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--clr-ink-faint);
  white-space: nowrap;
}

.comment-item__body {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  line-height: var(--leading-loose);
  color: var(--clr-ink-muted);
}

.comment-list__loading,
.comment-list__empty {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  color: var(--clr-ink-faint);
  padding-block: var(--space-4);
}

/* Floating share bubble + scroll-to-top */

.share-bubble {
  position: fixed;
  bottom: var(--space-8);
  right: var(--space-8);
  z-index: 200;
  display: flex;
  align-items: flex-end;
}

.share-bubble__trigger {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: var(--clr-accent);
  color: var(--clr-btn-primary-text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(var(--clr-accent-shadow), 0.40);
  transition: background var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.share-bubble__trigger:focus-visible, .share-bubble.is-open .share-bubble__trigger {
  background: var(--clr-accent-hover);
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(var(--clr-accent-shadow), 0.50);
  outline: none;
}

.share-bubble__menu {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  padding: var(--space-2);
  box-shadow: var(--shadow-lg);
  min-width: 152px;
  opacity: 0;
  transform: translateY(8px) scale(0.96);
  pointer-events: none;
  transition: opacity var(--dur-normal) var(--ease-out), transform var(--dur-normal) var(--ease-out);
  transform-origin: bottom right;
  position: absolute;
  bottom: calc(100% + var(--space-3));
  right: 0;
}

.share-bubble.is-open .share-bubble__menu {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.share-bubble__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--clr-ink-muted);
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}

.share-bubble__item:hover, .share-bubble__item:focus-visible {
  background: var(--clr-accent-soft);
  color: var(--clr-accent);
  outline: none;
}

@media (max-width: 480px) {
  .share-bubble {
    bottom: var(--space-5);
    right: var(--space-5);
  }
}

.scroll-to-top {
  position: fixed;
  bottom: var(--space-8);
  right: calc(var(--space-8) + 48px + var(--space-3));
  z-index: 200;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: var(--clr-accent);
  color: var(--clr-btn-primary-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(var(--clr-accent-shadow), 0.40);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity var(--dur-normal) var(--ease-out),
              transform var(--dur-normal) var(--ease-out),
              background var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
}

.scroll-to-top.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.scroll-to-top:hover {
  background: var(--clr-accent-hover);
  box-shadow: 0 6px 20px rgba(var(--clr-accent-shadow), 0.50);
  transform: translateY(-1px);
}

.scroll-to-top:focus-visible {
  outline: 2px solid var(--clr-accent);
  outline-offset: 3px;
}

@media (max-width: 480px) {
  .scroll-to-top {
    bottom: var(--space-5);
    right: calc(var(--space-5) + 48px + var(--space-3));
    width: 44px;
    height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-to-top {
    transition: opacity var(--dur-fast) linear;
    transform: none !important;
  }
}

/* Audio Playback */

.anw {
  padding: var(--space-4) var(--space-5);
  transition: border-color var(--dur-normal) ease,
              box-shadow var(--dur-normal) ease,
              transform var(--dur-normal) ease;
}

.anw:hover {
  border-color: var(--clr-hover-border-alt);
  box-shadow: 0 12px 32px rgba(var(--clr-ink-rgb), 0.08),
              0 2px 8px rgba(var(--clr-ink-rgb), 0.05);
  transform: translateY(-2px);
}

.anw--playing {
  border-color: rgba(var(--clr-accent-shadow), 0.30);
}

.anw__seek-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.anw__time {
  font-family: var(--font-ui);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--clr-ink-faint);
  flex-shrink: 0;
  white-space: nowrap;
}

.anw__time--right {
  text-align: right;
}

.anw__track-wrap {
  position: relative;
  flex: 1;
  height: 20px;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.anw__track {
  position: relative;
  width: 100%;
  height: 3px;
  background: var(--clr-border);
  border-radius: var(--radius-pill);
  overflow: visible;
}

.anw__fill {
  position: absolute;
  inset: 0;
  right: auto;
  width: 0%;
  background: var(--clr-accent);
  border-radius: var(--radius-pill);
  pointer-events: none;
}

.anw__thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--clr-accent);
  border: 1.5px solid var(--clr-surface);
  transform: translate(-50%, -50%);
  pointer-events: none;
  transition: transform var(--dur-fast) var(--ease-out);
}

.anw__track-wrap:hover .anw__thumb {
  transform: translate(-50%, -50%) scale(1.3);
}

.anw__scrubber {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  margin: 0;
  padding: 0;
  -webkit-appearance: none;
  appearance: none;
}

.anw__controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.anw__left-group  {
  display: flex;
  align-items: center;
  min-width: 52px;
}

.anw__right-group {
  min-width: 52px;
}

.anw__center-controls {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.anw__play-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--clr-accent);
  color: var(--clr-btn-primary-text);
  cursor: pointer;
  transition: box-shadow var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out);
  flex-shrink: 0;
}

.anw__play-btn:hover {
  box-shadow: 0 3px 10px rgba(var(--clr-accent-shadow),.35);
  transform: scale(1.06);
}

.anw__play-btn:active {
  transform: scale(0.96);
}

.anw__skip-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  color: var(--clr-ink-muted);
  cursor: pointer;
  border-radius: 50%;
  transition: color var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out);
}

.anw__skip-btn:hover {
  color: var(--clr-accent);
  background: var(--clr-accent-soft);
}

.anw__speed {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--clr-ink-muted);
  background: transparent;
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  padding: 3px 6px;
  cursor: pointer;
  outline: none;
  transition: border-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
  appearance: none;
  -webkit-appearance: none;
}

.anw__speed:hover,
.anw__speed:focus {
  border-color: var(--clr-accent);
  color: var(--clr-accent);
}

.anw-bubble__ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.anw-bubble__ring-track {
  fill: none;
  stroke: rgba(255,255,255,.25);
  stroke-width: 3;
}

.anw-bubble__ring-fill {
  fill: none;
  stroke: #fff;
  stroke-width: 3;
  stroke-linecap: round;
  transition: stroke-dashoffset 80ms linear;
}

.anw-bubble__trigger-icon {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.anw-bubble__seek-row {
  margin-bottom: var(--space-3);
}

.anw-bubble__track-wrap {
  position: relative;
  height: 20px;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.anw-bubble__track {
  position: relative;
  width: 100%;
  height: 3px;
  background: var(--clr-border);
  border-radius: var(--radius-pill);
  overflow: visible;
}

.anw-bubble__fill {
  position: absolute;
  inset: 0;
  right: auto;
  width: 0%;
  background: var(--clr-accent);
  border-radius: var(--radius-pill);
  pointer-events: none;
}

.anw-bubble__thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--clr-accent);
  border: 1.5px solid var(--clr-surface);
  transform: translate(-50%, -50%);
  pointer-events: none;
  transition: transform var(--dur-fast) var(--ease-out);
}

.anw-bubble__track-wrap:hover .anw-bubble__thumb {
  transform: translate(-50%, -50%) scale(1.3);
}

.anw-bubble__scrubber {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  margin: 0;
  padding: 0;
  -webkit-appearance: none;
  appearance: none;
}

.anw-bubble__controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.anw-bubble__time {
  font-family: var(--font-ui);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--clr-ink-faint);
  min-width: 32px;
  flex-shrink: 0;
}

.anw-bubble__time--right {
  text-align: right;
}

.anw-bubble__play {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--clr-accent);
  color: var(--clr-btn-primary-text);
  cursor: pointer;
  transition: box-shadow var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out);
  flex-shrink: 0;
}

.anw-bubble__play:hover {
  box-shadow: 0 3px 10px rgba(var(--clr-accent-shadow),.35);
  transform: scale(1.06);
}

.anw-bubble__skip {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  color: var(--clr-ink-muted);
  cursor: pointer;
  border-radius: 50%;
  transition: color var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out);
  flex-shrink: 0;
}

.anw-bubble__skip:hover {
  color: var(--clr-accent);
  background: var(--clr-accent-soft);
}

.anw-line--active {
  background: var(--clr-accent-soft) !important;
  border-radius: var(--radius-sm);
  padding: 0 0.35em;
  transition: background 180ms ease, box-shadow 180ms ease;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.anw__sync-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  color: var(--clr-ink-faint);
  cursor: pointer;
  border-radius: 50%;
  transition: color var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out);
}

.anw__sync-toggle:hover {
  color: var(--clr-accent);
  background: var(--clr-accent-soft);
}

.anw__sync-toggle.is-active {
  color: var(--clr-accent);
}

@media (max-width: 560px) {
  .anw-bubble__trigger {
    position: fixed;
    bottom: var(--space-5);
    right: calc(var(--space-5) + 44px + var(--space-3) + 44px + var(--space-3));
    z-index: 200;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: var(--clr-accent);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(var(--clr-accent-shadow), 0.40);
    padding: 0;
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    transition: opacity var(--dur-normal) var(--ease-out),
                transform var(--dur-normal) var(--ease-out),
                box-shadow var(--dur-fast) var(--ease-out);
  }

  .anw-bubble__trigger.is-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }

  .anw-bubble__trigger:hover {
    transform: scale(1.06) translateY(0);
    box-shadow: 0 6px 20px rgba(var(--clr-accent-shadow), 0.50);
  }

  .anw-bubble__popup {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 199;
    width: 100%;
    background: var(--clr-surface);
    border: 1px solid var(--clr-border);
    border-bottom: none;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: var(--space-5) var(--space-6) calc(var(--space-5) + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -4px 32px rgba(26, 23, 20, 0.18);
    opacity: 0;
    pointer-events: none;
    transform-origin: bottom center;
    transform: translateY(100%);
    transition: opacity var(--dur-normal) var(--ease-out),
                transform var(--dur-normal) var(--ease-out);
  }

  .anw-bubble__popup.is-open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .anw-bubble__trigger, .anw-bubble__popup {
    transition: opacity var(--dur-fast) linear;
    transform: none !important;
  }
}

/* Print: article-specific rules */

@media print {
  .article-header__dek {
    display: block !important;
    font-family: 'Source Serif 4', Georgia, serif !important;
    font-style: italic !important;
    font-size: 11pt !important;
    line-height: 1.5 !important;
    color: #6b6560 !important;
    margin: 0.15cm 0 0 !important;
  }

  .article-sidebar,
  .related-posts,
  #related-posts-section,
  .article-header__overlay,
  .article-meta__avatar,
  .article-meta__avatar-link,
  .article-meta__actions .like-btn,
  .article-meta__actions .bookmark-btn,
  .article-header__cover-bg,
  .comment-section,
  #comment-section-slot,
  .share-bubble,
  .scroll-to-top,
  .anw,
  .code-block-wrapper pre.code-block--clamped::after,
  .code-block-header,
  .code-block-expand,
  .code-view-toggle,
  .code-render-pane,
  .code-render-frame,
  .code-block-wrapper pre
  {
    display: none !important;
  }

  .code-block-wrapper,
  pre {
    background: #f5ede6 !important;
    border: 1px solid #e8e3dc !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  pre, pre code,
  .code-block-wrapper pre,
  .code-block-wrapper code {
    background: transparent !important;
    color: #1a1714 !important;
    font-family: 'DM Sans', monospace !important;
    font-size: 9pt !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  pre .hljs-keyword, pre .hljs-string, pre .hljs-comment,
  pre .hljs-number, pre .hljs-function, pre .hljs-title,
  pre code span {
    color: #1a1714 !important;
    background: transparent !important;
  }

  .code-block-wrapper pre.code-block--clamped {
    max-height: none !important;
    overflow: visible !important;
  }

  .article-layout {
    display: block !important;
  }

  .article-header {
    position: static !important;
    background: transparent !important;
    min-height: 0 !important;
    border-radius: 0 !important;
    overflow: visible !important;
    display: block !important;
    margin-bottom: 0.8cm !important;
    padding-bottom: 0 !important;
  }

  .article-header__content {
    position: static !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 0.35cm !important;
    background: transparent !important;
  }

  .article-header__zone {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
  }

  .article-header__zone--tags {
    order: 1;
  }

  .article-header__zone--title {
    order: 2;
  }

  .article-header__zone--meta {
    order: 3;
    padding-top: 0.35cm !important;
    margin-top: 0.1cm !important;
    border-top: 1.5px solid #a05222 !important;
  }

  .article-header__tags {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0.15cm !important;
    margin: 0 !important;
  }

  .article-header__tag {
    display: inline-block !important;
    font-family: 'DM Sans', system-ui, sans-serif !important;
    font-size: 8.5pt !important;
    font-weight: 600 !important;
    letter-spacing: 0.06em !important;
    text-transform: uppercase !important;
    color: #a05222 !important;
    background: #f5ede6 !important;
    border: 1px solid rgba(160, 82, 34, 0.35) !important;
    padding: 2px 9px !important;
    border-radius: 999px !important;
    margin: 0 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  .article-header__title {
    font-family: 'Playfair Display', Georgia, serif !important;
    font-size: 24pt !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    color: #1a1714 !important;
    text-shadow: none !important;
    letter-spacing: -0.02em !important;
    margin: 0 !important;
    display: block !important;
    -webkit-line-clamp: unset !important;
    line-clamp: unset !important;
    overflow: visible !important;
    min-height: 0 !important;
  }

  .article-meta {
    display: flex !important;
    align-items: baseline !important;
    flex-wrap: nowrap !important;
    gap: 0.2cm !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    width: 100% !important;
  }

  .article-meta__author {
    display: contents !important;
  }

  .article-meta__author > div {
    display: contents !important;
  }

  .article-meta__name,
  .article-meta__author-link {
    font-family: 'DM Sans', system-ui, sans-serif !important;
    font-size: 9pt !important;
    font-weight: 600 !important;
    color: #6b6560 !important;
    text-decoration: none !important;
    order: 1 !important;
  }

  .article-meta__name::before {
    content: "By " !important;
    font-weight: 400 !important;
    color: #6b6560 !important;
  }

  .article-meta__author-link::after {
    content: none !important;
  }

  .article-meta__date {
    font-family: 'DM Sans', system-ui, sans-serif !important;
    font-size: 9pt !important;
    color: #6b6560 !important;
    order: 2 !important;
    flex-shrink: 0 !important;
  }

  .article-meta__date::before {
    content: " · " !important;
    color: #6b6560 !important;
  }

  .article-meta__date::after {
    content: none !important;
  }

  .article-meta__actions {
    display: flex !important;
    align-items: baseline !important;
    order: 3 !important;
    margin-left: auto !important;
  }

  .article-meta__reading-time {
    font-family: 'DM Sans', system-ui, sans-serif !important;
    font-size: 9pt !important;
    color: #6b6560 !important;
    white-space: nowrap !important;
  }

  #article-body-slot::after,
  .article-body::after {
    content: "Read more essays from Elvin - © Elvin. Unauthorized reproduction prohibited.";
    display: block;
    margin-top: 1cm;
    padding-top: 0.4cm;
    border-top: 1px solid #c9bfb7;
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 8pt;
    color: #6b6560;
    text-align: center;
    letter-spacing: 0.02em;
  }

  #article-body-slot,
  .article-body {
    font-family: 'Source Serif 4', Georgia, serif !important;
    font-size: 11pt !important;
    line-height: 1.85 !important;
    color: #1a1714 !important;
  }

  .article-body > * + *,
  #article-body-slot > * + * {
    margin-top: 0.4cm !important;
  }

  .article-body h2,
  #article-body-slot h2 {
    font-family: 'Playfair Display', Georgia, serif !important;
    font-size: 16pt !important;
    font-weight: 700 !important;
    color: #1a1714 !important;
    margin-top: 0.8cm !important;
    margin-bottom: 0.25cm !important;
    display: table !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    page-break-after: avoid !important;
    break-after: avoid !important;
  }

  .article-body h2::after,
  #article-body-slot h2::after {
    content: '' !important;
    display: block !important;
    width: 36px !important;
    height: 2.5px !important;
    background: #a05222 !important;
    border-radius: 9999px !important;
    margin-top: 0.15cm !important;
  }

  .article-body h3,
  #article-body-slot h3 {
    font-family: 'Playfair Display', Georgia, serif !important;
    font-size: 13pt !important;
    font-weight: 700 !important;
    color: #1a1714 !important;
    margin-top: 0.6cm !important;
    margin-bottom: 0.2cm !important;
    page-break-after: avoid !important;
    break-after: avoid !important;
  }

  .article-body p,
  #article-body-slot p {
    orphans: 3 !important;
    widows: 3 !important;
    line-height: 1.85 !important;
  }

  .article-body blockquote,
  #article-body-slot blockquote {
    border-left: 3px solid #a05222 !important;
    padding-left: 0.5cm !important;
    margin-left: 0 !important;
    font-style: italic !important;
    color: #6b6560 !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .article-body ul,
  .article-body ol,
  #article-body-slot ul,
  #article-body-slot ol {
    list-style: revert !important;
    padding-left: 1.2cm !important;
  }

  .article-body li + li,
  #article-body-slot li + li {
    margin-top: 0.15cm !important;
  }

  .article-body hr,
  #article-body-slot hr {
    border: none !important;
    height: 2px !important;
    background: #c9bfb7 !important;
    margin-block: 0.6cm !important;
  }

  .article-body img,
  #article-body-slot img {
    max-width: 100% !important;
    height: auto !important;
    border-radius: 5px !important;
    display: block !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .article-body figure,
  #article-body-slot figure {
    margin-block: 0.5cm !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .article-body figcaption,
  #article-body-slot figcaption {
    font-family: 'DM Sans', system-ui, sans-serif !important;
    font-size: 8.5pt !important;
    color: #6c6661 !important;
    text-align: center !important;
    margin-top: 0.15cm !important;
  }

  .article-body a[href]::after,
  #article-body-slot a[href]::after {
    content: " (" attr(href) ")" !important;
    font-size: 8pt !important;
    color: #6b6560 !important;
    word-break: break-all !important;
    font-style: normal !important;
  }
}

@media print and (max-width: 1024px), print {
  .article-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  .article-header {
    grid-column: 1;
    grid-row: auto;
    order: 1;
  }

  .article-body {
    grid-column: 1;
    grid-row: auto;
    order: 3;
  }

  .article-comments {
    grid-column: 1;
    grid-row: auto;
    order: 4;
  }
}

@media (max-width: 1024px) {
  .article-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  .article-header {
    grid-column: 1;
    grid-row: auto;
    order: 1;
  }

  .article-body {
    grid-column: 1;
    grid-row: auto;
    order: 3;
  }

  .article-comments {
    grid-column: 1;
    grid-row: auto;
    order: 4;
  }

  .article-sidebar {
    grid-column: 1;
    grid-row: auto;
    order: 2;
    position: static;
  }
}

@media (max-width: 768px) {
  .article-header__content {
    padding: var(--space-5) var(--space-6);
  }

  .article-header__title {
    line-clamp: 3;
    -webkit-line-clamp: 3;
    min-height: calc(clamp(var(--text-2xl), 3.8vw, var(--text-3xl)) * 1.15 * 3);
  }
}

@media (max-width: 640px) {
  .article-header {
    min-height: 260px;
  }
}