/* The bar that becomes an island: a black navigation bar on a white page. Scrolling down it gathers into a floating
   black pill; pointed at or tapped, the pill swells into the menu. Under it, a plain column of headings and short
   paragraphs, only there to be scrolled. */
:root {
  --page: #ffffff;          /* the page */
  --ink: #16150f;           /* the headings of the column */
  --muted: #6d6a60;         /* its paragraphs */
  --island: #050505;        /* the island */
  --on-island: #f5f5f4;     /* the text on the island */
  --dim: #8e8e8a;           /* the quieter text on the island */
  --accent: #ff5a1f;        /* the upload's rings, and the outline of the focus */
  --done: #34c759;          /* an upload finished */
  --pill: 38px;             /* set by the script: the island's height */
  --bud: 35px;              /* set by the script: the bubble's size */
}

* {
  box-sizing: border-box;
}

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

body {
  background: var(--page);
  color: var(--ink);
  font-family: 'Inter Tight Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

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

/* ---------------------------------------------------------------- the island */
.top {
  position: fixed;
  inset: 0 0 auto;
  z-index: 10;
  height: 0;
}

.island {
  position: relative;
}

/* the one black shape: the script sets its width, height, corners and place every frame */
.island__shape {
  position: absolute;
  left: 50%;
  top: 0;
  width: 120px;
  height: var(--pill);
  border-radius: 999px;
  background: var(--island);
  color: var(--on-island);
  box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  will-change: width, height, transform;
  transform: translate3d(-50%, 12px, 0);
}

/* the bubble and the neck between it and the island */
.island__goo {
  position: absolute;
  left: 0;
  top: 0;
  height: 200px;
  overflow: visible;
  pointer-events: none;
}

.island__neck,
.island__bud {
  fill: var(--island);
}

/* the four layers: each sits in the middle of the shape, at its own size, and fades in and out */
[data-layer] {
  position: absolute;
  left: 50%;
  top: 0;
  visibility: hidden;
}

/* the wide bar: the upload's chip on the left, the links in the middle, the account on the right */
.wide {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 10px 0 15px;
}

.wide__links {
  display: flex;
  gap: 4px;
  margin: 0 auto;
  padding: 0;
  list-style: none;
}

.wide__links a,
.wide__signin {
  display: block;
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--dim);
  font-size: 14.5px;
  font-weight: 520;
  transition: color 0.2s, background-color 0.2s;
}

@media (hover: hover) {
  .wide__links a:hover,
  .wide__signin:hover {
    color: var(--on-island);
    background: rgba(255, 255, 255, 0.07);
  }
}

.wide__end {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* the little chip with the upload, on the wide bar */
.chip {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 7px;
  padding: 5px 10px 5px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--dim);
  font-size: 12.5px;
  font-weight: 560;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.wide__menu {
  display: none;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--on-island);
  cursor: pointer;
}

.wide__menu svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

/* the island: the menu's two lines and the section you are reading */
.compact {
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--pill);
  padding: 0 16px 0 12px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--on-island);
  font: inherit;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.compact__icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: var(--dim);
  stroke-width: 2;
  stroke-linecap: round;
}

.compact__label {
  position: relative;
  display: grid;
  height: 20px;
  overflow: hidden;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.compact__text,
.compact__ghost {
  grid-area: 1 / 1;
  line-height: 20px;
}

/* the ghost measures the next label's width; it is never seen */
.compact__ghost {
  visibility: hidden;
}

/* the island speaking up */
.notice {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 60px;
  padding: 0 18px 0 12px;
}

.notice__icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
}

.notice__text {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.notice__text b,
.act__text b {
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.notice__text small,
.act__text small {
  color: var(--dim);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* the name of the file going up can be long: it ends in an ellipsis rather than pushing the button out */
.act__text b,
.act__text small {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* the open island */
.open {
  display: grid;
  gap: 6px;
  padding: 10px;
}

.act {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 10px 8px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.06);
}

.act__ring {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
}

.act__pct {
  position: absolute;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.act__text {
  display: grid;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.act__btn {
  height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--on-island);
  font: inherit;
  font-size: 13px;
  font-weight: 620;
  white-space: nowrap;
  cursor: pointer;
}

@media (hover: hover) {
  .act__btn:hover {
    background: rgba(255, 255, 255, 0.2);
  }
}

.open__links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.open__links a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  font-size: 14.5px;
  font-weight: 560;
  transition: background-color 0.2s;
}

@media (hover: hover) {
  .open__links a:hover {
    background: rgba(255, 255, 255, 0.08);
  }
}

.open__links svg {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: var(--dim);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.open__end {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 4px 2px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.open__signin {
  color: var(--dim);
  font-size: 14px;
  font-weight: 520;
}

/* the bubble's ring, over the bubble */
.bud {
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: var(--bud);
  height: var(--bud);
  visibility: hidden;
  cursor: pointer;
}

/* ---------------------------------------------------------------- the rings */
.ring {
  display: block;
  fill: none;
}

.ring--chip {
  width: 20px;
  height: 20px;
}

.ring--bud {
  width: 80%;
  height: 80%;
}

.ring--notice {
  width: 34px;
  height: 34px;
}

.ring--act {
  width: 44px;
  height: 44px;
}

.ring__track {
  stroke: rgba(255, 255, 255, 0.14);
  stroke-width: 3.2;
}

.ring__fill {
  stroke: var(--accent);
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke 0.3s;
}

.ring__check {
  stroke: var(--done);
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 0.5s 0.15s cubic-bezier(0.3, 0.7, 0.2, 1);
}

.ring__arrow {
  stroke: var(--on-island);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

[data-upload='done'] .ring__fill {
  stroke: var(--done);
}

[data-upload='done'] .ring__check {
  stroke-dashoffset: 0;
}

/* ---------------------------------------------------------------- the buttons on the island */
.cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  font-size: 14.5px;
  font-weight: 620;
  white-space: nowrap;
  transition: transform 0.2s, background-color 0.2s;
}

.cta:active {
  transform: scale(0.97);
}

.cta--light {
  background: var(--on-island);
  color: var(--island);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 12px;
}

.compact:focus-visible {
  outline-offset: -2px;
  border-radius: 999px;
}

/* ---------------------------------------------------------------- the page to scroll */
/* a plain column of headings and short paragraphs, there only to be scrolled under the bar: each section is a name
   the island shows while you read it */
.read {
  display: grid;
  gap: clamp(110px, 24svh, 220px);
  max-width: 36rem;
  margin: 0 auto;
  padding: 160px 24px 0;
}

.read h2 {
  margin: 0 0 14px;
  font-size: clamp(26px, 3.2vw, 34px);
  font-weight: 650;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.read p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.6;
}

/* the last section is a screen tall: scrolled to the end, its heading still reaches the line where the island reads
   the section, and its link can bring it just under the island */
.read section:last-child {
  min-height: 100vh;
}

/* ---------------------------------------------------------------- narrow screens */
@media (max-width: 900px) {
  .wide__links,
  .wide__signin {
    display: none;
  }

  .wide__menu {
    display: grid;
    place-items: center;
  }

  .wide {
    justify-content: space-between;
    padding: 0 7px 0 12px;
  }
}

@media (max-width: 560px) {
  .wide .cta {
    height: 38px;
    padding: 0 14px;
    font-size: 14px;
  }
}
