/* Shiberu blog. Light = the landing page's daytime sky (cream, ink, coral);
   dark = the Forest theme (deep green, cream text, mint accent, coral). */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/inter-latin-var.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "DM Serif Display";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/dm-serif-display-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light dark;
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", "Noto Sans JP", "Noto Sans CJK JP", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-display: "DM Serif Display", "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", Georgia, serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --bg: #fffaf2;
  --sky-top: #cdeeff;
  --sky-mid: #f1faff;
  --surface: #fffdf7;
  --surface-2: #fff6e8;
  --ink: #173047;
  --ink-soft: #3f5566;
  --muted: #5d6f7c;
  --border: rgba(23, 48, 71, 0.13);
  --border-strong: rgba(23, 48, 71, 0.24);
  --link: #1f6b4b;
  --link-hover: #174f38;
  --accent: #ff6b57;
  --accent-hover: #ff7f6d;
  --accent-ink: #173047;
  --chip: rgba(23, 48, 71, 0.06);
  --code-bg: #f5eee2;
  --code-ink: #23384a;
  --shadow: 0 1px 2px rgba(23, 48, 71, 0.06), 0 12px 32px rgba(23, 48, 71, 0.08);
  --note: #2f6fb0;
  --tip: #2f7d58;
  --important: #7a4fc2;
  --warning: #b86b00;
  --caution: #c2412f;
  --mark: rgba(255, 107, 87, 0.16);

  --tok-keyword: #a3337a;
  --tok-string: #1f7a4a;
  --tok-comment: #7b8792;
  --tok-number: #b35a00;
  --tok-name: #2357a6;
  --tok-type: #7a4fc2;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1d15;
    --sky-top: #10281d;
    --sky-mid: #0e2219;
    --surface: #12291f;
    --surface-2: #163327;
    --ink: #f2f6f0;
    --ink-soft: #d0ddd4;
    --muted: #a7b9ae;
    --border: rgba(170, 216, 186, 0.15);
    --border-strong: rgba(170, 216, 186, 0.28);
    --link: #8fd4ad;
    --link-hover: #b6e6ca;
    --accent: #ff6b57;
    --accent-hover: #ff8a7a;
    --accent-ink: #173047;
    --chip: rgba(170, 216, 186, 0.1);
    --code-bg: #0f261c;
    --code-ink: #e3ece6;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px rgba(0, 0, 0, 0.25);
    --note: #7fb6f0;
    --tip: #8fd4ad;
    --important: #c4a8f5;
    --warning: #f0bf63;
    --caution: #ff8a7a;
    --mark: rgba(255, 107, 87, 0.22);

    --tok-keyword: #f2a0cf;
    --tok-string: #9be0b4;
    --tok-comment: #8a9e92;
    --tok-number: #f6c177;
    --tok-name: #9ccfff;
    --tok-type: #c4a8f5;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body.blog-page {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, var(--sky-top) 0, var(--sky-mid) 340px, var(--bg) 760px) no-repeat, var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
}

body.blog-page main { flex: 1; }

a { color: var(--link); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--link-hover); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

img, video { max-width: 100%; height: auto; }

.skip-link { position: absolute; left: -9999px; top: 0; }
.skip-link:focus { left: 16px; top: 12px; z-index: 10; background: var(--surface); padding: 8px 12px; border-radius: 8px; }

.preview-bar { background: var(--accent); color: var(--accent-ink); text-align: center; font-weight: 600; padding: 8px 16px; font-size: 15px; }

/* Header and footer ----------------------------------------------------- */

.site-header {
  background: color-mix(in srgb, var(--surface-2) 88%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(1.2) blur(8px);
}
.header-inner, .footer-inner { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.header-inner { display: flex; align-items: center; gap: 14px; min-height: 64px; }
.wordmark { font-family: var(--font-display); font-size: 26px; line-height: 1; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.wordmark:hover { color: var(--ink); }
.header-section { color: var(--muted); font-weight: 600; text-decoration: none; font-size: 15px; padding-left: 14px; border-left: 1px solid var(--border-strong); }
.header-section:hover { color: var(--ink); }
.header-nav { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.lang-menu { position: relative; }
.lang-menu summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--border-strong); border-radius: 8px; font-size: 14px; color: var(--ink-soft); background: var(--surface); }
.lang-menu summary::-webkit-details-marker { display: none; }
.lang-icon { width: 14px; height: 14px; border: 1.5px solid currentColor; border-radius: 50%; position: relative; }
.lang-icon::before { content: ""; position: absolute; inset: 0 3px; border: 1.5px solid currentColor; border-top: 0; border-bottom: 0; border-radius: 50%; }
.lang-menu ul { position: absolute; right: 0; top: calc(100% + 6px); margin: 0; padding: 6px; list-style: none; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); min-width: 150px; z-index: 5; }
.lang-menu li a { display: block; padding: 8px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; font-size: 15px; }
.lang-menu li a:hover { background: var(--chip); }
.lang-menu li a[aria-current] { font-weight: 600; }

.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 46px; padding: 0 22px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; text-decoration: none;
  box-shadow: 0 8px 20px rgba(255, 107, 87, 0.25);
  transition: background-color 120ms ease, transform 120ms ease;
}
.button:hover { background: var(--accent-hover); color: var(--accent-ink); }
.button:active { transform: translateY(1px); }
.button-small { min-height: 38px; padding: 0 16px; font-size: 14px; box-shadow: none; }

.site-footer { margin-top: 72px; border-top: 1px solid var(--border); background: var(--surface-2); padding: 40px 0 24px; }
.footer-inner { display: grid; gap: 28px; grid-template-columns: 1fr; }
.footer-brand p { margin: 10px 0 0; color: var(--muted); }
.footer-badges { display: flex; gap: 10px; flex-wrap: wrap; }
.footer-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 24px; align-content: start; }
.footer-links a { color: var(--ink-soft); text-decoration: none; font-size: 15px; }
.footer-links a:hover { color: var(--ink); text-decoration: underline; }
.copyright { max-width: 1120px; margin: 28px auto 0; padding: 0 16px; color: var(--muted); font-size: 13px; }
.store-badge { display: inline-block; line-height: 0; }
.store-badge img { height: 40px; width: auto; }
@media (min-width: 760px) {
  .footer-inner { grid-template-columns: 1.2fr 1fr; }
  .footer-links { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Index and lists --------------------------------------------------------- */

.container { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.blog-hero { max-width: 820px; margin: 0 auto; padding: 56px 16px 36px; text-align: center; }
.blog-hero-compact { padding-bottom: 28px; }
.blog-hero h1 { font-family: var(--font-display); font-weight: 400; font-size: clamp(36px, 6vw, 60px); line-height: 1.08; letter-spacing: -0.015em; margin: 6px 0 16px; text-wrap: balance; }
.lead { font-size: 19px; line-height: 1.55; color: var(--ink-soft); margin: 0 auto; max-width: 680px; text-wrap: pretty; }
.eyebrow { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #a14b2f; }
.eyebrow a { color: inherit; text-decoration: none; }
:lang(ja) .eyebrow, .eyebrow:lang(ja) { letter-spacing: 0.02em; text-transform: none; }
@media (prefers-color-scheme: dark) { .eyebrow { color: #f0a58f; } }

.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 22px; }
.chip { display: inline-block; padding: 6px 12px; border-radius: 999px; background: var(--chip); border: 1px solid var(--border); color: var(--ink-soft); text-decoration: none; font-size: 14px; font-weight: 500; }
.chip:hover { color: var(--ink); border-color: var(--border-strong); }

.empty { text-align: center; color: var(--muted); padding: 40px 0; }

.post-grid { display: grid; gap: 20px; grid-template-columns: 1fr; margin-top: 20px; }
@media (min-width: 640px) { .post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 960px) { .post-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.post-card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; overflow: hidden; box-shadow: var(--shadow); transition: transform 140ms ease, border-color 140ms ease; }
.post-card:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.post-card-link { display: flex; flex-direction: column; height: 100%; color: inherit; text-decoration: none; }
.post-card-link:hover { color: inherit; }
.post-card-cover { aspect-ratio: 16 / 9; background: var(--surface-2); overflow: hidden; }
.post-card-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.post-card-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.post-card-title { margin: 0; font-size: 20px; line-height: 1.3; font-weight: 700; text-wrap: balance; }
.post-card-excerpt { margin: 0; color: var(--ink-soft); font-size: 15.5px; display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.post-meta { margin: auto 0 0; color: var(--muted); font-size: 13.5px; display: flex; flex-wrap: wrap; gap: 6px; }
.post-card-featured { margin-top: 4px; }
@media (min-width: 860px) {
  .post-card-featured .post-card-link { display: grid; grid-template-columns: 1.15fr 1fr; }
  .post-card-featured .post-card-cover { aspect-ratio: auto; min-height: 320px; }
  .post-card-featured .post-card-body { padding: 32px; justify-content: center; }
}
.post-card-featured .post-card-title { font-family: var(--font-display); font-weight: 400; font-size: clamp(28px, 3.2vw, 38px); line-height: 1.12; }

.pagination { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 36px 0 0; font-weight: 600; }
.pagination-status { color: var(--muted); font-weight: 500; font-size: 14px; }

.author-hero { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.avatar { border-radius: 50%; object-fit: cover; width: 44px; height: 44px; }
.avatar-large { width: 72px; height: 72px; }
.author-hero .avatar-large { width: 96px; height: 96px; }

/* Post ------------------------------------------------------------------- */

.post { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.post-header { max-width: 760px; margin: 0 auto; padding: 40px 0 24px; }
.breadcrumbs { display: flex; gap: 8px; align-items: center; font-size: 14px; font-weight: 600; margin-bottom: 18px; }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--ink); }
.breadcrumbs span { color: var(--muted); }
.post-header h1 { font-family: var(--font-display); font-weight: 400; font-size: clamp(34px, 5.4vw, 54px); line-height: 1.1; letter-spacing: -0.015em; margin: 0 0 16px; text-wrap: balance; }
.post-header .lead { margin: 0 0 22px; text-align: left; }
.byline { display: flex; align-items: center; gap: 12px; }
.byline-name { font-weight: 700; color: var(--ink); text-decoration: none; }
.byline .post-meta { margin: 2px 0 0; }
.also-in { margin: 18px 0 0; font-size: 15px; }
.also-in a { display: inline-flex; gap: 6px; align-items: center; padding: 6px 12px; border-radius: 999px; background: var(--chip); text-decoration: none; font-weight: 600; }

.post-cover { max-width: 1040px; margin: 8px auto 32px; }
.post-cover img { width: 100%; border-radius: 22px; display: block; box-shadow: var(--shadow); }

.post-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; max-width: 760px; margin: 0 auto; }
.has-toc .post-layout { max-width: 760px; }
@media (min-width: 1120px) {
  .has-toc .post-layout { max-width: 1060px; grid-template-columns: minmax(0, 720px) 260px; justify-content: center; gap: 56px; }
  .has-toc .toc { order: 2; }
  .toc details { position: sticky; top: 24px; }
  /* The title block lines up with the text column, not the page centre. */
  .has-toc .post-header { max-width: 1036px; padding-right: 316px; }
}

.toc details { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 14px 16px; }
.toc summary { cursor: pointer; font-weight: 700; font-size: 14px; letter-spacing: 0.02em; color: var(--ink-soft); }
.toc ol { list-style: none; padding: 0; margin: 10px 0 2px; display: grid; gap: 6px; font-size: 14.5px; line-height: 1.4; }
.toc a { color: var(--ink-soft); text-decoration: none; }
.toc a:hover { color: var(--link); text-decoration: underline; }
.toc .toc-l3 { padding-left: 14px; font-size: 14px; }

.ruby-toggle-row { margin: 0 0 16px; }
.ruby-toggle { font: inherit; font-size: 14px; font-weight: 600; color: var(--ink-soft); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 999px; padding: 6px 14px; cursor: pointer; }
.ruby-toggle:hover { color: var(--ink); }
.hide-ruby .prose rt, .hide-ruby .prose rp { display: none; }

/* Prose ----------------------------------------------------------------- */

.prose { font-size: 18px; line-height: 1.75; color: var(--ink); overflow-wrap: break-word; }
.prose:lang(ja), .prose :lang(ja) { line-height: 1.95; line-break: strict; }
.prose > :first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol, .prose dl, .prose figure, .prose .table-wrap, .prose pre, .prose blockquote, .prose aside { margin: 0 0 1.3em; }
.prose h2, .prose h3, .prose h4 { line-height: 1.25; scroll-margin-top: 24px; text-wrap: balance; }
.prose h2 { font-family: var(--font-display); font-weight: 400; font-size: 32px; letter-spacing: -0.01em; margin: 2.1em 0 0.6em; }
.prose h3 { font-size: 22px; font-weight: 700; margin: 1.8em 0 0.5em; }
.prose h4 { font-size: 18px; font-weight: 700; margin: 1.6em 0 0.4em; }
.prose h1 { font-family: var(--font-display); font-weight: 400; font-size: 36px; }
:lang(ja) .prose h2, .prose h2:lang(ja), :lang(ja) .post-header h1, :lang(ja) .blog-hero h1, :lang(ja) .post-card-featured .post-card-title { font-family: var(--font-sans); font-weight: 700; letter-spacing: 0; }
:lang(ja) .post-header h1, :lang(ja) .blog-hero h1 { font-size: clamp(28px, 4.6vw, 44px); line-height: 1.3; }
:lang(ja) .prose h2 { font-size: 26px; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin: 0.35em 0; }
.prose li > ul, .prose li > ol { margin: 0.35em 0 0; }
.prose strong { font-weight: 700; }
.prose hr { border: 0; border-top: 1px solid var(--border-strong); margin: 2.4em 0; }
.prose blockquote { border-left: 4px solid var(--border-strong); padding: 0.1em 0 0.1em 1.1em; color: var(--ink-soft); font-style: normal; }
.prose blockquote > :last-child { margin-bottom: 0; }
.prose img { border-radius: 14px; display: block; margin: 0 auto; }
.prose figure { margin-left: 0; margin-right: 0; }
.prose figcaption { margin-top: 10px; text-align: center; color: var(--muted); font-size: 15px; line-height: 1.5; }
.prose video { width: 100%; border-radius: 14px; background: #000; display: block; }
.prose dt { font-weight: 700; }
.prose dd { margin: 0 0 0.8em 1.2em; }
.prose del { color: var(--muted); }
.prose code { font-family: var(--font-mono); font-size: 0.88em; background: var(--code-bg); color: var(--code-ink); padding: 0.12em 0.38em; border-radius: 6px; }
.prose pre { background: var(--code-bg); color: var(--code-ink); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; overflow-x: auto; font-size: 15px; line-height: 1.6; }
.prose pre code { background: none; padding: 0; font-size: inherit; border-radius: 0; }
.prose ruby rt { font-size: 0.56em; color: var(--ink-soft); font-weight: 500; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 14px; }
.prose table { border-collapse: collapse; width: 100%; font-size: 16px; line-height: 1.5; }
.prose th, .prose td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.prose thead th { background: var(--surface-2); font-weight: 700; }
.prose tbody tr:last-child td { border-bottom: 0; }

.prose .footnotes { font-size: 15px; color: var(--ink-soft); }
.prose .footnotes-sep { margin: 2.4em 0 1.2em; }
.prose .footnote-ref a { text-decoration: none; font-size: 0.8em; }

.callout { --tone: var(--note); border: 1px solid color-mix(in srgb, var(--tone) 38%, transparent); border-left: 5px solid var(--tone); background: color-mix(in srgb, var(--tone) 8%, var(--surface)); border-radius: 12px; padding: 14px 18px 2px; }
.callout-title { margin: 0 0 6px !important; font-weight: 700; color: var(--tone); font-size: 15.5px; }
.callout-tip { --tone: var(--tip); }
.callout-important { --tone: var(--important); }
.callout-warning { --tone: var(--warning); }
.callout-caution { --tone: var(--caution); }
.callout p { margin-bottom: 0.9em; }

.cta { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 22px 24px; box-shadow: var(--shadow); text-align: center; }
.cta p { margin: 0 0 10px; }
.cta p:last-child { margin-bottom: 0; }
.cta-title { font-family: var(--font-display); font-size: 26px; line-height: 1.2; }
:lang(ja) .cta-title { font-family: var(--font-sans); font-weight: 700; font-size: 21px; }
.cta-body { color: var(--ink-soft); font-size: 16px; line-height: 1.6; }
.cta-badges { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.cta-end { margin: 40px 0 28px; }
.prose .cta .button, .cta .button { color: var(--accent-ink); }

.yt { position: relative; margin: 0 0 1.3em; }
.yt-link { position: relative; display: block; border-radius: 14px; overflow: hidden; background: #000; aspect-ratio: 16 / 9; }
.yt-link img, .yt iframe { width: 100%; height: 100%; object-fit: cover; display: block; border: 0; border-radius: 0; }
.yt iframe { aspect-ratio: 16 / 9; border-radius: 14px; }
.yt-play { position: absolute; left: 50%; top: 50%; width: 72px; height: 50px; transform: translate(-50%, -50%); background: rgba(23, 23, 23, 0.82); border-radius: 14px; transition: background-color 120ms ease; }
.yt-play::after { content: ""; position: absolute; left: 29px; top: 15px; border-style: solid; border-width: 10px 0 10px 17px; border-color: transparent transparent transparent #fff; }
.yt-link:hover .yt-play { background: #ff0033; }
.yt-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.embed-error { color: var(--caution); font-weight: 600; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 28px 0 0; }

.author-box { display: flex; gap: 16px; align-items: flex-start; padding: 22px 0 0; border-top: 1px solid var(--border); }
.author-box p { margin: 0 0 6px; color: var(--ink-soft); font-size: 16px; }
.author-box-name { font-weight: 700; color: var(--ink) !important; }
.author-box-name a { color: inherit; text-decoration: none; }

.related { margin-top: 56px; }
.related h2 { font-family: var(--font-display); font-weight: 400; font-size: 32px; margin: 0; }
:lang(ja) .related h2 { font-family: var(--font-sans); font-weight: 700; font-size: 24px; }

/* Pygments (classprefix "tok-") */
.prose [class^="tok-k"] { color: var(--tok-keyword); }
.prose [class^="tok-s"] { color: var(--tok-string); }
.prose [class^="tok-c"] { color: var(--tok-comment); font-style: italic; }
.prose [class^="tok-m"] { color: var(--tok-number); }
.prose .tok-nf, .prose .tok-fm, .prose .tok-na, .prose .tok-nt { color: var(--tok-name); }
.prose .tok-nc, .prose .tok-kt, .prose .tok-nb, .prose .tok-bp { color: var(--tok-type); }
.prose .tok-gi { color: var(--tok-string); }
.prose .tok-gd { color: var(--caution); }
.prose .tok-err { color: inherit; border: 0; }

@media (max-width: 520px) {
  body.blog-page { font-size: 16px; }
  .header-section { display: none; }
  .prose { font-size: 17px; }
  .prose h2 { font-size: 27px; }
  .blog-hero { padding-top: 36px; }
  .lead { font-size: 17.5px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

@media print {
  .site-header, .site-footer, .toc, .cta, .ruby-toggle-row, .related { display: none; }
  body.blog-page { background: #fff; color: #000; }
}
