/* Column TOC styles */
.p-blog__toc {
  margin: 32px 0 40px;
}

.p-blog__toc .toc {
  max-width: 920px;
  margin: 0 auto;
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.03));
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  padding: 18px 20px 16px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.25);
  backdrop-filter: saturate(160%) blur(6px);
}

.p-blog__toc .toc-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: .02em;
  color: #dfe9ff;
}

.p-blog__toc .toc-title::before {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 6px;
  background: linear-gradient(135deg, #3ec5ff, #6ea8ff);
  box-shadow: 0 2px 8px rgba(89,170,255,.6);
}

.p-blog__toc .toc-list {
  list-style: none;
  margin: 0;
  padding: 4px 0 0;
  counter-reset: toc-num;
}

.p-blog__toc .toc-list > li {
  position: relative;
  counter-increment: toc-num;
  padding-left: 2.4em;
  margin: 8px 0;
  line-height: 1.7;
}

.p-blog__toc .toc-list > li::before {
  content: counter(toc-num) ".";
  position: absolute;
  left: 0;
  top: 0;
  transform: translateY(0.05em);
  min-width: 2em;
  text-align: right;
  color: #9ccaff;
  font-variant-numeric: tabular-nums;
  opacity: .9;
}

.p-blog__toc .toc-list a {
  color: #cfe4ff;
  text-decoration: none;
  border-radius: 8px;
  padding: 2px 6px;
  transition: color .15s ease, background-color .15s ease, box-shadow .15s ease;
}

.p-blog__toc .toc-list a:hover {
  color: #ffffff;
  background: rgba(158, 202, 255, 0.14);
}

.p-blog__toc .toc-list a:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(110,168,255,0.65);
}

/* Offset for sticky header when navigating TOC anchors */
.p-blog__body :is(h2, h3)[id] {
  scroll-margin-top: 96px;
}

/* Ordered lists in article body
   Reset global list padding removal and ensure markers sit inside the content box.
   This prevents numbers from protruding outside in single-column pages. */
#column-page .p-blog__body ol {
  margin: 0.9em 0 1.1em;
  padding-left: 1.6em; /* space for outside markers */
  list-style-position: outside;
}
#column-page .p-blog__body ol li {
  margin: 0.3em 0;
}
#column-page .p-blog__body ol li::marker {
  font-variant-numeric: tabular-nums; /* align multi-digit numbers */
}

/* Related articles section */
.p-blog__related {
  margin: 56px 0 36px;
  padding: 28px 24px 32px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.04));
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow: 0 16px 36px rgba(0,0,0,0.28);
}
.p-blog__related-title {
  margin: 0 0 20px;
  font-size: 1.18rem;
  font-weight: 700;
  letter-spacing: .03em;
  color: #e3ecff;
}
.p-blog__related-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.p-blog__related-item {
  margin: 0;
}
.p-blog__related-link {
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
  text-decoration: none;
  color: inherit;
  border-radius: 14px;
  padding: 12px;
  background: linear-gradient(180deg, rgba(16,31,60,0.92), rgba(16,31,60,0.72));
  border: 1px solid rgba(140,184,255,0.12);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.p-blog__related-link:hover,
.p-blog__related-link:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(140,184,255,0.36);
  box-shadow: 0 12px 28px rgba(0,0,0,0.35);
  outline: none;
}
.p-blog__related-thumb {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  aspect-ratio: 16 / 10;
  background: rgba(255,255,255,0.06);
}
.p-blog__related-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.p-blog__related-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.82rem;
  color: rgba(220,232,255,0.78);
}
.p-blog__related-cat {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 99px;
  font-size: 0.76rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  background: rgba(86,134,217,0.28);
  color: #dce7ff;
}
.p-blog__related-date {
  color: rgba(210,224,255,0.72);
}
.p-blog__related-item-title {
  margin: 0;
  font-size: 1rem;
  line-height: 1.6;
  color: #f3f6ff;
}

@media (max-width: 599px) {
  .p-blog__related {
    margin: 44px 0 28px;
    padding: 22px 18px 26px;
  }
  .p-blog__related-title {
    font-size: 1.08rem;
    margin-bottom: 16px;
  }
  .p-blog__related-list {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .p-blog__related-link {
    padding: 10px;
  }
}

@media (prefers-color-scheme: light) {
  .p-blog__related {
    background: rgba(255,255,255,0.94);
    border-color: rgba(0,0,0,0.08);
    box-shadow: 0 12px 28px rgba(0,0,0,0.12);
  }
  .p-blog__related-title {
    color: #1a2e4c;
  }
  .p-blog__related-link {
    background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(233,240,255,0.96));
    border-color: rgba(65,121,217,0.18);
  }
  .p-blog__related-link:hover,
  .p-blog__related-link:focus-visible {
    box-shadow: 0 12px 28px rgba(65,121,217,0.18);
    border-color: rgba(65,121,217,0.36);
  }
  .p-blog__related-thumb {
    background: rgba(0,0,0,0.06);
  }
  .p-blog__related-meta {
    color: rgba(26,47,78,0.72);
  }
  .p-blog__related-cat {
    background: rgba(65,121,217,0.16);
    color: #1d4ed8;
  }
  .p-blog__related-date {
    color: rgba(26,47,78,0.52);
  }
  .p-blog__related-item-title {
    color: #0f172a;
  }
}

@media (min-width: 960px) {
  .p-blog__toc .toc {
    padding: 20px 24px 18px;
  }
  .p-blog__toc .toc-title {
    font-size: 1.12rem;
  }
}

@media (prefers-color-scheme: light) {
  .p-blog__toc .toc {
    background: #ffffff;
    border-color: rgba(0,0,0,0.08);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  }
  .p-blog__toc .toc-title { color: #19324d; }
  .p-blog__toc .toc-list > li::before { color: #4179d9; }
  .p-blog__toc .toc-list a { color: #1d4ed8; }
  .p-blog__toc .toc-list a:hover {
    color: #0b3bb3;
    background: rgba(65,121,217,0.08);
  }
}

@media (max-width: 599px) {
  .p-blog__toc .toc {
    padding: 16px 16px 14px;
  }
  .p-blog__toc .toc-list > li {
    padding-left: 2.1em;
    margin: 6px 0;
  }
  .p-blog__toc .toc-title {
    font-size: 1rem;
  }
  .p-blog__body :is(h2, h3)[id] {
    scroll-margin-top: 72px;
  }
}

/* Accessibility: screen-reader-only utility */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  border: 0 !important;
  white-space: nowrap !important;
}

/* --------------------------------------------------
   Modern table styles for column articles
   Targets Gutenberg tables and generic tables inside .p-blog__body
-------------------------------------------------- */

/* Wrapper: allow horizontal scroll on small screens */
.p-blog__body figure.wp-block-table,
.p-blog__body .table-wrap {
  position: relative;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 24px 0;
}

/* Subtle fade indicating overflow */
.p-blog__body figure.wp-block-table::after,
.p-blog__body .table-wrap::after {
  content: "";
  position: sticky;
  right: 0;
  top: 0;
  height: 100%;
  width: 18px;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(0,0,0,0), rgba(0,0,0,0.22));
}

@media (prefers-color-scheme: light) {
  .p-blog__body figure.wp-block-table::after,
  .p-blog__body .table-wrap::after {
    background: linear-gradient(90deg, rgba(255,255,255,0), rgba(0,0,0,0.08));
  }
}

/* Base table */
.p-blog__body table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.22);
  overflow: hidden; /* for border-radius */
  color: #eaf2ff;
  table-layout: auto;
}

.p-blog__body thead th {
  position: sticky; /* sticks when inside scroll container */
  top: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgba(110,168,255,0.22), rgba(110,168,255,0.10));
  color: #e9f1ff;
  font-weight: 700;
}

.p-blog__body th,
.p-blog__body td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.10);
  vertical-align: middle;
  white-space: nowrap; /* prefer horizontal scroll over wrapping */
}

.p-blog__body tr:last-child td { border-bottom: 0; }

/* Align center except first column */
.p-blog__body tr > :is(th, td):not(:first-child) { text-align: center; }
.p-blog__body tr > :is(th, td):first-child {
  text-align: left;
  font-weight: 600;
  color: #dfe9ff;
  min-width: 8.5rem;
}

/* Ensure last column for description keeps breathing room */
.p-blog__body tr > :is(th, td):last-child { min-width: 22rem; }

/* Row zebra and hover */
.p-blog__body tbody tr:nth-child(odd) {
  background: rgba(255,255,255,0.03);
}
.p-blog__body tbody tr:hover {
  background: rgba(110,168,255,0.12);
}

/* Symbols like ◎○△— are a bit larger */
.p-blog__body td { font-variant-numeric: tabular-nums; }
.p-blog__body td:where(:not(:first-child)) {
  font-size: 1.02em;
  letter-spacing: .02em;
}

/* Caption */
.p-blog__body table caption {
  caption-side: top;
  text-align: left;
  padding: 8px 4px 10px;
  color: #9ccaff;
  font-weight: 600;
}

/* Light theme overrides */
@media (prefers-color-scheme: light) {
  .p-blog__body table {
    background: #ffffff;
    border-color: rgba(0,0,0,0.08);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    color: #0f172a;
  }
  .p-blog__body thead th {
    background: linear-gradient(180deg, rgba(65,121,217,0.14), rgba(65,121,217,0.06));
    color: #0b3bb3;
  }
  .p-blog__body th,
  .p-blog__body td {
    border-bottom-color: rgba(0,0,0,0.06);
  }
  .p-blog__body tr > :is(th, td):first-child { color: #19324d; }
  .p-blog__body tbody tr:nth-child(odd) { background: rgba(65,121,217,0.04); }
  .p-blog__body tbody tr:hover { background: rgba(65,121,217,0.10); }
  .p-blog__body table caption { color: #1d4ed8; }
}

/* Compact on small screens */
@media (max-width: 599px) {
  .p-blog__body th,
  .p-blog__body td { padding: 10px 12px; }
  .p-blog__body tr > :is(th, td):first-child { min-width: 7.2rem; }
  .p-blog__body tr > :is(th, td):last-child { min-width: 16rem; }
}

/* --------------------------------------------------
   Post header date: inline, accessible, SEO-safe
-------------------------------------------------- */
.p-blog__header .p-blog__date {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  font-variant-numeric: tabular-nums;
}
.p-blog__header .p-blog__date time { 
  display: inline; /* override global time{display:block} */
  white-space: nowrap;
}
.p-blog__header .p-blog__updated {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
  opacity: 0.9;
}
@media (max-width: 599px) {
  .p-blog__header .p-blog__date { gap: 8px; }
}

/* --------------------------------------------------
   Wider content for column page on desktop
   Keeps global layout intact; scope by body id
-------------------------------------------------- */
@media (min-width: 1280px) {
  #column-page .p-blog.c-inner { width: 74rem; }
}
@media (min-width: 1600px) {
  #column-page .p-blog.c-inner { width: 80rem; }
}

/* Utilities */
.cell-wrap { white-space: normal !important; }

/* --------------------------------------------------
   Column bottom nav (SP only)
-------------------------------------------------- */
@media (max-width: 959px) {
  /* Hide global floating page-top button on column page */
  #column-page #js-pagetop { display: none !important; }
  .c-bottom-nav.-column {
    position: fixed;
    z-index: 1000;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(13, 27, 46, 0.96);
    border-top: 1px solid rgba(255,255,255,0.12);
    backdrop-filter: saturate(160%) blur(10px);
  }
  @media (prefers-color-scheme: light) {
    .c-bottom-nav.-column { background: rgba(255,255,255,0.98); border-top-color: rgba(0,0,0,0.08); }
  }
  .c-bottom-nav__list {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    margin: 0;
    padding: 0 env(safe-area-inset-right) calc(6px + env(safe-area-inset-bottom)) env(safe-area-inset-left);
    list-style: none;
  }
  .c-bottom-nav__item { border-left: 1px solid rgba(255,255,255,0.06); }
  .c-bottom-nav__item:first-child { border-left: 0; }
  .c-bottom-nav__link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    height: 58px;
    width: 100%;
    text-decoration: none;
    color: #e6f0ff;
    font-size: 11px;
    /* reset default button UA styles so anchors/buttons look the same */
    background: transparent;
    border: none;
    margin: 0;
    padding: 0;
    appearance: none;
    -webkit-appearance: none;
  }
  .c-bottom-nav__item button.c-bottom-nav__link { cursor: pointer; }
  .c-bottom-nav__link .material-symbols-rounded { font-size: 22px; line-height: 1; }
  .c-bottom-nav__label { letter-spacing: .02em; }
  @media (prefers-color-scheme: light) {
    .c-bottom-nav__link { color: #0f172a; }
    .c-bottom-nav__item { border-left-color: rgba(0,0,0,0.06); }
  }
  /* give page bottom padding so content is not hidden under nav */
  #column-page .p-page__container { padding-bottom: 66px; }
}

/* --------------------------------------------------
   Hero thumbnail sizing for above-the-fold TOC
   Shrinks and right-aligns the eye-catch on desktop
-------------------------------------------------- */
@media (min-width: 960px) {
  #column-page .p-blog__thumb {
    max-width: clamp(260px, 28vw, 420px);
    margin: 12px 0 10px auto; /* pull up and align right */
  }
  #column-page .p-blog__thumb img {
    width: 100% !important;
    height: auto;
    display: block;
    border-radius: 14px;
  }
}
@media (max-width: 959px) {
  #column-page .p-blog__thumb {
    margin-top: 28px; /* slightly tighter than global */
  }
}

/* --------------------------------------------------
   Summary (要約) section
   Styles the blockquote after the "要約" label with a glassy card UI
-------------------------------------------------- */
/* Label: only when a paragraph is immediately followed by the summary block */
.p-blog__summary p:has(+ blockquote.wp-block-quote.is-summary) {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.p-blog__summary p:has(+ blockquote.wp-block-quote.is-summary)::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  min-width: 40px;
  background: linear-gradient(90deg, rgba(102,170,255,0.6), rgba(102,170,255,0));
  opacity: .6;
}
.p-blog__summary p:has(+ blockquote.wp-block-quote.is-summary) > strong:first-child {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 18px 7px 14px;
  border-radius: 999px;
  font-size: .95rem;
  font-weight: 700;
  letter-spacing: .10em;
  color: #dce9ff;
  background: linear-gradient(135deg, rgba(51,108,185,0.26), rgba(116,92,215,0.16));
  border: 1px solid rgba(132,184,255,0.42);
  box-shadow: 0 10px 30px rgba(18,32,66,0.45), inset 0 0 0 1px rgba(255,255,255,0.24);
}
.p-blog__summary p:has(+ blockquote.wp-block-quote.is-summary) > strong:first-child::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7fffd1, #5bc0ff);
  box-shadow: 0 0 12px rgba(105,218,255,0.9);
}

/* Summary card */
.p-blog__summary blockquote.wp-block-quote.is-summary {
  position: relative;
  margin: 0 0 40px;
  padding: 28px clamp(22px, 4vw, 36px);
  border-radius: 26px;
  border: 1px solid transparent;
  background:
    linear-gradient(140deg, rgba(15,31,60,0.92), rgba(16,33,58,0.76)) padding-box,
    linear-gradient(130deg, rgba(102,170,255,0.75), rgba(142,130,255,0.58)) border-box;
  box-shadow:
    0 40px 80px rgba(6,16,37,0.55),
    0 1px 0 rgba(255,255,255,0.08) inset;
  color: #eff6ff;
  isolation: isolate; /* contain blend effects */
  overflow: hidden;
  backdrop-filter: saturate(180%) blur(24px);
}

.p-blog__summary blockquote.wp-block-quote.is-summary::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(140px at 18% 14%, rgba(102,170,255,0.32), transparent 70%),
    radial-gradient(220px at 82% 0%, rgba(133,122,255,0.38), transparent 65%);
  mix-blend-mode: screen;
  opacity: .85;
  pointer-events: none;
}

.p-blog__summary blockquote.wp-block-quote.is-summary::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  border: 1px solid rgba(180,220,255,0.14);
  pointer-events: none;
}

/* Inner text rhythm */
.p-blog__summary blockquote.wp-block-quote.is-summary p {
  position: relative;
  margin: 0;
  line-height: 1.9;
  font-size: clamp(1.02rem, 1vw + .85rem, 1.08rem);
  letter-spacing: .02em;
  text-shadow: 0 1px 2px rgba(0,0,0,0.35);
}
.p-blog__summary blockquote.wp-block-quote.is-summary p + p { margin-top: 1.05em; }

.p-blog__summary blockquote.wp-block-quote.is-summary cite {
  display: block;
  margin-top: 1.6em;
  font-size: .9rem;
  letter-spacing: .08em;
  color: rgba(210,226,255,0.72);
  text-transform: uppercase;
}

/* Fallback when backdrop-filter is unsupported */
@supports not (backdrop-filter: blur(0)) {
  .p-blog__summary blockquote.wp-block-quote.is-summary {
    background: linear-gradient(140deg, rgba(13,29,55,0.96), rgba(12,24,46,0.86));
  }
}

/* Light theme adjustments */
@media (prefers-color-scheme: light) {
  .p-blog__summary p:has(+ blockquote.wp-block-quote.is-summary)::after {
    background: linear-gradient(90deg, rgba(65,121,217,0.55), rgba(65,121,217,0));
    opacity: .4;
  }
  .p-blog__summary p:has(+ blockquote.wp-block-quote.is-summary) > strong:first-child {
    color: #1a2e4c;
    background: linear-gradient(135deg, rgba(255,255,255,0.88), rgba(233,242,255,0.96));
    border-color: rgba(102,153,232,0.55);
    box-shadow: 0 18px 34px rgba(54,91,160,0.18), inset 0 0 0 1px rgba(255,255,255,0.6);
  }
  .p-blog__summary blockquote.wp-block-quote.is-summary {
    background:
      linear-gradient(140deg, rgba(249,252,255,0.94), rgba(233,240,255,0.96)) padding-box,
      linear-gradient(130deg, rgba(86,134,217,0.45), rgba(143,129,255,0.35)) border-box;
    box-shadow:
      0 40px 60px rgba(74,102,161,0.18),
      inset 0 1px 0 rgba(255,255,255,0.65);
    color: #0f172a;
    backdrop-filter: blur(20px) saturate(160%);
  }
  .p-blog__summary blockquote.wp-block-quote.is-summary::before {
    background:
      radial-gradient(140px at 18% 14%, rgba(86,134,217,0.32), transparent 70%),
      radial-gradient(220px at 82% 0%, rgba(143,129,255,0.28), transparent 65%);
    mix-blend-mode: multiply;
  }
  .p-blog__summary blockquote.wp-block-quote.is-summary::after {
    border-color: rgba(86,134,217,0.22);
  }
  .p-blog__summary blockquote.wp-block-quote.is-summary p {
    color: #14233d;
    text-shadow: none;
  }
  .p-blog__summary blockquote.wp-block-quote.is-summary cite { color: rgba(26,47,78,0.6); }
}

/* Compact spacing on small screens */
@media (max-width: 599px) {
  .p-blog__summary p:has(+ blockquote.wp-block-quote.is-summary) {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .p-blog__summary p:has(+ blockquote.wp-block-quote.is-summary)::after {
    width: 100%;
    max-width: none;
  }
  .p-blog__summary blockquote.wp-block-quote.is-summary {
    border-radius: 20px;
    padding: 22px 20px;
    margin-bottom: 32px;
  }
}

/* Print: remove heavy effects */
@media print {
  .p-blog__summary p:has(+ blockquote.wp-block-quote.is-summary) {
    display: block;
    margin-bottom: 12px;
  }
  .p-blog__summary p:has(+ blockquote.wp-block-quote.is-summary)::after,
  .p-blog__summary p:has(+ blockquote.wp-block-quote.is-summary) > strong:first-child::before,
  .p-blog__summary blockquote.wp-block-quote.is-summary::before,
  .p-blog__summary blockquote.wp-block-quote.is-summary::after { display: none; }
  .p-blog__summary blockquote.wp-block-quote.is-summary {
    box-shadow: none;
    background: none;
    border: 1px solid #888;
    color: #000;
  }
}
