/* ============================================================
   DCX — Universal Blog Article Template
   Shared JP article styles
   ============================================================ */

:root {
  --navy:      #363f75;
  --navy-deep: #2b2b68;
  --ink:       #1A005D;
  --green:     #8EC300;
  --accent:    #5a64ad;
  --tint:      #F6F7FB;
  --rail:      #E3E6F2;
  --text:      #2a2e3f;
  --muted:     #8a90ab;
  --radius:    16px;
  --shadow-sm: 0 1px 2px rgba(20,24,50,.05), 0 6px 16px rgba(20,24,50,.07);
  --shadow-md: 0 2px 4px rgba(20,24,50,.06), 0 14px 32px rgba(20,24,50,.13);
  --font-body: "Noto Sans JP","Hiragino Kaku Gothic ProN","ヒラギノ角ゴ ProN",sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --content-w: 720px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 120px; }
body { margin: 0; overflow-x: hidden; color: var(--text); font-family: var(--font-body); line-height: 1.9; background: #fff; }
img { max-width: 100%; height: auto; display: block; }
a { text-decoration: none; color: inherit; }
.container { width: min(1140px, 92%); margin-inline: auto; }

/* ---- HEADER ---- */
header { position: sticky; top: 0; z-index: 100; background: #fff; border-bottom: 3px solid var(--ink); box-shadow: 0 3px 0 var(--green); }
.header-in { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 12px 0; }
.brand { display: flex; flex-direction: column; line-height: 1.2; flex-shrink: 0; }
.brand img { width: 112px; }
.brand small { font-size: 10px; color: var(--navy); margin-top: 4px; }
nav.gnav { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
nav.gnav a { font-size: 13px; font-weight: 700; color: var(--text); position: relative; padding: 6px 0; min-height: 44px; display: inline-flex; align-items: center; }
nav.gnav a.active { color: var(--navy); }
nav.gnav a:not(.btn)::after { content: ""; position: absolute; left: 0; bottom: 0; width: 100%; height: 2px; background: var(--green); transform: scaleX(0); transform-origin: left; transition: transform .25s; }
nav.gnav a.active:not(.btn)::after, nav.gnav a:not(.btn):hover::after { transform: scaleX(1); }
nav.gnav .btn { padding: 10px 20px; font-size: 13px; color: #fff; }
nav.gnav .btn .arr { color: var(--green); transition: transform .2s; }
nav.gnav .btn:hover { background: var(--accent); transform: translateY(-2px); }
nav.gnav .btn:hover .arr { transform: translateX(4px); }
@media(max-width:860px) { nav.gnav a:not(.btn) { display: none; } }
@media(max-width:480px) { .brand img { width: 90px; } .brand small { display: none; } nav.gnav .btn { padding: 8px 16px; font-size: 13px; } }

/* ---- ARTICLE HERO ---- */
.article-hero { position: relative; overflow: hidden; min-height: min(52vh, 480px); display: flex; align-items: flex-end; color: #fff; }
.article-hero .bg { position: absolute; inset: 0; background-color: #2b2b68; background-size: cover; background-position: center; }
.article-hero .bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(13,16,44,.20) 0%, rgba(13,16,44,.75) 55%, rgba(13,16,44,.93) 100%); }
.article-hero .hero-body { position: relative; z-index: 1; width: 100%; padding: clamp(32px,6vw,64px) 0 clamp(36px,5vw,56px); }
.article-hero .hero-body > * { max-width: var(--content-w); }
.breadcrumb ol { display: flex; gap: 6px; align-items: center; margin-bottom: 18px; font-size: 12px; color: rgba(255,255,255,.6); list-style: none; padding: 0; }
.breadcrumb li { display: flex; align-items: center; gap: 6px; }
.breadcrumb li:not(:last-child)::after { content: "›"; color: rgba(255,255,255,.35); }
.breadcrumb a { color: rgba(255,255,255,.6); }
.breadcrumb a:hover { color: #fff; }
.article-meta-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.tag-pill { display: inline-block; padding: 3px 12px; border-radius: 999px; font-size: 11px; font-family: var(--font-mono); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.tag-blog        { background: rgba(255,255,255,.15); color: #fff; border: 1px solid rgba(255,255,255,.3); }
.tag-shopify     { background: rgba(142,195,0,.25);   color: #d4f08a; border: 1px solid rgba(142,195,0,.4); }
.tag-wms         { background: rgba(90,100,173,.3);   color: #c0c5f0; border: 1px solid rgba(90,100,173,.5); }
.tag-fulfillment { background: rgba(54,63,117,.3);    color: #b8bdea; border: 1px solid rgba(54,63,117,.5); }
.tag-overseas    { background: rgba(255,255,255,.1);  color: rgba(255,255,255,.8); border: 1px solid rgba(255,255,255,.25); }
.art-date { font-family: var(--font-mono); font-size: 12px; color: rgba(255,255,255,.65); letter-spacing: .08em; }
.article-hero h1 { margin: 0; font-size: clamp(22px,3.8vw,40px); font-weight: 900; letter-spacing: .03em; line-height: 1.45; text-wrap: balance; }

/* ---- LAYOUT (article body + sidebar) ---- */
.article-layout { display: grid; grid-template-columns: var(--content-w) 1fr; gap: 52px; align-items: start; padding: clamp(40px,6vw,72px) 0 clamp(60px,8vw,100px); }
@media(max-width:1100px) { .article-layout { grid-template-columns: 1fr; gap: 0; } }

/* ---- SIDEBAR ---- */
.sidebar { position: sticky; top: 110px; }
@media(max-width:1100px) { .sidebar { display: none; } }
.toc-box { background: var(--tint); border-radius: var(--radius); border: 1px solid var(--rail); padding: 22px 24px; margin-bottom: 28px; }
.toc-box h4 { margin: 0 0 16px; font-family: var(--font-mono); font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.toc-box h4::before { content: ""; flex: 1; height: 1px; background: var(--rail); }
.toc-list { margin: 0; padding: 0; list-style: none; max-height: min(380px, calc(55vh - 160px)); overflow-y: auto; }
.toc-list li { margin: 0; padding: 0; border: none; }
.toc-list li::before { display: none; }
.toc-list a { display: block; padding: 8px 0; font-size: 13px; font-weight: 500; color: var(--text); border-bottom: 1px solid var(--rail); transition: color .2s, padding-left .2s; line-height: 1.5; }
.toc-list a:hover, .toc-list a.active { color: var(--navy); padding-left: 6px; }
.toc-list a.active { font-weight: 700; border-left: 3px solid var(--green); }
.toc-list li:last-child a { border-bottom: none; }
.toc-list .toc-sub a { font-size: 12px; padding-left: 12px; color: var(--muted); }
.toc-list .toc-sub a:hover, .toc-list .toc-sub a.active { color: var(--navy); padding-left: 18px; }
.sidebar-cta { background: linear-gradient(135deg, var(--navy) 0%, var(--navy-deep) 100%); border-radius: var(--radius); padding: 24px 22px; color: #fff; text-align: center; box-shadow: var(--shadow-sm); }
.sidebar-cta img { width: 90px; margin: 0 auto 14px; filter: brightness(0) invert(1); opacity: .9; }
.sidebar-cta h4 { margin: 0 0 10px; font-size: 16px; font-weight: 900; color: #fff; }
.sidebar-cta p { margin: 0 0 18px; font-size: 13px; color: #dde0f0; line-height: 1.7; }
.sidebar-cta .btn-sm { display: block; padding: 11px 20px; font-size: 13px; font-weight: 700; color: #fff; background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.4); border-radius: 999px; margin-bottom: 10px; transition: background .2s; }
.sidebar-cta .btn-sm:hover { background: rgba(255,255,255,.25); }
.sidebar-cta .btn-sm .arr { color: var(--green); margin-left: 4px; display: inline-block; transition: transform .2s; }
.sidebar-cta .btn-sm:hover .arr { transform: translateX(4px); }
.sidebar-cta .btn-sm.primary { background: var(--green); border-color: var(--green); color: #1a2600; }
.sidebar-cta .btn-sm.primary:hover { background: #a0d900; }

/* ---- MOBILE TOC BAR ---- */
.mobile-toc { display: none; position: sticky; top: 65px; z-index: 89; background: #fff; border-bottom: 1px solid var(--rail); box-shadow: 0 2px 8px rgba(20,24,50,.06); }
.mobile-toc-trigger { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; cursor: pointer; user-select: none; }
.mobile-toc-trigger .toc-icon { width: 28px; height: 28px; flex-shrink: 0; background: var(--navy); border-radius: 6px; display: flex; align-items: center; justify-content: center; }
.mobile-toc-trigger .toc-icon svg { display: block; }
.mobile-toc-trigger .toc-current { flex: 1; font-size: 13px; font-weight: 700; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mobile-toc-trigger .toc-chevron { width: 18px; height: 18px; flex-shrink: 0; color: var(--muted); transition: transform .25s ease; }
.mobile-toc.open .toc-chevron { transform: rotate(180deg); }
.mobile-toc-progress { height: 3px; background: var(--rail); overflow: hidden; }
.mobile-toc-progress-fill { height: 100%; width: 0%; background: linear-gradient(to right, var(--navy), var(--green)); transition: width .2s ease; }
.mobile-toc-panel { display: none; border-top: 1px solid var(--rail); padding: 8px 0 16px; max-height: 60vh; overflow-y: auto; }
.mobile-toc.open .mobile-toc-panel { display: block; }
.mobile-toc-panel a { display: block; padding: 9px 4px; font-size: 14px; font-weight: 500; color: var(--text); border-bottom: 1px solid var(--rail); transition: color .2s, padding-left .15s; line-height: 1.5; }
.mobile-toc-panel a:last-child { border-bottom: none; }
.mobile-toc-panel a.sub { padding-left: 16px; font-size: 13px; color: var(--muted); }
.mobile-toc-panel a:hover { color: var(--navy); }
.mobile-toc-panel a.active { color: var(--navy); font-weight: 700; padding-left: 10px; border-left: 3px solid var(--green); }
.mobile-toc-panel a.sub.active { padding-left: 24px; }
@media(max-width:1100px) { .mobile-toc { display: block; } }
@media(max-width:480px) { .mobile-toc { top: 58px; } .mobile-toc-trigger .toc-current { font-size: 12px; } }

/* ---- ARTICLE BODY PROSE ---- */
.article-body { min-width: 0; }
.article-body p { margin: 0 0 1.2em; font-size: clamp(15px,1.3vw,16px); line-height: 2; }
.article-body p:empty { display: none; }
.article-body h2 { margin: 52px 0 20px; padding-bottom: 14px; font-size: clamp(20px,2.2vw,26px); font-weight: 900; color: var(--navy); border-bottom: 2px solid var(--rail); line-height: 1.5; text-wrap: balance; }
.article-body h2::before { content: ""; display: inline-block; width: 4px; height: 1.1em; background: var(--green); border-radius: 2px; margin-right: 12px; vertical-align: middle; margin-top: -2px; }
.article-body h3 { margin: 32px 0 12px; font-size: clamp(16px,1.7vw,19px); font-weight: 900; color: var(--navy); line-height: 1.5; text-wrap: balance; }
.article-body ul, .article-body ol { margin: 0 0 1.4em; padding: 0; list-style: none; }
.article-body ul li { position: relative; padding: 10px 0 10px 22px; font-size: clamp(15px,1.3vw,16px); line-height: 2; }
.article-body ul li::before { content: ""; position: absolute; left: 0; top: 22px; width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.article-body ol { counter-reset: list; }
.article-body ol li { position: relative; padding: 10px 0 10px 46px; font-size: clamp(15px,1.3vw,16px); line-height: 2; }
.article-body ol li::before { content: counter(list); counter-increment: list; position: absolute; left: 0; top: 14px; width: 30px; height: 30px; line-height: 30px; text-align: center; background: var(--navy); color: #fff; border-radius: 50%; font-family: var(--font-mono); font-size: 13px; font-weight: 700; }
.article-body strong, .article-body b { color: var(--navy); font-weight: 700; }
.article-body img { width: 100%; border-radius: var(--radius); box-shadow: var(--shadow-sm); margin: 28px 0; }
/* Suppress redundant line breaks the CMS adds */
.article-body br + br { display: none; }

/* ---- Nested list inside li (CMS structure: li > h3 + ul) ---- */
.article-body li > h3 { margin: 0 0 8px; }
.article-body ul ul { margin: 0 0 8px; }
.article-body ul ul li { padding-left: 18px; }
.article-body ul ul li::before { width: 6px; height: 6px; top: 23px; background: var(--accent); }

/* ---- TABLE ---- */
.article-body table { width: 100%; border-collapse: collapse; margin: 24px 0; display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.article-body th { background: var(--navy); color: #fff; padding: 10px 16px; font-size: 13px; font-weight: 700; text-align: left; border: 1px solid rgba(255,255,255,.15); }
.article-body td { border: 1px solid var(--rail); padding: 12px 16px; font-size: 14px; line-height: 1.8; vertical-align: top; }
.article-body tr:nth-child(even) td { background: var(--tint); }

/* ---- CODE ---- */
.article-body code { font-family: var(--font-mono); font-size: 14px; background: var(--tint); border: 1px solid var(--rail); padding: 3px 10px; border-radius: 6px; color: var(--navy); }

/* ---- CMS div.reference → "あわせて読みたい" card ---- */
.article-body .reference {
  margin: 36px 0;
  padding: 20px 22px;
  background: var(--tint);
  border-radius: var(--radius);
  border-left: 4px solid var(--green);
  cursor: pointer;
  transition: box-shadow .2s;
}
.article-body .reference:hover { box-shadow: var(--shadow-sm); }
.article-body .reference > span {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--green);
  margin-bottom: 10px;
}
.article-body .reference > div {
  display: flex !important;
  gap: 18px;
  align-items: center;
}
.article-body .reference img {
  flex-shrink: 0;
  width: 110px !important;
  height: 72px !important;
  object-fit: cover;
  border-radius: 10px;
  margin: 0 !important;
  box-shadow: none !important;
}
.article-body .reference .reference_text { flex: 1; min-width: 0; }
.article-body .reference .reference_title {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.55;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.article-body .reference .reference_desc {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
@media(max-width:540px) {
  .article-body .reference > div { flex-direction: column; gap: 12px; }
  .article-body .reference img { width: 100% !important; height: 140px !important; }
  .article-body .reference .reference_title { white-space: normal; }
}

/* ---- CMS div.reference → a.related-inline card ---- */
.related-inline { display: flex; gap: 18px; align-items: center; margin: 36px 0; padding: 20px 22px; background: var(--tint); border-radius: var(--radius); border-left: 4px solid var(--green); text-decoration: none; color: inherit; transition: box-shadow .2s; }
.related-inline:hover { box-shadow: var(--shadow-sm); }
.related-inline .thumb { flex-shrink: 0; width: 110px; height: 72px; border-radius: 10px; overflow: hidden; }
.related-inline .thumb img { width: 100%; height: 100%; object-fit: cover; margin: 0; border-radius: 0; box-shadow: none; }
.related-inline .info { flex: 1; min-width: 0; }
.related-inline .rela-label { display: block; font-family: var(--font-mono); font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--green); margin-bottom: 8px; }
.related-inline h4 { margin: 0 0 4px; font-size: 14px; font-weight: 700; color: var(--navy); line-height: 1.55; }
.related-inline p { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.6; }
@media(max-width:540px) { .related-inline { flex-direction: column; gap: 12px; } .related-inline .thumb { width: 100%; height: 140px; } }

/* ---- inline body links ---- */
.article-body a:not(.store):not(.related-inline):not(.cta-btn) { color: var(--accent); text-decoration: underline; text-decoration-color: rgba(90,100,173,.35); text-underline-offset: 3px; transition: color .2s, text-decoration-color .2s; }
.article-body a:not(.store):not(.related-inline):not(.cta-btn):hover { color: var(--navy); text-decoration-color: var(--navy); }

/* ---- CMS a.store → CTA button ---- */
.article-body a.store {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  min-height: 44px;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .05em;
  color: #fff;
  background: var(--navy-deep);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  transition: background .2s, transform .2s, box-shadow .2s;
  margin: 8px auto;
}
.article-body a.store::after { content: " →"; color: var(--green); }
.article-body a.store:hover { background: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.article-body p[style*="text-align: center"] { text-align: center; margin: 20px 0; }

/* ---- ARTICLE CTA ---- */
.article-cta { margin: 48px 0 0; text-align: center; }
.article-cta p { margin: 0 0 24px; font-size: 15px; line-height: 1.85; }
.article-cta .btn-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.cta-btn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 28px; min-height: 44px; font-size: 14px; font-weight: 700; border-radius: 999px; background: var(--navy-deep); color: #fff; border: none; transition: background .2s, transform .2s; }
.cta-btn .arr { color: var(--green); transition: transform .2s; }
.cta-btn:hover { background: var(--navy); transform: translateY(-2px); }
.cta-btn:hover .arr { transform: translateX(4px); }
.cta-btn.outline { background: transparent; color: var(--navy); border: 2px solid var(--navy); }
.cta-btn.outline:hover { background: var(--tint); }

/* ---- SHARE BAR ---- */
.share-bar { margin: 48px 0 0; padding: 24px 0 0; border-top: 1px solid var(--rail); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.share-label { font-family: var(--font-mono); font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); flex-shrink: 0; }
.share-btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 16px; min-height: 36px; font-size: 12px; font-weight: 700; border-radius: 999px; border: 1.5px solid var(--rail); color: var(--text); background: #fff; transition: border-color .2s, color .2s; cursor: pointer; font-family: var(--font-body); }
.share-btn:hover { border-color: var(--navy); color: var(--navy); }
.back-link { margin-top: 16px; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--accent); }
.back-link::before { content: "←"; }
.back-link:hover { color: var(--navy); }

/* ---- RELATED ARTICLES (bottom section) ---- */
.post-related { padding: clamp(44px,6vw,72px) 0; }
.post-related h3 { margin: 0 0 28px; font-size: 13px; font-weight: 700; font-family: var(--font-mono); letter-spacing: .2em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 12px; }
.post-related h3::after { content: ""; flex: 1; height: 1px; background: var(--rail); }
.post-cards { display: grid; grid-template-columns: repeat(3,1fr); gap: 24px; }
.post-card { display: flex; flex-direction: column; border: 1px solid var(--rail); border-radius: var(--radius); overflow: hidden; background: #fff; box-shadow: var(--shadow-sm); transition: transform .25s, box-shadow .25s; }
.post-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.post-card .pt { aspect-ratio: 16/9; overflow: hidden; background: var(--tint); }
.post-card .pt img { width: 100%; height: 100%; object-fit: cover; border-radius: 0; margin: 0; box-shadow: none; }
.post-card .pb { padding: 16px 18px; flex: 1; display: flex; flex-direction: column; }
.post-card .pc { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.post-card .pc span { font-family: var(--font-mono); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; background: var(--tint); color: var(--accent); border: 1px solid var(--rail); }
.post-card h4 { margin: 0 0 auto; padding-bottom: 12px; flex: 1; font-size: 14px; font-weight: 700; color: var(--navy); line-height: 1.65; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.post-card .read { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; color: var(--accent); padding-top: 12px; border-top: 1px solid var(--rail); }
.post-card .read::after { content: "→"; color: var(--green); }
@media(max-width:760px) { .post-cards { grid-template-columns: repeat(2,1fr); } }
@media(max-width:480px) { .post-cards { grid-template-columns: 1fr; } }

/* ---- FOOTER ---- */
footer { padding: 36px 0 44px; text-align: center; font-size: 13px; border-top: 3px solid var(--ink); box-shadow: 0 -3px 0 var(--green); }
footer a { color: var(--text); border-bottom: 1px solid var(--rail); padding-bottom: 1px; }
footer img { width: 190px; margin: 22px auto 14px; }
footer small { color: var(--muted); display: block; margin-top: 6px; }

/* ---- REVEAL ---- */
@keyframes revealFade { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
[data-reveal] { opacity: 1; }
.js [data-reveal] { opacity: 0; }
.js [data-reveal].in-view { animation: revealFade .65s ease forwards; opacity: 1; transform: none; }
@media(prefers-reduced-motion:reduce) {
  html { scroll-behavior: auto; }
  [data-reveal], .js [data-reveal] { opacity: 1; transform: none; transition: none; animation: none; }
  .post-card { transition: none; }
}
