/**
 * Single post: offset content for fixed custom header (.article-header)
 * - Does not change post HTML; spacing only.
 * - Admin bar present: WordPress offsets the page; keep smaller padding.
 *
 * 子テーマでは body_class() を <body> ではなく #body_wrap に出しているため、
 * 「body.single #body_wrap」だけだと一致しない。 #body_wrap.single も併記する。
 */

:root {
  /* 固定ヘッダー実高に合わせて調整（ロゴなし運用の試行値） */
  --livecom-fixed-header-offset: 48px;
}

@media (min-width: 768px) {
  :root {
    --livecom-fixed-header-offset: 48px;
  }
}

/* Anchor jumps (TOC etc.) — 記事ページのみ */
html body.single-post,
html body.single,
html:has(#body_wrap.single) {
  scroll-padding-top: calc(var(--livecom-fixed-header-offset) + env(safe-area-inset-top, 0px)) !important;
}

/*
 * Push SWELL layout below fixed custom header.
 * body.single … ＝ 標準の <body class="…"> 配置
 * #body_wrap.single … ＝ body_class() を #body_wrap に出している場合（当子テーマ）
 */
body.single-post #body_wrap,
body.single #body_wrap,
#body_wrap.single {
  padding-top: calc(var(--livecom-fixed-header-offset) + env(safe-area-inset-top, 0px)) !important;
}

body.single-post #content.l-content.l-container,
body.single #content.l-content.l-container,
#body_wrap.single #content.l-content.l-container {
  padding-top: calc(var(--livecom-fixed-header-offset) + env(safe-area-inset-top, 0px)) !important;
}

/* When admin bar is visible, WP already shifts layout; reduce our offset */
body.admin-bar.single-post #body_wrap,
body.admin-bar.single #body_wrap,
body.admin-bar #body_wrap.single {
  padding-top: 40px !important;
}

@media (min-width: 783px) {
  body.admin-bar.single-post #body_wrap,
  body.admin-bar.single #body_wrap,
  body.admin-bar #body_wrap.single {
    padding-top: 48px !important;
  }
}

body.admin-bar.single-post #content.l-content.l-container,
body.admin-bar.single #content.l-content.l-container,
body.admin-bar #body_wrap.single #content.l-content.l-container {
  padding-top: 32px !important;
}

@media (min-width: 783px) {
  body.admin-bar.single-post #content.l-content.l-container,
  body.admin-bar.single #content.l-content.l-container,
  body.admin-bar #body_wrap.single #content.l-content.l-container {
    padding-top: 40px !important;
  }
}
