/* ========================================
   理念ページ：1枚画像＋透明クリック領域
======================================== */

body.rinen-modal-open {
  overflow: hidden;
}

.rinen-page-title {
  padding: 38px 18px 30px;
  text-align: center;
  background:
    radial-gradient(circle at 12% 20%, rgba(138, 185, 83, 0.16), transparent 24%),
    radial-gradient(circle at 88% 20%, rgba(138, 185, 83, 0.16), transparent 24%),
    #f3f8ed;
}

.rinen-page-title__en {
  margin: 0 0 8px;
  color: #16834a;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.rinen-page-title h1 {
  margin: 0;
  color: #174d2b;
  font-size: clamp(25px, 4vw, 44px);
  line-height: 1.4;
}

.rinen-page-title > p:last-child {
  max-width: 720px;
  margin: 13px auto 0;
  color: #4f5e54;
  font-size: 15px;
  line-height: 1.8;
}

/* ========================================
   画像マップ
======================================== */

.rinen-image-section {
  padding: 30px 12px 66px;
  background:
    radial-gradient(circle at 50% 45%, rgba(235, 244, 226, 0.55), transparent 42%),
    #fffdf8;
}

.rinen-image-section__inner {
  width: min(780px, 100%);
  margin: 0 auto;
}

.rinen-image-map {
  position: relative;
  width: 100%;
  margin: 0 auto;
  overflow: hidden;
  background: #fffdf8;
  border-radius: 22px;
  box-shadow: 0 18px 48px rgba(52, 75, 54, 0.12);
}

.rinen-image-map__image {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
}

/* ========================================
   透明クリック領域
======================================== */

.rinen-hotspot {
  position: absolute;
  z-index: 2;
  display: block;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 45%;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.rinen-hotspot::after {
  content: "";
  position: absolute;
  inset: 2%;
  border: 4px solid transparent;
  border-radius: inherit;
  background: transparent;
  transition:
    border-color 0.2s ease,
    background-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
  .rinen-hotspot:hover::after {
    border-color: rgba(22, 131, 74, 0.75);
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 0 5px rgba(22, 131, 74, 0.12);
    transform: scale(1.02);
  }
}

.rinen-hotspot:focus-visible {
  outline: none;
}

.rinen-hotspot:focus-visible::after {
  border-color: #f2b84b;
  background: rgba(255, 255, 255, 0.18);
  box-shadow: 0 0 0 5px rgba(242, 184, 75, 0.3);
}

/*
  クリック領域は画像サイズに対する割合で指定。
  画像がスマホ幅へ縮小されても位置がずれません。
*/

.rinen-hotspot--1 {
  left: 34.5%;
  top: 0%;
  width: 31.5%;
  height: 25.5%;
}

.rinen-hotspot--2 {
  left: 2.5%;
  top: 11.5%;
  width: 34%;
  height: 25.5%;
}

.rinen-hotspot--3 {
  left: 64.5%;
  top: 11.5%;
  width: 33%;
  height: 25.5%;
}

.rinen-hotspot--4 {
  left: 0.5%;
  top: 45.5%;
  width: 30.5%;
  height: 24.5%;
}

.rinen-hotspot--5 {
  left: 68%;
  top: 45.5%;
  width: 31%;
  height: 24.5%;
}

.rinen-hotspot--6 {
  left: 17%;
  top: 68.5%;
  width: 31%;
  height: 23.5%;
}

.rinen-hotspot--7 {
  left: 51.5%;
  top: 68.5%;
  width: 31%;
  height: 23.5%;
}

/* ========================================
   ポップアップ
======================================== */

.rinen-modal {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding:
    max(10px, env(safe-area-inset-top))
    max(10px, env(safe-area-inset-right))
    max(10px, env(safe-area-inset-bottom))
    max(10px, env(safe-area-inset-left));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.25s ease,
    visibility 0.25s ease;
}

.rinen-modal.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.rinen-modal__overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  background: rgba(16, 38, 24, 0.78);
  border: 0;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.rinen-modal__panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(820px, 100%);
  height: auto;
  max-height: calc(100dvh - 20px);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #fffdf8;
  border-radius: 24px;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.36);
  transform: translateY(18px) scale(0.97);
  transition: transform 0.28s ease;
}

.rinen-modal__panel.is-tall {
  height: min(90dvh, 860px);
}

.rinen-modal.open .rinen-modal__panel {
  transform: translateY(0) scale(1);
}

.rinen-modal__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex: 0 0 auto;
  padding: 17px 20px 15px;
  color: #fff;
  background:
    radial-gradient(circle at 90% 18%, rgba(255, 255, 255, 0.14), transparent 24%),
    #176644;
}

.rinen-modal__header > div {
  min-width: 0;
}

.rinen-modal__label {
  margin: 0 0 4px;
  color: #d5eddd;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.15em;
}

.rinen-modal__header h2 {
  margin: 0;
  color: #fff;
  font-size: clamp(20px, 3vw, 28px);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.rinen-modal__close {
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  padding: 0 0 2px;
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 50%;
  font-family: inherit;
  font-size: 29px;
  line-height: 1;
  cursor: pointer;
}

.rinen-modal__conversation {
  display: grid;
  grid-template-columns: minmax(150px, 210px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  padding: 24px;
  overflow: hidden;
  background:
    radial-gradient(
      circle at 9% 18%,
      rgba(121, 168, 78, 0.11),
      transparent 25%
    ),
    #fffdf8;
}

.rinen-modal__speaker {
  position: sticky;
  top: 0;
  margin: 0;
  text-align: center;
}

.rinen-modal__speaker-frame {
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: #e8efe7;
  border: 7px solid #fff;
  border-radius: 24px;
  box-shadow:
    0 16px 34px rgba(49, 75, 51, 0.18),
    0 0 0 2px #d5ded2;
  transform: rotate(-1.5deg);
}

.rinen-modal__speaker-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rinen-modal__speaker figcaption {
  display: inline-block;
  margin-top: 10px;
  padding: 5px 12px;
  color: #315d38;
  background: #fff;
  border: 1px solid #d8e5da;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.rinen-modal__speech {
  position: relative;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  background: #fff;
  border: 4px solid #176644;
  border-radius: 34px;
  box-shadow: 0 15px 34px rgba(35, 63, 43, 0.12);
}

.rinen-modal__speech-tail {
  position: absolute;
  z-index: 2;
  left: -18px;
  top: 58px;
  width: 32px;
  height: 32px;
  background: #fff;
  border-left: 4px solid #176644;
  border-bottom: 4px solid #176644;
  transform: rotate(45deg);
}

.rinen-modal__speech::before {
  content: "";
  position: absolute;
  z-index: 1;
  left: -34px;
  top: 76px;
  width: 17px;
  height: 17px;
  background: #fff;
  border: 3px solid #176644;
  border-radius: 50%;
}

.rinen-modal__speech::after {
  content: "";
  position: absolute;
  z-index: 1;
  left: -52px;
  top: 92px;
  width: 10px;
  height: 10px;
  background: #fff;
  border: 3px solid #176644;
  border-radius: 50%;
}

.rinen-modal__body {
  position: relative;
  z-index: 2;
  width: 100%;
  min-height: 180px;
  max-height: calc(100dvh - 235px);
  padding: 30px 32px;
  overflow-x: hidden;
  overflow-y: auto;
  color: #354139;
  font-size: 16px;
  line-height: 2;
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

.rinen-modal__panel.is-tall .rinen-modal__body {
  height: 100%;
  max-height: none;
}

.rinen-modal__body p {
  margin: 0 0 20px;
}

.rinen-modal__body ul,
.rinen-modal__body ol {
  margin: 0 0 22px;
  padding-left: 1.5em;
}

.rinen-modal__body li {
  margin-bottom: 10px;
}

.rinen-modal__catch {
  margin-bottom: 24px !important;
  color: #176644;
  font-size: clamp(22px, 4vw, 31px);
  font-weight: 800;
  text-align: center;
}

.rinen-modal__body .rinen-modal__photo {
  display: none;
}

.rinen-modal__typing-cursor {
  display: inline-block;
  width: 0.55em;
  height: 1.1em;
  margin-left: 3px;
  vertical-align: -0.1em;
  background: #176644;
  animation: rinenTypingCursor 0.75s steps(1) infinite;
}

@keyframes rinenTypingCursor {
  0%,
  49% {
    opacity: 1;
  }

  50%,
  100% {
    opacity: 0;
  }
}

.rinen-modal__footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  flex: 0 0 auto;
  padding:
    11px
    18px
    calc(13px + env(safe-area-inset-bottom));
  background: #f5f8f1;
  border-top: 1px solid #dfe7dd;
}

.rinen-modal__nav-button {
  min-height: 44px;
  padding: 9px 18px;
  color: #fff;
  background: #176644;
  border: 0;
  border-radius: 999px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.rinen-modal__nav-button:first-child {
  justify-self: start;
}

.rinen-modal__nav-button:last-child {
  justify-self: end;
}

.rinen-modal__nav-button:disabled {
  opacity: 0.35;
  cursor: default;
}

.rinen-modal__progress {
  margin: 0;
  color: #536158;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

/* ========================================
   スマホ
======================================== */

@media screen and (max-width: 767px) {
  .rinen-page-title {
    padding: 29px 14px 24px;
  }

  .rinen-page-title__en {
    font-size: 10px;
  }

  .rinen-page-title h1 {
    font-size: 24px;
  }

  .rinen-page-title > p:last-child {
    font-size: 13px;
    text-align: left;
  }

  .rinen-image-section {
    padding: 18px 0 42px;
  }

  .rinen-image-section__inner {
    width: 100%;
  }

  .rinen-image-map {
    width: 100%;
    border-radius: 0;
    box-shadow: none;
  }

  .rinen-hotspot::after {
    border-width: 3px;
  }

  .rinen-modal {
    padding: 5px;
  }

  .rinen-modal__panel,
  .rinen-modal__panel.is-tall {
    width: 100%;
    height: calc(100dvh - 10px);
    max-height: none;
    border-radius: 15px;
  }

  .rinen-modal__header {
    padding: 13px 12px 11px;
  }

  .rinen-modal__header h2 {
    font-size: 17px;
  }

  .rinen-modal__close {
    flex-basis: 38px;
    width: 38px;
    height: 38px;
    font-size: 25px;
  }

  .rinen-modal__speech {
    min-height: 0;
    margin: 12px 10px;
    border-width: 3px;
    border-radius: 22px;
  }

  .rinen-modal__speech::before {
    left: 30px;
    top: -13px;
    width: 24px;
    height: 24px;
    border-left-width: 3px;
    border-top-width: 3px;
  }


  .rinen-modal__conversation {
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 12px 10px;
  }

  .rinen-modal__speaker {
    position: sticky;
    top: 0;
  }

  .rinen-modal__speaker-frame {
    border-width: 4px;
    border-radius: 14px;
    transform: none;
  }

  .rinen-modal__speaker figcaption {
    margin-top: 6px;
    padding: 3px 6px;
    font-size: 9px;
  }

  .rinen-modal__speech {
    border-width: 3px;
    border-radius: 22px;
  }

  .rinen-modal__speech-tail {
    left: -12px;
    top: 30px;
    width: 22px;
    height: 22px;
    border-left-width: 3px;
    border-bottom-width: 3px;
  }

  .rinen-modal__speech::before,
  .rinen-modal__speech::after {
    display: none;
  }

  .rinen-modal__body {
    height: 100%;
    min-height: 0;
    max-height: none;
    padding: 22px 16px 24px;
    font-size: 14px;
    line-height: 1.85;
  }

  .rinen-modal__footer {
    padding:
      9px
      10px
      calc(10px + env(safe-area-inset-bottom));
  }

  .rinen-modal__nav-button {
    min-height: 40px;
    padding: 7px 12px;
    font-size: 12px;
  }

  .rinen-modal__progress {
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rinen-modal,
  .rinen-modal__panel {
    transition: none;
  }

  .rinen-modal__typing-cursor {
    animation: none;
  }
}

/* スクリーンリーダー専用 */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
