/*
 * Zag Store Refraction — WordPress additions.
 * Only styles the prototype didn't need: real icons, unavailable states,
 * the installation paths, contribution providers and catalogue errors.
 * Uses the existing design tokens; no new colours or type.
 */

/* Blocksy prints `body { background-color: var(--theme-palette-color-7) }`
   in its own <style> after ours (outside the style queue, so it can't be
   dequeued). Its near-white covered the dark canvas. This selector outranks it. */
body.zag-rf { background: var(--bg-canvas); }

/* Wrappers added for optimised images must not change layout. */
picture { display: contents; }

/* ---------------------------------------------------------------- icons */
.tile--img {
  overflow: hidden;
  background: var(--tile-bg, var(--bg-sunken));
}
.tile--img img {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}
.tile--img.tile--contain img { object-fit: contain; padding: 8%; }
/* Pending originals sit over a monogram that shows if the image fails. */
.tile--pending { background: none; }
.tile--pending > .tile--under { position: absolute; inset: 0; width: 100%; height: 100%; box-shadow: none; }
.tile--pending > img { z-index: 1; }
.tile--mono .tile__letter {
  font-size: calc(var(--tile, 56px) * 0.42);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}
.app__list .tile--img img { border-radius: 11px; }

/* --------------------------------------------------------- catalogue */
.app-card__meta--id {
  font-family: var(--font-mono);
  font-size: 11.5px;
  overflow-wrap: anywhere;
}
.catalogue-error {
  margin: 20px 0 0;
  color: var(--text-secondary);
  font-size: 14.5px;
}
.catalogue-error .text-link { font: inherit; font-weight: 600; cursor: pointer; }
[data-catalogue-grid][aria-busy="true"] { opacity: 0.55; transition: opacity 200ms ease; }
[data-catalogue-more][aria-disabled="true"] { pointer-events: none; opacity: 0.6; }
.repo-row__host { font-family: var(--font-mono); font-size: 12px; }

/* ------------------------------------------------- unavailable actions */
.btn--disabled {
  cursor: not-allowed;
  opacity: 0.6;
  justify-content: center;
  box-shadow: none;
}
.btn--disabled:hover { transform: none; }

/* ----------------------------------------------------- install paths */
.install-paths {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(16px, 2.4vw, 28px);
  align-items: stretch;
  margin-bottom: clamp(56px, 8vw, 96px);
}
.install-path { display: flex; flex-direction: column; gap: 16px; }
.install-paths--single { grid-template-columns: minmax(0, 680px); justify-content: center; } /* one method: centred panel */
.install-path > p:not(.fine) { color: var(--text-secondary); }
.install-path__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.install-path__sub { color: var(--text-secondary); font-size: 13px; font-weight: 600; letter-spacing: 0.02em; }
.install-path__action { display: grid; gap: 10px; justify-items: start; margin-top: auto; padding-top: 8px; }
.install-path__note { color: var(--text-tertiary); font-size: 13.5px; line-height: 1.5; }
.install-path[data-state="unavailable"] .checklist,
.install-path[data-state="testing"] .checklist { opacity: 0.85; }

.checklist { display: grid; gap: 10px; font-size: 14.5px; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; }
.checklist__icon { width: 18px; height: 18px; flex: none; margin-top: 2px; color: var(--accent-text); }

.info-list__row--stack { flex-direction: column; gap: 6px; }
.info-list__row--stack dd { text-align: left; }
.checksum {
  display: block;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-sunken);
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  user-select: all;
}

/* ------------------------------------------------- contribution links */
.providers { display: grid; gap: 10px; }
.provider {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 2px 16px;
  min-height: 64px;
  padding: 14px 18px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface-glass);
  transition: border-color 300ms var(--ease-out-quart), background-color 300ms var(--ease-out-quart);
}
.provider:hover { border-color: var(--border-strong, var(--border-subtle)); background: color-mix(in srgb, var(--text-primary) 4%, var(--surface-glass)); }
.provider:focus-visible { outline-offset: 3px; }
.provider__name { font-weight: 650; letter-spacing: -0.01em; }
.provider__desc { grid-column: 1; color: var(--text-tertiary); font-size: 13.5px; }
.provider__icon { grid-column: 2; grid-row: 1 / span 2; width: 18px; height: 18px; color: var(--text-tertiary); }

@media (max-width: 800px) {
  .install-paths { grid-template-columns: minmax(0, 1fr); }
}

/* /install/ — the installer plugin's own form inside the Option 1 panel.
   Markup, IDs, validation and script are the plugin's; only its look follows Refraction here.
   Selectors start with "html body.zag-rf" so they win over the plugin's inline and page styles. */
html body.zag-rf.zag-byoc-install-page { background: var(--bg-canvas) !important; color: var(--text-primary) !important; }
/* The plugin's page style hides .page-title (meant for the old Blocksy title); Refraction's hero title uses it. */
html body.zag-rf.zag-byoc-install-page .page-title { display: block !important; }
.install-form { width: 100%; }
html body.zag-rf #zag-byoc-installer { background: none; padding: 0; margin: 0; color: var(--text-primary); }
html body.zag-rf #zag-byoc-installer .zag-wrap { max-width: none; margin: 0; }
html body.zag-rf #zag-byoc-installer .zag-wrap > h1,
html body.zag-rf #zag-byoc-installer .zag-wrap > p { display: none; } /* the panel above already introduces it */
html body.zag-rf #zag-byoc-installer .zag-panel { background: none; border: 0; border-radius: 0; padding: 0; }
html body.zag-rf #zag-byoc-installer .zag-version,
html body.zag-rf .install-path > .zag-version { background: var(--bg-sunken); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 14px 16px; margin: 0 0 16px; }
html body.zag-rf #zag-byoc-installer .zag-version strong,
html body.zag-rf .install-path > .zag-version strong { color: var(--text-primary); }
/* Above "You'll need" (install.php): the same block, its small line as inside the form. */
html body.zag-rf .install-path > .zag-version { margin: 0; }  /* spaced by the panel's 16px gap, like its neighbours */
html body.zag-rf .install-path > .zag-version small { display: block; margin-top: 4px; font-size: var(--text-small); color: var(--text-secondary); }
html body.zag-rf #zag-byoc-installer p,
html body.zag-rf #zag-byoc-installer small { color: var(--text-secondary); }
html body.zag-rf #zag-byoc-installer small { font-size: var(--text-small); }
html body.zag-rf #zag-byoc-installer .zag-status { border-left: 3px solid var(--zag-cyan-500); padding-left: 12px; margin: 0 0 4px; color: var(--text-primary); }
html body.zag-rf #zag-byoc-installer label { color: var(--text-primary); font-weight: 600; font-size: 15px; margin: 18px 0 8px; }
html body.zag-rf #zag-byoc-installer input {
  width: 100%; min-height: 50px; padding: 12px 16px; font: inherit; font-size: 16px; /* 16px: no iOS zoom on focus */
  color: var(--text-primary); background: var(--btn-ghost-fill); border: 0; border-radius: var(--radius-md);
  box-shadow: inset 0 0 0 1px var(--border-strong); cursor: text;
}
html body.zag-rf #zag-byoc-installer input[type=file] { font-size: 14px; min-height: 50px; padding: 8px; cursor: pointer; color: var(--text-secondary); background: var(--btn-ghost-fill); box-shadow: inset 0 0 0 1px var(--border-strong); border: 0; }
html body.zag-rf #zag-byoc-installer input[type=file]::file-selector-button {
  font: inherit; font-size: 14px; font-weight: 600; margin-right: 12px; padding: 9px 14px; cursor: pointer;
  color: var(--text-primary); background: var(--bg-elevated); border: 0; border-radius: var(--radius-pill); box-shadow: inset 0 0 0 1px var(--border-strong);
}
html body.zag-rf #zag-byoc-installer input:disabled { opacity: 0.55; cursor: not-allowed; }
html body.zag-rf #zag-byoc-installer input:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
html body.zag-rf #zag-byoc-installer button,
html body.zag-rf #zag-byoc-installer #zag-byoc-install {
  display: flex; align-items: center; justify-content: center; width: 100%; min-height: 54px; margin-top: 22px; padding: 0 26px;
  border: 0; border-radius: var(--radius-pill); font-size: 12px; font-weight: 650; letter-spacing: 0.15em; text-transform: uppercase;
  background: var(--btn-ink-bg); color: var(--btn-ink-text); box-shadow: var(--btn-ink-shadow); cursor: pointer; text-decoration: none;
}
html body.zag-rf #zag-byoc-installer #zag-byoc-install { background: var(--accent-fill); color: var(--text-on-accent); }
html body.zag-rf #zag-byoc-installer #zag-byoc-install[hidden] { display: none; }
html body.zag-rf #zag-byoc-installer button:disabled { background: var(--btn-ghost-fill); color: var(--text-tertiary); box-shadow: inset 0 0 0 1px var(--border-subtle); cursor: not-allowed; opacity: 1; }
html body.zag-rf #zag-byoc-installer button:focus-visible,
html body.zag-rf #zag-byoc-installer #zag-byoc-install:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 3px; }
