@import url("brand.css");

/* Chevron Lubricants - Design System
 *
 * Font mapping: Gotham Narrow → Montserrat (closest geometric sans-serif match)
 * gotham-narrow-book → Montserrat 400
 * gotham-narrow-bold → Montserrat 700
 */

/* fallback font */
@font-face {
  font-family: montserrat-fallback;
  size-adjust: 113%;
  src: local("Trebuchet MS"), local("Arial");
}

:root {
  /* grid */
  --grid-container-width: 83.4%;
  --grid-column-width: calc(var(--grid-container-width) / 12);
  --grid-gutter-width: 8.3%;

  /* spacing */
  --spacing-xxl: 48px;
  --spacing-xl: 32px;
  --spacing-l: 24px;
  --spacing-m: 12px;
  --spacing-s: 8px;
  --spacing-xs: 4px;

  /* Chevron brand colors */
  --color-chevron-blue: #0c2e72;
  --color-chevron-dark-blue: #0b2d71;
  --color-chevron-medium-blue: #2459a9;
  --color-chevron-light-blue: #edf2fa;
  --color-chevron-red: #e1251b;
  --color-grey-text: #6d6d6d;
  --color-grey-light-bg: #f5f5f5;
  --color-white: #fff;
  --color-black: #000;
  --color-dark-text: #212529;

  /* semantic colors */
  --color-text: var(--color-grey-text);
  --color-heading: var(--color-chevron-dark-blue);
  --color-link: var(--color-chevron-dark-blue);
  --color-link-secondary: var(--color-chevron-medium-blue);
  --color-background: var(--color-white);
  --color-accent: var(--color-chevron-blue);
  --color-accent-light: var(--color-chevron-light-blue);

  /* fonts */
  --font-family: var(--brand-body-font-family);
  --heading-font-family: var(--font-family);

  /* headings — matched from source site */
  --heading-font-size-xxl: 40px;
  --heading-font-size-xl: 28px;
  --heading-font-size-l: 24px;
  --heading-font-size-m: 20px;
  --heading-font-size-s: 18px;
  --heading-font-size-xs: 16px;
  --heading-line-height: 1.2;

  /* body */
  --body-font-size-xxxl: 25px;
  --body-font-size-xxl: 22px;
  --body-font-size-xl: 20px;
  --body-font-size-l: 18px;
  --body-font-size-m: 16px;
  --body-font-size-s: 14px;
  --body-font-size-xs: 12px;
  --body-line-height: 1.2;

  /* buttons */
  --button-bg: var(--color-chevron-blue);
  --button-color: var(--color-white);
  --button-border-radius: 6px;
  --button-padding: 10px 24px;
  --button-font-weight: 700;
  --button-transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;

  /* links */
  --link-transition: color 0.2s ease;

  /* misc */
  --utility-nav-height: 40px;
  --header-main-height: 80px;
  --header-height: calc(var(--utility-nav-height) + var(--header-main-height));
  --breadcrumb-height: 24px;
}

html {
  scroll-padding-top: calc(var(--header-height) + 1rem);
}

body {
  margin: 0;
  background-color: var(--color-background);
  color: var(--color-text);
  font-family: var(--font-family);
  font-size: var(--body-font-size-m);
  line-height: var(--body-line-height);
  padding: var(--header-height) 0 0;

  &.has-breadcrumb {
    margin: calc(var(--header-height) + var(--breadcrumb-height)) 0 0;
  }

  &.no-header {
    --header-height: 0;

    margin: 0;
  }
}

header {
  display: none;
  height: var(--header-height);
  position: fixed;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--heading-font-family);
  color: var(--color-heading);
  line-height: var(--heading-line-height);
  margin-top: 0.8em;
  margin-bottom: 0.4em;
}

h1 {
  font-size: var(--heading-font-size-xxl);
  font-weight: 400;
}

h2 {
  font-size: var(--heading-font-size-l);
  font-weight: 700;
  letter-spacing: 0.5px;
}

h3 {
  font-size: var(--heading-font-size-m);
  font-weight: 400;
}

h4 {
  font-size: var(--body-font-size-s);
  font-weight: 600;
}

h5 {
  font-size: var(--heading-font-size-s);
  font-weight: 600;
}

h6 {
  font-size: var(--heading-font-size-xs);
  font-weight: 400;
}

p {
  margin: 0 0 0.8em;
  line-height: 1.5;
}

strong {
  font-weight: 700;
}

/* Links */
a {
  color: var(--color-link);
  text-decoration: none;
  transition: var(--link-transition);

  &:hover {
    color: var(--color-link-secondary);
    text-decoration: underline;
  }

  &:focus-visible {
    outline: 2px solid var(--color-chevron-medium-blue);
    outline-offset: 2px;
    border-radius: 2px;
  }

  /* Button styles — primary */
  &.btn,
  &.button {
    display: inline-block;
    line-height: 1;
    font-weight: var(--button-font-weight);
    text-decoration: none;
    background-color: var(--button-bg);
    color: var(--button-color);
    border: 2px solid var(--button-bg);
    border-radius: var(--button-border-radius);
    padding: var(--button-padding);
    box-sizing: border-box;
    transition: var(--button-transition);
    cursor: pointer;

    &:hover {
      background-color: var(--color-chevron-dark-blue);
      border-color: var(--color-chevron-dark-blue);
      color: var(--color-white);
      text-decoration: none;
    }

    &:focus-visible {
      outline: 2px solid var(--color-chevron-medium-blue);
      outline-offset: 2px;
    }

    &:active {
      background-color: #091f50;
      border-color: #091f50;
    }
  }

  /* Button — secondary (outline) */
  &.btn-outline,
  &.button.secondary {
    background: transparent;
    color: var(--color-chevron-blue);
    border: 2px solid var(--color-chevron-blue);

    &:hover {
      background-color: var(--color-chevron-blue);
      color: var(--color-white);
    }
  }

  /* Button — accent (red CTA) */
  &.btn-accent {
    background-color: var(--color-chevron-red);
    border-color: var(--color-chevron-red);
    color: var(--color-white);

    &:hover {
      background-color: #c81f17;
      border-color: #c81f17;
    }
  }

  /* Button — on dark/blue backgrounds */
  &.btn-light {
    background-color: var(--color-white);
    color: var(--color-chevron-blue);
    border-color: var(--color-white);

    &:hover {
      background-color: var(--color-chevron-light-blue);
      border-color: var(--color-chevron-light-blue);
    }
  }
}

/* Sections */
.section {
  display: block;
  padding: var(--spacing-xl) 0;

  > .default-content {
    max-width: var(--grid-container-width);
    margin: 0 auto;
    padding: 0 var(--spacing-l);
  }
}

/* Section variant: blue background (Chevron brand blue) */
main > .section.blue-bg {
  background-color: var(--color-chevron-blue);
  color: var(--color-white);
  padding: var(--spacing-xxl) 0;

  > .default-content {
    text-align: center;
  }

  h1, h2, h3, h4, h5, h6 {
    color: var(--color-white);
    text-align: center;
  }

  a {
    color: var(--color-white);

    &:hover {
      color: var(--color-chevron-light-blue);
    }
  }

  p {
    color: var(--color-white);
  }

  /* Pill-button links (stacked CTAs on blue background) */
  .default-content p a {
    display: block;
    background: var(--color-white);
    color: var(--color-chevron-dark-blue);
    padding: 14px 32px;
    border-radius: 32px;
    text-decoration: none;
    font-weight: 700;
    font-size: var(--body-font-size-m);
    text-align: center;
    max-width: 320px;
    margin: var(--spacing-m) auto;
    transition: background-color 0.2s ease;

    &:hover {
      background-color: var(--color-chevron-light-blue);
      color: var(--color-chevron-dark-blue);
    }
  }
}

/* Section variant: banner - contained experience on #0c2e72 */
main > .section.banner {
  display: flex;
  flex-direction: column;
  background-color: #0c2e72;
  color: var(--color-white);
  padding: var(--spacing-xxl) 0;
  margin-bottom: 20px;
  min-height: 200px;

  > .default-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    max-width: var(--grid-container-width);
    margin: 0 auto;
    padding: 0 var(--spacing-l);
    text-align: center;
  }

  /* Push links to bottom with 10px padding */
  > .default-content > *:last-child:has(a) {
    margin-top: auto;
    padding-bottom: 10px;
  }

  h1, h2, h3, h4, h5, h6 {
    margin-top: 20px;
    color: var(--color-white);
    font-size: 30px;
    font-family: gotham-narrow-bold, montserrat, montserrat-fallback, "Trebuchet MS", sans-serif;
    font-weight: 400;
  }

  a {
    color: var(--color-white);
  }

  /* Links as white buttons with #0c2e72 text, rounded edges */
  .default-content p:has(a) {
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
    justify-content: center;
  }

  .default-content p a,
  a.btn,
  a.btn-primary {
    display: inline-block;
    background: var(--color-white);
    color: #0c2e72;
    padding: 14px 32px;
    border-radius: 24px;
    text-decoration: none;
    font-weight: 700;
    font-size: var(--body-font-size-m);
    transition: background-color 0.2s ease, color 0.2s ease;

    &:hover {
      background-color: var(--color-chevron-light-blue);
      color: #0c2e72;
    }
  }
}

/* Section variant: grey background */
main > .section.grey-bg {
  background-color: var(--color-grey-light-bg);
  padding: var(--spacing-xxl) 0;

  > .default-content {
    text-align: center;
  }

  h2, h3 {
    text-align: center;
  }
}

/* Section variant: light blue background */
main > .section.light-blue-bg {
  background-color: var(--color-accent-light);
}

/* Section variant: full-width background
 * Background extends edge-to-edge using viewport breakout */
main > .section.full-width-bg {
  --section-full-width-bg-color: #003653;

  width: 100vw;
  max-width: 100vw;
  margin-left: calc(-50vw + 50%);
  margin-right: calc(-50vw + 50%);
  box-sizing: border-box;
  background-color: var(--section-full-width-bg-color);
}

/* First hero section: full-width dark blue (#0b2d71) band, top 600px
 * Applies to any section containing a hero - no account-based variant needed */
main .persona-fragment-content > div:has(.hero):first-child,
main > div.section:has(.hero),
main > div:has(> .hero) {
  position: relative;
  overflow: visible;
}

main .persona-fragment-content > div:has(.hero):first-child::before,
main > div.section:has(.hero)::before,
main > div:has(> .hero)::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100vw;
  height: 300px;
  background-color: #003653;
  z-index: 0;
  pointer-events: none;
}

main .persona-fragment-content > div:has(.hero):first-child .hero,
main > div.section:has(.hero) .hero,
main > div:has(> .hero) .hero {
  position: relative;
  z-index: 1;
  margin-top: 15px;
}

main .persona-fragment-content > div:has(.hero):first-child .hero .hero-background img,
main > div.section:has(.hero) .hero .hero-background img,
main > div:has(> .hero) .hero .hero-background img {
  opacity: 0.75;
}

main .persona-fragment-content > div:has(.hero):first-child .hero .hero-foreground,
main > div.section:has(.hero) .hero .hero-foreground,
main > div:has(> .hero) .hero .hero-foreground {
  color: #fff;
  text-shadow: 0 1px 2px rgb(0 0 0 / 50%);
}

main .persona-fragment-content > div:has(.hero):first-child .hero .hero-foreground a,
main > div.section:has(.hero) .hero .hero-foreground a,
main > div:has(> .hero) .hero .hero-foreground a {
  color: #fff;
}

/* Hero CTA: oval button with pronounced hover effect
 * Targets all links in hero foreground (CTAs may not have .btn class from AEM content) */
main .persona-fragment-content > div:has(.hero):first-child .hero .hero-foreground p a,
main .persona-fragment-content > div:has(.hero):first-child .hero .hero-foreground a.btn,
main .persona-fragment-content > div:has(.hero):first-child .hero .hero-foreground a.btn-primary,
main > div.section:has(.hero) .hero .hero-foreground p a,
main > div.section:has(.hero) .hero .hero-foreground a.btn,
main > div.section:has(.hero) .hero .hero-foreground a.btn-primary,
main > div:has(> .hero) .hero .hero-foreground p a,
main > div:has(> .hero) .hero .hero-foreground a.btn,
main > div:has(> .hero) .hero .hero-foreground a.btn-primary {
  display: inline-block;
  border-radius: 9999px;
  padding: 14px 36px;
  font-weight: 700;
  font-size: var(--body-font-size-l);
  background-color: var(--color-white);
  color: var(--color-chevron-dark-blue) !important;
  border: 2px solid var(--color-white);
  transform: scale(1);
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  text-decoration: none;
}

main .persona-fragment-content > div:has(.hero):first-child .hero .hero-foreground p a:hover,
main .persona-fragment-content > div:has(.hero):first-child .hero .hero-foreground a.btn:hover,
main .persona-fragment-content > div:has(.hero):first-child .hero .hero-foreground a.btn-primary:hover,
main > div.section:has(.hero) .hero .hero-foreground p a:hover,
main > div.section:has(.hero) .hero .hero-foreground a.btn:hover,
main > div.section:has(.hero) .hero .hero-foreground a.btn-primary:hover,
main > div:has(> .hero) .hero .hero-foreground p a:hover,
main > div:has(> .hero) .hero .hero-foreground a.btn:hover,
main > div:has(> .hero) .hero .hero-foreground a.btn-primary:hover {
  background-color: var(--color-chevron-light-blue);
  border-color: var(--color-chevron-light-blue);
  color: var(--color-chevron-dark-blue) !important;
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgb(0 0 0 / 25%);
  text-decoration: none;
}

/* Lists */
main {
  ul,
  ol {
    padding-inline-start: 24px;

    ul,
    ol {
      padding-inline-start: 12px;
    }
  }
}

li {
  margin-block: 0.5em;
  line-height: 1.5;
}

/* Form elements */
button {
  cursor: pointer;
}

input,
textarea,
select,
button {
  font: inherit;
}

/* Images */
img {
  width: 100%;
  height: auto;
}

svg {
  width: 20px;
  height: 20px;
}

/* Responsive */
@media (width >= 600px) {
  :root {
    --heading-font-size-xxl: 44px;
    --heading-font-size-xl: 32px;
    --heading-font-size-l: 26px;
  }
}

@media (width >= 900px) {
  :root {
    --heading-font-size-xxl: 48px;
    --heading-font-size-xl: 36px;
    --heading-font-size-l: 28px;
  }

  .section > .default-content {
    padding: 0;
  }
}

@media (width >= 1440px) {
  :root {
    --grid-container-width: 1200px;
  }
}

/* Persona fragment content - prevent overlap when inserted by persona block */
.persona-fragment-content {
  position: relative;
  z-index: 1;
  display: flow-root;
  isolation: isolate;
}

.persona-fragment-content > .section {
  margin-top: 0;
}

.persona-fragment-content > .section + .section {
  margin-top: 0;
}

/* Ensure fragment sections stack below preceding content */
.persona-fragment-content > .section:first-child {
  clear: both;
}

/* EDS button reset (links decorated as .button keep plain link styling) */
main .button-container {
  display: inline;
}

main a.button:any-link {
  background: none;
  border: none;
  border-radius: 0;
  color: var(--color-link);
  font-size: inherit;
  font-weight: inherit;
  padding: 0;
  margin: 0;
  text-decoration: underline;
  white-space: normal;
}

/* ---------------------------------------------------------------
 * Design migration: default content + section layout
 * Values measured from https://www.chevronlubricants.com/ at 1440px
 * --------------------------------------------------------------- */
main > .section {
  padding: 0;
  margin-block: var(--brand-section-spacing);

  > .block-content:empty {
    display: none;
  }

  > .default-content {
    color: var(--brand-copy-color);

    h1 {
      margin: 0;
      font-size: var(--brand-heading-size-h1);
      font-weight: 700;
      line-height: 1.2;
      letter-spacing: normal;
      color: var(--brand-copy-color);
    }

    h2 {
      margin: 0;
      font-size: var(--brand-heading-size-h2);
      font-weight: 700;
      line-height: 1.2;
      letter-spacing: normal;
      color: var(--brand-copy-color);
    }

    h3 {
      margin: 0;
      font-size: var(--brand-heading-size-h3);
      font-weight: 700;
      line-height: 28px;
    }

    p {
      margin: 0;
      font-size: var(--brand-copy-size);
      line-height: 1.2;
      color: var(--brand-copy-color);
    }

    > h2 + p {
      margin-top: 16px;
    }
  }

  > .default-content + .block-content {
    margin-top: 15px;
  }
}

main > .section:first-child {
  margin-top: 15px;
}

/* centered: headings and copy centered */
main > .section.centered > .default-content {
  text-align: center;
}

/* contained colored bands (source bands sit inside the 1200px container) */
main > .section.blue-bg,
main > .section.grey-bg {
  box-sizing: border-box;
  padding: var(--brand-band-padding) var(--spacing-l) 24px;

  > .default-content {
    max-width: none;
    padding: 0;
  }

  > .default-content + .block-content {
    margin-top: 40px;
  }
}

main > .section.blue-bg > .default-content :is(h1, h2, h3, p) {
  color: var(--color-white);
}

main > .section.blue-bg.centered > .default-content h2,
main > .section.grey-bg.centered > .default-content h2 {
  font-size: var(--brand-heading-size-h2-band);
  line-height: 1.2;
}

/* split: default content beside the block */
main > .section.split > .default-content h2 {
  font-size: var(--brand-heading-size-h2-split);
  font-weight: 400;
  line-height: 1.24;
}

/* promo tile (image with overlaid heading + link) in split sections */
main > .section.split > .default-content {
  p:has(picture) {
    margin-top: 30px;
    border-radius: 10px;
    overflow: hidden;
    line-height: 0;

    img {
      display: block;
      width: 100%;
      height: auto;
      aspect-ratio: 498 / 385;
      object-fit: cover;
    }
  }

  p:has(picture) ~ h3 {
    margin-top: -112px;
    padding: 0 30px;
    position: relative;
    color: var(--color-white);
  }

  p:has(picture) ~ h3 + p {
    margin: 15px 0 29px;
    padding: 0 30px;
    position: relative;

    a {
      color: var(--color-white);
      font-size: 16px;
      font-weight: 700;
      text-decoration: underline;
    }
  }
}

/* blue split band (insights): pill button */
main > .section.blue-bg.split {
  padding: 60px 45px;

  > .default-content {
    text-align: left;

    h2 {
      text-align: left;
    }

    h2 + p {
      margin-top: 30px;
      font-weight: 300;
      line-height: 28px;
    }

    p a {
      display: block;
      box-sizing: border-box;
      width: min(406px, 100%);
      max-width: none;
      margin: 30px 0 0;
      padding: 10px 30px;
      border: 1px solid var(--color-white);
      border-radius: 25px;
      background: var(--color-white);
      color: var(--brand-copy-color);
      font-size: 16px;
      font-weight: 400;
      line-height: 27px;
      text-align: center;
      text-decoration: none;

      &:hover {
        background: var(--color-white);
        color: var(--brand-copy-color);
        text-decoration: none;
      }
    }
  }
}

@media (width >= 900px) {
  main > .section.split {
    display: grid;
    grid-template-columns: minmax(0, 498px) minmax(0, 1fr);
    column-gap: 15px;
    align-items: start;

    > .default-content {
      grid-column: 1;
      max-width: none;
      margin: 0;
    }

    > .block-content {
      grid-column: 2;
      min-width: 0;
    }

    > .default-content + .block-content {
      margin-top: 0;
    }
  }

  /* featured products: heading spans both columns, tile left, block right */
  main > .section.split:has(> .default-content picture) {
    grid-template-rows: auto auto 1fr;
    max-width: var(--brand-content-max-width);
    margin-inline: auto;
    padding-inline: 43px var(--brand-content-gutter);
    box-sizing: border-box;

    > .default-content {
      display: contents;

      > h2 {
        grid-column: 1 / -1;
        grid-row: 1;
        margin-top: 37px;
      }

      > :not(h2) {
        grid-column: 1;
        grid-row: 2;
      }

      > p:has(picture) {
        margin-top: 30px;
      }

      > h3 {
        align-self: end;
        margin: 0 0 83px;
      }

      > h3 + p {
        align-self: end;
        margin: 0 0 36px;
      }
    }

    > .block-content {
      grid-row: 2 / span 2;
      margin-top: 30px;
    }
  }

  main > .section.blue-bg.split {
    grid-template-columns: minmax(0, 445px) minmax(0, 1fr);
    column-gap: 60px;
    padding: 91px 0 100px 55px;
    overflow: hidden;
  }
}

@media (width >= 1200px) {
  /* centered bands sit inside the 12px container gutter; the split band spans the full container */
  main > .section.blue-bg,
  main > .section.grey-bg {
    max-width: calc(var(--brand-content-max-width) - 2 * var(--brand-content-gutter));
    margin-inline: auto;
  }

  main > .section.blue-bg.split {
    max-width: var(--brand-content-max-width);
  }

  main > .section > .default-content {
    max-width: calc(var(--brand-content-max-width) - 2 * var(--brand-content-gutter));
  }
}

/* EDS framework visibility */
main > div,
.has-template,
div[data-status] {
  display: none;
}

aem-sidekick {
  opacity: 0;

  &[open="true"].is-ready {
    opacity: 1;
  }
}
