/* R18. Shared colour field and chapter rhythm, with page-local compositions. */
:root[data-r18-system] {
  --r10-field: radial-gradient(ellipse at 100% 5%, #9a5651 0, #663447 25%, transparent 61%),
    linear-gradient(124deg, #241728 10%, #432646 63%, #604150 100%);
  --r18-chapter: #2e1d35;
  --r18-source: #4b2b42;
  --r18-assist: #39283f;
  --r18-formats: #201826;
  --r18-request: #6a3a54;
  --r18-ink: #fff8f2;
  --r18-soft: #ebdae6;
  --r18-accent: #e9c486;
  --r18-hairline: #d9b6d060;
  --r18-grid: minmax(0, .86fr) minmax(0, 1.14fr);
  --r18-gap: clamp(32px, 6vw, 88px);
  --r18-section-space: clamp(56px, 7vw, 112px);
}

:root[data-r18-system][data-theme="light"] {
  --r10-field: radial-gradient(ellipse at 105% 0%, #e1a954 0, #f6d9a1 31%, transparent 65%),
    linear-gradient(125deg, #e4d7ef 4%, #f8edf2 55%, #fff7e7 100%);
  --r18-chapter: #fbf4f7;
  --r18-source: #e5d7ed;
  --r18-assist: #fbebd8;
  --r18-formats: #f9f0f8;
  --r18-request: #e1c3db;
  --r18-ink: #302036;
  --r18-soft: #523f55;
  --r18-accent: #6f471d;
  --r18-hairline: #72466460;
}

/* Fill the full canvas at chapter boundaries without changing the reading grid. */
[data-r18-system] #benefits:where(.r9-benefits),
[data-r18-system] #benefits:where(.r9-benefits) .r9-benefit-story,
[data-r18-system="home"] #formats,
[data-r18-system="agents"] #requests {
  position: relative;
  isolation: isolate;
  background: var(--r18-ground) !important;
}

[data-r18-system] #benefits:where(.r9-benefits)::after,
[data-r18-system] #benefits:where(.r9-benefits) .r9-benefit-story::after,
[data-r18-system="home"] #formats::after,
[data-r18-system="agents"] #requests::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  box-shadow: 0 0 0 100vmax var(--r18-ground);
  clip-path: inset(0 -100vmax);
  pointer-events: none;
}

[data-r18-system] #benefits:where(.r9-benefits) {
  --r18-ground: var(--r18-chapter);
  padding-block: var(--r18-section-space) 0 !important;
  border-width: 0;
}

[data-r18-system] #benefits:where(.r9-benefits) > .r9-intro,
[data-r18-system="home"] :is(#formats > .section-heading, #delivery > .r9-intro),
[data-r18-system] #benefits:where(.r9-benefits) .r9-benefit-story > .r9-benefit-copy {
  display: grid;
  grid-template-columns: var(--r18-grid);
  gap: 14px var(--r18-gap);
  align-items: start;
  padding-inline: 0 !important;
  text-align: left;
}

[data-r18-system] #benefits:where(.r9-benefits) > .r9-intro {
  margin: 0 0 clamp(34px, 5vw, 72px);
}

[data-r18-system] #benefits:where(.r9-benefits) .r9-benefit-stories {
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}

[data-r18-system] #benefits:where(.r9-benefits) :is(.r9-intro, .r9-benefit-copy) > :is(h2, h3, p),
[data-r18-system="home"] :is(#formats > .section-heading, #delivery > .r9-intro) > :is(h2, h3, p) {
  margin: 0 !important;
  padding: 0 !important;
}

[data-r18-system] #benefits:where(.r9-benefits) .r9-benefit-story {
  --r18-ground: var(--r18-chapter);
  display: flex !important;
  flex-direction: column;
  align-items: stretch;
  gap: clamp(25px, 4vw, 62px) !important;
  padding-block: clamp(44px, 6.4vw, 102px) !important;
  border-width: 0;
}

[data-r18-system] #benefits:where(.r9-benefits) .r9-benefit-story:first-child {
  padding-top: 0 !important;
}

[data-r18-system] #benefits:where(.r9-benefits) .r9-benefit-story:nth-child(2) {
  --r18-ground: var(--r18-source);
}

[data-r18-system] #benefits:where(.r9-benefits) .r9-benefit-story:nth-child(2)::before {
  content: none;
}

[data-r18-system] #benefits:where(.r9-benefits) .r9-benefit-story:nth-child(3) {
  --r18-ground: var(--r18-assist);
}

[data-r18-system] #benefits:where(.r9-benefits) .r9-benefit-story > .r9-benefit-copy {
  order: -2 !important;
}

[data-r18-system] #benefits:where(.r9-benefits) .r9-benefit-copy > h3 {
  grid-column: 1;
  grid-row: 1 / span 2;
  font-size: clamp(29px, 3.5vw, 53px);
  max-width: 19ch;
  color: var(--r18-ink);
}

[data-r18-system] #benefits:where(.r9-benefits) .r9-benefit-copy > :is(p, a) {
  grid-column: 2;
}

[data-r18-system] #benefits:where(.r9-benefits) .r9-benefit-copy > p {
  color: var(--r18-soft);
  max-width: 51ch;
  grid-row: 1;
}

[data-r18-system] #benefits:where(.r9-benefits) .r9-benefit-copy > a {
  grid-row: 2;
  justify-self: start;
  margin: 0 !important;
}

[data-r18-system="home"] #formats {
  --r18-ground: var(--r18-formats);
  padding-block: var(--r18-section-space) !important;
  margin-block: 0 !important;
  border-width: 0;
}

[data-r18-system="home"] #formats .r8-formats-body {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(20px, 3vw, 48px);
  align-items: stretch;
}

[data-r18-system="home"] #formats article {
  display: flex;
  flex-direction: column;
  position: relative;
  isolation: isolate;
  padding: clamp(121px, 10vw, 160px) clamp(20px, 2.4vw, 34px) 36px;
  min-width: 0;
  color: var(--choice-ink);
  background: var(--choice-field);
}

[data-r18-system="home"] #formats article:first-child {
  --choice-ink: #fff3f7;
  --choice-field: radial-gradient(ellipse at 30% 8%, #724966 0, #492842 59%);
  --choice-mark: #dec1dc;
  border-radius: 6rem 0 0 0;
}

[data-r18-system="home"] #formats article:nth-child(2) {
  --choice-ink: #392436;
  --choice-field: radial-gradient(ellipse at 50% 5%, #f0dff5 0, #dbc3e4 66%);
  --choice-mark: #744d76;
  border-radius: 0;
}

[data-r18-system="home"] #formats article:nth-child(3) {
  --choice-ink: #362333;
  --choice-field: linear-gradient(153deg, #f9dba9 3%, #eabf87 60%, #d9a784);
  --choice-mark: #754e62;
  border-radius: 0 0 6rem 0;
}

[data-r18-system="home"] #formats article::before {
  content: "";
  position: absolute;
  top: 36px;
  left: clamp(20px, 2.4vw, 34px);
  width: 64px;
  height: 54px;
  color: var(--choice-mark);
}

[data-r18-system="home"] #formats article:first-child::before {
  background: radial-gradient(circle at 48% 28%, currentColor 0 10px, transparent 10.5px),
    radial-gradient(ellipse at 48% 100%, currentColor 0 23px, transparent 23.5px);
  border-bottom: 1px solid currentColor;
}

[data-r18-system="home"] #formats article:nth-child(2)::before {
  background: radial-gradient(circle at 50% 18%, currentColor 0 8px, transparent 8.5px),
    radial-gradient(circle at 18% 65%, currentColor 0 8px, transparent 8.5px),
    radial-gradient(circle at 82% 65%, currentColor 0 8px, transparent 8.5px),
    linear-gradient(126deg, transparent 46%, currentColor 47% 50%, transparent 51%) 3px 12px / 32px 26px no-repeat,
    linear-gradient(54deg, transparent 46%, currentColor 47% 50%, transparent 51%) 29px 12px / 32px 26px no-repeat;
  transform: translate(11px, 0) scale(1.24);
}

[data-r18-system="home"] #formats article:nth-child(3)::before {
  background: linear-gradient(135deg, transparent 40%, currentColor 41% 53%, transparent 54%) 0 30px / 27px 19px no-repeat,
    linear-gradient(135deg, transparent 40%, currentColor 41% 53%, transparent 54%) 19px 18px / 27px 19px no-repeat,
    linear-gradient(135deg, transparent 40%, currentColor 41% 53%, transparent 54%) 38px 6px / 27px 19px no-repeat;
  transform: translate(12px, 0) scale(1.28);
}

[data-r18-system="home"] #formats article > :is(h3, p, a) {
  color: inherit !important;
}

[data-r18-system="home"] #formats article > h3 {
  font-size: clamp(25px, 2.8vw, 40px);
  margin: 0 0 18px;
}

[data-r18-system="home"] #formats article > p {
  margin: 0 0 28px;
}

[data-r18-system="home"] #formats article > a {
  align-self: flex-start;
  margin-top: auto;
}

[data-r18-system="agents"] #requests {
  --r18-ground: var(--r18-request);
  margin-block: clamp(48px, 7vw, 112px) !important;
  padding-block: var(--r18-section-space) !important;
  border-width: 0;
}

[data-r18-system="agents"] #requests > .section-heading > h2 {
  color: var(--r18-ink);
}

[data-r18-system="agents"] #requests > .section-heading > p {
  color: var(--r18-soft);
}

[data-r18-system="home"] #delivery {
  padding-block: var(--r18-section-space) !important;
}

[data-r18-system] #delivery.r9-delivery > .r18-pilot {
  display: grid;
  grid-template-columns: minmax(0, 2.1fr) minmax(0, .9fr);
  gap: clamp(26px, 5vw, 76px);
  align-items: center;
}

.r18-pilot-report {
  --report-ink: #332139;
  --report-muted: #634b63;
  --report-rule: #b59aab;
  display: grid;
  gap: clamp(22px, 3vw, 44px);
  min-width: 0;
  margin: 0;
  padding: clamp(20px, 3.4vw, 48px);
  border: 1px solid #d8bdca;
  background: #fff8ef;
  color: var(--report-ink);
  box-shadow: 0 18px 54px #24182f20;
}

.r18-pilot-report > figcaption {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 24px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--report-rule);
}

.r18-pilot-report h3 {
  margin: 0;
  color: var(--report-ink);
  font-size: clamp(23px, 2.15vw, 34px);
  line-height: 1.12;
  letter-spacing: -.035em;
}

.r18-pilot-report figcaption > span {
  color: var(--report-muted);
  font-size: 13px;
}

.r18-pilot-report-data {
  display: grid;
  grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr);
  gap: clamp(20px, 3vw, 46px);
  align-items: end;
}

.r18-pilot-total > strong {
  display: block;
  margin-bottom: 6px;
  color: #523253;
  font-size: clamp(58px, 7.4vw, 108px);
  font-weight: 510;
  line-height: .86;
  letter-spacing: -.075em;
}

.r18-pilot-total > span {
  font-size: clamp(16px, 1.5vw, 21px);
  color: var(--report-ink);
}

.r18-pilot-total p {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 15px 0 0;
  color: #3d5a4d;
  font-size: 13px;
  line-height: 1.35;
}

.r18-pilot-total svg {
  flex: 0 0 16px;
  align-self: flex-start;
}

.r18-pilot-chart {
  --plot-height: clamp(82px, 10vw, 136px);
  --pilot-scale: 60;
  --pilot-columns: 7;
  display: grid;
  grid-template-columns: repeat(var(--pilot-columns), minmax(0, 1fr));
  gap: clamp(5px, 1vw, 12px);
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--report-muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.r18-pilot-chart-results {
  --pilot-scale: 10;
  --pilot-columns: 3;
}

.r18-pilot-chart > li {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
}

.r18-pilot-chart > li > span {
  margin-bottom: 4px;
}

.r18-pilot-chart > li > i {
  width: min(100%, 45px);
  height: calc(var(--plot-height) * var(--pilot-count) / var(--pilot-scale));
  background: linear-gradient(0deg, #986d99, #724a78);
}

.r18-pilot-chart :is(abbr, small) {
  padding-top: 5px;
  font-size: inherit;
  text-decoration: none;
}

.r18-pilot-exception {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding-top: clamp(13px, 2vw, 24px);
  border-top: 1px solid var(--report-rule);
}

.r18-pilot-exception > span {
  flex: 0 0 9px;
  height: 9px;
  border-radius: 50%;
  background: #a5632c;
}

.r18-pilot-exception > p {
  margin: 0;
  color: var(--report-ink);
  font-size: 15px;
  line-height: 1.45;
}

.r18-pilot-exception strong {
  display: inline-block;
  margin-right: .5em;
  color: #7e4a24;
}

.r18-pilot-decision > h3 {
  max-width: 14ch;
  margin: 0 0 15px;
  color: var(--r18-ink);
  font-size: clamp(29px, 3vw, 47px);
  font-weight: 500;
  line-height: 1.06;
  letter-spacing: -.04em;
}

.r18-pilot-decision > p,
.r18-pilot-process {
  max-width: 57ch;
  margin: 0;
  color: var(--r18-soft);
  font-size: clamp(16px, 1.35vw, 19px);
  line-height: 1.55;
}

.r18-pilot-process {
  margin-top: clamp(28px, 4.5vw, 64px);
}

[data-r18-system="dedicated-team"] #first-stage :is(.r17c-team-hero, .r16b-start) {
  background: #261a2a;
}

[data-r18-system="dedicated-team"] #first-stage .r16b-start {
  background: #261a2a url("../branches/system/team-studio-evening.webp") center / cover no-repeat;
}

[data-r18-system="dedicated-team"][data-theme="light"] #first-stage .r16b-start {
  background-image: url("../branches/system/team-studio-daylight.webp");
}

[data-r18-system="dedicated-team"] #first-stage :is(.r17c-team-hero .r17c-day, .r17c-team-hero .r17c-night, .r16b-start .r16b-photo) {
  display: none !important;
}

[data-r18-system="dedicated-team"] #first-stage .r18-team-photo {
  object-position: 62% 44%;
}

[data-r18-system="dedicated-team"] #first-stage .r17c-scrim {
  background: linear-gradient(0deg, #231829 0%, #231829d9 20%, #2318294d 47%, transparent 64%),
    linear-gradient(90deg, #2318294d, transparent 70%);
}

[data-r18-system="dedicated-team"][data-theme="light"] #first-stage .r17c-scrim {
  background: linear-gradient(0deg, #251b2b 0%, #251b2bdf 18%, #251b2b48 46%, transparent 65%),
    linear-gradient(90deg, #251b2b56, transparent 64%);
}

@media (max-width: 840px) {
  [data-r18-system] #benefits:where(.r9-benefits) > .r9-intro,
  [data-r18-system="home"] :is(#formats > .section-heading, #delivery > .r9-intro),
  [data-r18-system] #benefits:where(.r9-benefits) .r9-benefit-story > .r9-benefit-copy,
  [data-r18-system] #delivery.r9-delivery > .r18-pilot {
    grid-template-columns: minmax(0, 1fr);
  }

  [data-r18-system] #benefits:where(.r9-benefits) .r9-benefit-copy > :is(h3, p, a) {
    grid-column: 1;
    grid-row: auto;
  }

  [data-r18-system="home"] #formats .r8-formats-body {
    grid-template-columns: minmax(0, 1fr);
  }

  [data-r18-system="home"] #formats article:first-child {
    border-top-left-radius: 4.5rem;
  }

  [data-r18-system="home"] #formats article:nth-child(3) {
    border-bottom-right-radius: 4.5rem;
  }

  [data-r18-system="dedicated-team"] #first-stage .r18-team-photo {
    object-position: 74% 38%;
  }

  [data-r18-system="dedicated-team"][data-theme="light"] #first-stage .r18-team-photo {
    object-position: 83% 38%;
  }
}

@media (max-width: 550px) {
  .r18-pilot-report-data {
    grid-template-columns: minmax(0, 1fr);
  }
}
