/*
 * 全ページ共通の値（色・字・余白）、リセット、ヘッダー・フッター、星の評価、小さな道具。
 *
 * 2026-10-24 に作り直した。ポスター（立て看・休憩所ポスター・賞品ボード）の「雰囲気」だけを
 * 取り出して、WEB サイトとして組み直す方針（contest/README.md「見た目」）。
 *
 *   取り出したもの … 色（クリームの地・橙・黄・焦げ茶）、ロゴ、太い丸ゴシック、角丸
 *   捨てたもの     … ポスターの背景層・字の画像（word-*.svg）・箱の角の星・市松・
 *                    橙の太枠を全部に当てる組み方
 *
 * ★ MAP（map.php）は base.css と search.css だけ読み、ヘッダー・フッターを出さない。
 *   MAP が使っている旧トークン（--color-* / --font-display など）は値ごと残してある。
 *   新しいページは --ink / --orange / --cream-* を使う。
 */

:root {
  /* ===== 旧トークン（MAP と search.css の共有部品が読む。値を変えない） ===== */
  --color-washi: #fdf6e0;
  --color-washi-deep: #f4e3a1;
  --color-surface: #fbf5d3;
  --color-orange: #f08530;
  --color-orange-deep: #b35510;
  --color-orange-strong: #e07721;
  --color-apricot: #f3ae7a;
  --color-accent: #f08530;
  --color-on-orange: #3d2a18;
  --color-sumi: #4a3520;
  --color-sumi-soft: #7d6244;
  --color-sumi-faint: #a68a68;
  --color-kincha: #c9a05c;
  --color-yamabuki: #f5ca21;
  --color-line: rgba(74, 53, 32, 0.14);
  --color-line-strong: rgba(74, 53, 32, 0.26);
  --font-display: "Kiwi Maru", serif;
  /* 代替は Meiryo を先に（2026-10-25 夜）。Web フォントが届くまでの一瞬は代替で描かれ、届くと字の幅が変わって
     ヘッダーのナビが 8〜15px 横にずれていた（「コンテストとはを押すとヘッダーがガタッとなる」）。
     Windows の既定（Yu Gothic UI）はかなが詰まっていて幅が違う。Meiryo は Zen Maru Gothic とナビの幅が 1px 単位で同じ
     （手元の Chrome で実測。122/127/85/80px）。Mac は Meiryo が無いので sans-serif（ヒラギノ）になり、少しずれは残る */
  --font-body: "Zen Maru Gothic", Meiryo, sans-serif;

  /* ===== 新しいページの色 =====
     ポスターの色（投票ボタン.svg の RGB）から。
       cream-100 … ページの地。ポスターの地より一段明るい（長いページで重くならない）
       cream-200 … ポスターの地そのもの。ヒーローとフッターの面
       cream-50  … カード・ダイアログの面（ほぼ白のクリーム）
       orange    … 主役。ロゴ・数字・線。★ この上に字を載せない（クリームは 2.5、茶は濁る）
       orange-deep … 押してほしいボタンの面（クリームの字で 4.0）と、橙の字を小さく置くとき
       yellow    … 星・差し色
       ink       … 文字。クリームに載せる焦げ茶（賞品ボードの協賛名の色）。選んだ状態の面にも使う
       ink-soft  … 補足の文字 */
  --cream-50: #fffdf3;
  --cream-100: #fcf5da;
  --cream-200: #f4e3a1;
  --orange: #f0852f;
  --orange-deep: #c9601a;
  --yellow: #f5ca1f;
  --ink: #5e281d;
  --ink-soft: #8a5a44;
  --ink-faint: rgba(94, 40, 29, 0.42);
  --line: rgba(94, 40, 29, 0.12);
  --line-strong: rgba(94, 40, 29, 0.24);

  /* ===== 字 =====
     Zen Maru Gothic の 1 系統だけ。900（大きな見出し・数字）/ 700（UI の字）/ 500（本文）。
     ジャンプ率を大きく取る: 見出しと本文の差ではっきり強弱を付け、装飾で付けない */
  --text-caption: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: clamp(1.375rem, 1.1rem + 1.2vw, 1.75rem);
  --text-2xl: clamp(1.75rem, 1.2rem + 2.4vw, 2.5rem);
  --text-3xl: clamp(2.25rem, 1.4rem + 4vw, 3.5rem);
  --text-hero: clamp(2.5rem, 1.4rem + 6.5vw, 5.25rem);
  --text-num: clamp(3rem, 2rem + 6vw, 5.5rem);

  /* ===== 余白 ===== */
  --gap-1: 0.25rem;
  --gap-2: 0.5rem;
  --gap-3: 0.75rem;
  --gap-4: 1rem;
  --gap-5: 1.5rem;
  --gap-6: 2rem;
  --gap-8: 3rem;
  --gap-10: 4.5rem;
  --gap-12: 6rem;
  --gap-16: 8rem;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-pill: 999px;

  --shadow-raise: 0 1px 2px rgba(122, 74, 26, 0.07), 0 2px 6px rgba(122, 74, 26, 0.06);
  --shadow-card: 0 2px 4px rgba(122, 74, 26, 0.06), 0 8px 20px rgba(122, 74, 26, 0.09);
  --shadow-float: 0 6px 12px rgba(122, 74, 26, 0.1), 0 20px 44px rgba(122, 74, 26, 0.14);

  /* 動きの基本（ボタンの押し込み・ダイアログの出入り・ロゴの組み上がり） */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-pop: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* PC でどのページも同じ枠に入れる幅（ヘッダー・ファーストビュー・節・フッター・検索）。左端をそろえる */
  --container: 72rem;
  --container-pad: var(--gap-6);
  /* PC の節の 2 列（左に見出し、右に中身）の左の列の幅と、列の間 */
  --side-col: 17rem; /* 「総合優勝と3つの部門賞」（22px × 11 字）が 1 行に収まる幅 */
  --side-gap: 4rem;

  --z-base: 1;
  --z-sticky: 100;
  --z-sheet: 200;
  --z-overlay: 300;
  --z-modal: 400;

  color-scheme: light;
}

/* ============================================================
   リセットと基本
   ============================================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

html {
  height: 100%;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  /* 地・字の色・太さは MAP と共有するのでここでは旧来の値のまま。
     新しいページは css/theme.css（body.themed）で cream-100 / ink / 500 / 1.7 に上書きする */
  background: var(--color-washi);
  color: var(--color-sumi);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.75;
  font-feature-settings: "palt";
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  display: block;
  max-width: 100%;
}

ul,
ol {
  list-style: none;
  padding: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

/* 見出し。MAP は Kiwi Maru（400 しか無い）を使うので、太さはここで決めない。
   新しいページの見出しの太さ（900）は css/theme.css */
h1,
h2,
h3 {
  font-size: inherit;
  font-weight: 400;
  line-height: 1.4;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

/* ボタンやフォーム部品には本文の行間を継がせない（1 行のボタンに本文の行間が掛かると
   padding の外に 0.4 文字分の余白が生まれる） */
button,
input,
select,
textarea {
  line-height: 1.4;
  font-family: inherit;
}

/* iOS Safari は 16px 未満の入力欄に触れるとページごと拡大するので下限を引く */
input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  font-size: max(16px, 1em);
}

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   星による評価表示（MAP と共有）
   --score(0〜5) で ::after の幅を切る。画像も JS も要らない。
   ============================================================ */
.rating-stars {
  --score: 0;
  position: relative;
  display: inline-block;
  font-size: var(--text-base);
  line-height: 1;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.rating-stars::before,
.rating-stars::after {
  content: "★★★★★";
}

.rating-stars::before {
  color: rgba(74, 53, 32, 0.18);
}

.rating-stars::after {
  position: absolute;
  inset: 0;
  overflow: hidden;
  width: calc(var(--score) / 5 * 100%);
  color: var(--color-yamabuki);
}

.rating {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.rating__value {
  font-variant-numeric: tabular-nums;
  font-size: var(--text-sm);
  color: var(--color-sumi-soft);
}

.rating__count {
  margin-left: var(--gap-1);
  color: var(--color-sumi-faint);
}

.rating--empty {
  font-size: var(--text-sm);
  color: var(--color-sumi-faint);
}

/* ============================================================
   小さな道具
   ============================================================ */

.no-select {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

.no-scrollbar {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ============================================================
   ヘッダー
   ------------------------------------------------------------
   地と同じクリームで、線を引かない（スクロールして中身が下に来たときだけ影で浮く。
   js は使わず、backdrop の半透明で済ませる）。左に一橋祭のロゴ（来場者サイトのトップへ）、右にナビ。
   2026-10-24 夜までは左が「王冠＋模擬店コンテスト」だったが、コンテスト以外にも戻れるように一橋祭のロゴに。
   コンテストのトップへはナビの「トップ」（640px〜は「模擬店コンテストとは？」）。
   ★ 360px 幅でもロゴ＋ナビ 4 項目が切れないこと（下の 379px の media でナビを少し詰める。実測）。
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: color-mix(in srgb, var(--cream-100) 88%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

/* 高さと左の余白はサイト本体の common/common_header.css と同じ（スマホ 60px・左 20px、PC 65px）。
   ロゴをサイト本体の他のページと同じ位置に置くため、枠（72rem）には入れず画面の端から測る（2026-10-25） */
.site-header__inner {
  display: flex;
  height: 60px;
  align-items: center;
  gap: var(--gap-3);
  padding: 0 var(--gap-4) 0 20px;
}

.site-header__brand {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 6px; /* 本体: 印が左 20px（幅 29px）、字が左 55px */
  height: 40px;
}

.site-header__brand img {
  display: block;
  width: auto;
  height: 40px;
}

/* 印の後ろの白いぼかし（本体の .iks_logo_left::after と同じ。絵の上でも読めるように） */
.site-header__mark {
  position: relative;
  display: block;
  height: 40px;
}

.site-header__mark::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: -1;
  width: 70%;
  height: 70%;
  background: #fff;
  filter: blur(10px);
  transform: translate(-50%, -50%);
}

/* PC 用のロゴは 1024px〜で入れ替える（上の .site-header__brand img の display: block に勝つよう 2 段で書く） */
.site-header__brand .site-header__pc {
  display: none;
}

.site-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0;
}

/* Web フォントが揃うまでナビの字を出さない（lib/view.php の fonts-pending の注）。場所は取ったまま隠すので、
   揃ったときに何も動かない。フォントが手元にある 2 回目以降は、描く前に外れるので隠れる瞬間は無い */
.fonts-pending .site-nav {
  visibility: hidden;
}

.site-nav__link {
  position: relative;
  display: inline-flex;
  height: 2.75rem;
  align-items: center;
  padding: 0 0.375rem;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  color: var(--ink-soft);
  transition: color 0.15s, background-color 0.15s;
}

/* コンテストのトップへの項目は、スマホでは短い字（トップ）、640px〜は「模擬店コンテストとは？」 */
.site-nav__long {
  display: none;
}

/* 360px では「第57回 一橋祭」のロゴ（92px）＋ナビ 4 項目があふれるので、ナビの字と詰めを少し小さく */
@media (max-width: 379px) {
  .site-nav__link {
    padding: 0 0.3rem;
    font-size: 0.7rem;
  }
}

@media (hover: hover) and (pointer: fine) {
  .site-nav__link:hover {
    color: var(--ink);
  }
}

/* いま見ているページ。字を焦げ茶にして、下に短い橙の線 */
.site-nav__link[aria-current="page"] {
  color: var(--ink);
}

.site-nav__link[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0.375rem;
  right: 0.375rem;
  bottom: 0.25rem;
  height: 3px;
  border-radius: var(--radius-pill);
  background: var(--orange);
}

@media (min-width: 640px) {
  .site-header__inner {
    padding-right: var(--gap-6);
    gap: var(--gap-5);
  }
  .site-nav {
    gap: var(--gap-2);
  }
  .site-nav__link {
    padding: 0 0.75rem;
    font-size: var(--text-sm);
  }
  .site-nav__long {
    display: inline;
  }
  .site-nav__short {
    display: none;
  }
  .site-nav__link[aria-current="page"]::after {
    left: 0.75rem;
    right: 0.75rem;
  }
}

/* 「模擬店を探す」の虫めがね（lib/view.php の nav_items() の icon）。PC（1024px〜）だけ字の前に出す。
   トップで PC は固定の浮きボタンを置かない代わりに、固定されたヘッダーのこの項目が「店を探す入口」と分かるように
   （2026-10-25 夜。枠付きのボタンの形も作ったが「ボタンではなくアイコン」で戻した）。スマホの幅では字だけ（360px で溢れる） */
.site-nav__icon {
  display: none;
}

@media (min-width: 1024px) {
  .site-nav__icon {
    display: inline-flex;
    margin-right: 0.3em;
  }
  .site-nav__icon .icon {
    width: 1.05em;
    height: 1.05em;
  }
}

/* 押せる物は、素早く 2 回押してもブラウザがページを拡大しない（iOS の二度押しの拡大。
   「絞り込み」ボタンの連打で指摘。2026-10-24 夜）。地図（css/map.css）は別に touch-action: none */
button,
[role="button"],
a.btn,
.site-nav__link {
  touch-action: manipulation;
}

/* PC（1024px〜）: 本体と同じく logo.svg を左 20px に 40px 高、ヘッダーは 65px */
@media (min-width: 1024px) {
  .site-header__inner {
    height: 65px;
  }
  .site-header__brand .site-header__mark,
  .site-header__brand .site-header__text {
    display: none;
  }
  .site-header__brand .site-header__pc {
    display: block;
  }
}

/* ============================================================
   フッター
   ------------------------------------------------------------
   ポスターの地（cream-200）の面に、協賛ロゴとロゴと主催。線も市松も引かない。
   ============================================================ */
.site-footer {
  margin-top: auto;
  background: var(--cream-200);
}

.site-footer__inner {
  margin: 0 auto;
  max-width: var(--container);
  padding: var(--gap-10) var(--gap-4) var(--gap-8);
}

/* フッター広告。サイト本体のフッター（common/advertise.php）と同じく、札や枠を付けずに画像をそのまま格子に貼る
   （2026-10-24 の指示）。1 枚 234px 幅、間は 5px。スマホは 2 列（50%）、PC は 4 列 */
.sponsor-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  justify-content: center;
}

.sponsor-list a {
  display: block;
  transition: opacity 0.15s;
}

@media (hover: hover) and (pointer: fine) {
  .sponsor-list a:hover {
    opacity: 0.8;
  }
}

.sponsor-list img {
  display: block;
  width: 100%;
  height: auto;
}

/* ロゴと主催は中央に縦に並べる（左右に振り分けると、大きなロゴと 1 行の字で釣り合わない） */
.site-footer__bottom {
  margin-top: var(--gap-10);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--gap-3);
  text-align: center;
}

/* 広告が無いとき（lib/view.php の sponsors() が空）は、上の余白は .site-footer__inner の分だけ */
.site-footer__bottom:first-child {
  margin-top: 0;
}

.site-footer__logo {
  width: 6rem;
  height: auto;
}

.site-footer__copyright {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--ink-soft);
}


@media (min-width: 640px) {
  .site-footer__inner {
    padding-left: var(--gap-6);
    padding-right: var(--gap-6);
  }
  .sponsor-list {
    grid-template-columns: repeat(2, 234px);
  }
  .site-footer__logo {
    width: 7rem;
  }
}

/* PC は 4 列（640px〜の 2 列より後ろに書くこと。先に書くと上書きされる）。
   ★ 列の幅は 234px 固定ではなく、置き場所に収まるように縮める（最大で 234px）。検索ページの PC ではフッターが
     右の列（約 900px）に入るので、固定だと 951px の格子がはみ出して横スクロールが出た（2026-10-25） */
@media (min-width: 1056px) {
  .sponsor-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    max-width: calc(234px * 4 + 5px * 3);
    margin: 0 auto;
  }
}
