/* Implements landing page and detail pages */

.imp-listing,
.imp-detail {
  --imp-red: #e51836;
  --imp-ink: #222;
  --imp-grey: #4d4d4d;
  --imp-line: #d9d9d9;
  --imp-pale: #f5f5f5;
}

/* Filter */

.imp-toolbar {
  margin-bottom: 2rem;
}

.imp-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.imp-filter a {
  padding: 10px 22px;
  border: 1px solid var(--imp-grey);
  border-radius: 25px;
  color: var(--imp-ink);
  font-weight: 500;
  line-height: 1.3;
  text-decoration: none;
}

.imp-filter a span {
  margin-left: 4px;
  color: #6b6b6b;
  font-size: 0.85em;
}

.imp-filter a:hover {
  border-color: var(--imp-red);
  color: var(--imp-red);
}

.imp-filter a[aria-current] {
  border-color: var(--imp-red);
  background-color: var(--imp-red);
  color: #fff;
}

.imp-filter a[aria-current] span {
  color: #fff;
}

/* Cards */

.imp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
  gap: 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.imp-grid li[hidden] {
  display: none;
}

.imp-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--imp-line);
  border-bottom: 3px solid var(--imp-line);
  background-color: #fff;
  color: var(--imp-ink);
  text-decoration: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.imp-card:hover,
.imp-card:focus-visible {
  border-bottom-color: var(--imp-red);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
  color: var(--imp-ink);
}

.imp-card-img {
  display: block;
  overflow: hidden;
  aspect-ratio: 29 / 24;
  background-color: #fff;
}

.imp-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.imp-card:hover .imp-card-img img {
  transform: scale(1.04);
}

.imp-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 18px 20px 20px;
}

.imp-card-type {
  margin-bottom: 4px;
  color: #6b6b6b;
  font-size: 13px;
}

.imp-card h3 {
  margin-bottom: 8px;
  color: #000;
  font-family: Georama, sans-serif;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.2;
  text-transform: none;
}

.imp-card-text {
  margin-bottom: 16px;
  font-size: 15px;
  line-height: 1.5;
}

.imp-card-link {
  margin-top: auto;
  color: var(--imp-red);
  font-weight: 600;
}

.imp-card-link::after {
  content: "\2192";
  display: inline-block;
  margin-left: 6px;
  transition: transform 0.2s;
}

.imp-card:hover .imp-card-link::after {
  transform: translateX(4px);
}

/* Detail hero: 4:3 photos fill their half, cut-out products and photos that
   fade to white sit on the white background. */

.imp-hero {
  overflow: hidden;
  background-color: #fff;
}

.imp-hero-text {
  padding: 24px 16px 8px;
}

.imp-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 0;
  margin-bottom: 24px;
  font-size: 14px;
}

.imp-breadcrumb a {
  color: var(--imp-grey);
  text-decoration: none;
}

.imp-breadcrumb a:hover {
  color: var(--imp-red);
  text-decoration: underline;
}

.imp-breadcrumb a::after {
  content: "/";
  display: inline-block;
  margin: 0 8px;
  color: #6b6b6b;
}

.imp-hero h1 {
  margin-bottom: 6px;
  color: var(--imp-red);
  font-family: QuantumRise-semibold, Georama, sans-serif;
  font-size: clamp(1.5rem, 1.1rem + 1.3vw, 2.1rem);
  line-height: 1.1;
  text-transform: uppercase;
  text-wrap: balance;
}

.imp-tagline {
  margin-bottom: 18px;
  color: var(--imp-red);
  font-size: 20px;
  font-weight: 500;
  line-height: 1.3;
}

.imp-intro {
  max-width: 62ch;
  margin-bottom: 24px;
  color: var(--imp-ink);
  font-size: 16px;
  line-height: 1.65;
}

.imp-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
}

.imp-actions .fc-rounded-btn {
  margin: 0;
  padding: 10px 22px;
  color: #fff;
  text-decoration: none;
}

.imp-hero-img img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 560px;
  object-fit: contain;
}

@media (min-width: 992px) {
  .imp-hero {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    align-items: end;
  }

  .imp-hero-text {
    align-self: center;
    padding: 40px 40px 40px max(24px, calc((100vw - 1320px) / 2 + 12px));
  }

  .imp-hero-img img {
    max-height: 680px;
    object-position: center bottom;
  }

}

@media (min-width: 1200px) {
  .imp-hero.is-photo .imp-hero-img {
    position: relative;
    align-self: stretch;
    min-height: min(680px, 41vw);
  }

  .imp-hero.is-photo .imp-hero-img img {
    position: absolute;
    inset: 0;
    height: 100%;
    max-height: none;
    object-fit: cover;
    object-position: center;
  }
}

/* Section bar: stays below the fixed site header */

.imp-jump {
  position: sticky;
  top: var(--imp-bar-top, 90px);
  z-index: 20;
  background-color: #36373b;
  transition: box-shadow 0.3s ease;
}

.imp-jump.is-stuck {
  box-shadow: 0 10px 24px -8px rgba(0, 0, 0, 0.35);
}

.imp-jump .container {
  position: relative;
  display: flex;
  gap: 30px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}

.imp-jump .container::-webkit-scrollbar {
  display: none;
}

/* Centred, but still reachable from the start when the links are too wide. */
.imp-jump a:first-child {
  margin-left: auto;
}

.imp-jump a:last-child {
  margin-right: auto;
}

.imp-jump a {
  padding: 20px 0;
  color: #c4c4c4;
  line-height: 24px;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.3s;
}

.imp-jump a:hover,
.imp-jump a[aria-current] {
  color: #fff;
}

.imp-jump a:focus-visible {
  outline: 2px solid #fff;
  outline-offset: -4px;
}

/* Sections */

.imp-section:focus {
  outline: 0;
}

.imp-section {
  scroll-margin-top: calc(var(--imp-bar-top, 90px) + var(--imp-bar-height, 0px) - 1px);
}

.imp-section-grey {
  background-color: var(--imp-pale);
}

/* Same red as the site's .heading-title.text-red h2 */
.imp-section h2 {
  margin-bottom: 20px;
  color: var(--imp-red);
  font-family: QuantumRise-semibold, Georama, sans-serif;
  text-transform: uppercase;
}

.imp-feature-group h3 {
  margin-bottom: 10px;
  color: #000;
  font-size: 20px;
  font-weight: 600;
}

.imp-feature-group ol {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: imp-feature;
}

.imp-feature-group li {
  position: relative;
  padding: 10px 0 10px 36px;
  border-bottom: 1px solid #e9e9e9;
  line-height: 1.5;
  break-inside: avoid;
  counter-increment: imp-feature;
}

.imp-feature-group li::before {
  content: counter(imp-feature, decimal-leading-zero);
  position: absolute;
  top: 10px;
  left: 0;
  color: var(--imp-grey);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

@media (min-width: 768px) {
  .imp-features:not(.has-groups) ol,
  .imp-feature-group.is-lead ol {
    columns: 2;
    column-gap: 48px;
  }
}

.imp-features.has-groups {
  display: grid;
  gap: 32px 40px;
}

@media (min-width: 768px) {
  .imp-features.has-groups {
    grid-template-columns: repeat(var(--imp-groups, 2), minmax(0, 1fr));
  }
}

.imp-features.has-groups .is-lead {
  grid-column: 1 / -1;
}

/* Tables */

.imp-table-box {
  position: relative;
}

/* Shadow on the right edge while there are more columns to scroll to. */
.imp-table-box::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  width: 28px;
  background: linear-gradient(to left, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0));
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.imp-table-box.has-more::after {
  opacity: 1;
}

/* Same look as the series pages' specification tables: no borders, light
   stripes, red header text. Row labels are left-aligned; model columns share
   the width equally and are centred, as values can span several models. */
.imp-table-wrap {
  position: relative;
  overflow-x: auto;
  scrollbar-color: var(--imp-red) #e6e6e6;
  scrollbar-width: thin;
}

.imp-table-wrap::-webkit-scrollbar {
  height: 2px;
}

.imp-table-wrap::-webkit-scrollbar-track {
  background-color: #e6e6e6;
}

.imp-table-wrap::-webkit-scrollbar-thumb {
  background-color: var(--imp-red);
}

.imp-table {
  width: 100%;
  min-width: calc(175px + var(--imp-cols, 4) * 132px);
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  color: #000;
  font-size: 0.9rem;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

.imp-table th,
.imp-table td {
  padding: 8px;
  border: 0;
  background-color: #fff;
  font-weight: 400;
  text-align: center;
  vertical-align: middle;
}

.imp-table thead th {
  background-color: #f2f2f2;
  color: var(--imp-red);
  font-weight: 600;
}

.imp-table tbody tr:nth-child(even) > * {
  background-color: #f2f2f2;
}

.imp-table tbody th {
  font-weight: 500;
}

.imp-table tbody th,
.imp-table thead tr:first-child th:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  width: 175px;
  min-width: 175px;
  text-align: left;
}

/* Keeps the value of a wide merged cell in view while the table scrolls. */
.imp-cell {
  position: sticky;
  right: 8px;
  left: 183px;
  display: inline-block;
  max-width: min(100%, 420px);
}

.imp-table .imp-sku td {
  font-weight: 600;
  white-space: nowrap;
}

.imp-check {
  display: inline-block;
  width: 7px;
  height: 13px;
  margin-top: -3px;
  border: solid var(--imp-red);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.imp-table-options {
  min-width: 760px;
  table-layout: auto;
}

.imp-table-options th,
.imp-table-options td {
  text-align: left;
}

.imp-table-options tbody th,
.imp-table-options thead tr:first-child th:first-child {
  width: 150px;
  min-width: 130px;
}

.imp-note {
  margin-left: 3px;
  font-size: 0.7em;
}

.imp-help {
  margin: 14px 0 0;
  color: var(--imp-grey);
  font-size: 14px;
}

.imp-notes {
  padding: 24px 0;
  border-top: 1px solid var(--imp-line);
  color: var(--imp-grey);
  font-size: 13px;
  line-height: 1.6;
}

.imp-notes ol {
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
  counter-reset: note;
}

.imp-notes li::before {
  counter-increment: note;
  content: "[" counter(note) "] ";
}

.imp-notes p {
  max-width: 110ch;
  margin: 0;
  font-size: 13px;
}

/* Related */

.imp-related-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 20px;
  margin-bottom: 20px;
}

.imp-related-head h2 {
  margin: 0;
}

.imp-related-head a {
  color: var(--imp-red);
  font-weight: 600;
}

@media (max-width: 575px) {
  .imp-table {
    min-width: calc(130px + var(--imp-cols, 4) * 132px);
  }

  .imp-table tbody th,
  .imp-table thead tr:first-child th:first-child {
    width: 130px;
    min-width: 130px;
  }

  .imp-cell {
    left: 138px;
    max-width: min(100%, 190px);
  }
}

/* Motion */

@media screen and (prefers-reduced-motion: no-preference) {
  /* Hero, on load */

  .imp-hero-text > * {
    animation: imp-rise 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  .imp-hero-text > :nth-child(2) {
    animation-delay: 0.08s;
  }

  .imp-hero-text > :nth-child(3) {
    animation-delay: 0.16s;
  }

  .imp-hero-text > :nth-child(4) {
    animation-delay: 0.24s;
  }

  .imp-hero-text > :nth-child(5) {
    animation-delay: 0.32s;
  }

  .imp-hero-img {
    animation: imp-wipe 1.2s cubic-bezier(0.65, 0, 0.2, 1) both;
  }

  @keyframes imp-rise {
    from {
      opacity: 0;
      transform: translateY(28px);
    }
  }

  @keyframes imp-wipe {
    from {
      clip-path: polygon(115% 0, 115% 0, 100% 100%, 100% 100%);
    }

    to {
      clip-path: polygon(0 0, 115% 0, 100% 100%, -15% 100%);
    }
  }

  /* Hero, while scrolling */

  @supports (animation-timeline: scroll()) {
    @media (min-width: 992px) {
      .imp-hero-text {
        animation: imp-hero-text linear both;
        animation-timeline: scroll(root);
        animation-range: 0 700px;
      }
    }
  }

  @keyframes imp-hero-text {
    to {
      opacity: 0.2;
      transform: translateY(90px);
    }
  }

  /* Sections, as they come into view */

  .imp-reveal {
    opacity: 0;
    transform: translateY(32px);
  }

  .imp-reveal.is-in {
    opacity: 1;
    transform: none;
    transition: opacity 0.8s ease, transform 0.9s cubic-bezier(0.22, 1, 0.36, 1), clip-path 0.9s cubic-bezier(0.22, 1, 0.36, 1);
    transition-delay: var(--imp-delay, 0ms);
  }

  h2.imp-reveal {
    clip-path: inset(0 100% -8px 0);
    transform: none;
  }

  h2.imp-reveal.is-in {
    clip-path: inset(0 -8px -8px 0);
  }

  /* Rows move sideways: moving down would give the table a scrollbar. */
  .imp-table tr.imp-reveal {
    transform: translateX(-24px);
  }

  .imp-table tr.imp-reveal.is-in {
    transform: none;
  }

  .imp-table tr.imp-reveal .imp-check {
    clip-path: inset(-3px 100% -3px -3px);
  }

  .imp-table tr.imp-reveal.is-in .imp-check {
    clip-path: inset(-3px);
    transition: clip-path 0.45s ease-out;
    transition-delay: calc(var(--imp-delay, 0ms) + 350ms);
  }

  .imp-grid > li.imp-reveal {
    transform: translateY(56px);
  }

  .imp-grid > li.imp-reveal.is-in {
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .imp-card,
  .imp-card-img img,
  .imp-card-link::after,
  .imp-jump,
  .imp-jump a,
  .imp-table-box::after {
    transition: none;
  }
}
