/* Shared header. Keep rules scoped: article and dashboard styles use generic tags. */
html { scroll-padding-top: 80px; }
.global-header, .global-header * { box-sizing: border-box; }
.global-header {
  position: sticky; top: 0; z-index: 40; display: block; width: 100%;
  margin: 0; padding: 0; border: 0; border-bottom: 1px solid #715531;
  background: #0d141b; color: #ead9bd; font: 14px/1.4 system-ui, "Segoe UI", Arial, sans-serif;
  text-align: left; letter-spacing: normal; isolation: isolate;
}
.global-header .gh-inner { display: flex; align-items: center; gap: 16px; max-width: 1440px; min-height: 64px; margin: auto; padding: 8px 24px; }
.global-header a, .global-header button, .global-header summary { color: #ead9bd; font: inherit; letter-spacing: normal; text-transform: none; text-decoration: none; }
.global-header button { min-height: 40px; margin: 0; padding: 8px; border: 1px solid transparent; border-radius: 5px; background: transparent; box-shadow: none; cursor: pointer; }
.global-header button:disabled { opacity: .65; cursor: default; }
.global-header a:hover, .global-header summary:hover, .global-header button:not(:disabled):hover { color: #ffe0a2; background: #202a34; }
.global-header a:focus-visible, .global-header button:focus-visible, .global-header summary:focus-visible { outline: 2px solid #ffe0a2; outline-offset: 3px; }
.global-header [hidden] { display: none !important; }
.global-header .gh-brand { display: flex; flex: 0 0 auto; align-items: center; gap: 10px; border-radius: 5px; font-weight: 650; white-space: nowrap; }
.global-header .gh-mark { display: block; flex: 0 0 38px; width: 38px; height: 38px; border: 0; border-radius: 0; object-fit: contain; }
.global-header .gh-brand-name { color: inherit; font-size: 14px; letter-spacing: normal; }
.global-header .gh-menu { order: 2; margin-left: auto; }
.global-header summary { min-height: 40px; padding: 9px 10px; border-radius: 5px; cursor: pointer; list-style: none; }
.global-header summary::-webkit-details-marker { display: none; }
.global-header .gh-menu-toggle { border: 1px solid #715531; white-space: nowrap; }
.global-header .gh-menu-toggle span { margin-left: 6px; color: inherit; font-size: 14px; letter-spacing: normal; }
.global-header .gh-nav { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0; border: 0; }
.global-header .gh-nav > a { display: flex; align-items: center; min-height: 40px; padding: 9px 10px; border-radius: 5px; white-space: nowrap; }
.global-header .gh-group { position: relative; }
.global-header .gh-group > summary::after { content: '⌄'; margin-left: 6px; color: #c8934b; }
.global-header .gh-group[open] > summary { background: #202a34; }
.global-header .gh-submenu { position: absolute; top: calc(100% + 8px); left: 0; min-width: 205px; padding: 6px; border: 1px solid #715531; border-radius: 6px; background: #0d141b; box-shadow: 0 12px 32px #0008; }
.global-header .gh-submenu > a, .global-header .gh-submenu > button { display: block; width: 100%; min-height: 40px; padding: 10px; border-radius: 4px; text-align: left; white-space: nowrap; }
.global-header .gh-nav .gh-join { border: 1px solid #b78b50; color: #ffe0a2; }
.global-header .gh-languages { order: 3; display: flex; flex: 0 0 auto; gap: 2px; }
.global-header .gh-languages button { padding: 8px 7px; font-size: 12px; }
.global-header .gh-languages [aria-pressed="true"] { border-color: #715531; color: #ffe0a2; background: #202a34; }
.global-header .gh-language-full { display: inline; }
.global-header .gh-language-short { display: none; }
.global-header .gh-tools { --gh-tool-size: 40px; order: 1; display: grid; grid-auto-flow: column; grid-auto-columns: var(--gh-tool-size); flex: 0 0 auto; gap: 10px; }
.global-header .gh-tools > button {
  position: static; display: block; width: var(--gh-tool-size); height: var(--gh-tool-size);
  min-width: var(--gh-tool-size); min-height: var(--gh-tool-size); margin: 0; padding: 0;
  border: 0; border-radius: 50%;
  background: transparent var(--gh-action-icon) left center / 200% 100% no-repeat;
}
.global-header .gh-tool--install { --gh-action-icon: url('/assets/header-install-states-v4.webp'); }
.global-header .gh-tool--tip { --gh-action-icon: url('/assets/header-daily-tip-states-v4.webp'); }
.global-header .gh-tools > button:not(:disabled):hover,
.global-header .gh-tools > button:focus-visible,
.global-header .gh-tools > button.is-active {
  background: transparent var(--gh-action-icon) right center / 200% 100% no-repeat;
}
.global-header .gh-notice { position: absolute; top: calc(100% + 8px); right: 16px; display: flex; align-items: center; gap: 12px; max-width: min(440px, calc(100vw - 32px)); padding: 12px 16px; border: 1px solid #b78b50; border-radius: 6px; background: #0d141b; box-shadow: 0 12px 32px #0008; }
.global-header .gh-notice button { flex: 0 0 40px; font-size: 24px; }
body[data-header-layout="centered"] { display: block; padding: 0; }
body[data-header-layout="centered"] > main { margin: clamp(12px, 3vw, 38px) auto; max-width: calc(100% - 24px); }
body[data-header-layout="home"] { overflow-x: clip; overflow-y: visible; }
body:has(> .global-header) .reading-progress { top: 64px; }
body:has(> .global-header) .story-toc { top: 88px; max-height: calc(100svh - 112px); }
.global-header .gh-nav a[aria-current="page"] { color: #ffe0a2; text-decoration: underline; text-underline-offset: 5px; }
@media (min-width: 1180px) {
  .global-header[data-header-ready] .gh-menu-toggle { display: none; }
}
@media (max-width: 1179px) {
  .global-header .gh-inner { gap: 10px; padding-inline: 16px; }
  .global-header .gh-languages { order: 2; margin-left: auto; }
  .global-header .gh-menu { order: 3; margin-left: 0; }
  .global-header .gh-nav { position: absolute; top: 100%; right: 0; left: 0; display: flex; align-items: stretch; flex-direction: column; flex-wrap: nowrap; max-height: calc(100dvh - 64px); overflow-y: auto; padding: 12px 16px 20px; border-bottom: 1px solid #715531; background: #0d141b; box-shadow: 0 12px 32px #0008; }
  .global-header .gh-nav > a, .global-header .gh-group > summary { min-height: 44px; }
  .global-header .gh-submenu { position: static; min-width: 0; margin: 4px 0 8px; border: 0; border-left: 1px solid #715531; border-radius: 0; box-shadow: none; }
}
@media (max-width: 600px) {
  .global-header .gh-inner { gap: 6px; padding-inline: 10px; }
  .global-header .gh-brand-name { display: none; }
  .global-header .gh-language-full { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .global-header .gh-language-short { display: inline; }
  .global-header .gh-languages button { min-width: 35px; }
  .global-header .gh-tools { --gh-tool-size: 34px; }
  .global-header .gh-menu-toggle { padding-inline: 8px; font-size: 12px; }
}
@media (max-width: 360px) {
  .global-header .gh-inner { gap: 4px; padding-inline: 8px; }
  .global-header .gh-tools { --gh-tool-size: 30px; gap: 8px; }
}
