/* header.css: 上部バー: ブランド、ヘッダーの道具、表示 / 使い方ボタン。 */
/* ---------- header ---------- */
.top { position: sticky; top: 0; z-index: 10; background: var(--bg); border-bottom: 1px solid var(--line-strong);
  transition: transform var(--dur-open) var(--ease); }
/* スマホ（横向き含む）で下へスクロールすると、ロゴのバーが上へ消え、固定された目盛りが続く (js/boot.js)。 */
@media (max-width: 600px), (max-height: 520px) {
  /* バーを6px残し、選択中の日付が上端に触れないようにする。 */
  :root[data-head-min] .top { transform: translateY(calc(6px - var(--bar-h, 0px))); }
  :root[data-head-min] .ruler { top: calc(var(--top-h, 1px) - var(--bar-h, 0px) + 6px - 1px); }
}
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px 10px; max-width: 1400px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; margin: 0; font-size: inherit;
  font-weight: inherit; }
/* スクリーンリーダーと検索エンジン向け。表示はしない。 */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.brand .logo-mark { width: 28px; height: 28px; flex: none; }
/* ロゴの遊び（js/brand.js がランダムに1つ付ける）。マークの部品は tools/icons/make.py の mark()。
   G: 梯子が下から伸びる。柱は「ぐっと伸びて少し止まる」を3回、段は柱がそこを過ぎたところで下から1つずつ横に跳ねて出て、
      最後に上の点がぽんと弾む（均一に伸ばすと機械的だった）。
   L: まっすぐ立った梯子が、足もと（右下の点）を軸にすっと傾いて立てかかり、上の点が弾む。
   B: 「ご」の濁点（ワードマークの円）が少しずらして跳ねる。 */
.brand .logo-mark { overflow: visible; }
.brand .logo-mark .mk-rail, .brand .logo-mark .mk-rung, .brand .logo-mark .mk-top, .brand .ja circle { transform-box: fill-box;
  transform-origin: center; }
.brand .logo-mark .tilt { transform-box: view-box; transform-origin: 17.74px 24.12px; }
/* 登場（:root.logo-intro。index.html と pages/common.py の頭のスクリプトが付ける）: 開いて少ししてから、梯子が伸びる。 */
:root.logo-intro .brand .mk-rail { animation: brand-grow 1s .25s both; }
:root.logo-intro .brand .mk-rung { animation: brand-rung .32s ease-out both; }
:root.logo-intro .brand .mk-r1 { animation-delay: .41s; }
:root.logo-intro .brand .mk-r2 { animation-delay: .69s; }
:root.logo-intro .brand .mk-r3 { animation-delay: .97s; }
:root.logo-intro .brand .mk-top { animation: brand-pop .42s ease-out 1.15s both; }
.brand.play-g .mk-rail { animation: brand-grow 1s both; }
.brand.play-g .mk-rung { animation: brand-rung .32s ease-out both; }
.brand.play-g .mk-r1 { animation-delay: .16s; }
.brand.play-g .mk-r2 { animation-delay: .44s; }
.brand.play-g .mk-r3 { animation-delay: .72s; }
.brand.play-g .mk-top { animation: brand-pop .42s ease-out .9s both; }
.brand.play-l .tilt { animation: brand-lean .7s cubic-bezier(.3, .7, .3, 1); }
.brand.play-l .mk-top { animation: brand-bump .4s ease-out .5s both; }
.brand.play-b .ja circle { animation: brand-hop .45s ease-out; }
.brand.play-b .ja circle:last-of-type { animation-delay: .08s; }
@keyframes brand-grow {
  0% { clip-path: inset(100% 0 0 0); animation-timing-function: cubic-bezier(.2, .9, .3, 1); }
  26% { clip-path: inset(66% 0 0 0); animation-timing-function: ease-in-out; }
  36% { clip-path: inset(63% 0 0 0); animation-timing-function: cubic-bezier(.2, .9, .3, 1); }
  58% { clip-path: inset(36% 0 0 0); animation-timing-function: ease-in-out; }
  66% { clip-path: inset(33% 0 0 0); animation-timing-function: cubic-bezier(.2, .9, .3, 1); }
  100% { clip-path: inset(0 0 0 0); } }
@keyframes brand-rung { 0% { transform: scaleX(0); } 60% { transform: scaleX(1.18); } 80% { transform: scaleX(.95); }
  100% { transform: scaleX(1); } }
@keyframes brand-pop { 0% { transform: scale(0); } 55% { transform: scale(1.35); } 75% { transform: scale(.92); }
  100% { transform: scale(1); } }
@keyframes brand-lean { 0% { rotate: -15deg; } 70% { rotate: 2deg; } 100% { rotate: 0deg; } }
@keyframes brand-bump { 0% { transform: scale(1); } 45% { transform: scale(1.35); } 70% { transform: scale(.92); }
  100% { transform: scale(1); } }
@keyframes brand-hop { 0% { transform: translateY(0); } 40% { transform: translateY(-75%); } 70% { transform: translateY(10%); }
  100% { transform: translateY(0); } }
/* 名前は はしご（site/wordmark.svg、文字の色）。小さく淡い HASHIGO を横に添え、下をかなにそろえる。絵の下端は
   ベースラインより少し下なので、HASHIGO を1px上げる。かなは字間を詰めた絵なので、HASHIGO も間を詰め、字間は少しだけ空ける。 */
.brand .wm { display: flex; align-items: baseline; gap: 6px; }
.brand .ja { display: block; height: 19px; width: auto; }
.brand .en { position: relative; top: -1px; font-family: "Familjen Grotesk", var(--font-title); font-size: 13px;
  font-weight: 700; letter-spacing: .1em; line-height: 1; color: var(--muted); }
.tools { display: flex; gap: 6px; flex: none; }
.theme { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex: none;
  height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius); background: transparent;
  cursor: pointer; font-family: var(--font-ja); font-size: 12px; color: var(--muted); }
.theme:hover { border-color: var(--line-strong); color: var(--ink); }
.theme:active, .chip:active { transform: translateY(1px); }
.theme[aria-pressed="true"] { border-color: var(--line-strong); color: var(--ink); background: var(--surface-2); }
.theme svg { width: 14px; height: 14px; color: var(--ink); }


/* さがす（js/sheets.js）: 押すと、ロゴと道具の行に入力欄が重なって出る。ロゴと道具は場所を取ったまま見えなくするので、
   スマホ（道具が2段で背が高い）でもヘッダーの高さが変わらない（2026-11-30、入れ替えると 16px 縮んでいた）。
   入力欄は「さがす」のボタンのある右から、丸い形のまま左へ伸び、閉じるときは右へ縮む（中の文字は伸び縮みさせない）。 */
.bar { position: relative; }
.brand, .tools { transition: opacity var(--dur-quick) var(--ease); }
.top.searching .brand, .top.searching .tools > .theme { opacity: 0; visibility: hidden; }
.hsearch { position: absolute; inset: 0; display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 4px 16px 0;
  max-width: 1400px; margin: 0 auto; }
.hsearch[hidden] { display: none; }
/* 入力欄と「一覧」で1つの枠（.hs-box）。伸び縮みするのはこの枠。 */
.hs-box { flex: 1; min-width: 0; display: flex; align-items: stretch; height: var(--hs-h); max-width: var(--hs-max);
  border: 1px solid var(--hs-line); border-radius: calc(var(--hs-h) / 2); background: var(--surface); overflow: hidden; }
.hs-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.hs-q { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 0 10px 0 14px; cursor: text; }
.hs-q svg { flex: none; width: 15px; height: 15px; color: var(--muted); }
.hs-q input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink);
  font: inherit; font-family: var(--font-ja); font-size: 16px; }
.hs-q input::-webkit-search-cancel-button { display: none; }
.hs-clear { flex: none; display: grid; place-items: center; width: 22px; height: 22px; padding: 0;
  border: 0; border-radius: 50%; background: var(--surface-2); color: var(--muted); cursor: pointer;
  transition: background-color var(--dur-quick) var(--ease), color var(--dur-quick) var(--ease); }
/* 入力中に幅が変わらないよう、✕・数・一覧は場所を取ったままにする（出たり消えたりで入力欄の幅が揺れた。2026-11-30）。 */
.hs-clear.off { visibility: hidden; }
.hs-clear svg { width: 13px; height: 13px; }
@media (hover: hover) { .hs-clear:hover { background: color-mix(in srgb, var(--ink) 22%, var(--surface)); color: var(--ink); } }
.hs-n { flex: none; min-width: 3em; text-align: right; font-family: var(--font-ja); font-size: 12px; color: var(--muted);
  white-space: nowrap; }
.hs-n .sp { display: inline-block; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--accent);
  color: var(--bg); font-family: var(--font-num); font-size: 12px; font-weight: 700; line-height: 22px; text-align: center; }
.hs-n .sp.zero { background: var(--surface-2); color: var(--muted); }
/* 枠の右端の「一覧 ∨」。区切りの線で入力と分ける。押せるときは錆浅葱、押せないときは薄く、開いているときは地の色を付ける。 */
.hs-list { flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 0 12px 0 11px; border: 0;
  border-left: 1px solid var(--line); background: transparent; color: var(--accent); font-family: var(--font-ja); font-size: 13px;
  font-weight: 700; cursor: pointer; }
.hs-list:disabled { color: var(--muted); font-weight: 400; opacity: .5; cursor: default; }
.hs-list svg { width: 13px; height: 13px; margin-right: -3px; transition: rotate var(--dur-quick) var(--ease); }
.hs-list[aria-expanded="true"] svg { rotate: 180deg; }
.hs-list[aria-expanded="true"] { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); }
.hs-close { flex: none; display: inline-flex; align-items: center; gap: 4px; height: var(--hs-h); padding: 0 10px; border: 0;
  border-radius: calc(var(--hs-h) / 2); background: transparent; color: var(--muted); font-family: var(--font-ja); font-size: 13px;
  cursor: pointer; }
.hs-close svg { width: 15px; height: 15px; }
@media (hover: hover) {
  .hs-list:not(:disabled):not([aria-expanded="true"]):hover { background: var(--surface-2); }
  .hs-close:hover { background: var(--surface-2); color: var(--ink); }
}
.hs-kbd { display: none; }
/* 合う回を順に移る ∧ ∨（PC だけ。スマホは時間割の下の札 .hs-float、shows.css）。数の札の右に置く。 */
.hs-nav { display: none; align-items: center; gap: 2px; flex: none; }
.hs-nav button { display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: var(--ink); cursor: pointer; }
.hs-nav button:disabled { color: var(--muted); opacity: .4; cursor: default; }
.hs-nav svg { width: 15px; height: 15px; }
.hs-enter { flex: none; display: none; place-items: center; width: 18px; height: 18px; margin: 0 4px 0 0; border: 1px solid var(--line-strong);
  border-radius: var(--radius-md); font-family: var(--font-num); font-size: 11px; line-height: 1; color: var(--muted); }
/* 隠すときも場所は残す（入れている途中で入力欄の幅が揺れないよう）。一度たどったあとは、場所ごとなくす（.used）。 */
.hs-enter[hidden] { visibility: hidden; }
.hsearch.used .hs-enter { display: none; }
.hs-pos { margin-right: 2px; font-family: var(--font-num); font-size: 12px; color: var(--muted); white-space: nowrap; }
@media (hover: hover) { .hs-nav button:not(:disabled):hover { background: var(--surface-2); } }
/* PC は入力欄の中を3つに分ける: 言葉と ✕ ｜ この日の数と ∧ ∨ ｜ 一覧と全体の数。数がどれのことか、並びで分かる。 */
.hs-ln { display: none; }
@media (min-width: 601px) {
  .hs-enter { display: grid; }
  .hsearch.has-q .hs-nav { display: inline-flex; order: 3; align-self: stretch; margin-left: 4px; padding: 0 4px 0 10px;
    border-left: 1px solid var(--line); }
  .hs-pos { min-width: 8.4em; text-align: right; font-variant-numeric: tabular-nums; }
  .hs-q { padding-right: 0; }
  .hs-q .hs-clear { margin-right: 6px; }
  .hs-ln { display: none !important; display: inline-block; min-width: 20px; height: 18px; margin-left: 2px; padding: 0 5px; border-radius: 999px;
    background: var(--accent); color: var(--bg); font-family: var(--font-num); font-size: 11px; font-weight: 700; line-height: 18px;
    text-align: center; }
  .hs-list:disabled .hs-ln { background: var(--surface-2); color: var(--muted); }
}
/* 入力欄の幅: スマホは行いっぱい。PC は右寄せで 560px まで、ロゴは出したまま（行いっぱいだと横に長すぎた。2026-11-30）。 */
.hsearch { --hs-max: 100%; --hs-h: 38px;
  /* 枠の線は、ほかの線（--line）より少しだけ濃く（--line-strong だと黒く浮いた）。 */
  --hs-line: color-mix(in srgb, var(--line-strong) 30%, var(--line)); }
/* PC: 入力欄はいつも、道具（表示・使い方）の左に出しておく（横に余裕があるので、押して開く手間をなくす。2026-11-30）。
   「さがす」のボタンと「閉じる」は使わない（やめるときは ✕ で文字を消す）。読み込み中から出すので、場所は動かない。 */
@media (min-width: 601px) {
  /* ロゴと道具のあいだの真ん中に置く。何も入れていないときは、枠線のない淡い面（ほかのボタンより控えめ）。押すか文字が
     入ると、白い面と錆浅葱の縁になる。右端の / は「/ キーで入力欄へ」の印（何も入れていないときだけ）。 */
  .tools { flex: 1; justify-content: flex-end; }
  .hsearch, .hsearch[hidden] { display: flex; position: relative; width: 520px; margin-right: auto; margin-left: auto; padding: 0;
    --hs-h: 32px; }
  .top.searching .brand, .top.searching .tools > .theme { opacity: 1; visibility: visible; }
  #searchBtn, .hs-close { display: none; }
  /* 案内はほかの道具と同じくらいに小さく淡く（16px だとロゴより目立った）、入れた文字は読みやすい 15px。押しただけでは大きさを
     変えない（文字が跳ねて見えるので）。PC は iOS のズームの心配がない。 */
  .hs-q input { font-size: 15px; }
  .hs-q input::placeholder { font-size: 13px; color: color-mix(in srgb, var(--muted) 75%, transparent); }
  /* 虫眼鏡は錆浅葱で少し太く（淡い面だけだと、入力欄だと気づきにくかった）。 */
  .hs-q svg { width: 15px; height: 15px; color: var(--accent); stroke-width: 2.4; }
  .hs-box { border-color: transparent; background: var(--surface-2);
    transition: background-color var(--dur-quick) var(--ease), border-color var(--dur-quick) var(--ease); }
  .hsearch.has-q .hs-box { border-color: var(--hs-line); background: var(--surface); }
  .hs-box:focus-within { background: var(--surface); }
  .hsearch:not(.has-q) .hs-list, .hsearch:not(.has-q) .hs-n { display: none; }
  .hs-kbd { flex: none; display: grid; place-items: center; width: 20px; height: 20px; border: 1px solid var(--line-strong);
    border-radius: var(--radius-md); font-family: var(--font-num); font-size: 11px; color: var(--muted); }
  .hsearch.has-q .hs-kbd, .hs-box:focus-within .hs-kbd { display: none; }
  @media (hover: hover) { .hsearch:not(.has-q) .hs-box:not(:focus-within):hover { background: color-mix(in srgb, var(--ink) 9%, var(--surface-2)); } }
}
/* スマホは入力欄を広く使うため、閉じるは ✕ だけにする。 */
@media (max-width: 600px) {
  .hs-close .lbl { display: none; }
  .hs-close { width: var(--hs-h); justify-content: center; padding: 0; }
  .hs-close svg { width: 18px; height: 18px; }
}
@media (prefers-reduced-motion: no-preference) {
  .hsearch.opening .hs-box { animation: hs-grow .32s cubic-bezier(.2, .8, .2, 1) both; }
  .hsearch.opening .hs-close { animation: hs-fade .2s .12s var(--ease) both; }
  .hsearch.closing .hs-box { animation: hs-grow .24s cubic-bezier(.4, 0, .8, .4) reverse both; }
  .hsearch.closing .hs-close { animation: hs-fade .12s var(--ease) reverse both; }
}
@keyframes hs-grow { from { max-width: var(--hs-h); } to { max-width: var(--hs-max); } }
/* 終わりはその要素の不透明度（押せない「一覧」は薄いまま）。to を 1 にすると、開くとき一瞬濃く出てから薄くなった。 */
@keyframes hs-fade { from { opacity: 0; } }
