/* Final CTA and mobile layout polish.
   Loaded after the existing layered styles so these rules are intentionally narrow. */

.hero-cv .btn-luxury-primary {
  position: relative;
  min-height: 68px;
  padding: 18px 34px;
  justify-content: center;
  border: 1px solid #e6c477;
  border-radius: 7px;
  background: linear-gradient(135deg, #e0bc6b 0%, #c28b35 58%, #ab6f1b 100%);
  box-shadow:
    0 16px 42px rgba(184, 127, 37, .26),
    inset 0 1px 0 rgba(255, 255, 255, .42);
  color: #171108;
  font-size: .94rem;
  font-weight: 800;
  letter-spacing: .07em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .25);
}

.hero-cv .btn-luxury-primary::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(255, 246, 220, .22);
  border-radius: 4px;
  pointer-events: none;
}

.hero-cv .btn-luxury-primary:hover,
.hero-cv .btn-luxury-primary:focus-visible {
  border-color: #f0d28d;
  background: linear-gradient(135deg, #ebcb81 0%, #d29b40 58%, #b97b20 100%);
  box-shadow:
    0 18px 48px rgba(184, 127, 37, .34),
    inset 0 1px 0 rgba(255, 255, 255, .5);
  color: #100c06;
  outline: 2px solid rgba(232, 199, 124, .35);
  outline-offset: 4px;
}

.hero-cv .btn-luxury-primary svg {
  width: 20px;
  height: 20px;
  opacity: 1;
  stroke-width: 2.35;
}

/* Match the accuracy section label to the hierarchy used by every other section. */
#accuracy .accuracy-b-heading .section-label {
  font-family: var(--font-jp);
  font-size: .72rem;
  font-weight: 700;
  line-height: 1.9;
  letter-spacing: .16em;
}

/* Use one contained equation layout at every width, including desktop. */
#accuracy .accuracy-b-metric {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px minmax(0, 1fr);
  align-items: start;
  gap: clamp(12px, 1.8vw, 24px);
  width: 100%;
  margin: 0;
  padding: 4px 0 18px;
}

#accuracy .accuracy-b-start,
#accuracy .accuracy-b-goal {
  width: auto;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

#accuracy .accuracy-b-start small {
  margin: 0 0 8px;
  font-size: clamp(.94rem, 1.25vw, 1.18rem);
  line-height: 1.5;
}

#accuracy .accuracy-b-metric strong {
  display: block;
  max-width: 100%;
  overflow: visible;
  font-size: clamp(4.25rem, 6vw, 6rem);
  line-height: 1;
}

#accuracy .accuracy-b-metric em {
  display: inline-block;
  margin-left: .04em;
  padding-right: .14em;
  font-style: normal;
  line-height: 1;
  letter-spacing: 0;
}

#accuracy .accuracy-b-arrow {
  align-self: start;
  width: 72px;
  min-width: 72px;
  height: 2px;
  margin: clamp(61px, 6vw, 82px) 0 0;
}

#accuracy .accuracy-b-arrow::after {
  top: 50%;
  right: -1px;
  bottom: auto;
  width: 14px;
  height: 14px;
  transform: translateY(-50%) rotate(45deg);
}

#accuracy .accuracy-b-arrow small {
  top: 13px;
  left: 50%;
  width: 72px;
  font-size: .6rem;
  line-height: 1.35;
  transform: translateX(-50%);
}

#accuracy .accuracy-b-goal {
  padding-top: clamp(31px, 2.3vw, 37px);
}

#accuracy .accuracy-b-goal > span {
  padding: 8px 0 0;
  font-size: clamp(.88rem, 1.15vw, 1.05rem);
  line-height: 1.45;
  white-space: normal;
}

/* Desktop: retain the original number + side-copy composition at a safe scale. */
@media (min-width: 1101px) {
  #accuracy .accuracy-b-metric {
    grid-template-columns: minmax(0, .95fr) 72px minmax(0, 1.25fr);
  }

  #accuracy .accuracy-b-metric strong {
    font-size: clamp(4rem, 5vw, 5.25rem);
  }

  #accuracy .accuracy-b-goal {
    flex-direction: row;
    align-items: flex-end;
    justify-content: center;
    padding-top: clamp(32px, 2.3vw, 36px);
    text-align: left;
  }

  #accuracy .accuracy-b-goal > span {
    padding: 0 0 8px 10px;
    font-size: clamp(.86rem, 1vw, .96rem);
    line-height: 1.45;
    white-space: nowrap;
  }

  #accuracy .accuracy-b-arrow {
    margin-top: clamp(66px, 5.2vw, 78px);
  }
}

/* Prevent the accuracy equation from being squeezed between 761px and 1100px. */
@media (max-width: 1100px) {
  #accuracy .accuracy-b-hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
    min-height: 0;
  }

  #accuracy .accuracy-b-metric {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 72px minmax(0, 1fr);
    align-items: start;
    gap: clamp(8px, 1.8vw, 16px);
    width: min(100%, 680px);
    margin: 0 auto;
    padding: 4px 0 18px;
    text-align: center;
  }

  #accuracy .accuracy-b-start,
  #accuracy .accuracy-b-goal {
    width: auto;
    min-width: 0;
    flex-direction: column;
    align-items: center;
  }

  #accuracy .accuracy-b-start small {
    margin: 0 0 7px;
    font-size: .88rem;
    line-height: 1.5;
  }

  #accuracy .accuracy-b-metric strong {
    display: block;
    max-width: 100%;
    font-size: clamp(3.1rem, 7vw, 4.5rem);
    line-height: 1;
  }

  #accuracy .accuracy-b-arrow {
    align-self: start;
    width: 72px;
    min-width: 72px;
    height: 2px;
    margin: 53px 0 0;
  }

  #accuracy .accuracy-b-arrow::after {
    top: 50%;
    right: -1px;
    bottom: auto;
    width: 14px;
    height: 14px;
    transform: translateY(-50%) rotate(45deg);
  }

  #accuracy .accuracy-b-arrow small {
    top: 13px;
    left: 50%;
    width: 72px;
    font-size: .6rem;
    line-height: 1.35;
    transform: translateX(-50%);
  }

  #accuracy .accuracy-b-goal > span {
    padding: 7px 0 0;
    font-size: .82rem;
    line-height: 1.45;
    white-space: normal;
  }

  #accuracy .accuracy-b-goal {
    padding-top: 28px;
  }

  #accuracy .accuracy-b-lead {
    max-width: 760px;
    margin: 22px auto 0;
  }

  #accuracy .accuracy-b-visual {
    width: min(100%, 410px);
    margin: 0 auto;
  }
}

@media (max-width: 720px) {
  html,
  body {
    max-width: 100%;
    overflow-x: clip;
  }

  /* FV: show the action before the large product visual. */
  .hero-cv .cv {
    padding: 150px 18px 46px !important;
  }

  .hero-cv .cv-result {
    width: 100% !important;
  }

  .hero-cv .cv-sub {
    order: 6 !important;
    margin: 4px 0 14px !important;
    font-size: .9rem !important;
    line-height: 1.75 !important;
  }

  .hero-cv .cv-desc {
    order: 7 !important;
    max-width: 420px;
    font-size: .79rem !important;
    line-height: 1.9 !important;
  }

  .hero-cv .cv-cta {
    order: 8 !important;
    width: 100% !important;
    max-width: 420px;
    margin: 24px auto 0 !important;
  }

  .hero-cv .btn-luxury-primary {
    width: 100%;
    min-height: 64px;
    padding: 16px 18px;
    font-size: .9rem;
    letter-spacing: .035em;
  }

  .hero-cv .cv-cta-note {
    order: 9 !important;
    max-width: 420px;
    margin: 11px auto 0 !important;
    color: rgba(245, 241, 232, .72) !important;
    font-size: .68rem !important;
    line-height: 1.7 !important;
  }

  .hero-cv .cv-mock {
    order: 10 !important;
    width: min(100%, 400px) !important;
    margin: 24px auto 0 !important;
    padding: 0 !important;
  }

  .hero-cv .cv-mockup-img {
    width: 100% !important;
    filter:
      drop-shadow(0 18px 38px rgba(0, 0, 0, .72))
      drop-shadow(0 5px 12px rgba(0, 0, 0, .45))
      brightness(1.04);
  }

  /* Four steps: every choice stays visible instead of being cut off horizontally. */
  #steps .product-tour-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    overflow: visible;
    padding: 10px;
  }

  #steps .product-tour-step {
    width: auto;
    min-width: 0;
    min-height: 78px;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 8px;
    padding: 12px 10px;
    border-color: rgba(255, 255, 255, .08);
  }

  #steps .product-tour-step.is-active {
    border-color: rgba(212, 175, 96, .52);
    box-shadow: inset 3px 0 #d0a951;
  }

  #steps .product-tour-step-copy strong {
    font-size: .78rem;
    line-height: 1.45;
  }

  #steps .product-tour-step-copy small,
  #steps .product-tour-step-arrow {
    display: none;
  }

  #steps .product-tour-step-no {
    font-size: .7rem;
  }

  #steps .product-tour-canvas {
    min-height: 540px;
  }

  #steps .tour-journal {
    overflow: hidden;
  }

  #steps .tour-journal-head,
  #steps .tour-journal-row {
    min-width: 0;
    grid-template-columns: 42px minmax(0, 1.25fr) minmax(76px, .9fr) 66px;
    padding-right: 8px;
    padding-left: 8px;
  }

  /* Accuracy: preserve the desktop composition, scaled to the phone width. */
  #accuracy .accuracy-b-metric {
    grid-template-columns: minmax(0, .95fr) 52px minmax(0, 1.3fr);
    gap: 6px;
  }

  #accuracy .accuracy-b-metric strong {
    font-size: clamp(2.65rem, 12vw, 3.2rem);
  }

  #accuracy .accuracy-b-arrow {
    width: 52px;
    min-width: 52px;
    margin-top: 49px;
  }

  #accuracy .accuracy-b-arrow small {
    width: 62px;
    font-size: .53rem;
  }

  #accuracy .accuracy-b-goal {
    flex-direction: row;
    align-items: flex-end;
    justify-content: center;
    padding-top: 28px;
    text-align: left;
  }

  #accuracy .accuracy-b-goal > span {
    padding: 0 0 5px 6px;
    font-size: .72rem;
    line-height: 1.35;
    white-space: nowrap;
  }

  /* Keep the supported-document list compact enough to scan at a glance. */
  #accuracy .accuracy-b-documents {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    width: min(100%, 330px);
    margin-right: auto;
    margin-left: auto;
    overflow: visible;
    border: 0;
    background: transparent;
  }

  #accuracy .accuracy-b-documents span {
    min-width: 0;
    min-height: 38px;
    padding: 6px 5px;
    white-space: normal;
    font-size: .7rem;
    line-height: 1.35;
    text-align: center;
    border: 1px solid rgba(173, 119, 23, .3);
    border-radius: 7px;
    background: rgba(255, 253, 248, .86);
  }

  #accuracy .accuracy-b-documents span:last-child {
    grid-column: 2 / 3;
  }

  #accuracy .accuracy-b-documents span::after {
    display: none;
  }

  #accuracy .accuracy-b-documents span::before {
    width: 13px;
    height: 16px;
    margin-right: 4px;
    background-size: 6px 1px, 6px 1px, 4px 1px;
    background-position: 3px 5px, 3px 8px, 3px 11px;
  }

  /* The wide CSV screen now uses a mobile crop instead of an unreadable thumbnail. */
  #integration .v3-showcase-frame {
    aspect-ratio: 4 / 3;
  }

  #integration .v3-showcase-frame picture,
  #integration .v3-showcase-frame img {
    display: block;
    width: 100%;
    height: 100%;
  }

  #integration .v3-showcase-frame img {
    object-fit: cover;
    object-position: center;
  }

  /* Learning shift: the stacked mobile sequence needs a downward arrow. */
  #learning .b-learning-shift i {
    width: 2px;
    height: 48px;
    margin: 0 auto;
    background: linear-gradient(180deg, transparent, var(--b-gold));
  }

  #learning .b-learning-shift i::after {
    top: auto;
    right: 50%;
    bottom: -1px;
    border-top: 10px solid var(--b-gold);
    border-right: 7px solid transparent;
    border-bottom: 0;
    border-left: 7px solid transparent;
    transform: translateX(50%);
  }

  /* ROI: split the wide artwork before "4 hours saved" and stack the result below. */
  #roi .b-roi-approved-visual {
    display: grid;
    gap: 10px;
    width: 100%;
    max-width: none;
    aspect-ratio: auto;
    margin: 34px auto 0;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  #roi .b-roi-approved-visual picture {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 580 / 376;
    overflow: hidden;
    border: 1px solid rgba(183, 122, 20, .2);
    border-radius: 12px;
    background: #fffdf8;
  }

  #roi .b-roi-approved-visual picture img {
    position: absolute;
    top: 0;
    left: 0;
    display: block;
    width: auto;
    min-width: 0;
    max-width: none;
    height: 100%;
  }

  #roi .b-roi-approved-visual::after {
    content: "";
    display: block;
    width: 100%;
    aspect-ratio: 1114 / 376;
    border: 1px solid rgba(183, 122, 20, .2);
    border-radius: 12px;
    background-color: #fffdf8;
    background-image: url("./images/generated/s05-direction-b-v2-core.png");
    background-repeat: no-repeat;
    background-position: right center;
    background-size: auto 100%;
  }

  #roi .b-roi-approved-visual ~ .b-roi-flow {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
  }

  /* Integration: center the main message and retain horizontal process diagrams. */
  #integration .v3-showcase-content .section-title {
    text-align: center !important;
  }

  #integration .method-flow {
    grid-template-columns: minmax(0, 1fr) 12px minmax(0, 1fr) 12px minmax(0, 1fr);
    gap: 3px;
    min-height: 0;
    padding: 15px 7px;
  }

  #integration .method-arrow {
    transform: none;
  }

  #integration .method-node b {
    font-size: .68rem;
  }

  #integration .method-node small {
    font-size: .55rem;
  }

  #integration .method-icon {
    width: 34px;
    height: 34px;
  }

  /* Security detail labels stay in one compact horizontal rail. */
  #security .b-security-rail {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    border: 1px solid var(--b-line);
    border-radius: 10px;
    overflow: hidden;
  }

  #security .b-security-rail span {
    display: grid;
    min-width: 0;
    min-height: 50px;
    padding: 8px 5px;
    place-items: center;
    font-size: .66rem;
    line-height: 1.45;
  }

  #security .b-security-rail span + span {
    border-top: 0;
    border-left: 1px solid var(--b-line);
  }

  /* Comparison: improve the label contrast and reduce the oversized first column. */
  #compare .comparison-table {
    width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    border: 1px solid var(--border-gray);
    border-radius: var(--radius-md);
    background: var(--white);
    box-shadow: 0 8px 24px rgba(35, 30, 23, .045);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  #compare .comparison-header {
    display: grid;
    grid-template-columns: 140px 235px 265px;
    width: 640px;
    min-width: 640px;
    background: var(--sumi);
  }

  #compare .comparison-row {
    display: grid;
    grid-template-columns: 140px 235px 265px;
    width: 640px;
    min-width: 640px;
    overflow: visible;
    border: 0;
    border-bottom: 1px solid var(--border-gray);
    border-radius: 0;
    background: #fff;
    box-shadow: none;
  }

  #compare .comparison-row + .comparison-row {
    margin-top: 0;
  }

  #compare .comparison-row .comparison-col {
    display: flex;
    width: auto;
    min-width: 0;
    padding: 16px 18px;
    align-items: center;
    overflow-wrap: normal;
    font-size: .82rem;
    line-height: 1.55;
  }

  #compare .comparison-row .comparison-col-item {
    grid-column: auto;
    background: #faf8f4;
    color: #2f2a23;
    font-weight: 700;
  }

  #compare .comparison-header .comparison-col-item {
    background: #2a261f;
    color: #fffaf0;
    font-weight: 800;
  }

  #compare .comparison-row .comparison-col-other,
  #compare .comparison-row .comparison-col-us {
    display: flex;
    justify-content: center;
    text-align: center;
  }

  #compare .comparison-row .comparison-col-other {
    border-right: 0;
    color: var(--mid-gray);
  }

  #compare .comparison-row .comparison-col-us {
    background: var(--accent-dim);
    color: var(--ai-iro);
  }

  /* Treat the area between each rule as one cell and center its contents optically. */
  #pricing .b-pricing-conditions {
    padding-top: 0;
    padding-bottom: 0;
  }

  #pricing .b-pricing-conditions > div {
    min-height: 80px;
    padding: 0;
    align-items: center;
  }

  /* Keep the per-entry price on one baseline. */
  #pricing .b-pricing-main {
    display: grid;
    grid-template-columns: auto auto;
    align-items: baseline;
    justify-content: center;
    column-gap: .25em;
  }

  #pricing .b-pricing-main > span {
    grid-column: 1 / -1;
  }

  #pricing .b-pricing-main > strong {
    white-space: nowrap;
    font-size: clamp(4.2rem, 19vw, 5.5rem);
  }

  #pricing .b-pricing-main > b {
    white-space: nowrap;
    font-size: clamp(1.55rem, 6vw, 2.05rem);
  }

  #compare .comparison-row .comparison-col-other::before,
  #compare .comparison-row .comparison-col-us::before {
    display: none;
    content: none;
  }

  /* FAQ: on mobile, begin directly with the questions. */
  #faq .section-label,
  #faq .section-title {
    display: none;
  }

  #faq .container {
    display: block;
  }

  #faq .faq-list {
    width: 100%;
    margin: 0;
  }

  /* Closing proof points: vertically center every row in its cell. */
  #contact .b-closing-note {
    padding: 0;
  }

  #contact .b-closing-note span {
    display: grid;
    place-items: center;
    min-height: 58px;
    padding: 11px 16px;
  }

  /* Long Japanese headings must wrap inside the viewport. */
  #security .section-title,
  #pricing .section-title {
    max-width: 100%;
    font-size: clamp(1.9rem, 8vw, 2.15rem);
    word-break: normal;
    overflow-wrap: anywhere;
  }

  #pricing .section-title .title-phrase {
    display: inline;
  }

  #security .title-line,
  #pricing .title-line {
    max-width: 100%;
  }
}

@media (max-width: 420px) {
  #steps .product-tour-step {
    min-height: 72px;
    padding: 10px 8px;
  }

  #steps .product-tour-step-copy strong {
    font-size: .72rem;
  }

  #accuracy .accuracy-b-documents span {
    font-size: .73rem;
  }

  #compare .comparison-row .comparison-col {
    padding-right: 10px;
    padding-left: 10px;
  }
}
