/* The share page (/share/:id). Out of the way of the design: a white page
   in either theme, one font size, black controls, and hierarchy only by
   dimming the colour. */

/* Wider than the site's 1080 px: room for the design to show its thread. */
body.share-page .wrap { max-width: 1400px; }

body.share-page {
  --ink: #000;
  --dim: #8a8a8a;
  --line: #ececec;
  --paper: #fff;
  background: #fff; color: var(--ink);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.share-page :is(h1, h2, h3, p, dl, dd, ol, figure) { margin: 0; font: inherit; }
.share-page :is(button, select, input, a) { font: inherit; color: inherit; }
.share-page a { text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.share-page a:hover { text-decoration-color: currentColor; }
.share-page .dim { color: var(--dim); }
.share-page :focus-visible { outline: 2px solid #000; outline-offset: 2px; border-radius: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Header: the sewn wordmark, and the app for this system */
.share-page .top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 0; }
.share-page .wordmark { display: block; line-height: 0; text-decoration: none; }
.share-page .wordmark canvas { height: 39px; width: auto; }
.share-page .get { display: flex; align-items: center; gap: 16px; }
.tagline { white-space: nowrap; }
@media (max-width: 640px) { .tagline { display: none; } }
.share-page .wordmark .fallback { display: none; line-height: 1.6; letter-spacing: .08em; }
.share-page .get .btn svg { width: 15px; height: 15px; fill: currentColor; flex: none; }
.get-mac, .get-windows, .get-linux { display: none !important; }
html[data-os="mac"] .get-mac, html[data-os="windows"] .get-windows, html[data-os="linux"] .get-linux { display: inline-flex !important; }
html[data-os="mac"] .get-other, html[data-os="windows"] .get-other, html[data-os="linux"] .get-other { display: none !important; }

.share { padding: 12px 0 64px; }
.share h1 { overflow-wrap: anywhere; }
.share h2 { color: var(--dim); margin-bottom: 8px; }

.share-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 56px; align-items: start; }

/* The design */
.player { min-width: 0; }
/* As big as the page allows, and no taller than most of the window, so the controls stay in view. */
.stage { position: relative; aspect-ratio: 4 / 3; max-height: 70vh; width: 100%; background: #f8f5ee; border-radius: 4px; display: grid; place-items: center; overflow: hidden; }
.stage .still { width: 100%; height: 100%; object-fit: contain; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
/* With script, the picture waits for the player (it's framed differently, so showing it first
   made the design jump in size); it shows only if the player can't run. */
.player.ready .stage .still, .js .player:not(.failed) .stage .still { visibility: hidden; }
.player.loading .stage::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 1px; width: 30%;
  background: #000; animation: share-load 1.1s ease-in-out infinite;
}
@keyframes share-load { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
.no-picture { color: var(--dim); }

/* Controls: black, and only as much as they need */
.controls, .options { display: none; }
.player.ready .controls { display: flex; align-items: center; gap: 16px; margin-top: 16px; }
.player.ready .options { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; margin-top: 8px; }

.play, .share-page .btn {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px;
  border: 0; border-radius: 6px; background: #000; color: #fff !important; cursor: pointer; text-decoration: none;
}
.play { flex: none; width: 44px; height: 40px; padding: 0; justify-content: center; }
.play svg { width: 20px; height: 20px; fill: currentColor; display: none; }
.play:not([data-state]) .i-play, .play[data-state="play"] .i-play, .play[data-state="pause"] .i-pause, .play[data-state="replay"] .i-replay { display: block; }
.share-page .btn:hover, .play:hover { background: #222; }

.scrub { flex: 1; min-width: 0; accent-color: #000; height: 24px; margin: 0; }
.count { flex: none; font-variant-numeric: tabular-nums; }

.options button, .options select {
  height: 28px; padding: 0; border: 0; background: none; color: var(--dim); cursor: pointer;
}
.options button:hover, .options select:hover, .options button[aria-pressed="true"] { color: #000; }
.seg { display: inline-flex; gap: 14px; }

/* Zoom, quietly in the canvas's lower right corner */
.stage .zoom { position: absolute; right: 10px; bottom: 10px; z-index: 1; display: flex; gap: 4px; }
.stage .zoom button {
  display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 6px;
  background: rgba(255, 255, 255, .55); color: rgba(0, 0, 0, .45); cursor: pointer;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.stage .zoom button:hover { background: rgba(255, 255, 255, .85); color: #000; }
.stage .zoom button[hidden] { display: none; }
.stage .zoom svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.player:not(.ready) .stage .zoom { display: none; }
.fabrics { display: inline-flex; gap: 8px; }
.options .swatch { width: 16px; height: 16px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .2); }
.options .swatch[aria-pressed="true"] { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .2), 0 0 0 2px #fff, 0 0 0 3px #000; }
.speed { appearance: none; -webkit-appearance: none; }
.now { flex-basis: 100%; min-height: 1.6em; }

/* What's in it */
.details { display: grid; gap: 32px; }
.facts { display: grid; gap: 6px; }
.facts div { display: grid; grid-template-columns: 96px 1fr; gap: 12px; }
.facts dt { color: var(--dim); }
.facts dd { font-variant-numeric: tabular-nums; }
.facts dd .dim { display: block; }
.facts h1, .facts dd .dim.inline { display: inline; }

.downloads > .dim, .license > .dim { margin-top: 10px; }

/* Threads, in the sidebar: one row per colour, scrolling when there are many */
.threads-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 6px; }
.threads-head h2 { margin: 0; }
.charts { display: inline-flex; gap: 12px; }
.charts button { height: auto; padding: 0; border: 0; background: none; color: var(--dim); cursor: pointer; }
.charts button:hover, .charts button[aria-pressed="true"] { color: #000; }
.thread-list {
  list-style: none; padding: 0; margin: 0 0 12px; max-height: 300px; overflow-y: auto; overscroll-behavior: contain;
  /* Fades at the bottom edge when the list scrolls. */
  mask-image: linear-gradient(#000 calc(100% - 16px), transparent);
}
.thread { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 12px; padding: 5px 8px 5px 0; }
.thread[role="button"] { cursor: pointer; }
.thread[role="button"]:hover .tn, .thread[aria-current] .tn { text-decoration: underline; text-underline-offset: 3px; }
.chip { width: 22px; height: 22px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18); }
.tname { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tnum { font-variant-numeric: tabular-nums; }

/* Report, in the footer: its form opens above it */
.report { position: relative; }
.report summary { cursor: pointer; list-style: none; }
.report summary::-webkit-details-marker { display: none; }
.report summary:hover { color: #000; }
.report form {
  position: absolute; right: 0; bottom: calc(100% + 8px); z-index: 10; display: flex; gap: 8px; align-items: center;
  padding: 8px; background: #fff; border-radius: 8px; box-shadow: 0 0 0 1px var(--line), 0 8px 24px rgba(0, 0, 0, .08); white-space: nowrap;
}
.report select { border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; background: #fff; }
.report button { height: 32px; padding: 0 12px; border: 0; border-radius: 6px; background: #000; color: #fff; cursor: pointer; }

.gone { padding: 64px 0 120px; }
.gone .lede { margin: 4px 0 24px; color: var(--dim); }

.share-page footer .row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 12px 24px; margin-top: 64px; padding: 24px 0 40px; font-size: 15px; color: var(--dim); }
.share-page footer nav { display: flex; flex-wrap: wrap; align-items: baseline; gap: 20px; }
.share-page footer a { text-decoration: none; }
.share-page footer a:hover { color: #000; }

@media (max-width: 900px) {
  .share-grid { grid-template-columns: 1fr; gap: 32px; }
}
@media (max-width: 520px) {
  .stage { aspect-ratio: 1; }
  .share-page .get .btn { padding: 0 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .player.loading .stage::after { animation: none; }
}

/* Export: a black button with a menu of machine files */
.dl-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.dl-head h2 { margin: 0; }
/* Open in ZigZag: first in the Export menu, set apart from the files */
.menu .open-item { border-bottom: 1px solid var(--line); margin-bottom: 6px; padding-bottom: 6px; }
.menu .open-item span { display: inline-flex; align-items: center; gap: 8px; }
.menu .z { width: 11px; height: 12px; fill: currentColor; }
.menu { position: relative; }
.menu summary { list-style: none; user-select: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu summary svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.5; transition: transform .15s; }
.menu[open] summary svg { transform: rotate(180deg); }
.menu ul {
  position: absolute; z-index: 10; right: 0; top: calc(100% + 6px); min-width: 280px;
  list-style: none; margin: 0; padding: 6px; background: #fff; border-radius: 8px;
  box-shadow: 0 0 0 1px var(--line), 0 8px 24px rgba(0, 0, 0, .08);
}
.menu li a { display: flex; justify-content: space-between; gap: 16px; padding: 6px 10px; border-radius: 5px; text-decoration: none; }
.menu li a:hover, .menu li a:focus-visible { background: #f4f4f4; outline: none; }
@media (prefers-reduced-motion: reduce) { .menu summary svg { transition: none; } }
.menu li a span { white-space: nowrap; }
