/* Shared page rails and bilingual title scale, following the Insights header. */
:root {
  --jvds-content-max: 1920px;
  --jvds-page-header-max: 1600px;
  --jvds-content-gutter: 60px;
  --jvds-page-title-cn-size: 96px;
  --jvds-page-title-en-size: 70px;
  --jvds-page-title-cn-line: .95;
  --jvds-page-title-en-line: .9;
  --jvds-page-title-gap: 10px;
  --jvds-page-title-circle: 114px;
  --jvds-page-title-circle-left: -14px;
  --jvds-page-title-circle-top: 0px;
}

/* wp3 remains the site container; these rails replace legacy narrow page widths. */
body[class*="-framed"] .jvds-page-header.wp3 {
  box-sizing: border-box;
  width: 100%;
  max-width: var(--jvds-content-max);
  margin-right: auto;
  margin-left: auto;
  padding-right: var(--jvds-content-gutter);
  padding-left: var(--jvds-content-gutter);
}
/* These are the service page's outer content rails, never nested inner frames. */
body[class*="-framed"] .service-main > :is(.wp3, .service-hero),
body[class*="-framed"] .service-main > section > .wp3 {
  box-sizing: border-box;
  width: 100%;
  max-width: var(--jvds-content-max);
  margin-right: auto;
  margin-left: auto;
  padding-right: var(--jvds-content-gutter);
  padding-left: var(--jvds-content-gutter);
}

/* Only inner-page opening title rows use the narrower header rail.
 * Content, media and homepage containers keep their existing widths. */
body[class*="-framed"]:not(.jvds-home-framed) .jvds-page-header.wp3,
body.jvds-privacy-framed .privacy-hero > .wp3 {
  box-sizing: border-box;
  width: 100%;
  max-width: var(--jvds-page-header-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--jvds-content-gutter);
  padding-right: var(--jvds-content-gutter);
}
/* Contact's title row is nested inside the original wide cards container. */
body.jvds-contact-framed .contact-grid-intro {
  box-sizing: border-box;
  width: 100%;
  max-width: calc(var(--jvds-page-header-max) - var(--jvds-content-gutter) * 2);
  margin-left: auto;
  margin-right: auto;
}

body[class*="-framed"] h1.g-code-title.g-code-title-stack {
  display: inline-block;
  max-width: 100%;
  margin: 0;
  padding-left: 0;
  color: #000;
  font-family: var(--jvds-font-sans);
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0;
  position: relative;
  z-index: 1;
  text-align: left;
}
body[class*="-framed"] h1.g-code-title.g-code-title-stack::before {
  content: "";
  display: block;
  width: var(--jvds-page-title-circle);
  height: var(--jvds-page-title-circle);
  border-radius: 50%;
  background: linear-gradient(180deg,#f4ffce 0,#e0f94c 100%);
  position: absolute;
  left: var(--jvds-page-title-circle-left);
  top: var(--jvds-page-title-circle-top);
  z-index: -1;
}
body[class*="-framed"] h1.g-code-title.g-code-title-stack > :is(.g-code-cn, .g-code-en) {
  display: block;
  position: relative;
  z-index: 1;
  font-family: inherit;
  letter-spacing: 0;
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
  text-wrap: balance;
}
body[class*="-framed"] h1.g-code-title.g-code-title-stack > .g-code-cn {
  margin: 0;
  font-size: var(--jvds-page-title-cn-size);
  font-weight: 500;
  line-height: var(--jvds-page-title-cn-line);
}
body[class*="-framed"] h1.g-code-title.g-code-title-stack > .g-code-en {
  margin-top: var(--jvds-page-title-gap);
  font-size: var(--jvds-page-title-en-size);
  font-weight: 400;
  line-height: var(--jvds-page-title-en-line);
}

/* Portfolio categories sit on the title baseline, while Insights keeps its intro row. */
body[class*="-framed"] .jvds-page-header.jvds-works-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 60px;
}
body[class*="-framed"] .jvds-page-header.jvds-works-header::before,
body[class*="-framed"] .jvds-page-header.jvds-works-header::after {
  content: none;
  display: none;
}
body[class*="-framed"] .jvds-page-header.jvds-works-header > .g-tit01 {
  flex: 0 1 auto;
  min-width: 0;
  margin: 0;
  line-height: 0;
}
body[class*="-framed"] .jvds-page-header.jvds-works-header > .jvds-works-tools {
  display: block;
  flex: 0 0 auto;
  min-width: 0;
  margin-top: 0;
}

@media (max-width: 1280px) {
  :root { --jvds-content-gutter: 32px; }
  body[class*="-framed"] .jvds-page-header.jvds-works-header { gap: 36px; }
}
@media (max-width: 980px) {
  body[class*="-framed"] .jvds-page-header.jvds-works-header {
    flex-direction: column;
    align-items: stretch;
    gap: 28px;
  }
  body[class*="-framed"] .jvds-page-header.jvds-works-header > :is(.g-tit01, .jvds-works-tools) {
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
  }
}
@media (max-width: 800px) {
  :root {
    --jvds-content-gutter: 18px;
    --jvds-page-title-cn-size: 52px;
    --jvds-page-title-en-size: 34px;
    --jvds-page-title-cn-line: 1.15;
    --jvds-page-title-en-line: 1.12;
    --jvds-page-title-gap: 6px;
    --jvds-page-title-circle: 72px;
    --jvds-page-title-circle-left: -5px;
    --jvds-page-title-circle-top: -5px;
  }
}
@media (max-width: 390px) {
  :root {
    --jvds-content-gutter: 16px;
    --jvds-page-title-cn-size: 46px;
    --jvds-page-title-en-size: 30px;
  }
}
