/* Component: Reading progress bar + sticky mini header (single post) ---- */

.ts-reading-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--color-border);
  z-index: 60;
}
.ts-reading-bar__fill {
  height: 100%;
  width: 0%;
  background: var(--color-primary);
}

.ts-sticky-head {
  position: fixed;
  top: 3px;
  left: 0;
  width: 100%;
  /* 반투명 + 블러 (브라우저 미지원 시 불투명 흰색으로 폴백) */
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--color-border);
  padding-block: var(--space-2);
  font-size: var(--fs-sm);
  z-index: 59;
  transform: translateY(-120%);
  transition: transform var(--dur) var(--ease);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .ts-sticky-head { background: var(--color-surface); }
}
.ts-sticky-head.is-visible { transform: translateY(0); }

/* 본문 컬럼 폭에 맞춰 가운데 정렬 (데스크탑에서 글 영역 위치에서 시작) */
.ts-sticky-head__inner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  max-width: var(--container-narrow);
  margin-inline: auto;
  padding-inline: var(--space-4);
}

/* 목록으로 돌아가기 버튼 — 모바일: 아이콘만(원형), 데스크탑: 아이콘+'목록' */
.ts-sticky-head__back {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  width: 1.9em;
  height: 1.9em;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-pill);
  color: var(--color-primary);
  font-size: var(--fs-base);
  line-height: 1;
  background: var(--color-surface);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.ts-sticky-head__back:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-text-inverse);
}
.ts-sticky-head__back-label { display: none; }
@media (min-width: 769px) {
  .ts-sticky-head__back {
    width: auto;
    padding-inline: var(--space-3);
  }
  .ts-sticky-head__back-label { display: inline; font-size: var(--fs-sm); font-weight: var(--fw-medium); }
}

.ts-sticky-head__title {
  font-weight: var(--fw-bold);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 0 1 auto;
}
.ts-sticky-head__section {
  color: var(--color-text-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 auto;
}
.ts-sticky-head__section:empty { display: none; }
.ts-sticky-head__section::before { content: "·"; margin-right: var(--space-2); }
.ts-sticky-head__section:empty::before { content: none; }

/* 맨 위로 버튼 — 스크롤 내리면 우측 하단에 나타남, 누르면 최상단으로 */
.ts-to-top {
  position: fixed;
  right: var(--space-4);
  bottom: var(--space-4);
  width: 2.8em;
  height: 2.8em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  color: var(--color-primary);
  font-size: var(--fs-lg);
  line-height: 1;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease), background var(--dur) var(--ease), color var(--dur) var(--ease);
  z-index: 58;
}
.ts-to-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.ts-to-top:hover { background: var(--color-primary); color: var(--color-text-inverse); border-color: var(--color-primary); }

/* 로그인 상태에서 워드프레스 관리자바(#wpadminbar)에 가려지지 않도록 오프셋 */
body.admin-bar .ts-reading-bar { top: 32px; }
body.admin-bar .ts-sticky-head { top: 35px; }
@media (max-width: 782px) {
  body.admin-bar .ts-reading-bar { top: 46px; }
  body.admin-bar .ts-sticky-head { top: 49px; }
}
