/* 画面の外側（切り替えのタブ、一覧、文字入れ欄）は、閲覧する人の明暗の設定に合わせる。
   素材の画面そのもの（.card）は納品物なので、どちらの設定でも同じ色で描く */
:root {
  /* 素材の色。サイトの global.css と同じ値で、明暗で変えない */
  --ink: #222222;
  --cream: #fffaed;
  --orange: #ea5520;
  --gray-200: #e3e3e3;
  /* 画面の外側の色 */
  --ui-bg: #ecebe6;
  --ui-panel: #ffffff;
  --ui-fg: #222222;
  --ui-muted: #6b6a64;
  --ui-line: #d6d4cc;
  --ui-strong: #222222;
  --ui-on-strong: #ffffff;
  --maru: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Hiragino Sans", sans-serif;
  --solway: "Solway", Georgia, serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ui-bg: #1d1d1b; --ui-panel: #2a2a27; --ui-fg: #ecebe6; --ui-muted: #a5a39b;
    --ui-line: #3d3c38; --ui-strong: #ecebe6; --ui-on-strong: #1d1d1b; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ui-bg: #1d1d1b; --ui-panel: #2a2a27; --ui-fg: #ecebe6; --ui-muted: #a5a39b;
  --ui-line: #3d3c38; --ui-strong: #ecebe6; --ui-on-strong: #1d1d1b; color-scheme: dark;
}

/* フォントはページと同じ場所に置く（OFL）。PNG で保存するとき、外部のサイトから読めない環境でも埋め込めるようにするため */
@font-face { font-family: "Zen Maru Gothic"; font-weight: 500; font-display: block; src: url("assets/fonts/ZenMaruGothic-Medium.ttf") format("truetype"); }
@font-face { font-family: "Zen Maru Gothic"; font-weight: 700; font-display: block; src: url("assets/fonts/ZenMaruGothic-Bold.ttf") format("truetype"); }
@font-face { font-family: "Zen Maru Gothic"; font-weight: 900; font-display: block; src: url("assets/fonts/ZenMaruGothic-Black.ttf") format("truetype"); }
@font-face { font-family: "Solway"; font-weight: 500; font-display: block; src: url("assets/fonts/Solway-Medium.ttf") format("truetype"); }
@font-face { font-family: "Solway"; font-weight: 700; font-display: block; src: url("assets/fonts/Solway-Bold.ttf") format("truetype"); }
@font-face { font-family: "Solway"; font-weight: 800; font-display: block; src: url("assets/fonts/Solway-ExtraBold.ttf") format("truetype"); }

* { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }

/* 日本語の文字組み。kiso.css の考え方に合わせる
   https://www.tak-dcxi.com/article/introduce-kiso-css/
   - text-spacing-trim: 約物が続く所と行頭の約物の前の空きを詰める
   - text-autospace: 和文と英数字の間に 1/8 字ほどの空きを入れる
   - line-break: 行頭に来てはいけない約物を、厳しい規則で前の行に送る
   - overflow-wrap: URL のような長い英字の連なりでも、はみ出さずに折り返す */
:root {
  line-break: strict;
  overflow-wrap: anywhere;
  text-autospace: normal;
  text-spacing-trim: trim-start;
}

body {
  background: var(--ui-bg);
  color: var(--ui-fg);
  font-family: var(--maru);
  padding-bottom: 48px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* 画像の文字はすべて見出しとして大きく見せるものなので、約物の空きを詰める palt を使う。
   kiso.css でも、palt は本文ではなく見出しに限って使う方針になっている */
.card { font-feature-settings: "palt"; }

/* 素材の切り替え。上に貼り付け、狭い画面では折り返す */
body::before {
  background: var(--ui-panel);
  content: "";
  height: env(safe-area-inset-top, 0px);
  inset: 0 0 auto;
  position: fixed;
  z-index: 10;
}
#nav {
  background: var(--ui-panel);
  border-bottom: 1px solid var(--ui-line);
  display: flex;
  flex-wrap: wrap;
  font-size: 14px;
  font-weight: 700;
  gap: 6px;
  margin-inline: calc(-1 * max(16px, env(safe-area-inset-left, 0px))) calc(-1 * max(16px, env(safe-area-inset-right, 0px)));
  padding: 12px max(16px, env(safe-area-inset-right, 0px)) 12px max(16px, env(safe-area-inset-left, 0px));
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 9;
}
#nav a { border-radius: 999px; color: var(--ui-fg); padding: 8px 14px; text-decoration: none; }
#nav a:hover { background: var(--ui-bg); }
#nav a[aria-current] { background: var(--ui-strong); color: var(--ui-on-strong); }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }

/* 文字入れ欄 */
.editor {
  align-items: end;
  background: var(--ui-panel);
  border: 1px solid var(--ui-line);
  border-radius: 12px;
  display: flex;
  flex-wrap: wrap;
  font-size: 14px;
  font-weight: 700;
  gap: 12px 16px;
  margin-top: 20px;
  max-width: 760px;
  padding: 16px 20px;
}
.editor label { display: grid; flex: 1 1 240px; gap: 6px; min-width: 0; }
.editor input {
  background: var(--ui-bg);
  border: 1px solid var(--ui-line);
  border-radius: 8px;
  color: var(--ui-fg);
  font: inherit;
  font-weight: 500;
  padding: 10px 12px;
  width: 100%;
}
.editor p { color: var(--ui-muted); flex-basis: 100%; font-weight: 500; }

/* 一覧。画面は 1920x1080 のまま描き、枠の幅に合わせて縮める（--k は app.js が枠の幅から求める） */
.gallery {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 400px), 1fr));
  margin-top: 20px;
}
.gallery figure { display: grid; gap: 8px; min-width: 0; }
.gallery figure > a { border-radius: 8px; display: block; overflow: hidden; }
.gallery figcaption {
  align-items: center;
  display: flex;
  font-size: 13px;
  gap: 8px;
  justify-content: space-between;
  min-width: 0;
}
.gallery figcaption span { color: var(--ui-muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.frame { aspect-ratio: 16 / 9; max-width: 100%; overflow: hidden; position: relative; width: 100%; }
.frame > .card { left: 0; position: absolute; top: 0; transform: scale(var(--k, 0.25)); transform-origin: 0 0; }

/* 1 枚の表示 */
.single { display: grid; gap: 12px; margin-top: 20px; }
.single__bar { align-items: center; display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; }
.single .frame { border-radius: 8px; }
.back { color: var(--ui-fg); font-size: 14px; font-weight: 700; }

/* PNG で保存するボタン */
.save {
  background: var(--ui-strong);
  border: 0;
  border-radius: 999px;
  color: var(--ui-on-strong);
  cursor: pointer;
  flex-shrink: 0;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 14px;
}
.save:disabled { cursor: progress; opacity: 0.6; }

/* すべての素材に共通する画面 */
.card {
  background: var(--cream);
  color: var(--ink);   /* 画面の外側の文字色を引き継がないよう、素材の文字色をここで決める */
  display: grid;
  height: 1080px;
  overflow: hidden;
  padding: 120px 120px 120px 280px;   /* 左にもモチーフを覗かせる幅を取る */
  position: relative;
  width: 1920px;
}

/* 図形は中身より後ろに置く。位置と大きさは app.js の layoutShapes で決める */
.card__shape { pointer-events: none; position: absolute; }
.card > :not(.card__shape) { position: relative; z-index: 2; }

.card__head {
  align-items: center;
  align-self: start;
  display: flex;
  justify-content: space-between;
}

.card__logo { display: block; height: 88px; }

/* 行頭の始め括弧。Zen Maru Gothic には括弧の前の空きを詰めるための情報が無く、
   text-spacing-trim が効かないので、半角ぶん左へずらして左端を揃える */
.yakumono-start { margin-inline-start: -0.5em; }

/* ④ YouTube 投稿用画像 */
.thumb { grid-template-rows: auto 1fr auto; }

.thumb__meta { display: flex; gap: 16px; white-space: nowrap; }

.thumb__meta span {
  background: #ffffff;
  border: 3px solid var(--ink);
  border-radius: 999px;
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
  padding: 14px 28px;
}

.thumb__title {
  align-self: center;
  font-size: 96px;
  font-weight: 900;
  line-height: 1.35;
  max-width: 1360px;
  text-wrap: pretty;          /* 最後の行に 1 語だけ残る泣き別れを避ける */
  word-break: auto-phrase;    /* 日本語を文節の切れ目で改行する */
}

.thumb__title.is-long { font-size: 80px; }

.thumb__speaker {
  align-items: center;
  display: flex;
  gap: 40px;
  min-height: 200px;   /* アイコンが無いときも、名前の縦位置をアイコンがあるときと揃える */
}

.thumb__avatar {
  border: 6px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--gray-200);
  height: 200px;
  object-fit: cover;
  width: 200px;
}

.thumb__name { font-size: 60px; font-weight: 900; line-height: 1.2; white-space: nowrap; }

.thumb__handle {
  white-space: nowrap;
  color: var(--orange);
  font-family: var(--solway);
  font-size: 36px;
  font-weight: 700;
  margin-top: 8px;
}

/* ① 配信背景：汎用は中央を空けておき、映像やスライドを自由に重ねてもらう */
.background { align-content: start; }

/* スライドとカメラの枠。位置は 1920x1080 の座標で決め打ちにする（映像を重ねる位置を映像チームと合わせるため） */
.card > .bg__area,
.card > .bg__logo { position: absolute; }
/* 白い枠は図形の上に重ねる。図形は枠を避けず、汎用の背景と同じ大きさのまま枠の下に敷く。
   実際の配信では映像が枠の上に乗るので、枠は映像を置く位置のガイドになる */
.card > .bg__area { background: #ffffff; border-radius: 16px; z-index: 3; }

/* スライド用：上と左の余白 48px、スライドの右に 256px の列、下に 132px の帯が残る */
.is-slide .bg__slide { height: 900px; left: 48px; top: 48px; width: 1600px; }
.is-slide .bg__logo { left: 1680px; top: 48px; width: 200px; }

/* スライドとカメラ用：スライドの右の列（幅 384px）の下に、カメラの枠をスライドの下端に揃えて置く */
.is-camera .bg__slide { height: 810px; left: 48px; top: 48px; width: 1440px; }
.is-camera .bg__camera { height: 216px; left: 1520px; top: 642px; width: 384px; }
.is-camera .bg__logo { left: 1544px; top: 48px; width: 336px; }

/* ② 蓋絵：縦組みのロゴと日程を画面の中央に置く */
.lid {
  align-content: center;
  gap: 48px;
  justify-items: center;
  padding: 120px;
}
.lid__logo { display: block; height: 560px; }
.lid__date { display: block; width: 543px; }   /* 上の縦組みロゴと幅を揃える */

/* ③ 文字入れ用の蓋：⑤ と同じく中央揃え。ロゴを上の中央、文字を画面の中心に置き、左右の余白を揃える */
.text {
  grid-template-rows: auto 1fr;
  justify-items: center;
  padding-inline: 200px;
  text-align: center;
}
.text__body { align-self: center; display: grid; gap: 40px; justify-items: center; padding-bottom: 88px; }
.text__main {
  font-size: 160px;
  font-weight: 900;
  line-height: 1.25;
  max-width: 1360px;
  text-wrap: pretty;
  word-break: auto-phrase;
}
.text__main.is-long { font-size: 132px; }   /* 9 文字以上の文言は小さくして、改行を減らす */
.text__main:empty { display: none; }
.text__sub { font-size: 56px; font-weight: 700; line-height: 1.4; }

/* ⑤ スポンサーロゴ一覧：見出しはサイトの見出しと同じく、オレンジの英字と黒の和文にする */
/* 中央揃え。左右の余白も揃え、ロゴ、見出し、ロゴの並びを画面の中心に置く */
.sponsors {
  gap: 48px;
  grid-template-rows: auto auto 1fr;
  justify-items: center;
  padding-inline: 200px;
  padding-bottom: 240px;   /* 下の余白を広げて、上下中央に置くロゴの並びを少し上へ寄せる */
  text-align: center;
}
.sponsors__heading {
  color: var(--orange);
  display: grid;
  justify-items: center;
  font-family: var(--solway);
  font-size: 40px;   /* 主役はスポンサーのロゴなので、見出しは控えめにする */
  font-weight: 800;
  gap: 4px;
  line-height: 1.1;
}
/* 和文の小見出しは英字の見出しの 7/12 の大きさにする */
.sponsors__heading span { color: var(--ink); font-family: var(--maru); font-size: calc(7em / 12); font-weight: 900; }
/* 1 段に --cols 社ずつ並べ、社数が足りない最後の段も中央に揃える */
.sponsors__grid {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  justify-content: center;
  align-self: center;   /* ロゴの並びは、見出しの下の残りの高さの中で上下中央に置く */
  list-style: none;
  max-width: 1520px;
  padding: 0;
  width: 100%;
}
.sponsors__grid li {
  aspect-ratio: 1;
  width: calc((100% - (var(--cols) - 1) * 24px) / var(--cols));
  background: #ffffff;
  border-radius: 24px;
  overflow: hidden;
}
.sponsors__grid img { display: block; height: 100%; max-width: 100%; object-fit: contain; width: 100%; }


/* ⑤ のうち 2 区分を 1 枚に載せる画面。区分ごとに、見出しを左の列に右揃えで置き、ロゴを右に左揃えで並べる。
   見出しの列の幅を揃えて、2 区分のロゴの左端を揃える */
.sponsors.is-merged { grid-template-rows: auto 1fr; padding-block: 96px; padding-inline: 120px; }
.sponsors__plans {
  align-self: center;
  display: grid;
  gap: 56px;
  grid-template-columns: auto auto;
}
.sponsors__plan {
  align-items: center;
  column-gap: 48px;
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: subgrid;
}
.sponsors__plan .sponsors__heading { justify-items: end; text-align: right; white-space: nowrap; }
.sponsors__plan .sponsors__grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(var(--cols), var(--tile));
  justify-content: start;
  max-width: none;
  width: auto;
}
.sponsors__plan .sponsors__grid li { border-radius: calc(var(--tile) / 10); width: var(--tile); }
