/* The package manager tabs with the command that retypes itself: the install panel of a docs page on a white page.
   A porcelain card with a one pixel edge and layered shadows; on top the tabs in a sunken track, with a white pill that
   runs from tab to tab on two springs (the leading edge is quicker, so it stretches and catches up); below, the code
   well with the command, the install line with its timing bar, and the package line at the foot. */
:root {
  --page: #ffffff;            /* the page */
  --card: #fbfbfa;            /* the body of the card */
  --card-low: #f5f5f3;        /* the bottom of the card */
  --edge: rgba(20, 20, 26, 0.08); /* the 1px edge */
  --track: #efefec;           /* the well the tabs sit in */
  --well: #f3f3f0;            /* the code well */
  --pill: #ffffff;            /* the pill of the chosen tab */
  --ink: #17171c;             /* the words */
  --muted: #8b8b93;           /* the small words */
  --faint: rgba(20, 20, 26, 0.07); /* empty bars, hairlines */
  --accent: #e2522b;          /* the one colour: package name, caret, bar */
}

* {
  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;
}

/* ---------------------------------------------------------------- the card */
.panel {
  --mx: 50%;
  --my: 0%;
  position: relative;
  width: min(560px, 92vw);
  padding: clamp(8px, 1.6vh, 10px);
  border-radius: 20px;
  background: linear-gradient(180deg, var(--card), var(--card-low));
  box-shadow:
    inset 0 0 0 1px var(--edge),
    inset 0 1px 0 #ffffff,
    0 1px 1px rgba(20, 20, 26, 0.04),
    0 2px 4px -1px rgba(20, 20, 26, 0.05),
    0 14px 28px -12px rgba(20, 20, 26, 0.14),
    0 40px 70px -36px rgba(20, 20, 26, 0.22);
  isolation: isolate;
  opacity: 0;
}

/* a very fine grain over the porcelain */
.panel::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.06;
  mix-blend-mode: multiply;
  pointer-events: none;
  z-index: -1;
}

/* the soft light that follows the pointer over the card */
.panel__light {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(260px 160px at var(--mx) var(--my), rgba(255, 255, 255, 0.9), transparent 70%);
  opacity: 0;
  pointer-events: none;
  z-index: -1;
  transition: opacity 0.5s ease;
}

.panel:hover .panel__light {
  opacity: 1;
}

/* the top edge catching the light */
.panel__sheen {
  position: absolute;
  left: 12%;
  right: 12%;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 1), transparent);
  pointer-events: none;
}

/* ---------------------------------------------------------------- the head */
.head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 0 clamp(8px, 1.6vh, 10px);
}

.tabs {
  position: relative;
  display: flex;
  padding: 3px;
  border-radius: 12px;
  background: var(--track);
  box-shadow:
    inset 0 1px 2px rgba(20, 20, 26, 0.07),
    inset 0 0 0 1px rgba(20, 20, 26, 0.035),
    0 1px 0 #ffffff;
}

.pill {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 0;
  width: 0;
  border-radius: 9px;
  background: linear-gradient(180deg, #ffffff, #fbfbfa);
  box-shadow:
    inset 0 0 0 1px rgba(20, 20, 26, 0.07),
    inset 0 -1px 0 rgba(20, 20, 26, 0.03),
    0 1px 2px rgba(20, 20, 26, 0.08),
    0 3px 8px -2px rgba(20, 20, 26, 0.1);
  overflow: hidden;
  will-change: transform, width;
}

/* the glint that crosses the pill only while it runs */
.pill__glint {
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, color-mix(in srgb, var(--accent) 16%, transparent) 50%, transparent 80%);
  opacity: 0;
}

.tab {
  position: relative;
  z-index: 1;
  min-width: clamp(44px, 12vw, 58px);
  height: clamp(28px, 4.6vh, 32px);
  padding: 0 clamp(8px, 2.4vw, 13px);
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--muted);
  font: 500 13px/1 'Geist Mono Variable', ui-monospace, monospace;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: color 0.28s ease;
  -webkit-tap-highlight-color: transparent;
}

.tab[aria-selected='true'] {
  color: var(--ink);
}

.tab:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent);
  outline-offset: 1px;
}

@media (hover: hover) {
  .tab[aria-selected='false']:hover {
    color: color-mix(in srgb, var(--ink) 72%, var(--muted));
  }
}

/* ---------------------------------------------------------------- the copy button */
.copy {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: clamp(30px, 5vh, 34px);
  padding: 0 12px 0 10px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff, #f7f7f5);
  color: var(--ink);
  box-shadow:
    inset 0 0 0 1px rgba(20, 20, 26, 0.08),
    0 1px 2px rgba(20, 20, 26, 0.06),
    0 2px 6px -3px rgba(20, 20, 26, 0.12);
  font: 560 13px/1 'Mona Sans Variable', system-ui, sans-serif;
  font-variation-settings: 'wdth' 100;
  cursor: pointer;
  flex: none;
  -webkit-tap-highlight-color: transparent;
}

.copy:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent);
  outline-offset: 2px;
}

@media (hover: hover) {
  .copy:hover {
    box-shadow:
      inset 0 0 0 1px rgba(20, 20, 26, 0.12),
      0 1px 2px rgba(20, 20, 26, 0.08),
      0 6px 12px -6px rgba(20, 20, 26, 0.2);
  }
}

.copy__icon {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.copy__icon svg {
  overflow: visible;
}

.copy__back {
  fill: var(--track);
}

.copy__front {
  fill: #ffffff;
}

.copy [data-tick] {
  color: var(--accent);
  stroke: var(--accent);
}

.copy__label {
  position: relative;
  display: inline-block;
  height: 14px;
  overflow: hidden;
  white-space: nowrap;
}

.copy__word {
  display: block;
  line-height: 14px;
}

.copy__word--done {
  position: absolute;
  left: 0;
  top: 0;
  color: var(--accent);
  opacity: 0;
}

/* ---------------------------------------------------------------- the code well */
.well {
  position: relative;
  padding: clamp(12px, 2.6vh, 18px) clamp(14px, 4vw, 18px) clamp(11px, 2.2vh, 15px);
  border-radius: 13px;
  background: var(--well);
  box-shadow:
    inset 0 0 0 1px rgba(20, 20, 26, 0.05),
    inset 0 1px 3px rgba(20, 20, 26, 0.05),
    0 1px 0 #ffffff;
  overflow: hidden;
  font-family: 'Geist Mono Variable', ui-monospace, monospace;
}

/* the light that runs over the code when it is copied */
.well__sweep {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 46%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.85) 45%, color-mix(in srgb, var(--accent) 10%, transparent) 55%, transparent);
  opacity: 0;
  pointer-events: none;
}

.line {
  position: relative;
  display: flex;
  align-items: center;
  white-space: nowrap;
}

.line--cmd {
  gap: 0.75em;
  font-size: clamp(13px, 3.7vw, 16px);
  line-height: 1.5;
  letter-spacing: -0.01em;
}

.prompt {
  color: color-mix(in srgb, var(--muted) 70%, transparent);
  user-select: none;
}

.cmd {
  position: relative;
  display: inline-block;
  min-height: 1.5em;
}

.cmd__chars {
  position: relative;
  display: inline-block;
}

.ch {
  display: inline-block;
  vertical-align: top;
  white-space: pre;
  will-change: transform;
}

.ch--bin {
  color: var(--ink);
  font-weight: 560;
}

.ch--verb {
  color: #55555e;
}

.ch--pkg {
  color: var(--accent);
}

.caret {
  position: absolute;
  left: 0;
  top: 0.22em;
  width: 2px;
  height: 1.08em;
  border-radius: 1px;
  background: var(--accent);
  box-shadow: 0 0 0 0.5px color-mix(in srgb, var(--accent) 30%, transparent);
}

.line--out {
  gap: 8px;
  margin-top: clamp(6px, 1.4vh, 9px);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.out__mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 12px;
  height: 12px;
  color: #2f9d6a;
}

.out__mark svg {
  grid-area: 1 / 1;
}

.out__spin {
  color: var(--muted);
  opacity: 0;
}

.out__bar {
  position: relative;
  flex: 0 1 96px;
  min-width: 40px;
  height: 3px;
  margin-left: auto;
  border-radius: 2px;
  background: var(--faint);
  overflow: hidden;
}

.out__bar i {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 70%, #ffffff), var(--accent));
  transform-origin: 0 50%;
  transform: scaleX(0);
}

.out__time {
  min-width: 3.4em;
  font: 560 12px/1.4 'Mona Sans Variable', system-ui, sans-serif;
  text-align: right;
  color: var(--ink);
}

/* ---------------------------------------------------------------- the foot */
.foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: clamp(8px, 1.6vh, 10px) 6px 0;
  color: var(--muted);
  font-size: 12px;
  font-variation-settings: 'wdth' 96;
  white-space: nowrap;
}

.foot__pkg {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #55555e;
  font-weight: 540;
}

.foot__ver {
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--track);
  color: var(--muted);
  font: 500 11px/1.2 'Geist Mono Variable', ui-monospace, monospace;
}

/* narrow: the copy button keeps only its icon, the foot drops its size */
@media (max-width: 420px) {
  .copy {
    width: clamp(30px, 5vh, 34px);
    padding: 0;
    justify-content: center;
  }

  .copy__label {
    display: none;
  }

  .tab {
    font-size: 12px;
  }

  .line--out {
    font-size: 11px;
  }

  .foot__meta {
    display: none;
  }
}
