/* FQS_02 management-system page (食品安全マネジメントシステムの構築・運用支援).
   Extends page-food-inspection.css (shared layout/sidebar/FAQ) and
   page-quality-solution.css (qs-* layout, sidebar, checklist, section title). */

:root {
  --fqs-teal:        #008F8D;
  --fqs-teal-dark:   #006B68;
  --fqs-teal-mid:    #169A97;
  --fqs-teal-light:  #7EC8BF;
  --fqs-teal-mint:   #DDF0EF;
  --fqs-ink:         #061C3D;

  --fqs-red:         #F97E8D;
  --fqs-green:       #48BC7F;
  --fqs-yellow:      #F9E542;
  --fqs-blue:        #4C9DC9;
}

/* Overflow safety — long pdca-tails/text in the grid must not push the page horizontally. */
.fqs-pdca-card,
.fqs-arrows-card,
.fqs-numflow {
  max-width: 100%;
  overflow-x: clip;
  box-sizing: border-box;
}
@supports not (overflow-x: clip) {
  .fqs-pdca-card,
  .fqs-arrows-card,
  .fqs-numflow { overflow-x: hidden; }
}

/* ============================================================
   Override qs-checklist on FQS_02:
   - design uses plain centered heading (no green ellipse),
     2 separate bordered boxes side-by-side with check icon left.
   - CSS file is enqueued conditionally on the FQS template, so these
     overrides do not affect quality-solution.
   ============================================================ */
.fqs-page .qs-checkbox-section,
body.page-template-page-fqs-management-system .qs-checkbox-section {
  background: transparent;
  border-radius: 0;
  padding: 16px 0 28px;
  overflow: visible;
}
.fqs-page .qs-band-title,
body.page-template-page-fqs-management-system .qs-band-title {
  width: auto;
  margin: 0 0 24px;
  height: auto;
  border-radius: 0;
  background: transparent;
  color: var(--fqs-ink);
  font-weight: 700;
  font-size: 28px;
  line-height: 1.4;
  letter-spacing: -0.02em;
  display: block;
  padding: 0;
  text-align: center;
}
.fqs-page .qs-check-card,
body.page-template-page-fqs-management-system .qs-check-card {
  background: transparent;
  border-radius: 0;
  padding: 20px 0 0;     /* room for icon sticking out -20px above first row */
  margin: 0;
}
/* Figma Frame 1000008019 — row of 2 widgets, gap 26px */
.fqs-page .qs-check-list,
body.page-template-page-fqs-management-system .qs-check-list {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 26px;
  padding: 0;
  margin: 0;
  list-style: none;
}
/* Figma Widget — 437×132, white card, teal border + offset shadow */
.fqs-page .qs-check-list li,
body.page-template-page-fqs-management-system .qs-check-list li {
  position: relative;
  isolation: isolate;
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px 20px;
  min-height: 132px;
  background: #FFFFFF;
  border: 1px solid var(--fqs-teal);
  border-radius: 8px;
  box-shadow: 2px 3px 0 var(--fqs-teal);
  box-sizing: border-box;
  gap: 0;
}
/* Figma Frame 1000008018 — 48×48 white circle, teal border, top:-20 left:20 */
.fqs-page .qs-check-icon,
body.page-template-page-fqs-management-system .qs-check-icon {
  position: absolute;
  top: -20px;
  left: 20px;
  width: 48px;
  height: 48px;
  flex: none;
  margin: 0;
  padding: 7px;            /* (48 - 34) / 2 — inner check-mark renders at 34×34 */
  background: #FFFFFF;
  border: 1px solid var(--fqs-teal);
  border-radius: 50%;
  box-sizing: border-box;
  z-index: 1;
}
/* Figma H4 — Noto Sans JP 700 / 16 / 24, letter-spacing -0.02em */
.fqs-page .qs-check-text,
body.page-template-page-fqs-management-system .qs-check-text {
  flex: 1 1 auto;
  margin: 0;
  font-family: 'Noto Sans JP', sans-serif;
  font-weight: 700;
  font-size: 16px;
  line-height: 24px;
  letter-spacing: -0.02em;
  color: #061C3D;
  text-align: left;
  z-index: 0;
}
@media (max-width: 768px) {
  .fqs-page .qs-check-list,
  body.page-template-page-fqs-management-system .qs-check-list {
    flex-direction: column;
    gap: 32px;             /* extra room so icon doesn't overlap previous card */
  }
  .fqs-page .qs-band-title,
  body.page-template-page-fqs-management-system .qs-band-title {
    font-size: 20px;
  }
}

/* ============================================================
   fqs-intro — hero image as background, white card overlay top-left
   (Figma: container 900×377, card 526×152 padding 16px, body 16/24)
   ============================================================ */
.fqs-intro-section { margin-bottom: 24px; }

.fqs-intro-grid {
  position: relative;
  width: 100%;
  max-width: 900px;
  aspect-ratio: 900 / 377;
  margin: 0 auto;
  border-radius: 8px;
  overflow: hidden;
}
.fqs-intro-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  display: block;
}
.fqs-intro-card {
  position: absolute;
  top: 0;
  left: 0;
  width: 58.444%;       /* 526 / 900 */
  max-width: 526px;
  padding: 16px;
  background: #FFFFFF;
  box-shadow: 3px 4px 4px rgba(0, 0, 0, 0.33);
  backdrop-filter: blur(4.5px);
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.fqs-intro-paragraph {
  margin: 0;
  font-family: 'Noto Sans JP', sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 24px;
  color: #061C3D;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* ============================================================
   fqs-section-title — 構築支援 / 運用支援
   (large dark title centered + sub paragraph)
   ============================================================ */
.fqs-section-title-block {
  text-align: center;
  margin: 0;
}
.fqs-section-title {
  margin: 0;
  font-weight: 700;
  font-size: 36px;
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: var(--fqs-ink);
}
.fqs-section-sub {
  margin: 12px 0 0;
  font-weight: 500;
  font-size: 16px;
  line-height: 1.85;
  color: var(--fqs-ink);
}

/* ============================================================
   fqs-process-arrows — 認証取得までのイメージ
   (4 stacked chevron arrows pointing down, gradient teal)
   ============================================================ */
.fqs-arrows-section { margin: 16px 0; }
.fqs-arrows-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 50px rgba(0, 0, 0, 0.15);
  padding: 44px 60px;
}
.fqs-arrows-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.fqs-arrow-row {
  display: grid;
  grid-template-columns: 172px 1fr;
  gap: 36px;
  align-items: center;
}
/* Pull each arrow up so its V-tail nearly meets the next item's V-notch
   apex, leaving only a thin white sliver between chevrons. */
.fqs-arrow-row + .fqs-arrow-row {
  margin-top: -38px;
}
.fqs-arrow-shape {
  position: relative;
  width: 172px;
  height: 158px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #fff;
  /* V-cut top (42px notch into top) + V-tail bottom (42px point) */
  clip-path: polygon(0 0, 50% 26.6%, 100% 0, 100% 73.4%, 50% 100%, 0 73.4%);
}
/* First item: flat top + V-tail bottom (nothing above to interlock with) */
.fqs-arrow-row:first-child .fqs-arrow-shape {
  clip-path: polygon(0 0, 100% 0, 100% 73.4%, 50% 100%, 0 73.4%);
}
/* Last item: V-cut top + flat bottom */
.fqs-arrow-row:last-child .fqs-arrow-shape {
  clip-path: polygon(0 0, 50% 26.6%, 100% 0, 100% 100%, 0 100%);
}
.fqs-arrow-shape-text {
  font-family: 'Noto Sans JP', sans-serif;
  font-weight: 700;
  font-size: 20px;
  line-height: 32px;
  letter-spacing: -0.02em;
  padding-bottom: 30px;
}
.fqs-arrow-shade-1 { background: #0F7572; }
.fqs-arrow-shade-2 { background: #169A97; }
.fqs-arrow-shade-3 { background: #7EC8BF; }
.fqs-arrow-shade-4 { background: #DDF0EF; }
/* Middle items (have V-cut top): pull text further down out of notch */
.fqs-arrow-shade-2 .fqs-arrow-shape-text,
.fqs-arrow-shade-3 .fqs-arrow-shape-text {
  padding-top: 30px;
  padding-bottom: 30px;
}
.fqs-arrow-shade-4 .fqs-arrow-shape-text {
  color: #1C787C;
  padding-bottom: 0;
  padding-top: 30px;
}
.fqs-arrow-desc {
  margin: 0;
  font-weight: 500;
  font-size: 15px;
  line-height: 1.85;
  color: var(--fqs-ink);
  overflow-wrap: anywhere;
  word-break: break-word;
  min-width: 0;
}

/* ============================================================
   fqs-pdca — 支援の例 (PDCA wheel + 4 corner colored callout boxes)
   ============================================================ */
.fqs-pdca-section { margin: 16px 0; }
.fqs-pdca-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 50px rgba(0, 0, 0, 0.15);
  padding: 48px 56px;
}
.fqs-pdca-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 16px 28px;
  align-items: center;
  justify-items: center;
}
.fqs-pdca-pos-tl { grid-column: 1; grid-row: 1; justify-self: end; }
.fqs-pdca-pos-tr { grid-column: 3; grid-row: 1; justify-self: start; }
.fqs-pdca-pos-bl { grid-column: 1; grid-row: 2; justify-self: end; }
.fqs-pdca-pos-br { grid-column: 3; grid-row: 2; justify-self: start; }
.fqs-pdca-center {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fqs-pdca-center img {
  display: block;
  max-width: 280px;
  width: 100%;
  height: auto;
}
.fqs-pdca-box {
  position: relative;
  background: #fff;
  border: 2px solid currentColor;
  border-radius: 10px;
  padding: 12px 16px;
  max-width: 240px;
}
/* Pink speech-bubble tail on top-left box (right edge, 30px from top) */
.fqs-pdca-box.fqs-pdca-red.fqs-pdca-pos-tl::after {
  content: "";
  position: absolute;
  right: -40px;
  top: 20px;
  width: 50px;
  height: 29px;
  background: url('../../images/path_pink.png') center / contain no-repeat;
  pointer-events: none;
}
/* Green speech-bubble tail on top-right box (left edge, 20px from top) */
.fqs-pdca-box.fqs-pdca-green.fqs-pdca-pos-tr::after {
  content: "";
  position: absolute;
  left: -40px;
  top: 30px;
  width: 50px;
  height: 29px;
  background: url('../../images/path_green.png') center / contain no-repeat;
  pointer-events: none;
}
/* Yellow speech-bubble tail on bottom-left box (right edge) */
.fqs-pdca-box.fqs-pdca-yellow.fqs-pdca-pos-bl::after {
  content: "";
  position: absolute;
  right: -40px;
  top: 30px;
  width: 50px;
  height: 29px;
  background: url('../../images/path_yellow.png') center / contain no-repeat;
  pointer-events: none;
}
/* Blue speech-bubble tail on bottom-right box (left edge) */
.fqs-pdca-box.fqs-pdca-blue.fqs-pdca-pos-br::after {
  content: "";
  position: absolute;
  left: -40px;
  top: 40px;
  width: 50px;
  height: 29px;
  background: url('../../images/path_blue.png') center / contain no-repeat;
  pointer-events: none;
}
.fqs-pdca-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.fqs-pdca-item {
  position: relative;
  padding-left: 14px;
  font-weight: 500;
  font-size: 13px;
  line-height: 1.6;
  color: var(--fqs-ink);
  overflow-wrap: anywhere;
  word-break: break-word;
}
.fqs-pdca-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 6px;
  height: 6px;
  background: url('../../images/svg/point.svg') center / contain no-repeat;
}
.fqs-pdca-red    { color: var(--fqs-red); }
.fqs-pdca-green  { color: var(--fqs-green); }
.fqs-pdca-yellow { color: var(--fqs-yellow); }
.fqs-pdca-blue   { color: var(--fqs-blue); }

/* ============================================================
   fqs-numbered-flow — 運用支援実施の流れ
   (4 numbered cards with arrow between, teal border)
   ============================================================ */
.fqs-numflow-section { margin: 16px 0; }
.fqs-numflow {
  display: flex;
  flex-direction: column;
  gap: 63px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 50px rgba(0, 0, 0, 0.15);
  padding: 36px 44px;
}
.fqs-numflow-step {
  position: relative;
  display: grid;
  grid-template-columns: 60px 180px 1fr;
  gap: 24px;
  align-items: center;
  padding: 14px 24px;
  border: 2px solid var(--fqs-teal);
  border-radius: 8px;
  min-height: 76px;
}
.fqs-numflow-step:not(:first-child)::before {
  content: "";
  position: absolute;
  top: -50px;
  left: 50%;
  transform: translateX(-50%);
  width: 44px;
  height: 27px;
  background: url('../../images/svg/arrow_down.svg') center / contain no-repeat;
  opacity: 0.85;
}
.fqs-numflow-num {
  font-family: 'Work Sans', 'Noto Sans JP', sans-serif;
  font-weight: 700;
  font-size: 44px;
  line-height: 1;
  color: var(--fqs-teal);
  text-align: center;
}
.fqs-numflow-step-title {
  margin: 0;
  font-weight: 700;
  font-size: 18px;
  line-height: 1.35;
  color: var(--fqs-teal);
  overflow-wrap: anywhere;
  word-break: break-word;
  min-width: 0;
}
.fqs-numflow-step-desc {
  margin: 0;
  font-weight: 500;
  font-size: 14px;
  line-height: 1.85;
  color: var(--fqs-ink);
  overflow-wrap: anywhere;
  word-break: break-word;
  min-width: 0;
}

/* ============================================================
   fqs-experts — 担当者プロフィール (credentials closing)
   ============================================================ */
.fqs-experts-section { margin: 16px 0; }
.fqs-experts-text {
  margin: 0 0 6px;
  font-weight: 700;
  font-size: 16px;
  line-height: 1.85;
  color: var(--fqs-ink);
  overflow-wrap: anywhere;
  word-break: break-word;
}
.fqs-experts-text p {
  margin: 0 0 6px;
}
.fqs-experts-text p:last-child {
  margin-bottom: 0;
}
.fqs-experts-text:last-child { margin-bottom: 0; }
.fqs-experts-hl {
  color: var(--fqs-teal);
}

/* ============================================================
   Responsive
   ============================================================ */
/* Tablet / mid screens — tighten section paddings before sidebar collapses */
@media (max-width: 1024px) {
  .fqs-arrows-card { padding: 36px 32px; }
  .fqs-pdca-card { padding: 36px 32px; }
  .fqs-numflow { padding: 28px 28px; }
  .fqs-section-title { font-size: 30px; }
}

/* Intro & PDCA stack to single column once sidebar is about to collapse */
@media (max-width: 900px) {
  .fqs-intro-grid {
    aspect-ratio: auto;
    min-height: 280px;
  }
  .fqs-intro-card {
    position: static;
    width: 100%;
    max-width: 100%;
  }
  .fqs-intro-bg {
    position: relative;
    height: 220px;
  }
  .fqs-pdca-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    gap: 12px;
  }
  .fqs-pdca-pos-tl, .fqs-pdca-pos-tr, .fqs-pdca-pos-bl, .fqs-pdca-pos-br {
    grid-column: 1;
    grid-row: auto;
    justify-self: stretch;
  }
  .fqs-pdca-center {
    grid-column: 1;
    grid-row: auto;
  }
  .fqs-pdca-box { max-width: 100%; }
  .fqs-pdca-center img { max-width: 220px; }
  /* Speech-bubble tails point at the central PDCA image, but the grid has
     stacked to 1-col so tails lose context and overflow (right/left: -40px). Hide them. */
  .fqs-pdca-box.fqs-pdca-red.fqs-pdca-pos-tl::after,
  .fqs-pdca-box.fqs-pdca-green.fqs-pdca-pos-tr::after,
  .fqs-pdca-box.fqs-pdca-yellow.fqs-pdca-pos-bl::after,
  .fqs-pdca-box.fqs-pdca-blue.fqs-pdca-pos-br::after {
    display: none;
  }
}

/* Tablet portrait / large phone — sidebar collapses below content */
@media (max-width: 768px) {
  .fqs-section-title { font-size: 24px; }
  .fqs-section-sub { font-size: 14px; line-height: 1.7; }
  .fqs-intro-paragraph { font-size: 15px; line-height: 1.7; }
  .fqs-intro-card { padding: 14px; }

  .fqs-arrows-card { padding: 24px 18px; }
  .fqs-arrow-row {
    grid-template-columns: 120px 1fr;
    gap: 16px;
  }
  .fqs-arrow-row + .fqs-arrow-row { margin-top: -26px; }
  .fqs-arrow-shape { width: 120px; height: 110px; }
  .fqs-arrow-shape-text { font-size: 15px; line-height: 22px; padding-bottom: 20px; }
  .fqs-arrow-shade-4 .fqs-arrow-shape-text { padding-bottom: 0; padding-top: 20px; }
  .fqs-arrow-shade-2 .fqs-arrow-shape-text,
  .fqs-arrow-shade-3 .fqs-arrow-shape-text {
    padding-top: 20px;
    padding-bottom: 20px;
  }
  .fqs-arrow-desc { font-size: 13px; line-height: 1.7; }

  .fqs-pdca-card { padding: 24px 18px; }
  .fqs-pdca-center img { max-width: 200px; }
  .fqs-pdca-box { padding: 10px 14px; }
  .fqs-pdca-item { font-size: 12.5px; line-height: 1.55; }

  .fqs-numflow { padding: 24px 18px; gap: 36px; }
  .fqs-numflow-step {
    grid-template-columns: 44px 1fr;
    grid-template-rows: auto auto;
    gap: 8px 14px;
    padding: 14px 16px;
    min-height: 0;
  }
  .fqs-numflow-num { font-size: 32px; grid-row: 1 / span 2; }
  .fqs-numflow-step-title { grid-column: 2; grid-row: 1; font-size: 16px; }
  .fqs-numflow-step-desc { grid-column: 2; grid-row: 2; font-size: 13px; line-height: 1.7; }
  .fqs-numflow-step:not(:first-child)::before {
    top: -26px;
    width: 24px;
    height: 16px;
  }

  .fqs-experts-text { font-size: 14px; line-height: 1.75; }
}

/* Small phone (<= iPhone SE width) — squeeze paddings + drop arrow column */
@media (max-width: 480px) {
  .fqs-section-title { font-size: 20px; }
  .fqs-section-sub { font-size: 13px; }
  .fqs-intro-bg { height: 180px; }
  .fqs-intro-paragraph { font-size: 14px; }

  .fqs-arrows-card { padding: 18px 12px; }
  .fqs-arrow-row {
    grid-template-columns: 96px 1fr;
    gap: 12px;
  }
  .fqs-arrow-row + .fqs-arrow-row { margin-top: -22px; }
  .fqs-arrow-shape { width: 96px; height: 92px; }
  .fqs-arrow-shape-text { font-size: 13px; line-height: 18px; padding-bottom: 16px; }
  .fqs-arrow-shade-4 .fqs-arrow-shape-text { padding-bottom: 0; padding-top: 16px; }
  .fqs-arrow-shade-2 .fqs-arrow-shape-text,
  .fqs-arrow-shade-3 .fqs-arrow-shape-text {
    padding-top: 16px;
    padding-bottom: 16px;
  }
  .fqs-arrow-desc { font-size: 12.5px; }

  .fqs-pdca-card { padding: 18px 12px; }
  .fqs-pdca-center img { max-width: 180px; }

  .fqs-numflow { padding: 18px 12px; gap: 32px; }
  .fqs-numflow-step { padding: 12px 12px; }
  .fqs-numflow-step:not(:first-child)::before { top: -24px; }
  .fqs-numflow-num { font-size: 28px; }
  .fqs-numflow-step-title { font-size: 15px; }
  .fqs-numflow-step-desc { font-size: 12.5px; }
}
