/* Dark palette. The header link controls automatic or manually selected mode. Light-mode fallbacks in custom.css retain the
   original palette exactly. Keep button/brand colors separate from link colors.
   No image inversion: product photography and maps keep their original colors. */
@media screen {
  :root {
    color-scheme: dark;
    --ec-ink: #edf0f7;
    --ec-muted: #b3bbce;
    --ec-surface: #222a3c;
    --ec-border: #394359;
    --ec-adaptive-card: #1b2232;
    --ec-adaptive-soft: #252f45;
    --ec-adaptive-text: #edf0f7;
    --ec-adaptive-muted: #b3bbce;
    --ec-adaptive-link: #9dbbff;
    --ec-adaptive-border: #394359;
  }

  html, body { background: #121824; color: var(--ec-ink); }
  a, .btn-link { color: var(--ec-adaptive-link); }
  a:hover, a:focus, .btn-link:hover { color: #c4d5ff; }
  h1, h2, h3, h4, h5, h6, legend, .brand_list span { color: var(--ec-ink); }
  hr, legend, .table, .table > thead > tr > th,
  .table > thead > tr > td, .table > tbody > tr > td,
  .table > tbody > tr > th, .table > tfoot > tr > td,
  .modal-header, .modal-footer, .nav-tabs { border-color: var(--ec-border); }

  /* Bootstrap and extension surfaces that predate the custom theme. */
  .well, .panel, .modal-content, .dropdown-menu, .list-group-item,
  .thumbnail, .popover, .form-control, .pagination > li > a,
  .pagination > li > span, .select2-dropdown,
  .select2-container--default .select2-selection--single {
    background-color: var(--ec-adaptive-card);
    border-color: var(--ec-border);
    color: var(--ec-ink);
  }
  .panel-default > .panel-heading, .panel-footer, .input-group-addon,
  .breadcrumb, .table-striped > tbody > tr:nth-of-type(odd),
  .table-hover > tbody > tr:hover, .nav-tabs > li.active > a,
  .nav-tabs > li.active > a:hover, .nav-tabs > li.active > a:focus,
  .nav > li > a:hover, .nav > li > a:focus,
  .dropdown-menu > li > a:hover, .dropdown-menu > li > a:focus,
  .list-group-item:hover, .list-group-item:focus {
    background: var(--ec-surface);
    border-color: var(--ec-border);
    color: var(--ec-ink);
  }
  .dropdown-menu > li > a, .thumbnail .caption,
  .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--ec-ink);
  }
  .btn-default { background: var(--ec-surface); border-color: var(--ec-border); color: var(--ec-ink); text-shadow: none; }
  .btn-default:hover, .btn-default:focus { background: #35415b; color: #fff; }
  .form-control::placeholder { color: #a2adc3; opacity: 1; }
  .form-control:focus { border-color: #91b3ff; box-shadow: 0 0 0 3px #3976f633; }
  .form-control[disabled], .form-control[readonly], fieldset[disabled] .form-control { background: #293143; color: #a2adc3; }
  input, select, textarea { accent-color: #719fff; }
  .close { color: var(--ec-ink); text-shadow: none; opacity: .85; }
  .text-muted, .help-block { color: var(--ec-muted); }
  .text-danger, .has-error .control-label, .has-error .help-block { color: #ff9bad; }
  .has-error .form-control { border-color: #ff9bad; }
  .alert-danger { color: #ffbfcb; background: #442532; border-color: #794353; }
  .alert-warning { color: #f7d799; background: #3b3224; border-color: #735e36; }
  .alert-success { color: #a9e1c0; background: #213b32; border-color: #3d7059; }
  .alert-info { color: #bad2ff; background: #243550; border-color: #435d87; }
  .alert a { color: inherit; text-decoration: underline; }

  /* Header and menus. The logo asset is transparent, so it can sit directly
     on the dark header without a separate white tile. */
  header { background: #121824; }
  header #logo img {
    padding: 0;
    border-radius: 0;
    background: transparent;
    filter: brightness(0) invert(1);
    opacity: .96;
  }
  #top, #top a, #top .btn-link, #top-links li, #top-links a { color: var(--ec-muted); }
  #supermenu ul li div.bigdiv, #supermenu ul li div.bigdivwithimage,
  #supermenu .supermenu-left, #supermenu .supermenu-right,
  #supermenu ul li div .withimage, #supermenu ul li div .withchild,
  .liveform, #cart .dropdown-menu {
    background-color: var(--ec-adaptive-card) !important;
    color: var(--ec-ink);
    border-color: var(--ec-border) !important;
  }
  #supermenu ul li div a { color: var(--ec-ink) !important; }
  #supermenu ul li div a:hover { color: #b8ceff !important; background-color: var(--ec-surface) !important; }
  #cart .dropdown-menu .table, #cart .dropdown-menu .table td { background: transparent; color: var(--ec-ink); }

  /* Product images remain unfiltered and sit on a slightly lighter dark
     surface, so the whole product card reads as one component. */
  .product-thumb .image,
  :is(#product-category,#product-special) .product-layout .product-thumb > .image,
  .ecloud-home #content .row.module .product-thumb .image {
    background: var(--ec-surface);
    color-scheme: dark;
  }
  .home-hero__button--primary, .home-hero__button--primary:hover { background: #fff; color: #28366c; }
  .home-help__button { background: #384a78; color: #fff; }
  .home-location__map:after { box-shadow: none; }
  .home-category__icon, .home-location__eyebrow,
  .home-help__content > span, .ecloud-information-card a,
  #product-product .products_manufacturer__info a { color: var(--ec-adaptive-link) !important; }
  .product-thumb .price-new { color: #ff93aa; }
  .product-thumb .button-group { background-color: var(--ec-adaptive-card); border-color: var(--ec-border); }

  /* OCFilter and Simple checkout include their own hardcoded light skins. */
  .ocf-container, .ocf-container .ocf-content,
  .ocf-container .ocf-body, .ocf-container .ocf-filter-body,
  .ocf-container .ocf-value, .ocf-container .ocf-footer,
  .simplecheckout-block, .simplecheckout-cart,
  .simplecheckout-block-content, .simplecheckout-step,
  .simplecheckout .form-control {
    background-color: var(--ec-adaptive-card) !important;
    border-color: var(--ec-border) !important;
    color: var(--ec-ink) !important;
  }
  .ocf-container .ocf-filter-name, .ocf-container .ocf-value-name,
  .ocf-container .ocf-value-count, .ocf-container .ocf-value-input,
  .simplecheckout label, .simplecheckout-cart td { color: var(--ec-ink) !important; }
  .ocf-container .ocf-active-label, .ocf-container .ocf-noUi-value { color: var(--ec-muted) !important; }
  .ocf-container .ocf-form-control, .ocf-container .ocf-input-group-addon {
    background: var(--ec-adaptive-card) !important;
    border-color: var(--ec-border) !important;
    color: var(--ec-ink);
  }
  .ocf-container .ocf-value-count { background: var(--ec-surface) !important; }
  .ocf-container .ocf-selected .ocf-value-count {
    display: inline-flex !important;
    align-items: center;
  }
  .ocf-container .ocf-filter-body > .ocf-value-list {
    background-color: var(--ec-adaptive-card) !important;
    color-scheme: dark;
  }
  .ocf-container .ocf-open .ocf-filter-header {
    background-color: var(--ec-adaptive-card) !important;
    color: var(--ec-ink) !important;
  }
  .ocf-container .ocf-value-input::before {
    background-color: var(--ec-surface) !important;
    border-color: #71809d !important;
  }
  .ocf-container .ocf-footer {
    box-shadow: 0 -1px 0 var(--ec-border) !important;
  }
  body .not-allow_category .restricted-advertising-notice {
    background: var(--ec-adaptive-card);
    border-color: var(--ec-border);
    color: var(--ec-ink);
  }
  body .restricted-advertising-notice__close { color: var(--ec-muted); }
  #modal_info .modal-content {
    background: var(--ec-adaptive-card) !important;
    border-color: var(--ec-border) !important;
    box-shadow: 0 18px 55px rgba(0, 0, 0, .55) !important;
  }
  #modal_info .modal-body { color: var(--ec-ink) !important; }
  #modal_info .close { color: var(--ec-muted) !important; }
  #product-category > .breadcrumb,
  #product-product > .breadcrumb {
    color: #dbe2f2;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    text-shadow: none;
  }
  #product-category > .breadcrumb li,
  #product-category > .breadcrumb li:last-child,
  #product-product > .breadcrumb li,
  #product-product > .breadcrumb li:last-child {
    font-weight: 400;
    letter-spacing: .01em;
    text-shadow: none !important;
  }
  #product-product #content .stock { color: #a3e3bd; background: #213b32; }
  #product-product #product .price-new,
  :is(#product-category,#product-special) .product-layout .product-thumb .price-new,
  .ecloud-home #content .row.module .product-thumb .price-new { color: #ff93aa; }
  .simplecheckout-cart th, .simplecheckout-cart td,
  .simplecheckout-block-heading, .simplecheckout-cart-total {
    background: var(--ec-surface) !important;
    border-color: var(--ec-border) !important;
    color: var(--ec-ink) !important;
  }
  .success_add_to_cart .alert-success,
  #common-success .order-success-info > div {
    background: var(--ec-adaptive-card);
    color: var(--ec-ink);
  }

  /* These widgets may load their styles after the main document head. */
  body .ecloud-cookie-banner, body .ecloud-cookie-reject,
  #ecloud-consultant .ec-help-panel, #ecloud-consultant .ec-help-questions button {
    background: var(--ec-adaptive-card);
    border-color: var(--ec-border);
    color: var(--ec-ink);
  }
  body .ecloud-cookie-text a, #ecloud-consultant .ec-help-answer a,
  #ecloud-consultant .ec-help-contact a { color: #a8c5ff; }
  #ecloud-consultant { color: var(--ec-ink); }
  #ecloud-consultant .ec-help-answer { background: var(--ec-surface); }
  #ecloud-consultant .ec-help-product, #ecloud-consultant .ec-help-questions { border-color: var(--ec-border); }
}
