@import url('https://fonts.googleapis.com/css2?family=Zen+Kaku+Gothic+Antique:wght@400;500;700;900&display=swap');

:root {
   --bg: #fff;
   --border: #d8d8d8;
   --text: #111;
   --text-muted: #777;
   --line-height: 1.75;
      --space-sm: 1rem; --space-md: 2rem; --space-lg: 4rem;
   --tint: rgba(0,0,0,.06); 
   --font-gothic: var(--jp-font-family); 
   --transition: 180ms ease; 
}

   *, *::before, *::after { box-sizing: border-box;  margin: 0;  padding: 0;  }
   html { font-size: 18px;  -webkit-text-size-adjust: 100%;  scroll-behavior: smooth;  }
   body { --jp-font-family: 'Shippori Mincho', 'Zen Kaku Gothic Antique', sans-serif; --jp-title-font-family: 'JP Title Marks', 'Zen Kaku Gothic Antique', sans-serif; --font-gothic: var(--jp-font-family); background: var(--bg);  color: var(--text);  font: 400 1rem/var(--line-height) var(--font-gothic);  min-height: 100vh;  transition: background-color var(--transition), color var(--transition);  }
   a { color: inherit; }
   ::selection { background: var(--border); }


.prose, .diary-entry-body {
   font-family: var(--font-gothic);
   font-size: 1rem;
   font-weight: 400;
   line-height: var(--line-height);
   color: var(--text);
   width: 100%;
}

.diary-entry-body { margin-top: 1.3125rem; }

:is(.prose, .diary-entry-body) p {
   font-size: 1rem;
   margin-bottom: 1em; 
   max-width: 35em; /* JS計算前のフォールバック幅 */
}

   :is(.prose, .diary-entry-body) p:last-child { margin-bottom: 0; }
   :is(.prose, .diary-entry-body) a { color: var(--text);  text-decoration: underline;  text-underline-offset: 3px;  transition: color var(--transition);  }
   :is(.prose, .diary-entry-body) a:hover { color: var(--text-muted);  }
   :is(.prose, .diary-entry-body) img { max-width: 100%;  height: auto;  display: block;  margin: var(--space-md) 0;  border-radius: 2px;  }
   :is(.prose, .diary-entry-body) figure { margin: var(--space-md) 0;  }
   :is(.prose, .diary-entry-body) :is(h1, h2, h3, h4, h5, h6) { color: var(--text); font-weight: 900; }
   :is(.prose, .diary-entry-body) :is(h3, h4, h5, h6) { font-weight: 900;  letter-spacing: .06em;  margin: 1.4em 0 .5em;  line-height: 1.4;  }
   :is(.prose, .diary-entry-body) :is(strong, b, em, i) { color: var(--text); }
   :is(.prose, .diary-entry-body) :is(strong, b) { font-weight: 700; }
   :is(.prose, .diary-entry-body) :is(s, del) { color: var(--text-muted); }
   :is(.prose, .diary-entry-body) mark { background: var(--tint);  color: var(--text);  padding: .05em .15em;  border-radius: 2px;  }
   :is(.prose, .diary-entry-body) :is(code, pre) { background: var(--tint);  color: var(--text);  font-family: var(--font-gothic);  font-size: .875em;  border-radius: 3px;  }
   :is(.prose, .diary-entry-body) code { padding: .1em .35em; }
   :is(.prose, .diary-entry-body) pre { padding: 1em 1.2em;  margin: 1em 0;  line-height: 1.6;  overflow-x: auto;  }
   :is(.prose, .diary-entry-body) pre code { background: none;  padding: 0;  font-size: 1em;  border-radius: 0;  }
   :is(.prose, .diary-entry-body) blockquote { border-left: 3px solid var(--border);  margin: .4em 0;  padding: .5em 0 .5em 1.1em;  color: var(--text);  font-style: italic;  font-size: .95em;  line-height: 1.9;  }
   :is(.prose, .diary-entry-body) blockquote p { margin-bottom: .6em;  }
   :is(.prose, .diary-entry-body) blockquote p:last-child { margin-bottom: 0; }
   :is(.prose, .diary-entry-body) blockquote :is(cite, p:last-child:not(:first-child)) { display: block;  font-style: normal;  font-size: .85em;  color: var(--text-muted);  margin-top: .6em;  font-family: var(--font-gothic);  }
   :is(.prose, .diary-entry-body) blockquote + p { margin-top: 0; }

   :is(.prose, .diary-entry-body) :is(ul, ol) { margin: .875em 0; padding-left: 1.4em; line-height: 1.75; text-align: left; }
   :is(.prose, .diary-entry-body) li { margin-bottom: .3em; }
   :is(.prose, .diary-entry-body) :is(ul, ol) :is(ul, ol) { margin: .3em 0 .3em .2em; }

   :is(.prose, .diary-entry-body) hr { border: none; border-top: 1px solid var(--border); margin: 2em 0; }

   :is(.prose, .diary-entry-body) table { display: block; overflow-x: auto; border-collapse: collapse; margin: 1em 0; font-size: .9em; max-width: 100%; }
   :is(.prose, .diary-entry-body) :is(th, td) { border: 1px solid var(--border); padding: .4em .8em; text-align: left; }
   :is(.prose, .diary-entry-body) th { color: var(--text); font-weight: 500; background: var(--tint); }
   :is(.prose, .diary-entry-body) td { color: var(--text); }

   :is(.prose, .diary-entry-body) .math-block { margin: 1.2em 0; overflow-x: auto; text-align: center; }

   :is(.prose, .diary-entry-body) .embed-block { margin: var(--space-md) 0; }
   :is(.prose, .diary-entry-body) .embed-block iframe { display: block; width: 100%; border-radius: 8px; }

   a[href^="http"]::after { content: '\00a0↗';  font-size: .7em;  opacity: .6;  vertical-align: super;  font-style: normal;  }

   .loading { color: var(--text-muted);  font-size: .85rem;  letter-spacing: .06em;  padding: var(--space-lg) 0;  }
   .filter-clear-btn { display: block;  width: var(--prose-width, 35em);  max-width: 100%;  margin: 0 auto 1.125rem;  text-align: left;  background: none;  border: none;  cursor: pointer;  font-size: .8rem;  color: var(--text-muted);  letter-spacing: .06em;  transition: color var(--transition);  }
   .filter-clear-btn:hover { color: var(--text);  }
   .filter-clear-btn + .diary-entry { padding-top: 0; }
   .sidebar-title { font-size: .8rem;  letter-spacing: .12em;  color: var(--text-muted);  text-transform: uppercase;  }
   .tag-count { font-size: .72em;  opacity: .6;  }

   .month-accordion { list-style: none;  display: flex;  flex-direction: column;  gap: .4rem;  }
   .month-accordion details { border: none; }
   .month-accordion summary, .tags-section-summary, .tag-accordion > summary { cursor: pointer;  list-style: none;  user-select: none;  display: flex;  align-items: center;  }
   /* Safari/Chrome用のデフォルト三角マーカーを個別に消す（上のlist-styleだけでは消えない場合の保険） */
   .month-accordion summary::-webkit-details-marker, .tags-section-summary::-webkit-details-marker, .tag-accordion > summary::-webkit-details-marker { display: none; }
   .month-accordion summary { font-size: .8rem;  letter-spacing: .1em;  color: var(--text-muted);  text-transform: uppercase;  padding: .15rem 0;  gap: .35em;  }
   .month-accordion summary::before { content: '›';  font-size: 1.4em;  line-height: 1;  transition: transform .2s;  display: inline-flex;  align-items: center;  justify-content: center;  width: 1em;  height: 1em;  flex-shrink: 0;  opacity: .6;  transform: translateY(-.1em);  }
   .month-accordion details[open] > summary::before { transform: rotate(90deg); }
   .tags-section-summary { gap: .3em; }
   .tags-section-summary::after { content: '\25be';  font-size: .8em;  color: var(--text-muted);  transition: transform .15s;  }
   .tags-section-details[open] .tags-section-summary::after { transform: rotate(-180deg); }
   .tag-accordion { margin-bottom: .3rem; }
   .tag-accordion > summary { font-size: .78rem;  letter-spacing: .06em;  color: var(--text-muted);  gap: .4em;  padding: .15rem 0;  }
   .tag-accordion > summary::before { content: '›';  font-size: .85em;  transition: transform .15s;  display: inline-block;  width: .8em;  }
   .tag-accordion[open] > summary::before { transform: rotate(90deg); }
   .month-accordion .entry-links, .tag-entry-list { list-style: none;  display: flex;  flex-direction: column;  gap: .2rem;  }
   .month-accordion .entry-links { padding-left: .8rem; margin-top: .25rem; }
   .tag-entry-list { padding-left: 1.2em; margin-top: .2rem; }
   .month-accordion .entry-links a, .tag-entry-list a { color: var(--text-muted);  text-decoration: none;  display: grid;  grid-template-columns: 3em 1fr;  transition: color var(--transition);  }
   .month-accordion .entry-links a { font-size: .78rem;  column-gap: .4em;  padding: .1rem 0;  letter-spacing: .02em;  }
   .tag-entry-list a { font-size: .75rem;  column-gap: .5em;  padding: .05rem 0;  }
   .month-accordion .entry-links .arch-col2 { overflow: hidden;  white-space: nowrap;  }
   .month-accordion .entry-links a:hover, .month-accordion .entry-links a.active, .tag-entry-list a:hover { color: var(--text); }
   .index-tag-section { margin-top: var(--space-sm);  padding-top: var(--space-sm);  border-top: 1px solid var(--border);  }

   .index-root { display: grid;  grid-template-columns: 12rem 1fr;  column-gap: var(--space-lg);  max-width: 980px;  margin: 0 auto;  padding: var(--space-sm) var(--space-md);  align-items: start;  }
   .index-profile { position: sticky;  top: var(--space-md);  display: flex;  flex-direction: column;  }
   .index-feed { min-width: 0; }
   .diary-entry { width: var(--prose-width, 35em);  max-width: 100%;  margin: 0 auto;  padding: 1.5rem 0;  border-bottom: 1px solid var(--border);  display: flex;  flex-direction: column;  gap: 0;  }
   .diary-entry:first-child { padding-top: 0; }
   .diary-entry:last-child { border-bottom: none; }
   .diary-entry-time { font-size: .8rem;  color: var(--text-muted);  letter-spacing: .04em;  font-variant-numeric: tabular-nums;  }
   .diary-entry > a { text-decoration: none; align-self: flex-start; }
   .diary-entry > a:hover { text-decoration: underline; }
   :is(.diary-entry-title, .search-result h2, .entry-links .arch-col2, .tag-entry-list a span:last-child),
   :is(.prose, .diary-entry-body) :is(h1, h2, h3, h4, h5, h6) { font-family: var(--jp-title-font-family); }
   .diary-entry-title { margin-top: .9375rem;  font-size: 1.5rem;  font-weight: 500;  letter-spacing: .02em;  line-height: 1.4;  color: var(--text);  }
   .entry-pager { display: flex;  align-items: center;  width: var(--prose-width, 35em);  max-width: 100%;  margin: 1.125rem auto 0;  font-size: .8rem;  letter-spacing: .04em;  }
   .entry-pager a { color: var(--text-muted);  text-decoration: none;  transition: color var(--transition);  }
   .entry-pager a:hover { color: var(--text);  }
   .entry-pager-prev { margin-left: 0; }
   .entry-pager-next { margin-left: auto; }
   .mobile-hamburger { display: none; }
   .mobile-archive-drawer { display: none; }
   .index-drawer-overlay { display: none;  position: fixed;  inset: 0;  background: rgba(0,0,0,.45);  z-index: 199;  }
   .index-drawer-overlay.active { display: block; }

   @media (max-width: 720px) {
      html { font-size: 14px; }
      :is(.prose, .diary-entry-body) blockquote { margin-left: .5em;  margin-right: 0;  }
      .entry-pager { margin-bottom: calc(6rem + env(safe-area-inset-bottom, 0px)); }
      .index-root { grid-template-columns: 1fr;  padding: var(--space-sm);  gap: var(--space-md);  }
      .index-profile, .index-archive-wrap { display: none; }
      .diary-entry { padding: 1.5rem 0;  scroll-margin-top: 60px;  }
      .diary-entry-title { font-size: 1.25rem; }
      .mobile-hamburger { display: flex;  flex-direction: column;  justify-content: center;  align-items: center;  gap: 5px;  position: fixed;  top: 14px;  right: 16px;  z-index: 300;  width: 36px;  height: 36px;  background: var(--bg);  border: none;  border-radius: 50%;  cursor: pointer;  padding: 0;  box-shadow: 0 1px 4px rgba(0,0,0,.12);  }
      .mobile-hamburger span { display: block;  width: 22px;  height: 1.5px;  background: var(--text);  transition: opacity var(--transition);  }
      .mobile-hamburger:hover span { opacity: .5; }
      .mobile-archive-drawer { display: block;  position: fixed;  top: 0;  right: 0; transform: translate3d(100%, 0, 0); visibility: hidden;  width: 260px;  height: 100vh;  background: var(--bg);  border-left: 1px solid var(--border);  padding: var(--space-lg) var(--space-md);  overflow-y: auto;  z-index: 200;  transition: transform .36s cubic-bezier(.22, 1, .36, 1), visibility 0s .36s;  }
      .mobile-archive-drawer.open { transform: translate3d(0, 0, 0); visibility: visible; transition-delay: 0s; }
      .index-drawer-overlay { display: block; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .36s ease, visibility 0s .36s; }
      .index-drawer-overlay.active { opacity: 1; visibility: visible; pointer-events: auto; transition-delay: 0s; }
   }

   @media (min-width: 721px) {
      :is(.prose, .diary-entry-body) blockquote p { font-size: 1rem;  line-height: 1.85;  }
      .sidebar-title { font-size: .68rem;  letter-spacing: .14em;  }
      .month-accordion summary { font-size: .75rem; }
      .month-accordion .entry-links a { font-size: .72rem; }
   }

/* 日記の固定バー */
.has-page-bar { --page-bar-height: 56px; padding-top: var(--page-bar-height); }
.page-bar { position: fixed; inset: 0 0 auto; height: var(--page-bar-height); z-index: 350; background: var(--bg); border-bottom: 1px solid var(--border); }
.page-bar-inner { display: flex; align-items: center; gap: 1.75rem; max-width: 980px; height: 100%; margin: 0 auto; padding: 0 var(--space-md); }
.has-page-bar .index-profile { top: calc(var(--page-bar-height) + var(--space-sm)); max-height: calc(100dvh - var(--page-bar-height) - 2 * var(--space-sm)); overflow-y: auto; }
@media (max-width: 720px) {
   .page-bar-inner { padding: 0 var(--space-sm); }
   .page-bar .mobile-hamburger { position: static; margin-left: auto; flex-shrink: 0; box-shadow: none; }
   .has-page-bar .mobile-archive-drawer { top: var(--page-bar-height); height: calc(100vh - var(--page-bar-height)); height: calc(100dvh - var(--page-bar-height)); padding-top: var(--space-sm); }
   .has-page-bar .index-drawer-overlay { top: var(--page-bar-height); }
}

/* 日記の固定バーと、上から開く検索欄。 */
.diary-page { --page-bar-height: 40px; }
.diary-page .page-bar-inner { max-width: none; justify-content: flex-end; gap: 6px; padding: 0 16px; }
.diary-page .search-toggle { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0; border: none; background: var(--bg); color: var(--text); cursor: pointer; flex-shrink: 0; }
.diary-page .search-toggle svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.diary-page .search-toggle:hover, .diary-page .search-toggle[aria-expanded="true"] { color: var(--text-muted); }
.diary-page .search-drawer { position: fixed; top: var(--page-bar-height); left: 0; right: 0; z-index: 340; padding: 10px 16px; background: var(--bg); border-bottom: 1px solid var(--border); box-shadow: 0 2px 4px rgba(0,0,0,.04); transform: translate3d(0, -100%, 0); visibility: hidden; transition: transform .36s cubic-bezier(.22, 1, .36, 1), visibility 0s .36s; }
.diary-page #diary-search { display: flex; align-items: center; gap: 6px; min-width: 0; max-width: 560px; margin-left: auto; }
.diary-page #search-query { flex: 1; width: 100%; min-width: 0; height: 30px; padding: 0 8px; font: inherit; font-size: .85rem; border: 1px solid var(--border); border-radius: 2px; background: var(--bg); color: var(--text); }
.diary-page #diary-search button { flex-shrink: 0; min-height: 30px; padding: 0 8px; font: inherit; font-size: .8rem; border: 1px solid var(--border); border-radius: 2px; background: var(--bg); color: var(--text); cursor: pointer; }
.diary-page .diary-entry, .diary-page .search-hit { scroll-margin-top: calc(var(--page-bar-height) + 12px); }
.diary-page .search-drawer.open { transform: translate3d(0, 0, 0); visibility: visible; transition: transform .36s cubic-bezier(.22, 1, .36, 1), visibility 0s; }
@media (min-width: 721px) {
   .diary-page .page-bar-inner { max-width: 980px; padding: 0 var(--space-md); }
   .diary-page .search-drawer { left: auto; right: calc(max(0px, (100% - 980px) / 2) + var(--space-md)); width: 300px; max-width: calc(100% - 2 * var(--space-md)); padding: 8px; border: 1px solid var(--border); border-top: none; will-change: transform; }
   .diary-page #search-query { height: 28px; }
   .diary-page #diary-search button { min-height: 28px; }
}
@media (max-width: 720px) {
   .mobile-archive-drawer, .diary-page .search-drawer { will-change: transform; backface-visibility: hidden; }
   .index-drawer-overlay { will-change: opacity; }
   .diary-page .page-bar-inner { padding: 0 var(--space-sm); }
   .diary-page .page-bar .mobile-hamburger { width: 28px; height: 28px; margin-left: 0; gap: 4px; }
   .diary-page .mobile-hamburger span { width: 17px; height: 1px; }
   .diary-page .search-drawer { padding: 10px var(--space-sm); }
   .diary-page #search-query { font-size: max(16px, 1rem); }
   .diary-page #diary-search button { font-size: .9rem; }
}
@media (prefers-reduced-motion: reduce) { .diary-page .search-drawer, .diary-page .search-drawer.open, .mobile-archive-drawer, .mobile-archive-drawer.open, .index-drawer-overlay { transition: none; } }
.diary-page mark.search-hit { background: #fff0a6; color: var(--text); padding: 0; border-radius: 1px; }
.search-summary { font-size: .9rem; margin-bottom: 1rem; overflow-wrap: anywhere; }
.search-result { padding: 1.25rem 0; border-bottom: 1px solid var(--border); }
.search-result h2 { font-size: 1.15rem; font-weight: 500; margin: .5rem 0; }
.search-result a { color: var(--text); text-decoration: none; }
.search-result p { margin: .5rem 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.search-more { display: block; margin: 1.5rem auto; padding: .6rem 1rem; background: var(--bg); border: 1px solid var(--border); color: var(--text); cursor: pointer; }
.diary-page [hidden] { display: none !important; }

.not-found { max-width: 40rem; margin: 4rem auto; padding: 0 var(--space-sm); }
.not-found h1 { font-size: 1.5rem; margin-bottom: 1rem; }
.not-found p { margin-bottom: 1rem; }

