/* ============================================================
   肌研究ノート — Article page styles
   ============================================================ */

/* ---------- Breadcrumb ---------- */
.crumb { font-family: var(--f-ui); font-size: 12px; color: var(--c-ink-faint); padding-top: 26px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumb a, .crumb > span { white-space: nowrap; }
.crumb a:hover { color: var(--c-pink-deep); }
.crumb .sep { opacity: .5; }

/* ---------- Article header ---------- */
.art-head { padding-block: 22px 30px; max-width: 820px; }
.art-cat { display: inline-flex; }
.art-title {
  font-family: var(--f-display); font-weight: 700;
  font-size: clamp(27px, 4vw, 41px); line-height: 1.5; letter-spacing: .02em;
  margin: 16px 0 0; color: var(--c-ink); text-wrap: pretty;
}
.art-lead { font-size: 16.5px; line-height: 2; color: var(--c-ink-soft); margin: 22px 0 0; }
.art-meta { display: flex; align-items: center; gap: 16px; margin-top: 26px; flex-wrap: wrap; }
.author { display: flex; align-items: center; gap: 12px; }
.author .av { width: 46px; height: 46px; border-radius: 50%; background: var(--c-sage-tint); display:grid; place-items:center; color: var(--c-sage-deep); font-family: var(--f-display); font-weight:700; font-size:18px; flex-shrink:0; overflow: hidden; }
/* Image avatar variant — used by single.php with hadanote_author_avatar_url() */
.author .av.av-img { background: transparent; padding: 0; }
.author .av img,
.author .av.av-img img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: inherit; }
.author .nm { font-family: var(--f-ui); font-weight: 600; font-size: 14px; color: var(--c-ink); }
.author .rl { font-family: var(--f-ui); font-size: 11.5px; color: var(--c-ink-faint); margin-top: 2px; }
.art-meta-r { display:flex; gap:14px; font-family: var(--f-ui); font-size: 12.5px; color: var(--c-ink-faint); margin-left:auto; align-items:center; }
.art-meta-r > span { white-space: nowrap; }
.art-meta-r .pr-flag { color: var(--c-sage-deep); border:1px solid var(--c-line); padding: 3px 9px; border-radius: 99px; font-weight:600; letter-spacing:.06em; }

.art-hero { aspect-ratio: 16/8; border-radius: 14px; margin-bottom: 8px; }

/* ---------- Layout ---------- */
.art-layout { display: grid; grid-template-columns: minmax(0,1fr) 312px; gap: 56px; align-items: start; padding-bottom: 40px; }
@media (max-width: 980px) { .art-layout { grid-template-columns: 1fr; gap: 0; } .art-aside { display: none; } }

/* ---------- Body typography ---------- */
.body { max-width: 760px; }

/* Static page variant — center the content, no sidebar */
.body--page {
  max-width: 760px;
  margin: 0 auto;
  padding-bottom: 60px;
}
.page-head {
  max-width: 760px;
  margin: 0 auto;
}
.page-head .art-title { font-size: clamp(26px, 4vw, 36px); }

.body h2 {
  font-family: var(--f-display); font-weight: 700; font-size: clamp(22px, 3vw, 28px);
  line-height: 1.55; margin: 56px 0 20px; padding-bottom: 14px; letter-spacing: .02em;
  border-bottom: 2px solid var(--c-pink-tint); position: relative; scroll-margin-top: 90px;
}
.body h2::before {
  content: ""; position: absolute; left: 0; bottom: -2px; width: 64px; height: 2px; background: var(--c-pink-deep);
}
.body h3 { font-family: var(--f-display); font-weight: 600; font-size: 19px; margin: 36px 0 12px; color: var(--c-ink); }
.body p { font-size: 16px; line-height: 2.05; margin: 0 0 20px; color: var(--c-ink); }
.body strong { font-weight: 700; background: linear-gradient(transparent 60%, var(--c-pink-tint) 60%); padding: 0 1px; }
.body .lead-note {
  background: var(--c-sage-tint); border-radius: 10px; padding: 22px 24px; margin: 0 0 32px;
  font-size: 15px; line-height: 1.95; color: var(--c-ink); border-left: 3px solid var(--c-sage);
}
.body ul.points { list-style: none; padding: 0; margin: 0 0 24px; display: flex; flex-direction: column; gap: 14px; }
.body ul.points li { display: flex; gap: 12px; font-size: 15.5px; line-height: 1.85; }
.body ul.points li .bullet { flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--c-pink-tint); color: var(--c-pink-deep); display:grid; place-items:center; margin-top:3px; }
.body figure { margin: 0 0 32px; }
.body figcaption { font-family: var(--f-ui); font-size: 12px; color: var(--c-ink-faint); text-align: center; margin-top: 10px; }

/* ---------- TOC ---------- */
.toc { background: var(--c-paper); border: 1px solid var(--c-line); border-radius: 12px; padding: 24px 26px; margin: 8px 0 44px; }
.toc .toc-h { font-family: var(--f-ui); font-weight: 700; font-size: 13px; letter-spacing: .1em; color: var(--c-ink); display:flex; align-items:center; gap:9px; margin-bottom: 16px; }
.toc ol { list-style: none; counter-reset: toc; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 11px; }
.toc li { counter-increment: toc; }
.toc a { display: flex; gap: 12px; font-size: 14.5px; color: var(--c-ink-soft); line-height: 1.6; transition: color .2s; }
.toc a::before { content: counter(toc, decimal-leading-zero); font-family: var(--f-ui); font-weight: 700; color: var(--c-pink); flex-shrink:0; }
.toc a:hover { color: var(--c-pink-deep); }
.toc a[data-active="true"] { color: var(--c-pink-deep); font-weight: 600; }

/* ---------- Comparison table ---------- */
.cmp-wrap { margin: 8px 0 0; overflow-x: auto; border-radius: 12px; border: 1px solid var(--c-line); }
table.cmp { width: 100%; border-collapse: collapse; min-width: 560px; background: var(--c-paper); }
table.cmp th, table.cmp td { padding: 16px 18px; text-align: left; font-size: 14px; line-height: 1.6; border-bottom: 1px solid var(--c-line); }
table.cmp thead th { background: var(--c-ink); color: #fff; font-family: var(--f-ui); font-weight: 600; font-size: 12.5px; letter-spacing: .04em; }
table.cmp tbody tr:last-child td { border-bottom: none; }
table.cmp .rowname { font-family: var(--f-display); font-weight: 600; color: var(--c-ink); }
table.cmp tr.pick { background: var(--c-pink-tint2); }
table.cmp tr.pick .rowname { color: var(--c-pink-deep); }
.pick-flag { display:inline-flex; align-items:center; gap:5px; font-family: var(--f-ui); font-size:10.5px; font-weight:700; letter-spacing:.06em; color:#fff; background: var(--c-pink-deep); padding: 3px 9px; border-radius: 99px; margin-left:8px; }

/* ============================================================
   Ad slots (subtle, blended tone)
   ============================================================ */
.pr-label { font-family: var(--f-ui); font-size: 10px; font-weight: 600; letter-spacing: .14em; color: var(--c-ink-faint); display:inline-flex; align-items:center; gap:5px; }
.pr-label::before { content: "PR"; background: var(--c-line); color: var(--c-ink-soft); padding: 1px 6px; border-radius: 3px; font-size: 9.5px; }

/* CTA after comparison table */
.ad-cta {
  margin: 28px 0 12px; background: var(--c-pink-tint2); border: 1px solid var(--c-pink-tint);
  border-radius: 14px; padding: 26px 28px; display: flex; align-items: center; gap: 22px;
}
.ad-cta .txt { flex: 1; }
.ad-cta h4 { font-family: var(--f-display); font-weight: 600; font-size: 18px; margin: 8px 0 6px; }
.ad-cta p { font-size: 13.5px; color: var(--c-ink-soft); margin: 0; line-height: 1.7; }
.ad-cta .btn { flex-shrink: 0; }
@media (max-width: 600px) { .ad-cta { flex-direction: column; align-items: stretch; text-align: left; } .ad-cta .btn { width: 100%; } }

/* Affiliate link block after FAQ */
.ad-aff {
  margin: 32px 0; border: 1px solid var(--c-line); border-radius: 14px; overflow: hidden;
  display: flex; align-items: stretch; background: var(--c-paper); transition: box-shadow .3s, transform .3s;
}
.ad-aff:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.ad-aff .ph { width: 150px; flex-shrink: 0; }
.ad-aff .ad-aff-body { padding: 20px 24px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.ad-aff h4 { font-family: var(--f-display); font-weight: 600; font-size: 17px; margin: 4px 0 0; line-height: 1.5; }
.ad-aff p { font-size: 13px; color: var(--c-ink-soft); margin: 0; line-height: 1.7; }
.ad-aff .aff-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 6px; }
.ad-aff .aff-price { font-family: var(--f-display); font-weight: 700; font-size: 18px; color: var(--c-ink); }
.ad-aff .aff-price small { font-size: 11px; color: var(--c-ink-faint); font-weight: 400; font-family: var(--f-ui); }
.ad-aff .aff-go { font-family: var(--f-ui); font-size: 13px; font-weight: 600; color: var(--c-pink-deep); display:inline-flex; align-items:center; gap:6px; }
.ad-aff:hover .aff-go { gap: 10px; }
@media (max-width: 560px) { .ad-aff { flex-direction: column; } .ad-aff .ph { width: 100%; height: 150px; } }

/* Summary CTA at article end */
.ad-summary {
  margin: 48px 0 16px; background: var(--c-sage-tint); border-radius: 18px; padding: clamp(28px, 4vw, 44px);
  position: relative; overflow: hidden;
}
.ad-summary h3 { font-family: var(--f-display); font-weight: 700; font-size: 22px; margin: 12px 0 16px; display:flex; align-items:center; gap:10px; }
.ad-summary ul { list-style: none; padding: 0; margin: 0 0 26px; display: flex; flex-direction: column; gap: 12px; }
.ad-summary ul li { display: flex; gap: 11px; font-size: 15px; line-height: 1.7; }
.ad-summary ul li svg { color: var(--c-sage-deep); flex-shrink: 0; margin-top: 4px; }
.ad-summary .sum-cta { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.ad-summary .sum-note { font-family: var(--f-ui); font-size: 11.5px; color: var(--c-ink-faint); margin-top: 16px; }

/* ---------- Sidebar ---------- */
.art-aside { position: sticky; top: 90px; display: flex; flex-direction: column; gap: 28px; }
.aside-box { background: var(--c-paper); border: 1px solid var(--c-line); border-radius: 12px; padding: 22px; }
.aside-h { font-family: var(--f-ui); font-weight: 700; font-size: 12.5px; letter-spacing: .1em; color: var(--c-ink); margin-bottom: 16px; display:flex; align-items:center; gap:8px; white-space: nowrap; }
.aside-h .bar { width: 16px; height: 2px; background: var(--c-pink-deep); }

/* sticky following ad */
.ad-sidebar {
  border: 1px solid var(--c-pink-tint); border-radius: 12px; background: var(--c-pink-tint2);
  overflow: hidden;
}
.ad-sidebar .ad-sb-inner { padding: 18px; }
.ad-sidebar .ph { width: 100%; aspect-ratio: 4/3.4; border-radius: 8px; margin-bottom: 14px; }
.ad-sidebar h4 { font-family: var(--f-display); font-weight: 600; font-size: 16px; margin: 0 0 8px; line-height: 1.5; }
.ad-sidebar p { font-size: 12.5px; color: var(--c-ink-soft); margin: 0 0 16px; line-height: 1.7; }
.ad-sidebar .btn { width: 100%; }
.ad-sb-top { display:flex; justify-content:space-between; align-items:center; padding: 9px 14px; border-bottom: 1px solid var(--c-pink-tint); }
.ad-sb-top .sticky-tag { font-family: var(--f-ui); font-size:10px; font-weight:600; letter-spacing:.1em; color: var(--c-sage-deep); }

/* reading progress bar */
.progress { position: fixed; top: 0; left: 0; height: 3px; background: var(--c-pink-deep); z-index: 60; width: 0; transition: width .1s linear; }

/* related */
.related { background: #F4F3EF; }

/* ---------- FAQ ---------- */
.faq { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.faq-item { border: 1px solid var(--c-line); border-radius: 12px; background: var(--c-paper); overflow: hidden; transition: border-color .25s, box-shadow .25s; }
.faq-item[data-open="true"] { border-color: var(--c-pink); box-shadow: var(--shadow-sm); }
.faq-q { width: 100%; display: flex; align-items: center; gap: 14px; padding: 18px 20px; background: none; border: none; cursor: pointer; text-align: left; font-family: var(--f-body); }
.faq-qmark { flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%; background: var(--c-pink); color: #fff; font-family: var(--f-display); font-weight: 700; display: grid; place-items: center; font-size: 15px; }
.faq-qtext { flex: 1; font-family: var(--f-display); font-weight: 600; font-size: 16px; line-height: 1.6; color: var(--c-ink); }
.faq-chev { flex-shrink: 0; color: var(--c-ink-faint); }
.faq-a-wrap { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .35s cubic-bezier(.22,1,.36,1); }
.faq-item[data-open="true"] .faq-a-wrap { grid-template-rows: 1fr; }
.faq-a { overflow: hidden; display: flex; gap: 14px; padding: 0 20px; }
.faq-item[data-open="true"] .faq-a { padding-bottom: 20px; }
.faq-amark { flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%; background: var(--c-sage-tint); color: var(--c-sage-deep); font-family: var(--f-display); font-weight: 700; display: grid; place-items: center; font-size: 15px; }
.faq-a p { margin: 0; font-size: 14.5px; line-height: 1.9; color: var(--c-ink-soft); padding-top: 2px; }

/* ============================================================
   Mobile improvements (max-width: 768px)
   ============================================================ */
@media (max-width: 768px) {
  /* Article header */
  .crumb { padding-top: 18px; font-size: 11.5px; }
  .art-head { padding-block: 14px 22px; }
  .art-title { font-size: clamp(22px, 6vw, 28px); line-height: 1.45; margin: 12px 0 0; }
  .art-lead { font-size: 15px; line-height: 1.85; margin: 18px 0 0; }
  .art-meta { gap: 12px; margin-top: 20px; }
  .author .av { width: 38px; height: 38px; font-size: 15px; }
  .author .nm { font-size: 13.5px; }
  .author .rl { font-size: 11px; }
  .art-meta-r { margin-left: 0; gap: 10px; font-size: 11.5px; flex-wrap: wrap; }
  .art-hero { aspect-ratio: 16/10; border-radius: 10px; }

  /* Body typography — readable on small screens */
  .body { max-width: 100%; }
  .body h2 {
    font-size: 20px;
    margin: 40px 0 16px;
    padding-bottom: 11px;
    line-height: 1.5;
  }
  .body h2::before { width: 48px; }
  .body h3 { font-size: 16.5px; margin: 28px 0 10px; line-height: 1.55; }
  .body p { font-size: 15px; line-height: 1.9; margin: 0 0 16px; }
  .body strong { padding: 0 1px; }
  .body ul.points { gap: 10px; }
  .body ul.points li { font-size: 14.5px; line-height: 1.7; gap: 10px; }
  .body ul.points li .bullet { width: 22px; height: 22px; margin-top: 2px; }
  .body .lead-note { padding: 16px 18px; font-size: 14px; line-height: 1.85; }

  /* TOC */
  .toc { padding: 18px 20px; margin-bottom: 32px; }
  .toc .toc-h { font-size: 12px; margin-bottom: 12px; }
  .toc a { font-size: 13.5px; gap: 10px; }

  /* === Tables generated from markdown (plain <table> in .body) ===
     Convert to horizontally scrollable card while keeping legibility. */
  .body > table:not([border]) {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    margin: 16px 0;
    border: 1px solid var(--c-line);
    border-radius: 10px;
    border-collapse: separate;
    background: var(--c-paper);
    font-size: 13.5px;
  }
  .body > table:not([border]) thead th {
    background: var(--c-ink);
    color: #fff;
    padding: 10px 12px;
    font-family: var(--f-ui);
    font-weight: 600;
    font-size: 12px;
    letter-spacing: .04em;
    text-align: left;
    white-space: nowrap;
  }
  .body > table:not([border]) tbody td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--c-line-soft);
    line-height: 1.55;
    vertical-align: top;
  }
  .body > table:not([border]) tbody tr:last-child td { border-bottom: none; }
  .body > table:not([border]) strong { background: none; padding: 0; font-weight: 700; }

  /* === FAQ generated as plain H3+P === */
  .body h3 + p { margin-top: 4px; }
}

/* ============================================================
   Rakuten affiliate cards on narrow screens
   (cards have inline width:504px — let them shrink and stack)
   ============================================================ */
@media (max-width: 540px) {
  .body table[border="0"][cellpadding="0"][cellspacing="0"] {
    width: 100% !important;
    max-width: 100%;
    margin: 18px 0;
  }
  .body table[border="0"][cellpadding="0"][cellspacing="0"] td {
    display: block;
    width: 100% !important;
    box-sizing: border-box;
  }
  /* Inner styled card container (width:504px in inline style) */
  .body table[border="0"][cellpadding="0"][cellspacing="0"] div[style*="width:504px"] {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }
  /* Inner two-column layout inside each card: stack image / text */
  .body table[border="0"][cellpadding="0"][cellspacing="0"] table {
    width: 100% !important;
  }
  .body table[border="0"][cellpadding="0"][cellspacing="0"] td[style*="width:240px"],
  .body table[border="0"][cellpadding="0"][cellspacing="0"] td[style*="width:248px"] {
    display: block !important;
    width: 100% !important;
    text-align: center;
  }
  .body table[border="0"][cellpadding="0"][cellspacing="0"] td[style*="width:240px"] img {
    width: auto !important;
    max-width: 220px;
    height: auto !important;
    margin: 0 auto !important;
  }
  .body table[border="0"][cellpadding="0"][cellspacing="0"] td[style*="width:248px"] {
    text-align: left;
    padding-top: 6px;
  }
  /* "楽天で購入" button: full width and bigger tap target */
  .body table[border="0"][cellpadding="0"][cellspacing="0"] div[style*="float:right"] {
    float: none !important;
    width: 100% !important;
    box-sizing: border-box;
    margin-top: 10px;
  }
}

/* ============================================================
   Tap target sizing for buttons / icon-buttons on mobile
   (WCAG / iOS minimum 44px)
   ============================================================ */
@media (max-width: 768px) {
  .btn { min-height: 44px; padding: 12px 22px; font-size: 13.5px; }
  .icon-btn { min-width: 44px; min-height: 44px; }
  .ad-cta { padding: 20px 22px; gap: 14px; }
  .ad-cta h4 { font-size: 16px; }
  .ad-cta p { font-size: 13px; }
}


/* ============================================================
   Reading progress bar (single posts only).
   ============================================================ */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: transparent;
    z-index: 9999;
    pointer-events: none;
}
/* When the WP admin bar is showing, push the progress bar below it so it stays visible. */
.admin-bar .reading-progress { top: 32px; }
@media (max-width: 782px) {
    .admin-bar .reading-progress { top: 46px; }
}
.reading-progress__bar {
    display: block;
    width: 0;
    height: 100%;
    background: #F2A99A;
    transform-origin: left center;
    transition: width 0.08s linear;
    box-shadow: 0 0 6px rgba(242, 169, 154, 0.45);
}
@media (prefers-reduced-motion: reduce) {
    .reading-progress__bar { transition: none; }
}

/* ============================================================
   Related articles section header + tag chips.
   (.related background and .grid-3 columns are defined elsewhere
   — keep this block scoped to additions only.)
   ============================================================ */
.related { margin-top: clamp(48px, 7vw, 80px); }
.related .sec-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.related .sec-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--c-ink, #1A1A1A);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    border-bottom: 1px solid currentColor;
    padding-bottom: 2px;
}
.related .sec-link:hover { opacity: 0.7; }
@media (max-width: 600px) {
    .related .sec-head { flex-direction: column; align-items: flex-start; gap: 8px; }
}

/* Tag chip footer at end of article body */
.art-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--c-line);
}

/* ============================================================
   Compat: legacy related-card markup (.thumb/.meta/.title/.excerpt/.who).
   Older deploys rendered related cards with these classes instead of
   .card-media/.card-body. Style them so the layout doesn't break on
   sites running an in-between deploy.
   ============================================================ */
.related .card > .thumb {
    display: block;
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--c-paper);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.related .card > .thumb img,
.related .card > .thumb .wp-post-image {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    display: block;
}
.related .card > .meta,
.related .card > .who {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 20px;
    font-family: var(--f-ui);
    font-size: 12.5px;
    color: var(--c-ink-soft);
}
.related .card > .meta { padding-top: 16px; margin-bottom: 4px; }
.related .card > .meta .dot {
    width: 3px; height: 3px; border-radius: 50%;
    background: var(--c-line); margin: 0;
}
.related .card > .title {
    padding: 0 20px;
    margin: 4px 0 8px;
    font-family: var(--f-display);
    font-weight: 600;
    font-size: 16px;
    line-height: 1.55;
}
.related .card > .title a {
    color: var(--c-ink);
    text-decoration: none;
}
.related .card > .title a:hover { color: var(--c-pink-deep); }
.related .card > .excerpt {
    padding: 0 20px;
    margin: 0 0 14px;
    font-size: 13px;
    color: var(--c-ink-soft);
    line-height: 1.75;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.related .card > .who {
    padding-bottom: 18px;
    margin-top: auto;
}
.related .card > .who .av {
    width: 28px; height: 28px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}
.related .card > .who .av img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}
