/* Dusk for Chrome's page. Tokens, type scale, buttons and the footer come from style.css; this file is the page's
   own layout: a night band for the comparison, a light page below it, and the night footer. */
.chrome-page {
  --moonlight: #e9ecfa;
  --night-muted: #c2c6e3;
  --night-line: #464973;
}

.chrome-page .wrap {
  max-width: 1240px;
  padding-inline: clamp(18px, 4vw, 54px);
}

.chrome-night {
  background: var(--night);
  color: var(--moonlight);
}

.chrome-page header.top {
  align-items: center;
  flex-direction: row;
  gap: 14px;
  min-height: 68px;
}

.chrome-night .brand {
  color: #fff;
}

.chrome-night nav a {
  color: var(--moonlight);
}

.chrome-night nav a:active {
  color: #fff;
}

@media (hover: hover) and (pointer: fine) {
  .chrome-night nav a:hover {
    color: #fff;
    text-decoration: underline;
  }
}

.chrome-night a:focus-visible {
  outline-color: var(--ember);
}

.chrome-intro {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
  align-items: center;
  gap: clamp(30px, 5vw, 76px);
  padding-block: clamp(45px, 7vw, 106px) clamp(48px, 7vw, 92px);
}

.chrome-intro h1 {
  color: #fff;
  font-size: clamp(2.9rem, 5.2vw, 4.75rem);
  line-height: .99;
  letter-spacing: -.04em;
  text-wrap: normal;
}

.chrome-copy .lede {
  max-width: 29ch;
  margin-block: 0 24px;
  color: var(--moonlight);
  font-size: clamp(1.0625rem, 2vw, 1.3125rem);
  line-height: 1.4;
}

.chrome-intro .btn.primary:focus-visible {
  outline-color: #fff;
}

.chrome-copy .facts {
  color: var(--moonlight);
}

.chrome-note {
  margin: 2px 0 0;
  color: var(--night-muted);
  font-size: var(--fs-small);
  line-height: 1.4;
}

/* Shown to phones only, like the box it leads to (see the last media query). */
.chrome-phone {
  display: none;
  margin: 6px 0 0;
  font-size: var(--fs-small);
}

.chrome-phone a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--moonlight);
}

.chrome-demo {
  min-width: 0;
  margin: 0;
}

.chrome-demo-bar {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 10px 4px 16px;
  background: #23275a;
  border: 1px solid var(--night-line);
  border-radius: 14px 14px 0 0;
  font-size: var(--fs-small);
  font-weight: 500;
}

/* The page's name gives way to the two buttons: one line, cut with an ellipsis. */
.chrome-demo-bar > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chrome-controls:not([hidden]) {
  display: flex;
  flex: none;
  gap: 4px;
}

.chrome-controls button {
  min-width: 54px;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--moonlight);
  font: inherit;
  cursor: pointer;
}

@media (hover: hover) and (pointer: fine) {
  .chrome-controls button:hover {
    border-color: var(--night-muted);
  }
}

.chrome-controls button:active {
  border-color: var(--night-muted);
}

.chrome-controls button[aria-pressed="true"] {
  background: var(--moonlight);
  color: var(--night);
}

.chrome-controls button:focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: 1px;
}

.chrome-panes {
  --light: 50%;
  position: relative;
  border-radius: 0 0 14px 14px;
  overflow: hidden;
  background: #181a1b;
}

.chrome-panes picture,
.chrome-panes img {
  display: block;
}

.chrome-panes img {
  width: 100%;
  height: auto;
  user-select: none;
}

.chrome-light-pane {
  position: absolute;
  inset: 0;
  clip-path: inset(0 calc(100% - var(--light)) 0 0);
}

/* The native range receives drag, touch and keyboard input across the whole image. */
.chrome-range {
  appearance: none;
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0;
  border: 0;
  opacity: 0;
  cursor: ew-resize;
  touch-action: pan-y;
}

.chrome-range::-webkit-slider-thumb {
  appearance: none;
  width: 1px;
  height: 44px;
}

.chrome-range::-moz-range-thumb {
  width: 1px;
  height: 44px;
  border: 0;
}

.chrome-panes:has(.chrome-range:focus-visible) {
  outline: 3px solid var(--ember);
  outline-offset: 4px;
}

.chrome-divider {
  position: absolute;
  inset: 0 auto 0 var(--light);
  width: 2px;
  background: var(--ember);
  transform: translateX(-50%);
  pointer-events: none;
}

.chrome-divider span {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%);
  border: 2px solid var(--night);
  border-radius: 50%;
  background: linear-gradient(90deg, var(--ember) 50%, var(--moonlight) 50%);
  color: var(--night);
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1;
}

.chrome-range[hidden] + .chrome-divider span,
.chrome-drag-hint {
  display: none;
}

.chrome-demo:has(.chrome-range:not([hidden])) .chrome-drag-hint {
  display: inline;
}

.chrome-range:focus-visible + .chrome-divider span {
  box-shadow: 0 0 0 3px var(--night), 0 0 0 6px var(--ember);
}

.chrome-demo figcaption {
  margin-top: 12px;
  color: var(--night-muted);
  font-size: var(--fs-fine);
  line-height: 1.45;
}

.chrome-demo figcaption a,
.chrome-credits a {
  color: inherit;
}

.chrome-content {
  background: var(--bg);
  color: var(--ink);
}

.chrome-content a:focus-visible {
  outline-color: var(--accent);
}

.chrome-setup {
  border: 0;
  background: var(--card);
  padding-block: var(--section);
}

.chrome-setup-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(28px, 7vw, 96px);
}

.chrome-content h2 {
  font-size: var(--fs-display);
}

.chrome-steps {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 22px;
  max-width: 48ch;
  margin: 25px 0 0;
  padding-inline-start: 1.5em;
}

.chrome-steps li {
  padding-inline-start: .45em;
}

.chrome-steps li::marker {
  color: var(--mark);
  font-weight: 600;
}

.chrome-steps li::marker {
  font-size: var(--fs-title);
}

.chrome-steps h3 {
  margin: 0;
  font-size: var(--fs-title);
}

.chrome-steps p,
.chrome-save p {
  margin: 3px 0 0;
  color: var(--muted);
}

.chrome-popup {
  width: min(100%, 380px);
  justify-self: center;
  margin: 0;
}

.chrome-popup img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--r-img);
  box-shadow: var(--shot-shadow);
}

.chrome-popup figcaption {
  margin-top: 12px;
  color: var(--muted);
  font-size: var(--fs-fine);
  line-height: 1.45;
}

.chrome-faq {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.65fr);
  gap: 12px clamp(24px, 6vw, 90px);
  padding-block: var(--section);
  border: 0;
}

.chrome-faq details {
  border-top: 1px solid var(--line);
}

.chrome-faq details:last-child {
  border-bottom: 1px solid var(--line);
}

.chrome-page summary {
  cursor: pointer;
}

.chrome-page summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.chrome-faq summary {
  padding-block: 13px;
  font-weight: 600;
}

.chrome-faq details p {
  margin: 0;
  padding-bottom: 16px;
  color: var(--muted);
}

/* An answer opens in place instead of jumping. Only where the browser can size to content; a plain toggle elsewhere,
   so a browser that cannot animate the height does not get the clipping either. The clip keeps 6px of room for the
   focus ring of a link on the answer's first line or at the start of a line (3px ring, 3px offset). */
@media (prefers-reduced-motion: no-preference) {
  @supports (interpolate-size: allow-keywords) {
    .chrome-faq {
      interpolate-size: allow-keywords;
    }

    .chrome-faq details::details-content {
      block-size: 0;
      overflow: clip;
      overflow-clip-margin: 6px;
      transition: block-size .25s var(--ease-out), content-visibility .25s allow-discrete;
    }

    .chrome-faq details[open]::details-content {
      block-size: auto;
    }
  }
}

/* Phone to computer: hidden on a computer, where there is nothing to hand off. The slot around it stays in the page
   so that #save-for-desktop always has somewhere to land. */
.handoff-slot {
  scroll-margin-top: 20px;
}

.chrome-save {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 18px 32px;
  padding-block: 0 var(--section);
  border: 0;
}

.chrome-save h2 {
  font-size: var(--fs-title);
  line-height: 1.2;
  letter-spacing: -.01em;
}

.chrome-save > * {
  min-width: 0;
}

.chrome-save p {
  max-width: 49ch;
}

.chrome-credits {
  padding-block: 8px 20px;
  color: var(--night-muted);
  font-size: var(--fs-small);
}

.chrome-credits summary {
  padding-block: 10px;
}

.chrome-credits details p {
  max-width: 66ch;
  margin: 0 0 12px;
}

.chrome-credits summary:focus-visible {
  outline-color: var(--ember);
}

@media (max-width: 860px) {
  .chrome-intro, .chrome-setup-grid, .chrome-faq {
    grid-template-columns: minmax(0, 1fr);
  }

  .chrome-intro {
    gap: 26px;
  }

  .chrome-popup {
    justify-self: start;
  }
}

@media (max-width: 480px) {
  .chrome-page header.top nav {
    max-width: none;
    justify-content: flex-end;
    gap: 4px 10px;
  }

  .chrome-page header.top nav a {
    font-size: .875rem;
  }

  .chrome-intro h1 {
    font-size: clamp(2.35rem, 12vw, 3.5rem);
  }

  .chrome-save {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 760px), (pointer: coarse) {
  .chrome-phone {
    display: block;
  }

  .chrome-save {
    display: flex;
  }
}

@media (forced-colors: active) {
  .chrome-controls button {
    border: 1px solid ButtonText;
  }

  .chrome-controls button[aria-pressed="true"],
  .chrome-divider,
  .chrome-divider span {
    forced-color-adjust: none;
    background: Highlight;
    color: HighlightText;
  }

  .chrome-panes:has(.chrome-range:focus-visible) {
    outline-color: Highlight;
  }
}
