/* Shared navigation for the gallery and the reading pages. */
:root {
  --navigation-top: 12px;
  --navigation-height: 64px;
  --navigation-clearance: calc(var(--navigation-top) + var(--navigation-height) + 20px);
}

html { scroll-padding-top: var(--navigation-clearance); }
main[id], main [id] { scroll-margin-top: 12px; }

.site-header.wrap {
  position: sticky;
  top: var(--navigation-top);
  z-index: 30;
  width: min(1240px, calc(100% - 48px));
  height: var(--navigation-height);
  min-height: 0;
  margin: var(--navigation-top) auto 0;
  padding: 0 22px 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border: 1px solid #dcded370;
  border-radius: 999px;
  background: #faf9f5f2;
  color: #3d4b3f;
  box-shadow: 0 3px 16px #37432e06;
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans", sans-serif;
  line-height: 1.5;
  view-transition-name: site-navigation;
}

.site-header .brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -.7px;
  text-decoration: none;
}
.brand-mark {
  display: block;
  flex-shrink: 0;
  width: 36px;
  height: 30px;
  background-color: currentColor;
  -webkit-mask: url('/assets/brand-mark.png') center / contain no-repeat;
  mask: url('/assets/brand-mark.png') center / contain no-repeat;
}
.site-footer .brand-mark { width: 28px; height: 23px; }
.site-header nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 auto 0 8px;
  padding: 0;
  font-size: 13px;
  color: #6d7567;
}
.site-header nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 13px;
  border-radius: 999px;
  white-space: nowrap;
  text-decoration: none;
  transition: color 140ms ease, background-color 140ms ease;
}
.site-header nav a:hover { color: #34583f; background: #e8ecdf80; }
.site-header nav a[aria-current] {
  color: #3d5d43;
  background: #e8ecdf;
  text-decoration: none;
}
.site-header .language-menu {
  margin: 0;
  position: relative;
  flex-shrink: 0;
  border: 0;
  z-index: 1;
}
.site-header .language-menu summary {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  padding: 8px 0 8px 8px;
  list-style: none;
  font-size: 13px;
  line-height: 1.5;
  color: #6d7567;
  white-space: nowrap;
  cursor: pointer;
}
.site-header .language-menu summary::after { content: none; }
.site-header .language-menu summary::-webkit-details-marker { display: none; }
.site-header .language-menu summary span { margin: 0; }
.site-header .language-menu summary svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 140ms ease;
}
.site-header .language-menu[open] summary svg { transform: rotate(180deg); }
.site-header .language-options {
  position: absolute;
  top: calc(100% + 10px);
  right: -8px;
  min-width: 156px;
  padding: 6px;
  border: 1px solid #dcded3;
  border-radius: 12px;
  background: #fdfcf8;
  box-shadow: 0 8px 24px #37432e0d;
}
.site-header .language-options a {
  display: block;
  padding: 10px 12px;
  border-radius: 6px;
  color: #4e5c4b;
  font-size: 13px;
  line-height: 1.5;
  text-decoration: none;
}
.site-header .language-options a:hover,
.site-header .language-options a:focus-visible { background: #eef0e7; }
.site-header .language-options a[aria-current=true] { color: #3d5d43; font-weight: 600; }
.site-header .creator-menu { position: relative; margin: 0; border: 0; }
.site-header .creator-menu summary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px 13px;
  border-radius: 999px;
  font-size: inherit;
  line-height: 1.5;
  list-style: none;
  cursor: pointer;
  white-space: nowrap;
  transition: color 140ms ease, background-color 140ms ease;
}
.site-header .creator-menu summary::after { content: none; }
.site-header .creator-menu summary::-webkit-details-marker { display: none; }
.site-header .creator-menu summary:hover,
.site-header .creator-menu[open] summary { color: #34583f; background: #e8ecdf80; }
.site-header .creator-menu summary svg {
  width: 10px; height: 10px; fill: none; stroke: currentColor; stroke-width: 1.5;
  stroke-linecap: round; stroke-linejoin: round; transition: transform 140ms ease;
}
.site-header .creator-menu[open] summary svg { transform: rotate(180deg); }
.site-header .creator-options {
  position: absolute;
  top: calc(100% + 12px);
  left: 0;
  width: 258px;
  padding: 10px 6px 6px;
  border: 1px solid #dcded3;
  border-radius: 12px;
  background: #fdfcf8;
  box-shadow: 0 8px 24px #37432e0d;
}
.site-header .creator-caption { margin: 3px 12px 8px; font-size: 11px; color: #808777; }
.site-header .creator-options a {
  display: block;
  min-height: 0;
  padding: 11px 12px;
  border-radius: 6px;
  color: #4e5c4b;
  font-size: 13px;
  line-height: 1.5;
  white-space: normal;
}
.site-header .creator-options a:hover { background: #eef0e7; }
.site-header .creator-options strong { display: flex; justify-content: space-between; gap: 12px; font-weight: 500; }
.site-header .creator-options small { display: block; margin-top: 3px; color: #7b8274; font-size: 11px; line-height: 1.7; }
.site-header .creator-options .external-mark { color: #8c9386; font-size: 12px; }
.site-header .creator-options .support-entry { border-top: 1px solid #e9ebdf; margin-top: 5px; padding-top: 13px; }
.site-header a:focus-visible,
.site-header summary:focus-visible { outline: 2px solid #426b55; outline-offset: 3px; }
.skip, .skip-link:focus { z-index: 40; }

/* Native document navigation keeps deep links, new tabs and browser history intact. */
@media (prefers-reduced-motion: no-preference) {
  .page-entry main { animation: content-in 180ms ease backwards; }
  @view-transition { navigation: auto; }
  ::view-transition-old(root) { animation: content-out 100ms ease both; }
  ::view-transition-new(root) { animation: content-in 180ms ease both; }
  ::view-transition-group(site-navigation) { animation-duration: 0s; }
  ::view-transition-old(site-navigation) { animation: none; }
  ::view-transition-new(site-navigation) { animation: content-in 140ms ease both; }
}
@keyframes content-out { to { opacity: 0; } }
@keyframes content-in { from { opacity: 0; } }

@media (max-width: 767px) {
  :root { --navigation-top: 8px; --navigation-height: 102px; }
  .site-header.wrap {
    width: calc(100% - 24px);
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: 42px 38px;
    column-gap: 12px;
    row-gap: 2px;
    padding: 9px 14px;
    border-radius: 22px;
  }
  .site-header .brand { grid-column: 1; grid-row: 1; font-size: 21px; gap: 8px; }
  .site-header .brand-mark { width: 32px; height: 26px; }
  .site-header nav {
    grid-column: 1 / -1;
    grid-row: 2;
    display: flex;
    justify-content: flex-start;
    gap: 2px;
    margin: 0 -4px;
    padding: 0;
    font-size: 12px;
  }
  .site-header nav>a { min-height: 36px; padding: 8px; }
  .site-header .creator-menu summary { min-height: 36px; padding: 8px; gap: 4px; }
  .site-header .creator-options { left: auto; right: 0; width: min(258px, calc(100vw - 48px)); }
  .site-header .language-menu { grid-column: 2; grid-row: 1; margin: 0; }
  .site-header .language-menu summary { font-size: 12px; }
  .site-header .language-options { right: -2px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .site-header * { transition: none; }
}
