/* Download widget (download-widget.js): split button, menu, steps.
 * Colours come from variables so each site sets its own; the fallbacks are neutral.
 * Kept identical in 12hobbies-studio and laurence/helia. */
.dl {
  --dl-accent: #c1653f;
  --dl-accent-text: #fff;
  --dl-panel: rgba(127, 127, 127, 0.1);
  --dl-menu-bg: #fff;
  --dl-menu-text: #222;
  --dl-line: rgba(127, 127, 127, 0.35);
  box-sizing: border-box;
  max-width: 44rem;
  margin: 1.25rem 0 2rem;
  padding: 1.25rem;
  border: 1px solid var(--dl-line);
  border-radius: 14px;
  background: var(--dl-panel);
  overflow-wrap: anywhere;
}
.dl *, .dl *::before, .dl *::after { box-sizing: border-box; }
.dl p { margin: 0.5rem 0; }
.dl .dl-version, .dl .dl-file, .dl .dl-detect { font-size: 0.92em; opacity: 0.85; }
.dl .dl-sha { font-size: 0.85em; opacity: 0.85; overflow-wrap: anywhere; }
.dl .dl-sha code { word-break: break-all; }

.dl .dl-split { display: flex; margin: 0.9rem 0 0.2rem; }
.dl .dl-btn, .dl .dl-caret {
  margin: 0;
  border: 0;
  background: var(--dl-accent);
  color: var(--dl-accent-text);
  font: inherit;
  cursor: pointer;
}
.dl .dl-btn {
  flex: 1 1 auto;
  min-width: 0;
  padding: 1rem 1.1rem;
  border-radius: 12px 0 0 12px;
  font-size: 1.15em;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
}
.dl .dl-caret {
  flex: 0 0 3.2rem;
  border-left: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 0 12px 12px 0;
}
.dl .dl-arrow {
  display: inline-block;
  width: 0.6rem;
  height: 0.6rem;
  margin-top: -0.25rem;
  border-right: 3px solid currentColor;
  border-bottom: 3px solid currentColor;
  transform: rotate(45deg);
}
.dl .dl-caret[aria-expanded="true"] .dl-arrow { margin-top: 0.25rem; transform: rotate(-135deg); }
.dl .dl-btn:hover, .dl .dl-caret:hover, .dl .dl-btn:focus-visible, .dl .dl-caret:focus-visible { filter: brightness(0.9); color: var(--dl-accent-text); }
.dl .dl-btn:focus-visible, .dl .dl-caret:focus-visible { outline: 3px solid currentColor; outline-offset: 2px; }
.dl .dl-item:focus { outline: 2px solid var(--dl-accent); outline-offset: -2px; }

/* The list opens in the page flow under the button and pushes the content down:
   no floating box, no height limit and no inner scrolling. Groups sit side by side when there is room. */
.dl .dl-menu {
  margin: 0.5rem 0 0;
  padding: 0.3rem 0.4rem 0.5rem;
  border: 1px solid var(--dl-line);
  border-radius: 12px;
  background: var(--dl-menu-bg);
  color: var(--dl-menu-text);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  column-gap: 0.4rem;
}
.dl .dl-menu[hidden] { display: none; }
.dl .dl-group { min-width: 0; }
.dl .dl-gh { padding: 0.55rem 0.6rem 0.15rem; font-size: 0.78em; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.7; }
.dl .dl-item {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0.4rem 0.6rem 0.4rem 2rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  position: relative;
}
.dl .dl-item:hover, .dl .dl-item:focus-visible { background: var(--dl-panel); }
.dl .dl-item[aria-checked="true"]::before { content: "\2713"; position: absolute; left: 0.6rem; top: 0.4rem; font-weight: 700; color: var(--dl-accent); }
.dl .dl-item.is-soon { cursor: default; opacity: 0.55; }
.dl .dl-item .dl-t { display: block; font-weight: 700; line-height: 1.3; }
.dl .dl-item .dl-d { display: block; margin-top: 0.1rem; font-size: 0.82em; line-height: 1.35; opacity: 0.8; }

.dl .dl-steps { margin: 0.8rem 0 0.4rem; padding-left: 1.4rem; }
.dl .dl-steps li { margin: 0.45rem 0; }
.dl h4, .dl .dl-h { margin: 0.9rem 0 0.2rem; font-size: 1em; font-weight: 700; }
.dl ul { margin: 0.2rem 0 0.4rem; padding-left: 1.3rem; }
.dl .dl-advanced { margin-top: 1.1rem; border-top: 1px solid var(--dl-line); padding-top: 0.2rem; font-size: 0.92em; }
.dl .dl-advanced h4, .dl .dl-advanced .dl-h { opacity: 0.85; }
.dl .dl-btn.is-soon, .dl .dl-btn:disabled {
  border-radius: 12px;
  background: var(--dl-line);
  color: var(--dl-soon-text, inherit);
  cursor: default;
  filter: none;
}
.dl.dl-is-soon .dl-msg { margin-top: 0.7rem; }
.dl .dl-source { margin: 0.4rem 0 0; font-weight: 700; }
.dl[data-dl-compact="1"] { margin: 0.8rem 0 0; padding: 0.9rem; }
.dl[data-dl-compact="1"] .dl-btn { padding: 0.8rem 0.9rem; font-size: 1.02em; }
.dl[data-dl-compact="1"] .dl-split { margin-top: 0.5rem; }
@media (prefers-color-scheme: dark) {
  .dl { --dl-menu-bg: #2b2520; --dl-menu-text: #f2e8d8; --dl-soon-text: #d9ccb8; }
}
@media (max-width: 30rem) {
  .dl { padding: 1rem; }
  .dl .dl-btn { padding: 0.85rem 0.8rem; font-size: 1.05em; }
  .dl .dl-caret { flex-basis: 2.8rem; }
}

/* Pay what you want step (a modal dialog; opened by the download button when the manifest has "pay") */
dialog.dl.dl-pay {
  width: min(34rem, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  margin: auto;
  overflow-y: auto;
  background: var(--dl-menu-bg);
  color: var(--dl-menu-text);
}
dialog.dl.dl-pay::backdrop { background: rgba(0, 0, 0, 0.6); }
.dl-pay .dl-pay-h { margin: 0 0 0.4rem; font-size: 1.5em; line-height: 1.2; }
.dl-pay .dl-pay-file { font-size: 0.92em; opacity: 0.85; }
.dl-pay fieldset { border: 0; padding: 0; margin: 1rem 0 0; min-width: 0; }
.dl-pay legend { font-weight: 700; padding: 0; margin-bottom: 0.5rem; }
.dl-pay .dl-pay-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.dl-pay .dl-pay-pick { position: relative; cursor: pointer; }
.dl-pay .dl-pay-pick input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.dl-pay .dl-pay-pick span { display: inline-block; min-width: 4rem; padding: 0.55rem 1rem; border: 2px solid var(--dl-line); border-radius: 12px; font-weight: 700; text-align: center; }
.dl-pay .dl-pay-pick input:checked + span { border-color: var(--dl-accent); box-shadow: inset 0 0 0 2px var(--dl-accent); }
.dl-pay .dl-pay-pick input:focus-visible + span { outline: 3px solid var(--dl-accent); outline-offset: 2px; }
.dl-pay .dl-pay-custom { margin: 0.8rem 0 0; }
.dl-pay .dl-pay-custom label { display: block; margin-bottom: 0.25rem; font-weight: 700; }
.dl-pay .dl-pay-custom input { width: 100%; max-width: 14rem; padding: 0.55rem 0.7rem; border: 2px solid var(--dl-line); border-radius: 10px; background: transparent; color: inherit; font: inherit; }
.dl-pay .dl-pay-custom input:disabled { opacity: 0.5; }
.dl-pay .dl-pay-outcome { min-height: 1.5em; font-weight: 700; }
.dl-pay .dl-pay-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.dl-pay .dl-btn { flex: 0 1 auto; border-radius: 12px; padding: 0.8rem 1.4rem; }
.dl-pay .dl-btn:disabled { background: var(--dl-line); cursor: not-allowed; }
.dl-pay .dl-pay-cancel { margin: 0; padding: 0.7rem 1.1rem; border: 2px solid var(--dl-line); border-radius: 12px; background: transparent; color: inherit; font: inherit; font-weight: 700; cursor: pointer; }
.dl-pay .dl-pay-notes { margin: 0.8rem 0 0; padding-left: 1.2rem; font-size: 0.92em; opacity: 0.9; }
.dl-pay .dl-pay-notes li { margin: 0.3rem 0; }
@media (max-width: 30rem) {
  dialog.dl.dl-pay { padding: 1rem; width: calc(100vw - 1.5rem); }
  .dl-pay .dl-pay-pick span { min-width: 3.4rem; padding: 0.5rem 0.85rem; }
  .dl-pay .dl-btn { width: 100%; }
}
