/* Publishing extras: Publish popover status, Site settings sheet (see modules/publish.js). */
:root { --pubx-warn: #9A5B00; --pubx-warn-bg: #FFF3DC; --pubx-warn-line: #F3D9A4; --pubx-bar: #0F9E6E; --pubx-bar-off: rgba(18, 19, 22, .12); --pubx-link: #1A4FBF; }
:root[data-mode="dark"] { --pubx-warn: #F2C46B; --pubx-warn-bg: rgba(229, 168, 0, .12); --pubx-warn-line: rgba(229, 168, 0, .3); --pubx-bar: #3DD69E; --pubx-bar-off: rgba(255, 255, 255, .14); --pubx-link: #8AB4F8; }
@media (prefers-color-scheme: dark) { :root:not([data-mode="light"]) { --pubx-warn: #F2C46B; --pubx-warn-bg: rgba(229, 168, 0, .12); --pubx-warn-line: rgba(229, 168, 0, .3); --pubx-bar: #3DD69E; --pubx-bar-off: rgba(255, 255, 255, .14); --pubx-link: #8AB4F8; } }

/* ---------- Publish popover ---------- */
.pubx-status { display: flex; flex-direction: column; gap: 10px; }
.pubx-status[hidden] { display: none; }
.pubx-updated { margin: -2px 0 0 2px; font-size: 12px; color: var(--ink-faint); }
.pubx-updated time { color: var(--ink-muted); font-weight: 500; }
.pubx-pending { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--pubx-warn-bg); border: 1px solid var(--pubx-warn-line); }
.pubx-pending[hidden] { display: none; }
.pubx-pdot { width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; background: linear-gradient(135deg, var(--cta-a), var(--cta-b)); flex-shrink: 0; box-shadow: 0 0 0 3px rgba(232, 101, 43, .18); }
.pubx-ptext { display: flex; flex-direction: column; gap: 1px; font-size: 12px; color: var(--ink-muted); }
.pubx-ptext b { font-size: 13px; color: var(--pubx-warn); font-weight: 600; }
.pubx-visits { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--chip-bg); }
.pubx-vtext { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pubx-vlabel { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-faint); }
.pubx-vnums { font-size: 13px; color: var(--ink); font-variant-numeric: tabular-nums; }
.pubx-spark { flex-shrink: 0; line-height: 0; }
.pubx-spark rect.off { fill: var(--pubx-bar-off); }
.pubx-spark rect.on { fill: var(--pubx-bar); opacity: .7; }
.pubx-spark rect.today { opacity: 1; }
.pubx-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; border-radius: 12px; border: 1px solid var(--line); background: transparent; color: var(--ink); text-align: left; cursor: pointer; font: inherit; }
.pubx-row:hover { background: var(--hover); }
.pubx-row:focus-visible { outline: 2px solid var(--select); outline-offset: 2px; }
.pubx-row-ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--chip-bg); color: var(--ink-muted); flex-shrink: 0; }
.pubx-row-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.pubx-row-txt b { font-size: 13px; font-weight: 600; }
.pubx-row-txt span { font-size: 12px; color: var(--ink-faint); }
.pubx-row-chev { color: var(--ink-faint); display: flex; transition: transform .15s ease; }
.pubx-row:hover .pubx-row-chev { transform: translateX(2px); }
/* "Published" button gets a small dot while changes aren't live yet */
.publish-wrap.pubx-has-pending #publish-btn { position: relative; }
.publish-wrap.pubx-has-pending #publish-btn::after { content: ""; position: absolute; top: -2px; right: -2px; width: 10px; height: 10px; border-radius: 50%; background: #FFD25E; border: 2px solid var(--card); }
#pub-go.pubx-go-hot { background: linear-gradient(135deg, var(--cta-a), var(--cta-b)); color: var(--cta-ink, #fff); border-radius: 999px; }
#pub-go.pubx-go-hot:hover { background: linear-gradient(135deg, #F07436, #EDB414); }

/* ---------- Site settings sheet ---------- */
html.pubx-lock, html.pubx-lock body { overflow: hidden; }
.pubx-back { position: fixed; inset: 0; z-index: 58; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(10, 11, 13, .38); }
.pubx-back[hidden] { display: none; }
.pubx-sheet { position: relative; width: 100%; max-width: 820px; max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); display: flex; flex-direction: column; border-radius: 24px; background: var(--glass-strong); border: 1px solid var(--glass-line); box-shadow: var(--shadow-window); color: var(--ink); overflow: hidden; outline: none; }
.pubx-grab { display: none; }
.pubx-head { display: flex; align-items: flex-start; gap: 12px; padding: 20px 20px 12px 24px; }
.pubx-head > div { flex: 1; min-width: 0; }
.pubx-head h2 { margin: 0 0 4px; font-size: 19px; letter-spacing: -.01em; }
.pubx-head p { margin: 0; font-size: 13px; color: var(--ink-muted); }
.pubx-x { border-radius: 999px; flex-shrink: 0; }
.pubx-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; padding: 8px 24px 20px; }
.pubx-sheet.loading .pubx-body { opacity: .55; pointer-events: none; }
.pubx-form { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.pubx-field { gap: 6px; }
.pubx-ftop { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.pubx-label, .pubx-ftop label { font-size: 13px; font-weight: 600; }
.pubx-count { font-size: 11px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.pubx-count.warn { color: var(--pubx-warn); }
.pubx-hint { margin: 0; }
.pubx-hint.bad { color: var(--danger); }
.pubx-ta { resize: vertical; min-height: 76px; line-height: 1.45; font-family: inherit; }
.pubx-form .input { border-radius: 12px; }

/* language combobox */
.pubx-combo { position: relative; }
.pubx-combo .input { padding-right: 84px; }
.pubx-code { position: absolute; right: 40px; top: 50%; transform: translateY(-50%); font-family: var(--mono); font-size: 11px; padding: 2px 7px; border-radius: 999px; background: var(--chip-bg); color: var(--ink-muted); pointer-events: none; }
.pubx-code[hidden] { display: none; }
.pubx-caret { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; border-radius: 999px; border: 0; background: transparent; color: var(--ink-faint); display: grid; place-items: center; cursor: pointer; }
.pubx-caret:hover { background: var(--hover); color: var(--ink); }
.pubx-list { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 5; margin: 0; padding: 6px; list-style: none; max-height: 232px; overflow-y: auto; overscroll-behavior: contain; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-window); }
.pubx-list[hidden] { display: none; }
.pubx-opt { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 36px; padding: 0 10px; border-radius: 9px; font-size: 14px; cursor: pointer; }
.pubx-opt:hover, .pubx-opt.active { background: var(--hover); }
.pubx-opt[aria-selected="true"] { color: var(--accent-text); font-weight: 600; }
.pubx-opt-c { font-family: var(--mono); font-size: 11px; color: var(--ink-faint); font-weight: 400; }
.pubx-none { padding: 10px; font-size: 13px; color: var(--ink-faint); }

/* pictures */
.pubx-pic { display: flex; align-items: center; gap: 14px; }
.pubx-tile { position: relative; flex-shrink: 0; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--line); background: linear-gradient(135deg, var(--f-peach), var(--f-sky)); color: var(--ink-muted); }
.pubx-tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pubx-tile img[hidden] { display: none; }
.pubx-pic-favicon .pubx-tile { width: 56px; height: 56px; border-radius: 14px; font-weight: 700; font-size: 22px; }
.pubx-pic-favicon .pubx-tile img { object-fit: contain; background: var(--card); }
.pubx-pic-image .pubx-tile { width: 132px; aspect-ratio: 1.91 / 1; border-radius: 12px; }
.pubx-ph { display: flex; }
.pubx-pic-btns { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 4px; min-width: 0; }
.pubx-pic-btns .btn { border-radius: 999px; }
.pubx-pic-btns .btn[hidden] { display: none; }
.pubx-pic-btns .pubx-hint { flex-basis: 100%; }

/* the switch (same feel as the theme switch) */
.pubx-switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 14px 14px 16px; border-radius: 16px; border: 1px solid var(--line); background: var(--chip-bg); }
.pubx-switch-txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pubx-switch { position: relative; flex-shrink: 0; width: 48px; height: 28px; padding: 0; border-radius: 999px; border: 1px solid var(--line); background: var(--pubx-bar-off); cursor: pointer; transition: background-color .2s ease, border-color .2s ease; }
.pubx-switch .pubx-knob { position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%; background: #FFFFFF; box-shadow: 0 1px 3px rgba(0, 0, 0, .28); transition: transform .22s cubic-bezier(.3, .7, .4, 1); }
.pubx-switch[aria-checked="true"] { background: var(--select); border-color: var(--select); }
.pubx-switch[aria-checked="true"] .pubx-knob { transform: translateX(20px); }
.pubx-switch:focus-visible { outline: 2px solid var(--select); outline-offset: 3px; }

/* previews */
.pubx-previews { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.pubx-pv { display: flex; flex-direction: column; gap: 8px; }
.pubx-pv-label { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-faint); }
.pubx-tab { display: flex; align-items: center; gap: 8px; max-width: 240px; height: 34px; padding: 0 10px; border-radius: 10px 10px 0 0; background: var(--card); border: 1px solid var(--line); border-bottom: 0; box-shadow: 0 6px 0 -5px var(--line); font-size: 12px; }
.pubx-tab-ic, .pubx-serp-ic { position: relative; width: 16px; height: 16px; border-radius: 4px; flex-shrink: 0; overflow: hidden; display: grid; place-items: center; }
.pubx-tab-ic img, .pubx-serp-ic img { width: 100%; height: 100%; object-fit: contain; }
.pubx-tab-ic img[hidden], .pubx-serp-ic img[hidden] { display: none; }
.pubx-tab-ic.empty, .pubx-serp-ic.empty { background: linear-gradient(135deg, var(--cta-a), var(--cta-b)); }
.pubx-tab-ic.empty::after, .pubx-serp-ic.empty::after { content: attr(data-l); color: #FFFFFF; font-size: 10px; font-weight: 700; }
.pubx-tab-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pubx-tab-x { color: var(--ink-faint); display: flex; }
.pubx-serp { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); transition: opacity .2s ease; }
.pubx-serp.off { opacity: .45; }
.pubx-serp-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pubx-serp-ic { width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--line); background: var(--chip-bg); }
.pubx-serp-url { font-size: 11px; color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pubx-serp-t { font-size: 16px; color: var(--pubx-link); line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
.pubx-serp-d { font-size: 12px; color: var(--ink-muted); line-height: 1.45; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
.pubx-serp-d.muted { color: var(--ink-faint); font-style: italic; }
.pubx-serp-hidden { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: var(--ink-muted); }
.pubx-serp-hidden[hidden] { display: none; }
.pubx-card { border-radius: 16px; overflow: hidden; background: var(--card); border: 1px solid var(--line); box-shadow: 0 10px 28px -18px rgba(40, 25, 10, .45); }
.pubx-card-img { position: relative; aspect-ratio: 1.91 / 1; display: grid; place-items: center; background: linear-gradient(135deg, var(--glow-peach), var(--glow-sky)); border-bottom: 1px solid var(--line); overflow: hidden; }
.pubx-card-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pubx-card-img img[hidden] { display: none; }
.pubx-card-ph { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; background: rgba(255, 255, 255, .75); color: #121316; font-size: 24px; font-weight: 700; box-shadow: 0 8px 20px -10px rgba(40, 25, 10, .5); }
.pubx-card-img:not(.empty) .pubx-card-ph { display: none; }
.pubx-card-body { display: flex; flex-direction: column; gap: 3px; padding: 10px 14px 12px; }
.pubx-card-dom { font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pubx-card-t { font-size: 14px; font-weight: 600; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
.pubx-card-d { font-size: 12px; color: var(--ink-muted); line-height: 1.4; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
.pubx-card-d[hidden] { display: none; }

.pubx-foot { display: flex; align-items: center; gap: 8px; padding: 12px 20px 16px 24px; border-top: 1px solid var(--line); }
.pubx-foot-note { flex: 1; min-width: 0; margin: 0; font-size: 12px; color: var(--ink-faint); }
.pubx-foot .btn { border-radius: 999px; }
.pubx-save { min-width: 84px; }
.pubx-save[disabled] { opacity: .5; }

/* Tablets: previews go under the form */
@media (max-width: 860px) {
  .pubx-body { grid-template-columns: 1fr; }
  .pubx-previews { display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
  .pubx-previews .pubx-pv:first-child { grid-column: 1 / -1; }
}
/* Phones: a bottom sheet */
@media (max-width: 640px) {
  .pubx-back { align-items: flex-end; padding: 0; }
  .pubx-sheet { max-width: none; max-height: 92vh; max-height: 92dvh; border-radius: 24px 24px 0 0; border-bottom: 0; padding-bottom: env(safe-area-inset-bottom); }
  .pubx-grab { display: block; width: 40px; height: 5px; border-radius: 999px; background: var(--line); margin: 8px auto 0; flex-shrink: 0; }
  .pubx-head { padding: 12px 12px 8px 20px; }
  .pubx-body { padding: 4px 20px 16px; gap: 20px; }
  .pubx-previews { display: flex; }
  .pubx-foot { padding: 10px 16px 14px 20px; }
  .pubx-foot-note { display: none; }
  .pubx-foot .btn { min-height: 42px; flex: 1; }
  .pubx-pic-image .pubx-tile { width: 112px; }
  .pubx-form .input { font-size: 16px; } /* no zoom on iOS */
}

/* Phones: the Publish popover becomes a bottom sheet too */
@media (max-width: 640px) {
  #publish-pop .pop-actions { flex-wrap: wrap; flex-direction: row-reverse; }
  #publish-pop .pop-actions .grow { display: none; }
  #publish-pop #pub-go { flex: 1 1 100%; min-height: 48px; font-size: 15px; }
  #publish-pop #unpublish-btn { flex: 1 1 100%; }
  #publish-pop { position: fixed; left: 0; right: 0; top: auto; bottom: 0; width: auto; max-width: none; max-height: 85vh; max-height: 85dvh; overflow-y: auto; overscroll-behavior: contain; border-radius: 24px 24px 0 0; border-bottom: 0; padding: 22px 20px calc(18px + env(safe-area-inset-bottom)); box-shadow: 0 -18px 50px -20px rgba(40, 25, 10, .35); z-index: 60; }
  #publish-pop::before { content: ""; position: absolute; top: 8px; left: 50%; width: 40px; height: 5px; margin-left: -20px; border-radius: 999px; background: var(--line); }
}

/* Motion */
@keyframes pubx-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pubx-rise { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes pubx-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes pubx-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: no-preference) {
  .pubx-back:not([hidden]) { animation: pubx-fade .2s ease both; }
  .pubx-back:not([hidden]) .pubx-sheet { animation: pubx-rise .26s cubic-bezier(.2, .8, .2, 1) both; }
  .pubx-list:not([hidden]) { animation: pubx-in .16s cubic-bezier(.2, .8, .2, 1) both; }
  .pubx-pending:not([hidden]) { animation: pubx-in .2s ease both; }
  .pubx-sheet { transition: opacity .2s ease; }
  .pubx-body { transition: opacity .2s ease; }
}
@media (prefers-reduced-motion: no-preference) and (max-width: 640px) {
  .pubx-back:not([hidden]) .pubx-sheet { animation: pubx-up .3s cubic-bezier(.2, .8, .2, 1) both; }
  #publish-pop:not([hidden]) { animation: pubx-up .3s cubic-bezier(.2, .8, .2, 1) both; }
}
@media (prefers-reduced-motion: reduce) {
  .pubx-back, .pubx-sheet, .pubx-list, .pubx-pending, .pubx-switch, .pubx-knob, .pubx-row-chev, #publish-pop { animation: none !important; transition: none !important; }
}
/* Who can see your site */
.pubx-acc { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pubx-acc-opt { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 11px 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: var(--ink); text-align: left; font: inherit; cursor: pointer; transition: border-color .15s, box-shadow .15s, background .15s; }
.pubx-acc-opt b { font-size: 13.5px; }
.pubx-acc-opt span { font-size: 12px; color: var(--ink-faint); line-height: 1.35; }
.pubx-acc-opt:hover:not(:disabled) { background: var(--hover); }
.pubx-acc-opt[aria-checked="true"] { border-color: var(--select); box-shadow: 0 0 0 3px color-mix(in srgb, var(--select) 18%, transparent); }
.pubx-acc-opt:disabled { cursor: default; opacity: .6; }
.pubx-acc-opt b { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pubx-acc-opt .pubx-pro { line-height: 1.5; padding: 1px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 700; letter-spacing: .02em; color: var(--cta-ink); background: linear-gradient(135deg, var(--cta-a), var(--cta-b)); }
.pubx-acc-opt.is-locked > span { opacity: .75; }
.pubx-upsell { display: flex; align-items: center; gap: 12px; margin-top: 8px; padding: 10px 12px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--cta-a) 35%, var(--line)); background: color-mix(in srgb, var(--cta-a) 7%, var(--card)); font-size: 13px; line-height: 1.45; color: var(--ink-muted); }
.pubx-upsell[hidden] { display: none; }
.pubx-upsell .btn { flex-shrink: 0; }
.pubx-pw { display: flex; gap: 8px; margin-top: 8px; }
.pubx-pw[hidden] { display: none; }
.pubx-pw .input { flex: 1; min-width: 0; }
.pubx-mk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
.pubx-mk-f { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pubx-mk-f label { font-size: 12.5px; font-weight: 600; }
.pubx-mk-f .hint { font-size: 11.5px; }
@media (max-width: 640px) { .pubx-acc, .pubx-mk-grid { grid-template-columns: 1fr; } }
