:root {
  color-scheme: light;
  --brand-card: #f3f4f4;
  --brand-card-edge: #d0d2d5;
  --focus-ring: #176db0;
  --site-header-height: 72px;
}

.header { height: var(--site-header-height); }
@media (max-width: 850px) {
  :root { --site-header-height: 64px; }
}

html[data-theme="dark"] {
  color-scheme: dark;
  --paper: #17191c;
  --soft: #24272b;
  --ink: #f3f4f5;
  --muted: #c3c7cd;
  --line: #464b52;
  --black: #111316;
  --brand-card: #23262a;
  --brand-card-edge: #43484f;
  --focus-ring: #85c9ff;
}

html[data-theme="dark"] :is(.header, .hero, .quote-section) { background-color: #202125; }
html[data-theme="dark"] :is(.preview-bar, .skip, .yellow, .sector-bar, .since, .brands-section) { color: #202125; }
html[data-theme="dark"] .button.dark { background: #24262b; color: #fff; border-color: #747980; }
html[data-theme="dark"] .product { background: var(--soft); }
html[data-theme="dark"] .product-image { background: #bfc3c6; }
html[data-theme="dark"] .product-help a { color: var(--ink); }
html[data-theme="dark"] .eyebrow { color: #bec3cb; }
html[data-theme="dark"] .eyebrow.light { color: var(--yellow); }
html[data-theme="dark"] .brands-layout .eyebrow { color: #554713; }
html[data-theme="dark"] .quote-form,
html[data-theme="dark"] .oil-dialog { background: var(--soft); color: var(--ink); }
html[data-theme="dark"] :is(.form-note, #contagem) { color: var(--muted); }
.quote-form fieldset { min-width: 0; padding: 0; margin: 0 0 22px; border: 0; }
.quote-form button:disabled { cursor: wait; opacity: .7; }
#form-status:empty { margin: 0; }
#form-status[data-state="sending"] { color: var(--muted); }
#form-status[data-state]:not([data-state="sending"], [data-state="success"]) { color: #9a3021; }
html[data-theme="dark"] #form-status[data-state="success"] { color: #a7dcae; }
html[data-theme="dark"] #form-status[data-state]:not([data-state="sending"], [data-state="success"]) { color: #ffb9a9; }
html[data-theme="dark"] :is(input, select, textarea) {
  background-color: #17191c;
  border-color: #747a82;
  color: var(--ink);
}
html[data-theme="dark"] ::placeholder { color: #adb2bb; opacity: 1; }
html[data-theme="dark"] select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%23f3f4f5' stroke-width='2'/%3E%3C/svg%3E");
}
html[data-theme="dark"] .oil-open { background: var(--soft); border-color: var(--line); }
html[data-theme="dark"] .oil-open:is(:hover, :focus-visible) { background: #2e3135; border-color: var(--yellow); }
html[data-theme="dark"] .oil-open::after { color: var(--ink); background: #34383e; }
html[data-theme="dark"] .oil-open:is(:hover, :focus-visible)::after { color: #202125; background: var(--yellow); }
html[data-theme="dark"] .oil-dialog::backdrop { background: rgb(3 4 6 / 78%); }
:is(a, button, input, textarea, select, summary):focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

.header {
  gap: clamp(12px, 1.5vw, 24px);
  justify-content: flex-start;
}
.header .logo { order: 0; width: clamp(200px, 20vw, 248px); max-width: 100%; }
.header nav { order: 3; gap: clamp(12px, 1.65vw, 26px); }
.header nav a { white-space: nowrap; }
.header nav a:not(.button) { display: inline-flex; align-items: center; min-height: 44px; }
@media (1040px < width <= 1200px) {
  @media (height < 37.5em), (hover: none), (pointer: coarse) {
    .header, .header nav { gap: .625rem; }
  }
}
.site-preferences {
  order: 1;
  display: flex;
  align-items: center;
  margin-inline-start: auto;
  gap: 2px;
  padding-inline-end: 8px;
  border-inline-end: 1px solid #60646c;
}
.site-preferences :is(button, .language-link) {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 5px;
  min-width: 44px;
  min-height: 44px;
  padding: 6px 7px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #fff;
  background: transparent;
  font: inherit;
  font-size: .875rem;
  font-weight: 650;
  line-height: 1.15;
}
.site-preferences :is(button, .language-link):hover { background: #34373c; border-color: #676d76; }
.site-preferences :is(button, .language-link):focus-visible,
.header a:focus-visible,
.menu-toggle:focus-visible { outline-color: #8acbff; }
.site-preferences svg { display: block; flex-shrink: 0; width: 19px; height: 19px; }
.header .menu-toggle { order: 2; }
.quote-form :is(input, select, textarea) { border-color: #85898e; }
html[data-theme="dark"] .quote-form :is(input, select, textarea) { border-color: #7e848d; }
@media (prefers-reduced-motion: reduce), (hover: none) {
  .button:hover { transform: none; }
}

.parts-brands { color: var(--ink); background: var(--paper); }
.rexoil-brand-lockup {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: .5rem;
  text-align: center;
}
.rexoil-brand-lockup .eyebrow { margin: 0; }
.rexoil-brand-lockup h2 { position: relative; }
.rexoil-brand-lockup .rexoil-logo {
  position: absolute;
  inset: 0;
  display: block;
  margin: auto;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
}
.rexoil-brand-caption {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.25;
}
@media (max-width: 540px) {
  .rexoil-brand-lockup h2 {
    justify-self: center;
    width: min(100%, 15rem);
    aspect-ratio: 1200 / 313;
  }
}

/* Darken the surface at each edge without tinting black areas. */
@media screen and (forced-colors: none) {
  body > main {
    position: relative;
    isolation: isolate;
    background-color: var(--paper);
  }
  body > main::before,
  body > main::after {
    content: "";
    pointer-events: none;
    z-index: 3;
    inset-inline: 0;
    height: 14px;
    mix-blend-mode: darken;
    background: linear-gradient(var(--fade-direction), rgb(37 37 41 / 20%), rgb(37 37 41 / 7%) 50%, transparent);
  }
  body > main::before {
    --fade-direction: to bottom;
    position: fixed;
    top: var(--site-header-height);
  }
  body > main::after {
    --fade-direction: to top;
    position: absolute;
    bottom: 0;
  }
  body:has(dialog[open]) > main::before,
  body:has(dialog[open]) > main::after { visibility: hidden; }
}
.brands-intro { max-width: 66ch; margin-top: 16px; color: var(--muted); }
.company-copy .delivery-title { margin-top: 30px; font-size: 1.3rem; }
.company-copy .delivery-title + p { margin-top: 8px; }

.whatsapp-link {
  position: relative;
  order: 1;
  flex: 0 0 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px;
  color: #fff;
  background: #116748;
  border: 1px solid #90bea8;
  border-radius: 999px;
  font-size: .9375rem;
  line-height: 1.2;
  font-weight: 700;
  text-decoration: none;
}
.whatsapp-link:is(:hover, :focus-visible) { background: #0b5037; }
.whatsapp-link svg { display: block; width: 23px; height: 23px; flex: none; }
.whatsapp-link span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
footer .whatsapp-link { display: none; }
body:has(.oil-dialog[open]) .whatsapp-link { visibility: hidden; }

@media (max-width: 1040px) {
  .header .logo { width: 204px; }
  .site-preferences { margin-inline-start: auto; border: 0; padding: 0; }
  .header .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 44px;
    padding: 7px 10px;
    background: transparent;
    color: white;
    border: 1px solid #72767d;
    font-size: .875rem;
  }
  .header nav {
    display: none;
    position: absolute;
    inset: 100% 0 auto;
    max-height: calc(100dvh - 105px);
    overflow-y: auto;
    padding: 16px clamp(16px, 4vw, 32px);
    align-items: stretch;
    background: #202125;
    box-shadow: 0 15px 20px #0003;
  }
  .header nav.open { display: flex; flex-direction: column; gap: 4px; }
  .header nav a { padding: 10px 12px; }
}
@media (max-width: 540px) {
  .header { gap: 5px; padding-inline: 12px; }
  .header .logo { width: clamp(108px, 39vw, 196px); min-width: 0; flex-shrink: 1; }
  .site-preferences { gap: 0; }
  .site-preferences :is(button, .language-link) { padding-inline: 5px; }
  #theme-switch:has(svg) .theme-caption {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}
@media (max-width: 390px) {
  .header .menu-toggle { min-width: 44px; padding: 6px; gap: 0; font-size: 0; }
  .header .menu-toggle span { font-size: 19px; }
}
@media print {
  .site-preferences, .whatsapp-link, .menu-toggle { display: none; }
}

.sector-bar .wrap {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0;
  margin-block: 0;
  padding: 18px 0;
  list-style: none;
}
.sector-bar li {
  display: grid;
  align-content: center;
  padding: 3px 10px;
  text-align: center;
  text-wrap: balance;
  text-transform: uppercase;
  font-size: .8125rem;
  font-weight: 700;
  line-height: 1.35;
}
.sector-bar li + li { border-inline-start: 1px solid #20212533; }
@media (max-width: 1100px) {
  .sector-bar .wrap { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 12px; }
  .sector-bar li:nth-child(3n + 1) { border-inline-start: 0; }
}
@media (max-width: 600px) {
  .sector-bar .wrap { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sector-bar li:nth-child(odd) { border-inline-start: 0; }
  .sector-bar li:nth-child(even) { border-inline-start: 1px solid #20212533; }
}

/* The same footer stays in the document flow on small or touch-first screens. */
@media screen {
  body > footer {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto auto;
    grid-template-areas: "brand signature legal settings social";
    gap: .75rem clamp(1rem, 1.8vw, 1.75rem);
    align-items: center;
    padding: .5rem max(2rem, calc((100% - var(--max)) / 2));
    background: #191b1e;
    border-top: 1px solid #404247;
  }
  footer .footer-top { display: contents; }
  footer .footer-top .logo { grid-area: brand; width: clamp(7rem, 9vw, 8.75rem); }
  footer .footer-top p {
    grid-area: signature;
    padding-inline-start: clamp(1rem, 1.8vw, 1.75rem);
    border-inline-start: 1px solid #54565a;
    color: #e0e1e3;
    font-size: .875rem;
    font-weight: 500;
    line-height: 1.3;
  }
  footer .footer-top p::first-line { color: #fff; font-weight: 650; }
  footer .socials { grid-area: social; margin: 0; gap: .25rem; }
  footer .socials a { width: 44px; height: 44px; border-color: transparent; }
  footer .socials a:hover { border-color: #f2c020; }
  footer .socials svg { width: 19px; height: 19px; }
  footer .site-preferences {
    grid-area: settings;
    justify-self: start;
    margin: 0;
    padding: 0 .5rem;
    border-inline: 1px solid #505256;
  }
  footer .site-preferences :is(button, .language-link) { white-space: nowrap; }
  footer :is(a, button):focus-visible { outline: 2px solid #f2c020; outline-offset: 0; }
  footer .footer-bottom {
    grid-area: legal;
    display: grid;
    gap: .125rem;
    width: auto;
    margin: 0;
    padding: 0;
    border: 0;
    color: #c4c6c9;
    font-size: .75rem;
    line-height: 1.35;
    text-align: end;
  }
}
@media screen and (max-width: 55em) {
  body > footer {
    grid-template-columns: minmax(max-content, 1fr) minmax(0, auto);
    grid-template-areas: "brand legal" "signature signature" "settings social";
    gap: .4rem 1rem;
    padding: .75rem max(1.25rem, env(safe-area-inset-left)) max(1rem, env(safe-area-inset-bottom));
  }
  footer .footer-top p { padding: 0; border: 0; }
  footer .socials { justify-self: end; }
  footer .site-preferences { padding: 0; border: 0; }
  footer .site-preferences :is(button, .language-link) { padding-inline: .375rem; }
  footer .footer-bottom { justify-self: end; }
}
@media screen and (max-width: 36em) {
  body > footer {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "brand brand" "signature signature" "settings social" "legal legal";
  }
  footer .footer-bottom {
    display: flex;
    flex-wrap: wrap;
    justify-self: start;
    gap: .125rem .65rem;
    text-align: start;
  }
}
@media screen and (min-width: 65.0625em) and (min-height: 37.5em) and (hover: hover) and (pointer: fine) {
  html {
    --footer-height: 3.5rem;
    scroll-padding-bottom: calc(var(--footer-height) + .75rem);
  }
  body { padding-bottom: var(--footer-height); }
  body > main::after {
    position: fixed;
    bottom: var(--footer-height);
  }
  .header .site-preferences { display: none; }
  .header nav { margin-inline-start: auto; }
  body:has(footer .whatsapp-link) .header .whatsapp-link { display: none; }
  body > footer {
    position: fixed;
    inset: auto 0 0;
    z-index: 8;
    height: var(--footer-height);
    padding-block: 0;
  }
  body > footer:has(.whatsapp-link) {
    grid-template-columns: auto minmax(0, 1fr) auto auto auto auto;
    grid-template-areas: "brand signature legal settings social whatsapp";
    column-gap: clamp(.625rem, 1.5vw, 1.5rem);
  }
  footer .whatsapp-link {
    grid-area: whatsapp;
    display: inline-flex;
    gap: .45rem;
    padding-inline: .85rem;
    justify-self: end;
  }
  footer .whatsapp-link span {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip-path: none;
  }
  @media (max-width: 78em) {
    body > footer:has(.whatsapp-link) { column-gap: .625rem; }
    footer .footer-top .logo { width: 6.25rem; }
    footer .footer-top p { padding-inline-start: .625rem; }
    footer .footer-bottom { max-width: 8rem; }
    footer .site-preferences { padding-inline: .125rem; }
    footer .whatsapp-link { padding-inline: .625rem; }
  }
}
