/* Songe cover: a full-screen night scene that folds into a pill.
   Cover type and controls follow the main site: Outfit, h1 450 / -.03em, body 320 / 1.58,
   uppercase labels. */
.sg { --p: #452bb0; --soft: #e2dcfb; --muted: #c7bdf2;
  position: fixed; inset: 0; z-index: 50; display: grid; grid-template-rows: auto 1fr; min-block-size: 100svh; overflow: hidden; color: #fff; background: #211060;
  clip-path: inset(0 round 0); transition: clip-path 680ms cubic-bezier(.65,0,.35,1); }
/* the page's paper grain continues over the cover, so the paper at its bottom is the homepage's paper */
.sg::before { content: ""; position: absolute; inset: 0; z-index: 4; pointer-events: none; background: var(--grain, none) 0 0 / 200px 200px repeat; opacity: .04; }
/* while folding, the scene turns the pill's colour, and the pill fades in over it: one object changing size */
.sg::after { content: ""; position: absolute; inset: 0; z-index: 5; background: #452bb0; opacity: 0; pointer-events: none; transition: opacity 360ms ease; }
.sg.folding::after { opacity: 1; transition-delay: 300ms; }
.sg-art { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; image-rendering: pixelated; }
.sg > :not(canvas) { position: relative; z-index: 2; }
.sg-nav { display: flex; align-items: center; justify-content: space-between; padding: clamp(1.5rem, 4svh, 2.75rem) var(--gutter) 0; }
.sg-brand { --mark-size: 1.125rem; --brand-gap: .625rem; --brand-height: 1.5rem; color: #fff; }
.sg-brand circle { fill: var(--soft); }
.sg-brand .wordmark-divider { background-color: #ffffff4d; }
.sg-brand .wordmark-suffix { color: var(--soft); }
.sg-main { align-self: start; padding: clamp(2.5rem, 9svh, 6rem) var(--gutter) 0; max-inline-size: calc(35rem + 2 * var(--gutter)); }
.sg-title { margin: 0; font-size: clamp(3rem, 6vw, 4.75rem); font-weight: 450; letter-spacing: -.03em; line-height: 1; }
.sg-line { margin: .875rem 0 0; color: var(--soft); font-size: 1rem; font-weight: 320; line-height: 1.58; text-wrap: pretty; }
/* Install block, after boat.dev: tabs + one click-to-copy row, square corners, Plex Mono. */
.sg-install { --box: #211060; --tab: #ccc1f2; --dim: #9983e2; inline-size: min(100%, 24rem); margin-block-start: 2rem; font: 400 .875rem/1.5rem "IBM Plex Mono", ui-monospace, monospace; }
.sg-tabs { display: flex; gap: 4px; }
.sg-tabs button { block-size: 2rem; padding: 0 .75rem; border: 0; background: transparent; color: var(--tab); font: inherit; line-height: 1.25rem; cursor: pointer; }
.sg-tabs button.on { background: var(--box); color: #fff; }
.sg-about { margin-inline-start: auto; color: var(--tab); line-height: 2rem; text-decoration: none; }
.sg-gh { color: #fff; font: 400 .875rem/1.5rem "IBM Plex Mono", ui-monospace, monospace; text-decoration: none; } /* the repository, top right of the cover */
:is(.sg-about, .sg-gh):is(:hover, :focus-visible) { color: #fff; }
.sg-gh:is(:hover, :focus-visible) { text-decoration: underline; text-underline-offset: .25em; }
:is(.sg-about, .sg-gh):focus-visible { outline: 1px solid #ffffffa6; outline-offset: 2px; }
.sg-cmd { display: flex; align-items: center; gap: 1rem; inline-size: 100%; padding: .75rem 1rem; border: 0; background: var(--box); color: #fff; font: inherit; text-align: start; cursor: pointer; }
.sg-cmd code { flex: 1; min-inline-size: 0; font: inherit; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-dollar, .sg-copy { color: var(--dim); transition: color var(--nav-duration) var(--nav-ease); }
.sg-cmd:is(:hover, :focus-visible) .sg-copy { color: #fff; }
.sg-cmd:focus-visible { outline: 1px solid #ffffffa6; outline-offset: 2px; }
/* Style 2 and 4: centred */
body.s4 .sg-main { justify-self: center; display: grid; justify-items: center; text-align: center; padding-inline: 1.25rem; max-inline-size: 40rem; }
body.s4 .sg-install { text-align: start; }
body.s4 .sg-title { font-size: clamp(4.5rem, 13vw, 10.5rem); letter-spacing: -.045em; line-height: 1.05; }
body.s4 .sg-line { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
body.s4 .sg-install { margin-block-start: 1.75rem; }
body:not(.s4) .sg-arc { display: none; }
.sg > .sg-arc { position: absolute; inset: 0; z-index: 2; inline-size: 100%; block-size: 100%; pointer-events: none; overflow: visible; }
.sg-arc text { fill: #211060; font: 500 17px/1 Outfit, system-ui, sans-serif; letter-spacing: .01em; }
@media (width < 46rem) { .sg-arc text { font-size: 14px; } }
body.s4 .sg-main { padding-block-start: clamp(3rem, 13svh, 8rem); }
/* Style 3: text sits mid-height on the left */
body.s3 .sg-main { align-self: center; padding-block: 0 8svh; }
@media (width < 46rem) { body.s3 .sg-main { align-self: start; padding-block: clamp(2.5rem, 9svh, 6rem) 0; } }
/* The way down: a small chevron where the scene has dissolved into paper */
.sg > .sg-next { position: absolute; z-index: 3; inset-block-end: .25rem; inset-inline: 0; display: flex; inline-size: fit-content; margin-inline: auto; padding: .5rem .75rem; border: 0; background: none; color: #211060; cursor: pointer; }
.sg-next svg { inline-size: .875rem; block-size: .625rem; fill: currentColor; shape-rendering: crispEdges; animation: sg-bob 1.3s steps(2, jump-none) infinite alternate; }
.sg-next:focus-visible { outline: 1px solid currentColor; outline-offset: 2px; }
@keyframes sg-bob { to { transform: translateY(3px); } }
@media (width < 46rem) { .sg > .sg-next { inset-block-end: 3.125rem; } } /* on a phone it sits above the scene switch */
/* Scene switch, bottom left of the cover */
.sg > .sg-switch { position: absolute; z-index: 3; inset-block-end: .75rem; inset-inline-start: .75rem; display: flex; gap: .25rem; padding: .25rem; border-radius: .5rem; background: #090518cc; font: 400 .6875rem/1 "IBM Plex Mono", ui-monospace, monospace; }
.sg-switch button { padding: .375rem .5rem; border: 0; border-radius: .3125rem; background: transparent; color: #c7bdf2; font: inherit; cursor: pointer; }
.sg-switch button[aria-pressed="true"] { background: #ffffff26; color: #fff; }
.sg-switch button:focus-visible { outline: 1px solid #ffffffa6; outline-offset: 1px; }

/* The pill is the cover at rest. On desktop it is the first entry of the page's left menu: its moon sits in the
   logo's column and its text lines up with the wordmark and the menu. On a phone it floats bottom right. */
.sg-pill { position: relative; z-index: 60; display: flex; align-items: center; gap: .6875rem; inline-size: fit-content; margin: 1rem 0 0 -.4375rem; padding: .4375rem .875rem .4375rem .5rem; overflow: hidden; border: 1px solid #ffffff1a; border-radius: 999px; background: #452bb0; color: #fff; font: 400 .8125rem/1 Outfit, system-ui; cursor: pointer; box-shadow: 0 6px 18px #452bb033;
  transition: transform 320ms var(--nav-ease), box-shadow 320ms var(--nav-ease), opacity 260ms ease; }
.sg-pill b { margin-inline-end: -.25rem; }
@media (width < 46rem) {
  .sg-pill { position: fixed; inset-inline-end: clamp(1rem, 2.5vw, 1.75rem); inset-block-end: clamp(1rem, 2.5vw, 1.75rem); gap: .5rem; margin: 0; padding: .5625rem 1rem .5625rem .75rem; box-shadow: 0 10px 30px #452bb040; }
  .sg-pill b { margin-inline-end: 0; }
}
.sg-pill[hidden] { display: none; }
.sg-pill.out { opacity: 0; pointer-events: none; }
/* its background is a small dithered night, drawn by songe-cover.js; the hover motion happens in those pixels */
.sg-pill-art { position: absolute; inset: 0 auto auto 0; image-rendering: pixelated; }
.sg-pill > :not(canvas) { position: relative; }
.sg-pill b { font-weight: 500; }
.sg-pill span:last-child { color: #e2dcfb; transition: color 320ms var(--nav-ease); }
.sg-pill-moon { inline-size: .9375rem; block-size: .9375rem; } /* room for the pixel moon */
@media (hover: hover) {
  .sg-pill:hover { transform: translateY(-1px); box-shadow: 0 9px 22px #452bb052; }
  .sg-pill:hover span:last-child { color: #fff; }
}
.sg-pill:active { transform: translateY(1px); transition-duration: 120ms; }
.sg-pill:focus-visible { outline: 2px solid #452bb0; outline-offset: 3px; }

.sg > :not(canvas) { transition: opacity 220ms ease; }
.sg.folding > :not(canvas) { opacity: 0; }
body.cover-open { overflow: hidden; }
@media (prefers-reduced-motion: reduce) { .sg, .sg::after, .sg > :not(canvas), .sg-pill, .sg-pill *, .sg-next svg { transition: none; animation: none; } }
