/*
 * トップ（index.html）の見た目。背景（空・平原）の上の「掲示板の板」に、羊皮紙の張り紙を貼る。
 * 色・板・張り紙の形は、試作品（proto/commentguild の src/styles/tokens.css と src/layouts/Base.astro）と同じ値。
 * creators.html・commenters.html・404.html は、前からの style.css を使う（このファイルは使わない）。
 */

/*
 * 書体：Kaisei Decol 700（見出し）、BIZ UDPゴシック 400・700（本文）。どちらも SIL Open Font License 1.1（/fonts/OFL-kaisei-decol.txt、/fonts/OFL-biz-udpgothic.txt）。
 * このページで使う文字だけにしぼって、このサーバーに置いてある（外のサービスからは、読みこまない）。作り方は tools/make-home-fonts.js
 */
@font-face {
  font-family: "CG Kaisei";
  src: url("/fonts/cg-kaisei-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "CG Gothic";
  src: url("/fonts/cg-gothic-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "CG Gothic";
  src: url("/fonts/cg-gothic-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #2b1b0e;
  --cream: #f1e3c0;
  --cream-light: #fff3da;
  --paper: #eedcae;
  --paper-edge: #cfae70;
  --paper-spot-a: rgba(120, 70, 20, 0.22);
  --paper-spot-b: rgba(100, 60, 20, 0.2);
  --paper-outline: polygon(6px 4px, 24% 1px, 50% 0, 78% 4px, calc(100% - 4px) 5px, 100% 30%, calc(100% - 7px) 60%, 100% calc(100% - 5px), 70% 100%, 45% calc(100% - 6px), 20% 100%, 0 calc(100% - 3px), 5px 70%, 0 35%);
  --note: #fff8e6;
  --line: rgba(90, 60, 25, 0.35);
  --line-soft: rgba(90, 60, 25, 0.3);
  --line-dash: rgba(90, 60, 25, 0.45);
  --link: #7a5a12;
  --link-hover: #4a3608;
  --wood-dark: #2e1d10;
  --gold: #c9a23f;
  --overlay: rgba(26, 14, 5, 0.72);

  --font-body: "CG Gothic", "BIZ UDPGothic", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", sans-serif;
  --font-head: "CG Kaisei", "Kaisei Decol", "Hiragino Mincho ProN", "Yu Mincho", serif;

  /* 板（絵は 1332×1950。上から 153、下から 241 のところが、板と板のすきま） */
  --board-top: 150px;
  --board-pad-top: 30px;
  --board-pad-side: 44px;
  --board-pad-bottom: 34px;
  --board-out-top: 70px;
  --board-out-side: 70px;
  --board-out-bottom: 160px;
  --board-legs: 110px;
  --card-pad: 26px 30px 26px;
  --head-size: 32px;
}

* { box-sizing: border-box; }

html {
  background: linear-gradient(#2f6fb5 0, #8fbee6 240px, #cfe3f2 300px, #7fa651 316px, #5e8538 700px, #4c6e2c 100%);
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  position: relative;
  min-height: 100vh;
  overflow-x: clip;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
}
body::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: 0;
  right: 0;
  top: 0;
  height: 360px;
  background: url("/design/background.svg") center top / cover no-repeat;
}
.defs { position: absolute; }

a { color: var(--link); }
a:hover { color: var(--link-hover); }
p, h1, h2, h3, dl, dd { margin: 0; }
img { max-width: 100%; height: auto; }

main {
  max-width: 1240px;
  margin: var(--board-top) auto 0;
  padding: 0 24px;
}

/* 掲示板の板：絵の上と下は、そのまま。まんなかの板は、中身の高さに合わせて、くり返す */
.board {
  position: relative;
  padding: var(--board-pad-top) var(--board-pad-side) var(--board-pad-bottom);
  margin-bottom: var(--board-legs);
  border: 0 solid transparent;
  border-image-source: url("/design/board.webp");
  border-image-slice: 153 0 241 0 fill;
  border-image-width: 153px 0 241px 0;
  border-image-outset: var(--board-out-top) var(--board-out-side) var(--board-out-bottom) var(--board-out-side);
  border-image-repeat: stretch repeat;
}

/* ロゴと URL */
.top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
  text-align: center;
}
.logo { width: 780px; max-width: 100%; }
.logo img { display: block; width: 100%; }
.domain {
  padding: 4px 14px;
  background: var(--overlay);
  color: var(--cream);
  font-size: 15px;
  letter-spacing: 0.08em;
}

/* 羊皮紙の張り紙：紙は、うしろの ::after に描く（張り紙そのものを切りぬくと、釘まで切れるため）。釘は ::before */
.card {
  position: relative;
  isolation: isolate;
  padding: var(--card-pad);
  margin-bottom: 26px;
}
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 80% 18%, var(--paper-spot-a), transparent 30%),
    radial-gradient(circle at 20% 85%, var(--paper-spot-b), transparent 28%),
    radial-gradient(ellipse at 50% 50%, var(--paper) 50%, var(--paper-edge) 100%);
  clip-path: var(--paper-outline);
}
.card::before {
  content: "";
  position: absolute;
  top: -4px;
  left: 50%;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #9a9a9a, #3b3b3b 60%, #1e1e1e);
  box-shadow: 0 2px 2px rgba(0, 0, 0, 0.5);
}
.card.center { text-align: center; }

h2, h3, .headline, .story, ruby {
  font-family: var(--font-head);
  font-weight: 700;
}
.headline {
  margin-bottom: 10px;
  font-size: var(--head-size);
  line-height: 1.4;
  text-align: center;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.headline.tight { margin-bottom: 6px; }
.lead { font-size: 16px; line-height: 1.9; }
.story { font-size: 16px; line-height: 1.9; }

/* しくみの図 */
.how-lead {
  max-width: 680px;
  margin: 0 auto 20px;
  font-size: 15px;
  line-height: 1.8;
  text-align: center;
}
.scroll-hint {
  display: none;
  margin-bottom: 6px;
  font-size: 12px;
  text-align: center;
}
.diagram-scroll { overflow-x: auto; }
.diagram {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px minmax(0, 1fr) 72px minmax(0, 1fr);
  grid-template-rows: auto;
  row-gap: 10px;
  min-width: 880px;
  max-width: 1100px;
  margin: 0 auto;
}
.c1 { grid-column: 1; }
.c2 { grid-column: 2; }
.c3 { grid-column: 3; }
.c4 { grid-column: 4; }
.c5 { grid-column: 5; }
.r1 { grid-row: 1; }
.r2 { grid-row: 2; }
.r3 { grid-row: 3; }
.r4 { grid-row: 4; }
.r5 { grid-row: 5; }
.r6 { grid-row: 6; }
.r7 { grid-row: 7; }
.r8 { grid-row: 8; }
.r1-3 { grid-row: 1 / 3; }
.r3-9 { grid-row: 3 / 9; }
.r4-6 { grid-row: 4 / 6; }
.r6-8 { grid-row: 6 / 8; }

.zone {
  border: 1px dashed var(--line-dash);
  border-radius: 10px;
  z-index: 0;
}
.zone.blue { background: rgba(70, 110, 160, 0.12); }
.zone.purple { background: rgba(120, 80, 150, 0.12); }
.zone.green { background: rgba(70, 130, 80, 0.12); }

.who {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 12px 4px;
  text-align: center;
}
.who.bottom { align-self: end; }
.who img {
  flex: 0 0 144px;
  width: 144px;
  height: 144px;
  object-fit: contain;
  object-position: bottom;
}
.who h3 { margin-bottom: 6px; font-size: 19px; }

.note {
  position: relative;
  z-index: 1;
  margin: 0 12px;
  padding: 10px 12px;
  background: var(--note);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.6;
  text-align: left;
}
.note.wish { align-self: stretch; margin-bottom: 12px; }
.note.first { align-self: start; margin-top: 12px; }
.note.last { align-self: start; margin-bottom: 12px; }
.note.middle {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
}
.num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--cream-light);
  font-size: 13px;
  font-weight: 700;
  vertical-align: 1px;
}
.arrow {
  position: relative;
  z-index: 1;
  align-self: center;
  display: flex;
  justify-content: center;
  margin: 0 -12px;
}
.arrow svg { display: block; }
.shot {
  position: relative;
  z-index: 1;
  align-self: start;
  margin: 12px;
}
.shot img {
  display: block;
  width: 100%;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}
.legend { margin-top: 14px; font-size: 13px; text-align: center; }
.callout {
  max-width: 760px;
  margin: 22px auto 0;
  padding: 12px 18px;
  border: 1px dashed var(--link);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.8;
}

/* あなたはどっちのタイプですか？ */
.type {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}
.type-figure {
  display: block;
  flex: 0 0 auto;
  width: auto;
  height: 300px;
}
.type-body { flex: 1 1 auto; align-self: center; }
.type-body .headline { margin-bottom: 16px; }
.type-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
}
.big-button {
  display: inline-block;
  padding: 16px 28px;
  font-size: 17px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}
.big-button ruby { font-size: 28px; ruby-position: over; }
.big-button rt {
  padding-bottom: 2px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.04em;
}
.big-button span { display: block; font-size: 13px; font-weight: 400; }
.big-button.brass {
  background: linear-gradient(#5e4418, #2e1e08);
  color: #f0cf6a;
  letter-spacing: 0.04em;
  border: 2px solid #8a6a24;
  box-shadow: inset 0 1px 0 rgba(255, 230, 160, 0.35), 0 2px 0 #120802;
}
.big-button.iron {
  background: linear-gradient(#4a4440, #2a2624);
  color: #e6e0d8;
  border: 2px solid #1d1a18;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.big-button:hover { filter: brightness(1.15); }
.big-button.brass:hover { color: #f0cf6a; }
.big-button.iron:hover { color: #e6e0d8; }
.big-button:focus-visible, .diagram-scroll:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* いちばん下の2枚（版ごとの知らせと、運営者情報） */
.two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  align-items: stretch;
}
.two .card { margin-bottom: 0; }
.card.small { padding: 22px 26px 22px; font-size: 14px; }
.card.small h2 { margin-bottom: 12px; font-size: 20px; }
.about div {
  display: flex;
  gap: 12px;
  padding: 6px 0;
  border-top: 1px solid var(--line-soft);
}
.about dt { flex: 0 0 96px; font-weight: 700; }

footer {
  position: relative;
  z-index: 1;
  padding: 18px 24px;
  background: var(--wood-dark);
  border-top: 3px solid var(--gold);
  color: var(--cream);
  font-size: 13px;
  text-align: center;
}

/* スマホの幅 */
@media (max-width: 600px) {
  :root {
    --board-top: 110px;
    --board-pad-top: 14px;
    --board-pad-side: 8px;
    --board-pad-bottom: 20px;
    --board-out-side: 22px;
    --board-legs: 70px;
    --card-pad: 22px 14px 20px;
    --head-size: 23px;
  }
  main { padding: 0 8px; }
  .top { gap: 10px; margin-bottom: 20px; }
  .card { margin-bottom: 22px; }
  .scroll-hint { display: block; }
  .type { flex-wrap: wrap; justify-content: center; }
  .type-figure { height: 170px; }
  .type-body { order: 3; flex-basis: 100%; }
  .type-buttons { gap: 14px; }
  .big-button { width: 100%; }
  .two { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .card.small { padding: 20px 14px 18px; }
}
