/* 全ページ共通：色・文字・外枠（ロゴ・メニュー・足もと）・空・重ねる板 */

:root {
  --ink: #15181e;
  --white: #fff;
  --yellow: #ffd23f;
  --yellow-deep: #d4a012;
  /* 作品ページの地と、入る演出の板の地。トップと同じ青空（本人 2026-11-09「紺色は良くないので、青空の方がいい」） */
  --work-bg: #2a6bc4 url("/assets/sky.webp") center / cover no-repeat;
  --font-latin: "Bahnschrift", "DIN Alternate", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --font-ja: "Noto Sans JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
  --shadow-text: 0 2px 10px rgba(21, 24, 30, 0.5), 0 1px 2px rgba(21, 24, 30, 0.35);
  /* 時間と曲線は config.js から入る（app.js が書き込む）。ここは読み込み前の仮の値 */
  --vh: 1vh;
  --hero-h: 300px;
  --fade-out: 350ms;
  --fade-in: 300ms;
  --nav-slide: 500ms;
  --retreat: 250ms;
  --title-in: 450ms;
  --title-out: 180ms;
  --push-out: 150ms;
  --shadow-in: 1200ms;
  --shadow-out: 300ms;
  --frame-in: 300ms;
  --work-card-in: 800ms;
  --work-body-in: 450ms;
  --back-hide: 300ms;
  --ease-slide: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-rise: cubic-bezier(0.2, 0.9, 0.25, 1);
  /* 待ち受けの画面（loading.js が config.js の値を入れる。ここは読み込み前の仮の値） */
  --loading-estimate: 7600ms;
  --loading-from: 0.025;
  --loading-to: 0.92;
  --loading-fade: 300ms;
  --ease-gauge: cubic-bezier(0.12, 0.58, 0.24, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scrollbar-width: none;               /* 帯の幅を画面の幅とそろえるため、スクロールの棒は出さない */
  -webkit-text-size-adjust: 100%;
}
html::-webkit-scrollbar { display: none; }

body {
  margin: 0;
  min-height: 100%;
  color: var(--white);
  font-family: var(--font-ja);
  background: #2a6bc4;                 /* 空の絵が届くまでの色 */
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

html[data-page="top"],
html[data-page="top"] body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

img { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* 押せる物に Tab で来たときの枠 */
:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--white);
  outline-offset: 4px;
  box-shadow: 0 0 0 7px rgba(21, 24, 30, 0.45);
  border-radius: 6px;
}

/* ---- 空 ---- */
.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: #2a6bc4 url("/assets/sky.webp") center / cover no-repeat;
}
@media (max-width: 767px) {
  .sky { background-image: url("/assets/sky_sp.webp"); }
  :root { --work-bg: #2a6bc4 url("/assets/sky_sp.webp") center / cover no-repeat; }
}

main#view {
  position: relative;
  z-index: 1;
  min-height: 100%;
}
main#view.is-fading-out {
  opacity: 0;
  transition: opacity var(--fade-out) ease;
}
main#view.is-fading-in {
  animation: view-in var(--fade-in) ease both;
}
@keyframes view-in { from { opacity: 0; } }

/* ---- ロゴとメニュー ---- */
.site-head {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  pointer-events: none;
}
.site-head a { pointer-events: auto; }

.logo {
  position: absolute;
  left: 48px; top: 26px;
  display: block;
  text-decoration: none;
  text-shadow: var(--shadow-text);
  padding: 4px 2px;
}
.logo-name {
  display: block;
  font-family: var(--font-latin);
  font-weight: 700;
  font-size: 40px;
  line-height: 1;
  letter-spacing: 0.01em;
}
.logo-tag {
  display: block;
  margin-top: 9px;
  font-family: var(--font-latin);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.02em;
}

.site-nav {
  position: absolute;
  right: 40px; top: 30px;
  display: flex;
  gap: 18px;
}
.site-nav a {
  position: relative;
  display: block;
  padding: 0 8px;
  line-height: 44px;
  min-height: 44px;
  font-family: var(--font-latin);
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  text-shadow: var(--shadow-text);
}
.nav-bar {
  position: absolute;
  left: 0; top: 39px;
  width: 10px; height: 2px;
  background: var(--white);
  border-radius: 1px;
  box-shadow: 0 1px 4px rgba(21, 24, 30, 0.35);
  transform-origin: 0 0;
  opacity: 0;
  transition: transform var(--nav-slide) var(--ease-slide), width calc(var(--nav-slide) * 0.6) ease, opacity 200ms ease;
}
.nav-bar.is-on { opacity: 1; }

/* ---- 足もと ---- */
.site-foot {
  position: fixed;
  right: 40px; bottom: 14px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
}
.site-foot a,
.site-foot span {
  display: block;
  padding: 0 10px;
  line-height: 36px;
  text-decoration: none;
}
.site-foot .foot-links { display: flex; }
/* ホームページ制作のサイトへのつなぎ（本人 2026-11-13「X の隣に小さく同じような大きさで、黄色いマークで白抜きの字で」）。
   下の段のリンクの一番右（X の右）に、黄色の小さな札に白い字で置く。字の大きさと箱の高さ（押せる所）は隣の YouTube などと同じにして、
   黄色の地だけを箱の上下の真ん中に細く敷く（上下の透明な枠の分は地を塗らない）。白い字は黄色の地の上で薄いので、太字と薄い影で読ませる。
   位置の確かめは tests/hp-link.test.mjs（17 通りの画面の大きさ） */
.site-foot .hp-foot {
  --box: 36px;                         /* 箱の高さ（隣のリンクの行の高さと同じ。スマートフォンは下で 44px） */
  --band: 22px;                        /* 黄色の地の高さ */
  border: solid transparent;
  border-width: calc((var(--box) - var(--band)) / 2) 0;
  border-radius: calc(var(--band) / 2) / calc(var(--box) / 2);   /* 地の角がちょうど半円になる（縦の丸みは枠の太さの分だけ減る） */
  background: var(--yellow) padding-box;
  color: var(--white);
  font-weight: 700;
  line-height: var(--band);
  white-space: nowrap;
  text-shadow: 0 1px 1px rgba(21, 24, 30, 0.35);
}
.site-foot .hp-foot:hover,
.site-foot .hp-foot:focus-visible { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
html[data-page="work"] .site-foot { display: none; }
html[data-page="plain"] .site-foot { color: var(--white); text-shadow: var(--shadow-text); }
/* Profile・Contact・見つからない頁は下へ送って読むので、画面に留まるロゴとメニュー・足もとの裏に、空の色をうっすら敷く
   （下へ送った字がロゴやメニューと重なって読めなくなるのを防ぐ。2026-11-12）。色は空の絵の上の端と下の端の色。
   開いたときは空の絵と同じ色なので、敷いてあるのは見えない */
html[data-page="plain"] .site-head::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 124px;
  z-index: -1;
  background: linear-gradient(to bottom, rgba(0, 69, 155, 0.97) 0%, rgba(0, 69, 155, 0.9) 62%, rgba(0, 69, 155, 0) 100%);
  pointer-events: none;
}
html[data-page="plain"] body::after {
  content: "";
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 58px;
  z-index: 40;
  background: linear-gradient(to top, rgba(61, 182, 251, 0.95) 0%, rgba(61, 182, 251, 0.85) 50%, rgba(61, 182, 251, 0) 100%);
  pointer-events: none;
}
@media (max-width: 767px) {
  html[data-page="plain"] .site-head::before { height: 104px; }
}

@media (max-width: 767px) {
  .logo { left: 20px; top: 18px; }
  .logo-name { font-size: 30px; }
  .logo-tag { font-size: 11px; margin-top: 6px; }
  .site-nav { right: 10px; top: 16px; gap: 2px; }
  .site-nav a { font-size: 14px; padding: 0 8px; }
  .nav-bar { top: 37px; }
  .site-foot {
    left: 10px; right: 10px; bottom: 4px;
    justify-content: space-between;
    flex-wrap: wrap-reverse;
    row-gap: 0;
    font-size: 11px;
  }
  .site-foot a, .site-foot span { line-height: 44px; padding: 0 8px; }
  .site-foot .hp-foot { --box: 44px; }
  /* リンク（YouTube・Instagram・X・ホームページ制作）と著作の表示は 1 行に収まらないので、リンクの段をいちばん下に置き、
     著作の表示はその上の段の左に回す（ホームページ制作は、いちばん下の段の最後になる）。著作の表示は押す物ではないので、
     行の高さは字の分（16px）だけにして、下のリンクの押せる箱の上の余白に 8px 重ね、押しは下のリンクに通す
     （下の段の高さ 4 + 44 + 16 − 8 = 56px。Profile の下の余白 64px との間が 8px 空く） */
  .site-foot > span { line-height: 16px; margin-bottom: -8px; pointer-events: none; }
}

/* ---- 押して中に入るときに重ねる板 ---- */
.veil {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
}
.veil[hidden] { display: none; }
.veil-shade {
  position: absolute;
  inset: 0;
  background: var(--work-bg);
  opacity: 0;
}
.veil-clip {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.veil-img {
  position: absolute;
  left: 0; top: 0;
  max-width: none;
  user-select: none;
}

/* ---- 黄色い丸（push と戻るボタン） ---- */
.yellow-btn {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 3px 0 var(--yellow-deep), 0 9px 18px rgba(21, 24, 30, 0.42);
  font-family: var(--font-latin);
  font-weight: 700;
  -webkit-user-select: none;
  user-select: none;
}
.yellow-btn:focus-visible {
  outline-color: var(--ink);
  box-shadow: 0 3px 0 var(--yellow-deep), 0 0 0 7px rgba(255, 255, 255, 0.8);
  border-radius: 50%;
}
.yellow-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--yellow-deep), 0 5px 12px rgba(21, 24, 30, 0.4); }

/* ---- Profile・Contact（試作では仮の 1 枚） ---- */
.plain {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-content: center;
  padding: 0 24px;
  text-align: center;
  text-shadow: var(--shadow-text);
}
.plain-title { margin: 0; font-family: var(--font-latin); font-size: 48px; font-weight: 700; }
.plain-text { margin: 14px 0 0; font-size: 16px; }

/* ---- 待ち受けの画面（ページを開いた・読み直したときだけ出す。出し入れは js/loading.js） ---- */
/* 絵は 1119×746。ゲージは、絵の中に描いた棒（左 338・上 544・幅 442・高さ 22）にぴったり重ねる（my-HP と同じ値） */
.loading { display: none; }
html[data-loading] { overflow: hidden; }            /* 待っている間は、下の画面をスクロールさせない */
html[data-loading] .loading {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: #fcf9f1;                               /* 絵の端の色（252, 249, 241）。絵の縁を見せない */
  opacity: 1;
  transition: opacity var(--loading-fade) ease;
  touch-action: none;
}
html[data-loading="leaving"] .loading { opacity: 0; }
.loading-art {
  position: relative;
  flex: none;
  width: min(100%, 1119px, calc((100vh - 32px) * 1119 / 746));
  width: min(100%, 1119px, calc((100dvh - 32px) * 1119 / 746));
  aspect-ratio: 1119 / 746;
}
.loading-img {
  width: 100%;
  height: 100%;
  -webkit-user-select: none;
  user-select: none;
}
.loading-gauge {
  position: absolute;
  left: calc(338 / 1119 * 100%);
  top: calc(544 / 746 * 100%);
  width: calc(442 / 1119 * 100%);
  height: calc(22 / 746 * 100%);
  overflow: hidden;
  border-radius: 999px;
  background: #e2e0df;                               /* 絵の中の棒の地の色 */
}
.loading-gauge i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: #28a8f5;                               /* 絵の中の青 */
  transform: translateX(calc((var(--loading-from) - 1) * 100%));
  animation: loading-gauge var(--loading-estimate) var(--ease-gauge) forwards;
}
/* 経った時間の目安で伸びる（読み込みの割合ではない）。端まで満ちるのは、そろったときだけ */
@keyframes loading-gauge {
  from { transform: translateX(calc((var(--loading-from) - 1) * 100%)); }
  to { transform: translateX(calc((var(--loading-to) - 1) * 100%)); }
}
.loading-text {
  display: none;
  position: absolute;
  left: 0; right: 0;
  bottom: calc((746 - 544) / 746 * 100% + 10px);
  margin: 0;
  color: #303a40;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
}
.loading.is-noimage .loading-img { visibility: hidden; }
.loading.is-noimage .loading-text { display: block; }
@media (prefers-reduced-motion: reduce) {
  html[data-loading] .loading { transition: none; }
  .loading-gauge i { animation: none; }
}
/* トップの見出し（2026-11-12）：待ち受けの上の方に、見出しを大きく出す（見出しはトップの待ち受けにだけある）。
   絵は見出しの分だけ小さくして、見出しと重ねない。パソコンは 40px で 1 行、スマートフォンは 24px で 2 行まで
   （割るのは「お店の1分CM、」と「3Dで作りませんか？」の間だけ）。出し入れの時間は今まで通り（js/loading.js）。
   作品ページの待ち受けは、中身が絵の 1 つだけなので、縦に並べても形は変わらない。絵を小さくするのは、見出しのすぐ後ろの絵だけ */
.loading { flex-direction: column; }
.loading-midashi {
  flex: none;
  margin: 0 0 20px;
  color: #303a40;                                    /* 待ち受けの字と同じ */
  font-size: 40px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.02em;
  text-align: center;
  font-feature-settings: "palt";
}
.loading-midashi .mi-line { display: inline-block; }
.loading-midashi + .loading-art {                    /* 72px：見出し 1 行（52px）と絵との間（20px） */
  width: min(100%, 1119px, calc((100vh - 32px - 72px) * 1119 / 746));
  width: min(100%, 1119px, calc((100dvh - 32px - 72px) * 1119 / 746));
}
@media (max-width: 767px) {
  .loading-midashi { margin-bottom: 14px; font-size: 24px; }
  .loading-midashi + .loading-art {                  /* 78px：見出し 2 行（63px）と絵との間（14px） */
    width: min(100%, 1119px, calc((100vh - 32px - 78px) * 1119 / 746));
    width: min(100%, 1119px, calc((100dvh - 32px - 78px) * 1119 / 746));
  }
}
