/* ---------- tokens: paper, ink, chrome, one brass accent ---------- */
:root {
  --paper: #f8f8f6;
  --paper-tray: #efefeb;
  --paper-raised: #ffffff;
  --ink: #1a1a1a;
  --ink-2: #444442;
  --ink-3: #636361;
  --chrome: #c9cdd3;
  --chrome-2: #dfe2e6;
  --chrome-deep: #8a8f98;
  --brass: #f2b233;
  --brass-tint: #faf3df;

  --font: 'Public Sans', 'Helvetica Neue', Arial, sans-serif;

  --fs-body: 17px;
  --fs-small: 14px;
  --fs-h1: clamp(32px, 4.2vw, 46px);
  --fs-h2: clamp(22px, 2.4vw, 28px);
  --fs-h3: 18px;

  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;
  --sp-8: 64px;

  --wrap: 1120px;
  --gutter: 24px;
  --topbar-h: 64px;
  --measure: 68ch;
}

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

* {
  margin: 0;
}

/* the tool toggles panels with [hidden]; author display rules would otherwise beat the UA style */
[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  scrollbar-color: var(--chrome) var(--paper);
  /* the top bar is pinned; anchor and focus jumps land below it, not under it */
  scroll-padding-top: var(--topbar-h);
}

body {
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

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

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
}

a:hover {
  text-decoration-thickness: 2px;
}

/* ---------- browser surfaces ---------- */
::selection {
  background: var(--brass);
  color: var(--ink);
}

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

input,
textarea {
  caret-color: var(--brass);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--chrome) transparent;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

/* ---------- type ---------- */
h1,
h2,
h3 {
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

h1 {
  font-size: var(--fs-h1);
}

h2 {
  font-size: var(--fs-h2);
  margin-top: var(--sp-7);
  margin-bottom: var(--sp-4);
}

h3 {
  font-size: var(--fs-h3);
}

p {
  max-width: var(--measure);
  text-wrap: pretty;
}

.tnum {
  font-variant-numeric: tabular-nums;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- layout ---------- */
.wrap {
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* pinned for the whole scroll, as on every PDF tool site: the way back home is never off-screen.
   z-index sits above the tool's own sticky bar (2) and below the page modal (10). */
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  height: var(--topbar-h);
  border-bottom: 1px solid var(--chrome);
  background: var(--paper);
}

.topbar .wrap {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand-mark {
  flex: none;
}

.nav {
  display: flex;
  gap: var(--sp-5);
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-2);
}

.nav a {
  text-decoration: none;
}

.nav a:hover {
  color: var(--ink);
  text-decoration: underline;
}

.foot {
  margin-top: var(--sp-8);
  border-top: 1px solid var(--chrome);
  padding: var(--sp-6) 0 var(--sp-7);
  font-size: var(--fs-small);
  color: var(--ink-3);
}

.foot .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--sp-4) var(--sp-6);
}

.foot-brand {
  font-weight: 700;
  color: var(--ink);
}

.foot nav {
  display: flex;
  gap: var(--sp-4);
}

@media (max-width: 560px) {
  :root {
    --gutter: 16px;
    --sp-6: 24px;
    --sp-7: 32px;
    --sp-8: 40px;
  }

  .nav {
    gap: var(--sp-4);
    font-size: 14px;
  }

  .nav a:nth-child(2) {
    display: none;
  }
}


/* ---------- home: a two-line promise, then the desk holding the entry ---------- */
/* the first screen carries the whole pitch, by iLovePDF's rule: nothing above the tool but the promise, so the folder clears the fold on a 768px-high laptop */
.hero {
  padding-top: var(--sp-6);
}

/* the lede is the one place the scope is spelled out; wide enough to hold it in three lines */
.hero-lede {
  margin-top: var(--sp-4);
  font-size: 20px;
  line-height: 1.5;
  color: var(--ink-2);
  max-width: 60ch;
}

/* the desk: a tray field holding the open folders. Only shipped tools get a folder (white, stapled); one still being built gets no placeholder */
.desk {
  display: flex;
  align-items: stretch;
  gap: 6px;
  margin-top: var(--sp-6);
  padding: 44px var(--sp-5) var(--sp-5);
  background: var(--paper-tray);
}

.folder {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  text-decoration: none;
}

/* alone on the desk it keeps a folder's width instead of stretching across; a second folder makes them share the row again */
.folder:only-child {
  flex: 0 1 400px;
}

.folder-tab {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  margin-bottom: -2px;
  padding: 10px 18px 9px;
  border: 2px solid var(--ink);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  background: var(--paper-raised);
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
}

.folder-tab .staple {
  display: block;
  color: var(--brass);
}

.folder-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-5);
  border: 2px solid var(--ink);
  background: var(--paper-raised);
  font-size: 16px;
  line-height: 1.5;
}

.folder-line {
  font-weight: 500;
}

/* the one row under the pitch: the underlined "Open", held at the body's bottom right */
.folder-meta {
  display: flex;
  justify-content: flex-end;
  margin-top: auto;
  font-size: var(--fs-small);
  font-weight: 600;
}

/* the outline warms to brass under the pointer; the fill stays put */
.folder:hover .folder-tab,
.folder:hover .folder-body {
  border-color: var(--brass);
}

.folder-open {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 0.16em;
}

/* ---------- the tray ---------- */
/* a flat tonal field, no frame: the grey against the paper is the region */
.tray {
  display: flex;
  flex-direction: column;
  min-height: calc(100svh - var(--topbar-h) - var(--sp-6));
  background: var(--paper-tray);
  padding: var(--sp-6);
}

.tray-head {
  margin-bottom: var(--sp-5);
  text-align: center;
}

.tray-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* the engine's tool mount: a flex column so `flex: 1` inside has room to grow. `1 0 auto`: fills the idle tray, then follows its content once the grid is long */
[data-gf-tool] {
  display: flex;
  flex-direction: column;
  flex: 1 0 auto;
  min-height: 0;
}

/* ---------- prose sections under the tray ---------- */
.section {
  margin-top: var(--sp-8);
}

.section > h2 {
  margin-top: 0;
}

/* questions: a left-aligned list under hairlines, no boxes. The plus at the line's right end turns to a cross when open */
.faq {
  max-width: var(--measure);
  margin-top: var(--sp-5);
  border-top: 1px solid var(--chrome);
}

.faq-item {
  border-bottom: 1px solid var(--chrome);
}

.faq-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-3) 0;
  font-size: var(--fs-h3);
  font-weight: 700;
  line-height: 1.3;
  cursor: pointer;
  list-style: none;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary:hover .faq-q {
  text-decoration: underline;
  text-underline-offset: 0.16em;
}

.faq-mark {
  flex: none;
  color: var(--ink-3);
  transition:
    transform 0.15s ease-out,
    color 0.15s ease-out;
}

.faq-item[open] .faq-mark {
  color: var(--ink);
  transform: rotate(45deg);
}

.faq-item p {
  padding-bottom: var(--sp-4);
  color: var(--ink-2);
}

/* long-form text pages */
.page {
  max-width: 64ch;
  padding-top: var(--sp-7);
}

.page h1 {
  margin-bottom: var(--sp-5);
}

.page h2 {
  margin-top: var(--sp-6);
}

.page p,
.page li {
  color: var(--ink-2);
}

.page ul,
.page ol {
  padding-left: 1.2em;
}

/* the 404 page: the staple in brass beside the heading */
.notfound-title {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.notfound-mark {
  display: inline-flex;
  color: var(--brass);
}

.notfound-mark .staple {
  width: 40px;
  height: 20px;
}

@media (max-width: 760px) {
  .desk {
    flex-direction: column;
    gap: var(--sp-3);
    padding: 40px var(--sp-4) var(--sp-4);
  }

  /* stacked, the folder takes the tray's width and its own height: up there the 400px basis is a width, here it would be a height */
  .folder:only-child {
    flex: 0 1 auto;
  }

  /* on a phone the hand-set break would leave a two-word line under the promise; balance wraps the whole H1 instead */
  .hero-br {
    display: none;
  }

  .tray {
    padding: var(--sp-5) var(--sp-4);
  }
}


/* ---------- page extractor: lives inside the tray; inherits paper/ink/chrome/brass ---------- */
.pe {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.pe[data-over='true'] .pe-drop {
  border-color: var(--brass);
  border-style: solid;
  background: var(--brass-tint);
}

/* ---------- idle: the drop panel ---------- */
.pe-drop {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 300px;
  padding: var(--sp-7) var(--sp-5);
  border: 1.5px dashed var(--chrome-deep);
  background: var(--paper-raised);
  text-align: center;
  cursor: pointer;
  transition:
    border-color 0.15s ease-out,
    background-color 0.15s ease-out;
}

.pe-drop:hover {
  border-color: var(--ink);
}

.pe-drop-title {
  font-size: clamp(22px, 2.6vw, 28px);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.15;
}

.pe-drop-sub {
  font-size: var(--fs-small);
  color: var(--ink-3);
}

.pe-drop-note {
  margin-top: var(--sp-4);
  font-size: var(--fs-small);
  color: var(--ink-2);
  max-width: 42ch;
}

/* ---------- loading ---------- */
.pe-loading {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  min-height: 300px;
  padding: var(--sp-5);
  background: var(--paper-raised);
}

.pe-loading-bar {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-4);
  font-size: var(--fs-small);
  color: var(--ink-3);
}

.pe-loading-bar strong {
  color: var(--ink);
  font-weight: 600;
}

.pe-skeleton {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: var(--sp-4);
  align-content: start;
}

.pe-skeleton i {
  display: block;
  aspect-ratio: 1 / 1.414;
  background-image: repeating-linear-gradient(45deg, transparent 0 5px, var(--chrome-2) 5px 6px);
}

/* ---------- toolbar ---------- */
/* sticks under the pinned top bar while the page scrolls under it, so the range box and the Extract button stay in reach on a 200-page file */
.pe-bar {
  position: sticky;
  top: var(--topbar-h);
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  margin-top: calc(-1 * var(--sp-2));
  padding: var(--sp-2) 0 var(--sp-4);
  background: var(--paper-tray);
  border-bottom: 1px solid var(--chrome);
}

.pe-bar-file {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--sp-2) var(--sp-3);
  font-size: var(--fs-small);
  color: var(--ink-3);
}

.pe-bar-file strong {
  font-weight: 600;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.pe-bar-file button {
  margin-left: auto;
  border: none;
  background: none;
  padding: 0;
  font-size: var(--fs-small);
  color: var(--ink-2);
  text-decoration: underline;
  text-underline-offset: 0.16em;
  cursor: pointer;
}

.pe-bar-file button:hover {
  color: var(--ink);
  text-decoration-thickness: 2px;
}

.pe-bar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2) var(--sp-3);
}

.pe-range {
  flex: 1 1 260px;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-width: 0;
}

.pe-range label {
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--ink-2);
  white-space: nowrap;
}

.pe-range input {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border: 1.5px solid var(--chrome-deep);
  background: var(--paper-raised);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.pe-range input:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.pe-range input::placeholder {
  color: var(--ink-3);
  opacity: 1;
}

.pe-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* quiet control: no edge at rest, a chrome outline on hover, brass fill when pressed on */
.pe-btn {
  padding: 8px 12px;
  border: 1.5px solid transparent;
  background: none;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition:
    border-color 0.12s ease-out,
    background-color 0.12s ease-out,
    color 0.12s ease-out;
}

.pe-btn:hover {
  border-color: var(--chrome-deep);
  background: var(--paper-raised);
  color: var(--ink);
}

.pe-btn:active {
  background: var(--chrome-2);
}

.pe-btn[aria-pressed='true'],
.pe-btn.is-on {
  background: var(--brass);
  border-color: var(--brass);
  color: var(--ink);
}

.pe-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.pe-btn:disabled:hover {
  border-color: transparent;
  background: none;
  color: var(--ink-2);
}


/* Save as: two quiet options shaped like the quick buttons, no enclosing box */
.pe-seg {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: none;
  padding: 0;
  margin: 0;
}

.pe-seg legend {
  float: left;
  padding: 9px 0;
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--ink-2);
}

.pe-seg label {
  display: inline-flex;
}

.pe-seg input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.pe-seg span {
  display: inline-block;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink-2);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition:
    border-color 0.12s ease-out,
    background-color 0.12s ease-out,
    color 0.12s ease-out;
}

.pe-seg input:not(:checked) + span:hover {
  border-color: var(--chrome-deep);
  background: var(--paper-raised);
  color: var(--ink);
}

.pe-seg input:checked + span {
  background: var(--brass);
  border-color: var(--brass);
  color: var(--ink);
}

.pe-seg input:focus-visible + span {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.pe-cta {
  margin-left: auto;
  padding: 12px 22px;
  border: 1.5px solid var(--brass);
  background: var(--brass);
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition:
    background-color 0.12s ease-out,
    border-color 0.12s ease-out,
    color 0.12s ease-out;
}

.pe-cta:hover:not(:disabled) {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.pe-cta:disabled {
  background: var(--paper-raised);
  border-color: var(--chrome-deep);
  color: var(--ink-3);
  cursor: not-allowed;
}

.pe-cta[aria-busy='true'] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
  cursor: progress;
}

/* ---------- done + error bars ---------- */
.pe-done {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2) var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  background: var(--paper-raised);
  font-size: 15px;
}

.pe-done strong {
  font-weight: 700;
}

.pe-done-file {
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}

.pe-done a,
.pe-done button {
  margin-left: auto;
  border: none;
  background: none;
  padding: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 0.16em;
  cursor: pointer;
}

.pe-done button {
  margin-left: 0;
  color: var(--ink-3);
}

.pe-error {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--sp-3);
  align-items: start;
  margin-bottom: var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  border: 1.5px solid var(--brass);
  background: var(--brass-tint);
  font-size: 15px;
  color: var(--ink);
}

.pe-error strong {
  display: block;
  font-weight: 700;
  margin-bottom: 2px;
}

.pe-error button {
  border: none;
  background: none;
  padding: 0 4px;
  font-size: 20px;
  line-height: 1;
  color: var(--ink-2);
  cursor: pointer;
}

/* ---------- thumbnail grid ---------- */
/* the grid is part of the page: no inner scrollbar. A long PDF scrolls the document, under the sticky toolbar */
.pe-grid {
  display: grid;
  /* iLovePDF's rule: fixed-width pages, as many columns as fit, the grid centred in the tray */
  grid-template-columns: repeat(auto-fill, 160px);
  justify-content: center;
  gap: var(--sp-5) var(--sp-4);
  padding: var(--sp-4) 0 var(--sp-5);
}

.pe-thumb {
  --i: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: center;
  color: var(--ink-3);
}

.pe-thumb-main {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
  font: inherit;
  text-align: center;
}

/* zoom button riding the page's top-right corner: centred on the sheet's top edge and 8px past its right edge,
   so it covers a 16×24 corner of the page instead of sitting inside it (column gap is 12–16px, so it never
   reaches the neighbour). Hidden until hover, always shown on touch. */
.pe-zoom {
  position: absolute;
  top: 14px;
  right: -8px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--chrome-deep);
  background: var(--paper-raised);
  color: var(--ink);
  cursor: pointer;
  opacity: 0;
}

@media (prefers-reduced-motion: no-preference) {
  .pe-zoom {
    transition:
      opacity 0.12s ease-out,
      background-color 0.12s ease-out,
      border-color 0.12s ease-out;
  }
}

.pe-thumb:hover .pe-zoom,
.pe-zoom:focus-visible {
  opacity: 1;
}

.pe-zoom:hover {
  background: var(--brass);
  border-color: var(--brass);
}

@media (hover: none) {
  .pe-thumb .pe-zoom {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .pe-thumb {
    animation: pe-in 0.36s cubic-bezier(0.2, 0.8, 0.2, 1) both;
    animation-delay: calc(var(--i) * 18ms);
  }
}

@keyframes pe-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* round checkbox above each page: an input control, so it keeps an edge at rest */
.pe-check {
  align-self: center;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--chrome-deep);
  background: var(--paper-raised);
  /* the tick is opacity 0 at rest and ink when selected; the resting colour only has to pass the contrast check */
  color: var(--ink-3);
}

.pe-check svg {
  opacity: 0;
}

@media (prefers-reduced-motion: no-preference) {
  .pe-check,
  .pe-check svg {
    transition:
      background-color 0.12s ease-out,
      border-color 0.12s ease-out,
      opacity 0.12s ease-out;
  }
}

.pe-thumb:hover .pe-check {
  border-color: var(--ink);
}


.pe-thumb-paper {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1 / 1.414;
  background: var(--paper-raised);
  border: 1px solid transparent;
  overflow: hidden;
  transition:
    border-color 0.12s ease-out,
    box-shadow 0.12s ease-out;
}

.pe-thumb-paper[data-rendered='false'] {
  background-image: repeating-linear-gradient(45deg, transparent 0 5px, var(--chrome-2) 5px 6px);
}

.pe-thumb-paper canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.pe-thumb:hover .pe-thumb-paper {
  border-color: var(--chrome-deep);
}

.pe-thumb[data-selected='true'] .pe-check {
  background: var(--brass);
  border-color: var(--brass);
  color: var(--ink);
}

.pe-thumb[data-selected='true'] .pe-check svg {
  opacity: 1;
}

.pe-thumb[data-selected='true'] .pe-thumb-paper {
  border-color: var(--brass);
  box-shadow: inset 0 0 0 1px var(--brass);
}

.pe-thumb-num {
  align-self: center;
  min-width: 26px;
  padding: 0 6px;
  font-size: 13px;
  line-height: 20px;
  font-variant-numeric: tabular-nums;
  transition: background-color 0.12s ease-out, color 0.12s ease-out;
}

.pe-thumb[data-selected='true'] .pe-thumb-num {
  color: var(--ink);
  font-weight: 700;
}

.pe-thumb:focus-visible {
  outline-offset: 4px;
}

.pe-thumb-main:focus-visible {
  outline-offset: 4px;
}

/* full-screen page modal: the tray dims to ink, the page shows as a big sheet of paper */
.pe-modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-4);
  padding: var(--sp-5);
  background: rgba(26, 26, 26, 0.72);
}

@media (prefers-reduced-motion: no-preference) {
  .pe-modal {
    animation: pe-fade 0.14s ease-out;
  }
}

@keyframes pe-fade {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.pe-modal-paper {
  border: 1px solid var(--chrome);
  background: var(--paper-raised);
}

.pe-modal-paper[data-rendered='false'] {
  background-image: repeating-linear-gradient(45deg, transparent 0 5px, var(--chrome-2) 5px 6px);
}

.pe-modal-paper canvas {
  display: block;
}

.pe-modal-close {
  position: absolute;
  top: var(--sp-5);
  right: var(--sp-5);
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid var(--chrome-deep);
  background: var(--paper-raised);
  color: var(--ink);
  cursor: pointer;
}

.pe-modal-close:hover {
  border-color: var(--ink);
}

.pe-modal-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.pe-modal-count {
  min-width: 64px;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  color: var(--paper);
  font-variant-numeric: tabular-nums;
}

.pe-modal-bar .pe-btn {
  color: var(--paper);
}

.pe-modal-bar .pe-btn:hover {
  border-color: var(--chrome-deep);
  background: rgba(255, 255, 255, 0.08);
  color: var(--paper);
}

.pe-modal-bar .pe-btn:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.pe-modal-bar .pe-btn:disabled:hover {
  border-color: transparent;
  background: none;
  color: var(--paper);
}

@media (max-width: 560px) {
  .pe-modal {
    padding: var(--sp-3);
  }

  .pe-modal-close {
    top: var(--sp-3);
    right: var(--sp-3);
  }
}

@media (max-width: 760px) {
  /* the bar is a third of a phone screen; let it scroll away instead of pinning */
  .pe-bar {
    position: static;
    margin-top: 0;
    padding-top: 0;
  }
}

@media (max-width: 560px) {
  .pe-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--sp-4) var(--sp-3);
  }

  .pe-cta {
    width: 100%;
    margin-left: 0;
  }

  .pe-bar-file button {
    margin-left: 0;
  }
}
