.office-heading {
  position: absolute;
  top: clamp(18px, 3vw, 48px);
  left: 51.5%;
  width: min(38%, 380px);
  min-width: min(260px, 41%);
  aspect-ratio: 2.45;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8px 14px;
  isolation: isolate;
  transform: translateX(-50%);
  text-align: center;
  color: #492811;

}
/* Clip the baked-in checkerboard around the board and its two ropes. */
.office-heading::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -47% -12.5% -25%;
  background: url("/assets/office-title-sign.jpg") center / 100% 100% no-repeat;
  clip-path: polygon(
    10% 29%, 10.3% 27.4%, 16.2% 27.4%, 16.3% 25.3%,
    16.7% 24.5%, 16.75% 0, 17.5% 0, 17.55% 23.4%,
    18.1% 22.4%, 18.55% 23%, 17.9% 24.9%, 18% 27.4%,
    81.9% 27.4%, 82% 25%, 81.45% 23%, 81.9% 22.4%,
    82.45% 23.4%, 82.45% 0, 83.25% 0, 83.25% 24.5%,
    83.7% 25.3%, 83.8% 27.4%, 89.7% 27.4%, 89.95% 29%,
    89.95% 84%, 89.7% 85.5%, 10.3% 85.5%, 10% 84%
  );
}
/* セクションに来たら、天井側を支点に数秒揺れて止まる */
.office-heading.is-swaying {
  transform-origin: 50% -47%;
  animation: office-sign-sway 3.2s ease-in-out both;
}
@keyframes office-sign-sway {
  0%, 100% { transform: translateX(-50%) rotate(0deg); }
  12% { transform: translateX(-50%) rotate(1.8deg); }
  28% { transform: translateX(-50%) rotate(-1.5deg); }
  44% { transform: translateX(-50%) rotate(1.1deg); }
  60% { transform: translateX(-50%) rotate(-0.75deg); }
  76% { transform: translateX(-50%) rotate(0.4deg); }
  90% { transform: translateX(-50%) rotate(-0.15deg); }
}
@media (prefers-reduced-motion: reduce) {
  .office-heading.is-swaying { animation: none; }
}
.office-heading .office-lead {
  margin: 0 0 2px;
}
.office-title {
  margin: 0 0 6px;
  text-align: center;
  font-family: "Zen Kaku Gothic New", sans-serif;
  font-size: clamp(24px, 3vw, 34px);
}
.office-title-kana { letter-spacing: -0.045em; }
.office-title-kana-tight { letter-spacing: -0.08em; }
.office-instruction {
  text-align: center;
  margin: 0;
}
.office-scene {
  position: relative;
  /* The seven characters span roughly 30%–73% of the illustration. */
  width: min(2381.4px, calc(100% / 0.43));
  left: 50%;
  transform: translateX(-51.5%);
}
.office-illustration,
.office-illustration img {
  display: block;
  width: 100%;
  height: auto;
}
/* 仕事中の仲間が考えていること。絵と文字を分け、左右反転は絵だけにする */
.office-thought {
  position: absolute;
  z-index: 2;
  left: var(--x);
  top: var(--y);
  width: 130px;
  aspect-ratio: 800 / 736;
  transform: translate(-7%, calc(-97% - 4px));
  color: #492811;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  text-align: center;
  white-space: pre-line;
  word-break: keep-all;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.office-thought.is-flipped { transform: translate(-93%, calc(-97% - 4px)); }
.office-thought.is-visible { opacity: 1; }
.office-thought::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("/assets/office-thought-bubble.webp") center / 100% 100% no-repeat;
}
.office-thought.is-flipped::before { transform: scaleX(-1); }
.office-thought span {
  position: absolute;
  /* 雲の本体の範囲(小さな丸を除く)。左右が同じなので反転しても変わらない */
  inset: 1.6% 1.5% 23.1%;
  display: flex;
  align-items: center;
  justify-content: center;
}
@media (width < 600px) {
  .office-thought { width: 124px; }
}
.office-labels button,
.office-profile button {
  border: 1px solid #9e7654;
  border-radius: 999px;
  background: #fff4db;
  color: #492811;
  padding: 6px 12px;
  min-height: 44px;
  font: inherit;
  cursor: pointer;
}
.office-labels button:hover,
.office-profile button:hover { background: #f3dfb7; }
.office-labels button:focus-visible,
.office-profile button:focus-visible { outline: 2px solid #436b2c; outline-offset: 2px; }
.office-profile {
  box-sizing: border-box;
  width: min(680px, calc(100% - 32px));
  padding: 32px;
  border: 1px solid #ba864c;
  border-radius: 24px;
  background: radial-gradient(ellipse at 25% 15%, #fffaea, #fff3d6);
  color: #492811;
  box-shadow: 0 16px 48px rgb(45 27 12 / 25%);
}
#office-profile-7,
#office-profile-7 .office-profile-portrait {
  background: #fff;
}
.office-profile[open] {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  align-items: center;
  gap: 24px;
}
.office-profile::backdrop { background: rgb(32 26 16 / 55%); }
.office-profile form {
  position: absolute;
  top: 12px;
  right: 12px;
  margin: 0;
}
.office-profile button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
}
.office-profile-portrait {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  background: radial-gradient(circle closest-side, #dce3b9 55%, transparent 100%);
}
.office-profile-portrait img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 248px;
  object-fit: contain;
}
.office-profile-copy { padding-top: 16px; }
.office-profile h3 {
  margin: 0 0 6px;
  font-size: clamp(24px, 4vw, 32px);
  line-height: 1.15;
}
.office-profile strong {
  display: block;
  color: #3b612d;
  font-size: 1.125rem;
}
.office-profile p {
  margin: 14px 0 0;
  padding-top: 14px;
  border-top: 1px solid #cfaa77;
  line-height: 1.65;
}
.office-profile-preferences {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 5px 12px;
  margin: 14px 0 0;
  font-size: 0.875rem;
  line-height: 1.55;
}
.office-profile-preferences dt {
  color: #3b612d;
  font-weight: 700;
}
.office-profile-preferences dd { margin: 0; }
@media (width < 560px) {
  .office-profile { padding: 22px; }
  .office-profile[open] { grid-template-columns: 1fr; gap: 14px; }
  .office-profile-portrait { width: min(180px, 65%); margin-inline: auto; }
  .office-profile-portrait img { max-height: 180px; }
  .office-profile-copy { padding-top: 0; }
}
@media (min-width: 1100px) {
  .office-labels button {
    position: absolute;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 38px;
    padding: 4px 9px;
    left: var(--x);
    top: var(--y);
    transform: translate(-50%, -50%);
    box-shadow: 0 2px 5px rgb(73 40 17 / 22%);
  }
  .office-labels button::after {
    content: "";
    position: absolute;
    inset: -3px 0;
  }
  .office-labels button::before {
    content: "";
    width: 22px;
    height: 22px;
    flex: none;
    border-radius: 50%;
    background:
      linear-gradient(#fff, #fff) center / 8px 1px no-repeat,
      linear-gradient(#fff, #fff) center / 1px 8px no-repeat,
      var(--fv-green, #4e8a2c);
  }
}
@media (width < 1100px) {
  .office-labels {
    position: relative;
    left: 51.5%;
    width: 43%;
    transform: translateX(-50%);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px 0;
  }
}

.top-section.forest-office {
  padding-block: 0;
  overflow: clip;
}

@media (width < 600px) {
  .office-scene {
    width: 100%;
    left: auto;
    transform: none;
  }
  .office-heading {
    top: 12px;
    left: 50%;
    width: min(78%, 320px);
    min-width: 0;
  }
  .office-labels {
    left: auto;
    width: 100%;
    transform: none;
  }
  .office-heading .office-lead { font-size: 11px; }
  .office-title { font-size: clamp(15px, 4.3vw, 24px); }
  .office-instruction { font-size: clamp(11px, 3vw, 14px); }
}

/* 2026-11-15 りささん「キャラ名のところ白背景でセルみたいな形で名前配置できないかな？ボタンじゃなくて」：
   絵の下に名前を並べる幅(1100px未満)では、丸いボタンをやめて表のマス目に。線は1px #e8e5e0、角丸・影なし。
   スマホ(600px以下)は4列×2行(8つ目は空のマス)、601px以上は7列×1行。押せることが分かるよう、ホバーと押したときだけ薄い緑 */
@media (width < 1100px) {
  .office-labels {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0;
    padding: 0;
    margin-top: 0;
    border-top: 1px solid #e8e5e0;
    background: #fff;
  }
  /* 表は画面の端まで伸ばし、左右の外枠の線は付けない(りささん「せるとイラストの間が空いてる」で絵のすぐ下に) */
  html body .office-labels button:nth-child(7n) { border-right: 0; }
  html body .office-labels button {
    min-height: 44px;
    padding: 6px 4px;
    border: 0;
    border-radius: 0;
    border-right: 1px solid #e8e5e0;
    border-bottom: 1px solid #e8e5e0;
    border-radius: 0;
    background: #fff;
    box-shadow: none;
    white-space: nowrap;
  }
  html body .office-labels button:hover,
  html body .office-labels button:active { background: #f4f6dc; }
  .office-labels button:focus-visible { outline-offset: -3px; }
}
@media (width <= 600px) {
  .office-labels { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  html body .office-labels button:nth-child(7n) { border-right: 1px solid #e8e5e0; }
  html body .office-labels button:nth-child(4n) { border-right: 0; }
  /* 8つ目のマスは空けて、線だけ引いて表の形を保つ */
  .office-labels::after { content: ""; border-bottom: 1px solid #e8e5e0; background: #fff; }
}

/* 2026-11-15 りささん「PC以外はもくもくのフレームに入ったコメントズレるからコメント外そう」：1024px未満は考えごとの吹き出しを出さない */
@media (width < 1024px) {
  .office-thought { display: none; }
}

/* 2026-11-15 りささん「看板をもっと大きくしたいし、タイトル名も大きくしたい」(PC以外)：
   スマホ(600px未満、縦長の絵)は看板を画面幅の88%に。看板の板の上端は要素の上端と同じ位置なので、上から16px空けて切れないようにする。
   600〜1023px(横長の絵を広く見せる幅)は、88%だと絵の上半分が隠れるので、画面幅の62%(最大620px)にとどめる。
   「キャラクター紹介」は看板の幅の約6割の長さに。英字と説明文の大きさはそのまま */
@media (width < 600px) {
  .office-heading { top: 16px; width: 88vw; max-width: none; padding: 10px 18px; }
  .office-title { font-size: 6.8vw; margin-bottom: 4px; }
}
@media (600px <= width < 1024px) {
  .office-heading { width: min(44vw, 460px); min-width: 0; max-width: none; } /* りささん「看板は小さくしたい」62vw→44vw */
  .office-title { font-size: min(4.6vw, 46px); margin-bottom: 4px; }
}

/* 2026-11-16 りささん「バツの色を丸の色に合わせて」：プロフィールの閉じるボタンの×を、丸の線と同じ茶色(#9e7654)・同じ1pxの見た目に */
.office-profile form button { color: #9e7654; }
.office-profile form button svg path { vector-effect: non-scaling-stroke; stroke-width: 1.2px; }

/* 2026-11-21 公開前の最終確認：600px前後で看板が細くなり「キャラクター紹／介」と1文字落ちていた。
   題名は1行のまま、看板の中の幅に合わせて文字を小さくする(cqi は看板の中の幅に対する割合) */
.office-heading { container-type: inline-size; }
.office-title { white-space: nowrap; }
