/* ==========================================================================
   EVB Portable Chargers — Setting Tutorial
   Anchor: Swiss. White surface, one grotesque family, hairline grid rules,
   left-aligned type, numerals used as composition. Single accent:
   EV green #219150, inherited from the existing AEFA product pages.
   ========================================================================== */

:root {
  --paper:  #ffffff;
  --wash:   #f7f7f8;
  --ink:    #14161a;
  --muted:  #6b7280;
  --rule:   #d9dde2;
  --green:  #219150;
  --green-tint: #e0f7ef;

  --font: "Helvetica Neue", Helvetica, Arial, system-ui, -apple-system, sans-serif;
  --wrap: 960px;
  --step-thumb: 240px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }

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

:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 20px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--ink);
  color: #fff;
  padding: 12px 18px;
  font-size: 14px;
  text-decoration: none;
}
.skip-link:focus { left: 0; }

/* ----------------------------------------------------------- breadcrumb */

.crumbs {
  border-bottom: 1px solid var(--rule);
  background: var(--wash);
}

.crumbs__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-block: 12px;
  font-size: 13px;
  color: var(--muted);
}

.crumbs__inner a { text-decoration: none; }
.crumbs__inner a:hover { text-decoration: underline; }

/* ------------------------------------------------------------- products */

.products {
  margin: 0;
  padding: 0;
  list-style: none;
}

.product { border-bottom: 1px solid var(--rule); }

.product__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 4px;
  color: inherit;
  text-decoration: none;
  transition: background-color 0.18s ease, padding 0.18s ease;
}

.product__link:hover { background: var(--wash); }

.product__name {
  display: block;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.018em;
}

.product__cue {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.product__arrow {
  flex: none;
  font-size: 1.25rem;
  color: var(--green);
  transition: transform 0.18s ease;
}
.product__link:hover .product__arrow { transform: translateX(4px); }

/* --------------------------------------------------------------- masthead */

.masthead {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}

.masthead__inner {
  padding-block: 56px 40px;
  position: relative;
}

/* hairline column rule on the left, the grid made visible */
.masthead__inner::before {
  content: "";
  position: absolute;
  left: 20px;
  top: 56px;
  width: 28px;
  height: 3px;
  background: var(--green);
}

.masthead__brand {
  margin: 0 0 22px;
  padding-left: 44px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--green);
}

.masthead__title {
  margin: 0;
  font-size: clamp(2.1rem, 7vw, 3.5rem);
  line-height: 0.98;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.masthead__lede {
  margin: 20px 0 0;
  max-width: 46ch;
  font-size: 1.0625rem;
  color: var(--muted);
}

/* --------------------------------------------------------------- section */

.section { padding-block: 40px 72px; }

.section__title {
  margin: 0 0 8px;
  padding-bottom: 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--ink);
}

/* ----------------------------------------------------------- step index */

.steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.step {
  border-bottom: 1px solid var(--rule);
  counter-increment: step;
}

.step__button {
  display: grid;
  grid-template-columns: 3.5rem var(--step-thumb) 1fr;
  align-items: center;
  gap: 24px;
  width: 100%;
  padding: 20px 0;
  margin: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.18s ease;
}

.step__button:hover { background: var(--wash); }

/* the row whose video is currently open in the lightbox */
.step__button.is-active { background: var(--green-tint); }
.step__button.is-active .step__index { color: var(--green); }
.step__button.is-active .step__thumb { border-color: var(--green); }

.step__index::before {
  content: counter(step, decimal-leading-zero);
}

.step__index {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--rule);
  transition: color 0.18s ease;
}
.step__button:hover .step__index,
.step__button:focus-visible .step__index { color: var(--green); }

/* Neutral tile: shows while the thumbnail loads and stays in place if it
   never arrives, so a blocked thumbnail leaves no broken-image icon. */
.step__thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--ink) center / cover no-repeat;
  border: 1px solid var(--rule);
  transition: border-color 0.18s ease;
}
.step__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.9);
  transition: transform 0.35s ease, filter 0.18s ease;
}
.step__button:hover .step__thumb { border-color: var(--green); }
.step__button:hover .step__thumb img {
  transform: scale(1.03);
  filter: saturate(1);
}

.step__play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
}
.step__play::before {
  content: "";
  position: absolute;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(20, 22, 26, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.65);
  transition: background-color 0.18s ease, transform 0.18s ease;
}
.step__play svg {
  position: relative;
  fill: #fff;
  margin-left: 2px;
}
.step__button:hover .step__play::before {
  background: var(--green);
  transform: scale(1.06);
}

.step__body { display: block; }

.step__title {
  display: block;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.012em;
  text-wrap: balance;
}

.step__cue {
  display: inline-block;
  margin-top: 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 3px;
  transition: color 0.18s ease, border-color 0.18s ease;
}
.step__button:hover .step__cue {
  color: var(--green);
  border-color: var(--green);
}

/* --------------------------------------------------------------- footer */

.footer {
  border-top: 1px solid var(--rule);
  background: var(--wash);
}

.footer__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding-block: 28px 40px;
}

.footer__note {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

/* --------------------------------------------------- lightbox / player */

.lightbox[hidden] { display: none; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
}

.lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 14, 17, 0.78);
  backdrop-filter: blur(3px);
}

.lightbox__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(920px, 100%);
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--green);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.34);
  overflow: hidden;
}

.lightbox__bar {
  flex: none;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--rule);
}

.lightbox__count {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  font-variant-numeric: tabular-nums;
  color: var(--green);
}

.lightbox__title {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.lightbox__close {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}
.lightbox__close:hover {
  background: var(--green-tint);
  border-color: var(--green);
  color: var(--green);
}

.lightbox__frame {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  place-items: center;
  background: #000;
  padding: 16px;
}

/* Sizes to the available width, but never taller than the space left over
   once the header and footer are accounted for. On a phone held sideways that
   keeps the whole player — and the Previous/Next controls — on screen. */
.lightbox__player {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  max-height: 100%;
  background: #000;
}
.lightbox__player iframe,
.lightbox__player video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.lightbox__foot {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 20px 20px;
}

.lightbox__link { font-size: 13px; }

.lightbox__nav { display: flex; gap: 10px; }

.btn {
  min-height: 44px;
  padding: 9px 16px;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}
.btn:hover {
  background: var(--green-tint);
  border-color: var(--green);
  color: var(--green);
}
.btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
  background: var(--paper);
  border-color: var(--rule);
  color: var(--muted);
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 760px) {
  :root { --step-thumb: 180px; }
  .step__button { gap: 18px; }
  .step__title { font-size: 1.125rem; }
}

@media (max-width: 620px) {
  .masthead__inner { padding-block: 40px 32px; }
  .masthead__inner::before { top: 40px; }
  .masthead__lede { font-size: 1rem; }
  .section { padding-block: 28px 56px; }

  .step__button {
    grid-template-columns: 2.5rem 1fr;
    grid-template-areas:
      "index title"
      "thumb thumb";
    align-items: start;
    gap: 12px 16px;
    padding: 18px 0 22px;
  }
  .step__index { grid-area: index; font-size: 1.5rem; padding-top: 2px; }
  .product__name { font-size: 1.25rem; }
  .product__link { padding: 18px 2px; }
  .step__body  { grid-area: title; }
  .step__thumb { grid-area: thumb; }
  .step__title { font-size: 1.0625rem; }
  .step__cue { margin-top: 8px; }

  .lightbox { padding: 0; }
  /* Size to the content rather than filling the screen, so a 16:9 video in a
     portrait viewport doesn't leave a tall empty band under it. */
  .lightbox__panel {
    width: 100%;
    height: auto;
    max-height: 100dvh;
    border-inline: 0;
    border-top-width: 3px;
  }
  .lightbox__bar {
    gap: 10px;
    padding: 10px 12px;
    padding-top: calc(10px + env(safe-area-inset-top));
  }
  .lightbox__count { display: none; }
  .lightbox__title { font-size: 0.9375rem; }
  /* Portrait phones have far more vertical space than a 16:9 video needs, so
     sit the player directly under the header and let the page background show
     instead of a tall black band. */
  .lightbox__frame {
    flex: none;
    padding: 8px;
    background: var(--paper);
  }
  .lightbox__foot {
    gap: 10px;
    padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
  }
  .lightbox__nav { width: 100%; }
  .btn { flex: 1; }
}

/* Landscape phones: the viewport is short, so trim every non-video row to
   keep the player legible and both navigation buttons reachable. */
@media (max-width: 900px) and (max-height: 480px) {
  .lightbox { padding: 8px; }
  /* A definite panel height is what lets the player clamp to the leftover
     space instead of pushing the controls below the fold. */
  .lightbox__panel {
    height: calc(100vh - 16px);
    height: calc(100dvh - 16px);
    max-height: calc(100dvh - 16px);
    border-top-width: 2px;
  }
  .lightbox__frame { min-height: 0; }
  /* Height is the scarce dimension here, so derive the width from it. */
  .lightbox__player {
    width: auto;
    height: 100%;
    max-width: 100%;
    max-height: none;
  }
  .lightbox__bar {
    padding-block: 6px;
    padding-top: calc(6px + env(safe-area-inset-top));
  }
  .lightbox__title {
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .lightbox__frame { padding: 6px; }
  .lightbox__foot {
    padding-block: 6px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
  }
  .lightbox__link { font-size: 12px; }
  .btn { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
  .step__button:hover .step__thumb img { transform: none; }
}

/* Coarse pointers (phones/tablets): keep every control finger-sized. */
@media (hover: none) and (pointer: coarse) {
  .lightbox__close { width: 46px; height: 46px; }
  .btn { min-height: 46px; }
  .product__link:hover { background: none; }
  .product__link:active { background: var(--green-tint); }
  .step__button:hover { background: none; }
  .step__button:active { background: var(--green-tint); }
  .step__button.is-active { background: var(--green-tint); }
}
