/* The download portfolio button with the pages that stack up. One graphite pill (.dp__body, moved only by GSAP) with
   its skin, grain and 1px edges in .dp__skin, a light that follows the pointer (.dp__shine) and a reflection for the
   end (.dp__sweep). On the left the pile of pages (each page moved only by GSAP, its ink drawn by CSS), in the middle
   the words, on the right the knob with the progress ring and the arrow. */
:root {
  --page: #000000;            /* the page around the button */
  --graphite: #17161a;        /* the button */
  --ink: #f4f0ea;             /* the words */
  --muted: rgba(244, 240, 234, 0.56); /* the small line under the words */
  --accent: #ffb27a;          /* the warm light: ring, glow, page numbers */
  --knob: #f4eee4;            /* the bone knob */
  --knob-ink: #1b1a1f;        /* the arrow on the knob */
  --success: #1d6b45;         /* the check on the knob */
  --cover-1: #d8643f;         /* the covers of the pages that fall */
  --cover-2: #e9e1d3;
  --cover-3: #3c5bd6;
  --cover-4: #9fb59a;
  --cover-5: #f1c35b;
  --cover-6: #2a2a30;
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.stage {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow: hidden;
  background:
    radial-gradient(60% 46% at 50% 56%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 70%),
    var(--page);
}

.dp {
  position: relative;
  display: grid;
  place-items: center;
}

/* the warm light the button throws on the floor */
.dp__spill {
  position: absolute;
  left: 50%;
  top: 100%;
  width: 110%;
  height: 44px;
  margin: -16px 0 0 -55%;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 55%, transparent), color-mix(in srgb, var(--accent) 14%, transparent) 60%, transparent);
  filter: blur(14px);
  opacity: 0.26;
  pointer-events: none;
}

.dp__btn {
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  border-radius: 999px;
  -webkit-tap-highlight-color: transparent;
}

.dp__btn:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 80%, white);
  outline-offset: 5px;
}

.dp__body {
  --mx: 30%;
  --my: 40%;
  position: relative;
  display: block;
  width: min(84vw, 300px);
  height: 60px;
  border-radius: 999px;
  overflow: hidden;
  isolation: isolate;
  background: var(--graphite);
  box-shadow:
    0 1px 1px rgba(0, 0, 0, 0.8),
    0 12px 26px -14px color-mix(in srgb, var(--accent) 45%, transparent),
    0 30px 60px -30px rgba(0, 0, 0, 1);
}

.dp__skin,
.dp__shine,
.dp__sweep {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
}

/* graphite: lighter on top, grain, a 1px edge that catches the light above and a darker one below */
.dp__skin {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.95' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.22 0'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E"),
    radial-gradient(70% 120% at 12% 120%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.015) 50%, rgba(0, 0, 0, 0.28));
  background-size: 120px 120px, 100% 100%, 100% 100%;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    inset 0 -1px 0 rgba(0, 0, 0, 0.5),
    inset 0 -12px 20px -14px rgba(0, 0, 0, 0.8);
}

/* the light under the pointer */
.dp__shine {
  background: radial-gradient(110px 70px at var(--mx) var(--my), rgba(255, 236, 220, 0.13), rgba(255, 236, 220, 0.03) 50%, transparent 72%);
  opacity: 0;
}

.dp__sweep {
  overflow: hidden;
}

.dp__sweep-band {
  position: absolute;
  top: -30%;
  left: 0;
  width: 34%;
  height: 160%;
  background: linear-gradient(100deg, transparent 0%, rgba(255, 240, 225, 0.04) 30%, rgba(255, 240, 225, 0.22) 50%, rgba(255, 240, 225, 0.04) 70%, transparent 100%);
}

.dp__row {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 8px 0 10px;
  gap: 12px;
}

/* ---------------------------------------------------------------- the pile of pages */
.dp__stack {
  flex: none;
  position: relative;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
}

.dp__pile {
  position: relative;
  width: 24px;
  height: 31px;
}

.dp__drops {
  position: absolute;
  inset: 0;
}

.dp__page {
  position: absolute;
  inset: 0;
  border-radius: 2.5px;
  background: var(--cover, var(--cover-2));
  box-shadow:
    0 1px 1.5px rgba(0, 0, 0, 0.55),
    0 4px 8px -3px rgba(0, 0, 0, 0.7),
    inset 0 0 0 0.5px rgba(255, 255, 255, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
  overflow: hidden;
}

.dp__page--a {
  --cover: var(--cover-2);
}

.dp__page--b {
  --cover: var(--cover-1);
}

.dp__page--c {
  --cover: var(--cover-3);
}

/* the layout printed on a page: a picture block and two lines of text */
.dp__ink {
  position: absolute;
  inset: 3px 3px auto;
  height: 15px;
  border-radius: 1px;
  background: linear-gradient(160deg, rgba(0, 0, 0, 0.22), rgba(0, 0, 0, 0.05) 60%, rgba(255, 255, 255, 0.12));
}

.dp__ink::after {
  content: '';
  position: absolute;
  left: 0;
  top: 19px;
  width: 100%;
  height: 6px;
  background:
    linear-gradient(currentColor, currentColor) 0 0 / 100% 1px no-repeat,
    linear-gradient(currentColor, currentColor) 0 4px / 62% 1px no-repeat;
  color: rgba(0, 0, 0, 0.28);
}

/* a light reflection on the paper */
.dp__page::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(125deg, rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0) 42%);
  pointer-events: none;
}

/* ---------------------------------------------------------------- the words */
.dp__text {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 3px;
  text-align: left;
}

.dp__labels,
.dp__subs {
  display: grid;
  min-width: 0;
}

.dp__label,
.dp__sub {
  grid-area: 1 / 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dp__label {
  font-size: 15.5px;
  line-height: 1.15;
  font-weight: 580;
  font-variation-settings: 'wdth' 102;
  letter-spacing: 0.002em;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);
}

.dp__sub {
  font-size: 11.5px;
  line-height: 1.2;
  font-weight: 480;
  font-variation-settings: 'wdth' 94;
  letter-spacing: 0.015em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.dp__num {
  color: var(--accent);
}

/* before the script runs, only the rest state shows */
.dp__label + .dp__label,
.dp__sub + .dp__sub {
  opacity: 0;
}

/* ---------------------------------------------------------------- the knob */
.dp__knob {
  flex: none;
  position: relative;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
}

.dp__ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  overflow: visible;
}

.dp__ring circle {
  fill: none;
  stroke-width: 1.5;
}

.dp__ring-track {
  stroke: rgba(255, 255, 255, 0.07);
}

.dp__ring-fill {
  stroke: var(--accent);
  stroke-linecap: butt;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  filter: drop-shadow(0 0 3px color-mix(in srgb, var(--accent) 70%, transparent));
}

.dp__well {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% 0%, #ffffff, var(--knob) 46%, color-mix(in srgb, var(--knob) 86%, #6b5a46) 100%);
  box-shadow:
    0 1px 1px rgba(0, 0, 0, 0.6),
    0 4px 10px -4px rgba(0, 0, 0, 0.9),
    inset 0 -1px 1px rgba(120, 96, 70, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 1);
}

.dp__icon {
  width: 18px;
  height: 18px;
  overflow: visible;
}

.dp__icon path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dp__arrow,
.dp__tray {
  stroke: var(--knob-ink);
  stroke-width: 1.9;
}

.dp__check {
  stroke: var(--success);
  stroke-width: 2.2;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  opacity: 0;
}
