/* ==========================================================================
   Quick IB Media — stylesheet
   LP（quickib.com）のブランドトークンに準拠。依存なし。JSは進行用のみ（任意）。
   セマンティックトークン層 + ダークモード + リッチエディトリアル部品。
   ========================================================================== */
:root {
  /* brand (source of truth) */
  --indigo: #3E2DDA;
  --indigo-deep: #1F1875;
  --indigo-bright: #5B47F0;
  --indigo-50: #F1EFFF;
  --indigo-100: #E2DCFF;
  --ink: #0F0830;
  --cream: #FAF8F2;
  --sun: #FFD63A;
  --sun-deep: #F5C200;
  --paper: #ffffff;
  --mute: #6b6685;
  --line: #ece8f7;
  /* semantic layer (dark mode flips these, not the brand) */
  --bg: var(--cream);
  --surface: var(--paper);
  --surface-2: #F6F4FF;
  --text: var(--ink);
  --text-2: #332B54;
  --text-mute: var(--mute);
  --border: var(--line);
  --border-strong: #dcd6f0;
  --accent: var(--indigo);
  --accent-ink: var(--indigo-deep);
  --accent-tint: var(--indigo-50);
  --accent-tint-2: var(--indigo-100);
  --focus: var(--sun);
  --footer-bg: var(--ink);
  --shadow-sm: 0 2px 8px -3px rgba(31,24,117,.18);
  --shadow-md: 0 18px 40px -22px rgba(31,24,117,.35);
  --shadow-lg: 0 30px 60px -30px rgba(31,24,117,.6);
  --maxw: 760px;
  --wide: 1120px;
  --r: 18px;
}
:root[data-theme="dark"] {
  --bg: #0B0820; --surface: #15102E; --surface-2: #1C1640;
  --text: #F4F2FF; --text-2: #D8D3F0; --text-mute: #9D97BE;
  --border: #241C4D; --border-strong: #332a63;
  --accent: #8A7BFF; --accent-ink: #B9AEFF; --accent-tint: #1C1640; --accent-tint-2: #241C4D;
  --footer-bg: #060414;
  --shadow-sm: 0 2px 8px -3px rgba(0,0,0,.5);
  --shadow-md: 0 18px 40px -22px rgba(0,0,0,.55);
  --shadow-lg: 0 30px 60px -30px rgba(0,0,0,.65);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B0820; --surface: #15102E; --surface-2: #1C1640;
    --text: #F4F2FF; --text-2: #D8D3F0; --text-mute: #9D97BE;
    --border: #241C4D; --border-strong: #332a63;
    --accent: #8A7BFF; --accent-ink: #B9AEFF; --accent-tint: #1C1640; --accent-tint-2: #241C4D;
    --footer-bg: #060414;
    --shadow-sm: 0 2px 8px -3px rgba(0,0,0,.5);
    --shadow-md: 0 18px 40px -22px rgba(0,0,0,.55);
    --shadow-lg: 0 30px 60px -30px rgba(0,0,0,.65);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Plus Jakarta Sans", "Zen Kaku Gothic New", system-ui, -apple-system, "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.78;
  transition: background-color .3s ease, color .3s ease;
}
:lang(ja) { font-family: "Zen Kaku Gothic New", "Plus Jakarta Sans", system-ui, -apple-system, "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif; line-height: 1.85; font-feature-settings: "palt" 1; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: var(--sun); color: var(--ink); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* skip link */
.skip { position: absolute; left: -999px; top: 0; z-index: 60; }
.skip:focus { left: 8px; top: 8px; background: var(--surface); color: var(--accent-ink); padding: 8px 14px; border-radius: 8px; box-shadow: var(--shadow-sm); font-weight: 700; }

/* reading progress */
.progress { position: sticky; top: 0; left: 0; height: 3px; z-index: 39; background: transparent; pointer-events: none; }
.progress-bar { display: block; height: 100%; width: 100%; transform: scaleX(0); transform-origin: left; background: linear-gradient(90deg, var(--accent), var(--sun)); transition: transform .1s linear; }

/* reveal-on-scroll */
.reveal { opacity: 0; transform: translateY(14px); }
.reveal.in { opacity: 1; transform: none; transition: opacity .5s ease, transform .5s cubic-bezier(.22,1,.36,1); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5em;
  padding: 14px 26px; border-radius: 999px;
  font-weight: 800; font-size: 15px; letter-spacing: .01em;
  cursor: pointer; transition: transform .25s cubic-bezier(.22,1,.36,1), box-shadow .25s;
  white-space: nowrap; text-decoration: none; border: 0;
}
.btn:hover { text-decoration: none; }
.btn-sm { padding: 9px 18px; font-size: 13px; }
.btn-sun {
  background: var(--sun); color: var(--ink);
  box-shadow: 0 6px 0 var(--sun-deep), 0 14px 28px -10px rgba(245,194,0,.45);
}
.btn-sun:hover { transform: translateY(-2px); box-shadow: 0 8px 0 var(--sun-deep), 0 20px 36px -10px rgba(245,194,0,.55); }
.btn-sun:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--sun-deep); }
.btn-ghost { background: transparent; color: var(--accent-ink); border: 1.5px solid var(--accent-tint-2); }
.btn-ghost:hover { background: var(--accent-tint); transform: translateY(-1px); }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner { max-width: var(--wide); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; padding-top: 12px; padding-bottom: 12px; }
.brand { display: flex; flex-direction: column; line-height: 1; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark { font-weight: 800; font-size: 21px; color: var(--text); letter-spacing: -.01em; }
.brand-mark-ib { color: var(--accent); }
.brand-sub { font-size: 11px; font-weight: 700; color: var(--text-mute); letter-spacing: .14em; text-transform: uppercase; margin-top: 3px; }
.site-nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 12px 14px; }
.site-nav > a { font-size: 14px; font-weight: 700; color: var(--text); }
.site-nav > a:hover { color: var(--accent); text-decoration: none; }
.lang-pill { display: inline-flex; background: var(--accent-tint); border-radius: 999px; padding: 3px; }
.lang-pill a { font-size: 12px; font-weight: 800; padding: 4px 10px; border-radius: 999px; color: color-mix(in srgb, var(--text) 55%, transparent); }
.lang-pill a:hover { text-decoration: none; color: var(--text); }
.lang-pill a.on { background: var(--text); color: var(--surface); }
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  cursor: pointer; transition: background .2s, color .2s, transform .2s;
}
.theme-toggle:hover { color: var(--accent); transform: translateY(-1px); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .ic-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .ic-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .ic-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .ic-sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .ic-moon { display: block; }
}

/* ---------- index hero ---------- */
.index { max-width: var(--wide); padding-top: 40px; padding-bottom: 64px; }
.index-hero { text-align: center; padding: 28px 0 30px; }
.eyebrow { display: inline-block; font-size: 12px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); background: var(--accent-tint); padding: 6px 14px; border-radius: 999px; }
:lang(ja) .eyebrow { text-transform: none; letter-spacing: .04em; }
.index-hero h1 { font-size: clamp(28px, 5vw, 44px); line-height: 1.18; margin: 18px 0 12px; letter-spacing: -.02em; text-wrap: balance; }
.index-hero p { color: var(--text-mute); max-width: 620px; margin: 0 auto; font-size: 16px; }
.cat-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 28px; }

/* ---------- cards ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.card {
  position: relative; display: block; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 24px; color: var(--text); overflow: hidden;
  transition: transform .3s cubic-bezier(.22,1,.36,1), box-shadow .3s, border-color .25s;
}
.card::after { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--sun); transform: scaleX(0); transform-origin: left; transition: transform .3s cubic-bezier(.22,1,.36,1); }
.card:hover { transform: translateY(-5px); box-shadow: var(--shadow-md); border-color: var(--accent-tint-2); text-decoration: none; }
.card:hover::after { transform: scaleX(1); }
.card h3 { font-size: 19px; line-height: 1.4; margin: 12px 0 8px; letter-spacing: -.01em; }
.card-excerpt { color: var(--text-mute); font-size: 14px; margin: 0 0 14px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { color: var(--text-mute); font-size: 12.5px; margin: 0; }

.chip { display: inline-block; font-size: 11.5px; font-weight: 800; color: var(--accent-ink); background: var(--accent-tint); padding: 5px 11px; border-radius: 999px; letter-spacing: .02em; }

/* ---------- breadcrumb ---------- */
.breadcrumb { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 12.5px; color: var(--text-mute); padding: 26px 0 6px; }
.breadcrumb a { color: var(--text-mute); font-weight: 600; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span { color: var(--accent-tint-2); }
.breadcrumb [aria-current] { color: var(--text); font-weight: 700; }

/* ---------- article ---------- */
.article { padding-bottom: 56px; }
.article-head { padding: 8px 0 18px; border-bottom: 1px solid var(--border); margin-bottom: 10px; }
.article-head h1 { font-size: clamp(27px, 4.4vw, 41px); line-height: 1.2; letter-spacing: -.02em; margin: 14px 0 14px; text-wrap: balance; }
:lang(ja) .article-head h1 { line-height: 1.32; }
.article-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--text-mute); font-size: 13px; margin: 0 0 4px; }
.article-meta a { color: var(--accent-ink); font-weight: 700; }
.article-lead { font-size: clamp(17px, 1.6vw, 19px); line-height: 1.7; color: var(--text-2); font-weight: 500; margin: 16px 0 8px; max-width: 62ch; }
.article-hero-img { border-radius: 16px; aspect-ratio: 16/9; object-fit: cover; margin: 8px 0 4px; box-shadow: var(--shadow-md); width: 100%; }

/* TL;DR / key takeaways */
.tldr { background: linear-gradient(180deg, var(--accent-tint), var(--surface)); border: 1px solid var(--accent-tint-2); border-radius: 16px; padding: 20px 24px; margin: 24px 0; }
.tldr-title { display: flex; align-items: center; gap: 9px; font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--accent-ink); margin: 0 0 10px; }
:lang(ja) .tldr-title { letter-spacing: .04em; }
.tldr-title::before { content: ""; width: 18px; height: 18px; border-radius: 5px; background: var(--sun); flex: none; }
.tldr ul { margin: 0; padding-left: 20px; }
.tldr li { margin: 6px 0; font-weight: 500; }
.tldr li::marker { color: var(--accent); }

/* table of contents */
.toc { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--focus); border-radius: 14px; padding: 18px 22px; margin: 26px 0; }
.toc-title { font-weight: 800; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink); margin: 0 0 8px; }
:lang(ja) .toc-title { letter-spacing: .04em; }
.toc ol { margin: 0; padding-left: 20px; }
.toc li { margin: 5px 0; position: relative; }
.toc a { color: var(--text-2); font-weight: 600; font-size: 14.5px; }
.toc a.is-active { color: var(--accent-ink); font-weight: 800; }

/* prose */
.prose { font-size: 17px; }
.prose h2 { font-size: clamp(23px, 3vw, 28px); line-height: 1.32; letter-spacing: -.01em; margin: 44px 0 14px; padding-top: 18px; position: relative; scroll-margin-top: 84px; }
:lang(ja) .prose h2 { letter-spacing: 0; }
.prose h2::before { content: ""; position: absolute; left: 0; top: 0; width: 46px; height: 5px; border-radius: 3px; background: var(--sun); }
.prose h3 { font-size: 20px; margin: 32px 0 10px; letter-spacing: -.01em; scroll-margin-top: 84px; }
.prose h4 { font-size: 17px; margin: 24px 0 8px; color: var(--accent-ink); }
.prose p { margin: 16px 0; text-wrap: pretty; }
.prose ul, .prose ol { margin: 16px 0; padding-left: 26px; }
.prose li { margin: 8px 0; }
.prose li::marker { color: var(--accent); font-weight: 700; }
.prose a { font-weight: 600; text-decoration: underline; text-decoration-color: var(--accent-tint-2); text-underline-offset: 3px; }
.prose a:hover { text-decoration-color: var(--accent); }
.prose strong { font-weight: 800; }
.prose code { background: var(--accent-tint); color: var(--accent-ink); padding: 2px 7px; border-radius: 6px; font-size: .9em; font-family: ui-monospace, SFMono-Regular, Menlo, "Source Han Code JP", monospace; }
.prose pre { background: var(--ink); color: #f4f2ff; padding: 18px 20px; border-radius: 12px; overflow-x: auto; font-size: 14px; line-height: 1.6; }
:root[data-theme="dark"] .prose pre { background: #060414; }
.prose pre code { background: none; padding: 0; color: inherit; }
.prose blockquote { margin: 22px 0; padding: 14px 20px; background: var(--accent-tint); border-left: 4px solid var(--accent); border-radius: 0 12px 12px 0; color: var(--text-2); font-weight: 500; }
.prose img { border-radius: 12px; margin: 22px 0; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 36px 0; }
.table-wrap { overflow-x: auto; margin: 22px 0; }
.prose table { width: 100%; border-collapse: collapse; font-size: 15px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.prose th, .prose td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); }
.prose th { background: var(--accent-ink); color: #fff; font-weight: 700; font-size: 14px; }
.prose tbody tr:nth-child(even) { background: var(--surface-2); }

/* callouts */
.callout { display: grid; grid-template-columns: 1fr; gap: 6px; padding: 16px 20px; border-radius: 14px; border: 1px solid var(--border); border-left: 4px solid var(--accent); background: var(--surface); margin: 24px 0; }
.callout-title { font-weight: 800; margin: 0; color: var(--accent-ink); }
.callout-body > :first-child { margin-top: 0; }
.callout-body > :last-child { margin-bottom: 0; }
.callout-body p { margin: 8px 0 0; color: var(--text-2); }
.callout--tip { border-left-color: #16A34A; background: color-mix(in srgb, #16A34A 7%, var(--surface)); }
.callout--tip .callout-title { color: #15803D; }
.callout--warn { border-left-color: var(--sun-deep); background: color-mix(in srgb, var(--sun) 12%, var(--surface)); }
.callout--warn .callout-title { color: #8a6d00; }
.callout--exam { border-left-color: var(--indigo-deep); background: var(--accent-tint); }
.callout--note { border-left-color: var(--accent); }
:root[data-theme="dark"] .callout--tip .callout-title { color: #5DD6A0; }
:root[data-theme="dark"] .callout--warn .callout-title { color: var(--sun); }

/* pull-quote */
.pull { margin: 34px 0; padding: 8px 0 8px 28px; border-left: 5px solid var(--focus); font-size: clamp(20px, 2.4vw, 26px); line-height: 1.45; font-weight: 700; color: var(--accent-ink); letter-spacing: -.01em; }
:lang(ja) .pull { line-height: 1.6; }
.pull cite { display: block; margin-top: 10px; font-size: 14px; font-weight: 600; font-style: normal; color: var(--text-mute); }

/* tags */
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 30px 0 0; }
.tag { font-size: 12.5px; color: var(--text-mute); background: var(--surface); border: 1px solid var(--border); padding: 5px 11px; border-radius: 999px; }
.tag:hover { border-color: var(--accent-tint-2); color: var(--accent); }

/* faq */
.faq { margin: 44px 0 0; }
.faq h2 { font-size: 24px; margin-bottom: 12px; }
.faq details { border: 1px solid var(--border); border-radius: 14px; padding: 2px 18px; margin: 10px 0; background: var(--surface); transition: border-color .2s, box-shadow .2s; }
.faq details[open] { border-color: var(--accent-tint-2); box-shadow: var(--shadow-sm); }
.faq summary { cursor: pointer; font-weight: 700; padding: 14px 0; list-style: none; display: flex; gap: 12px; align-items: flex-start; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: "＋"; color: var(--accent); font-weight: 800; flex: none; }
.faq details[open] summary::before { content: "−"; }
.faq-a { padding: 0 0 14px; color: var(--text-2); }

/* author / credibility card */
.author-card { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: start; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 22px 24px; margin: 40px 0; }
.author-avatar { width: 60px; height: 60px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--indigo), var(--indigo-deep)); color: #fff; font-weight: 800; font-size: 16px; letter-spacing: -.02em; box-shadow: var(--shadow-sm); }
.author-avatar span { color: var(--sun); }
.author-name { font-weight: 800; font-size: 17px; margin: 0; }
.author-role { color: var(--accent-ink); font-size: 13px; font-weight: 700; margin: 2px 0 8px; }
.author-bio { color: var(--text-2); font-size: 14.5px; margin: 0 0 10px; }
.author-creds { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; }
.author-creds li { font-size: 12px; font-weight: 700; background: var(--accent-tint); color: var(--accent-ink); padding: 4px 10px; border-radius: 999px; }

/* cta */
.cta { margin: 46px 0; }
.cta-inner {
  background: linear-gradient(135deg, var(--indigo) 0%, var(--indigo-deep) 100%);
  color: #fff; border-radius: 24px; padding: 38px 32px; text-align: center;
  position: relative; overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.cta-inner::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 82% 18%, rgba(255,214,58,.20), transparent 60%); pointer-events: none; }
.cta-title { font-size: clamp(21px, 3.2vw, 27px); line-height: 1.35; margin: 0 0 12px; position: relative; }
.cta-body { color: rgba(255,255,255,.84); max-width: 560px; margin: 0 auto 22px; font-size: 15px; position: relative; }
.cta-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; position: relative; }
.cta .btn-ghost { color: #fff; border-color: rgba(255,255,255,.32); }
.cta .btn-ghost:hover { background: rgba(255,255,255,.12); }

.related { margin: 50px 0 0; }
.related h2 { font-size: 22px; margin-bottom: 18px; }
.back { margin: 40px 0 0; font-weight: 700; }

/* footer */
.site-footer { background: var(--footer-bg); color: rgba(255,255,255,.8); margin-top: 64px; padding: 44px 0 28px; }
.footer-inner { max-width: var(--wide); display: flex; flex-wrap: wrap; gap: 24px; justify-content: space-between; align-items: flex-start; }
.footer-brand { color: #fff; font-size: 22px; }
.footer-tagline { color: rgba(255,255,255,.6); font-size: 13px; margin: 8px 0 0; max-width: 280px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 18px; }
.footer-links a { color: rgba(255,255,255,.8); font-size: 14px; font-weight: 600; }
.footer-links a:hover { color: var(--sun); text-decoration: none; }
.footer-copy { max-width: var(--wide); margin-top: 28px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.12); font-size: 12.5px; color: rgba(255,255,255,.5); }

@media (max-width: 720px) {
  .site-nav { gap: 10px 12px; }
  .site-nav > a:not(.btn) { display: none; }
  .brand-sub { display: none; }
  .prose { font-size: 16.5px; }
  .cta-inner { padding: 30px 22px; }
  .author-card { grid-template-columns: 1fr; }
}
@media (max-width: 380px) {
  .btn-sm { padding: 8px 13px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01ms !important; animation-duration: .01ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}
@media (forced-colors: active) {
  .toc a.is-active { text-decoration: underline; }
  .card, .callout, .tldr, .author-card { border: 1px solid CanvasText; }
}

/* hero(アイキャッチ) -------------------------------------------------------- */
.article-hero { display: block; margin: 2px 0 22px; }
.article-hero img {
  width: 100%; height: auto; aspect-ratio: 1200 / 630; object-fit: cover;
  border-radius: var(--r); box-shadow: var(--shadow-md); background: var(--surface-2);
}
.card-media { display: block; margin: -24px -24px 16px; }
.card-media img {
  width: 100%; height: auto; aspect-ratio: 1200 / 630; object-fit: cover;
  display: block; background: var(--surface-2);
}
