/* ============================================================
   BORG SITES, the builder tab (/build) and Create New Site (/create)

   Dark chrome, so the customer's own site is the brightest thing on the
   screen: space navy around everything, panels and raised cards one step up
   each, hairlines between, and the brand gradient as the one accent. The
   bright gradient is used only where there are no words on it (the active
   tab's underline, the AI's working line, the send button's arrow); a
   button with words on it uses the deep twin (--grad-brand-deep), whose
   lightest stop still carries white at 4.55:1.

   Measured contrast (WCAG AA), every text pair used here:
     text #F2F4FF on chrome #0A0E27 17.34, panel #10152F 16.37, card #182046 14.36,
       hover #1F2852 12.91, hairline #2A3363 10.93, error ground #3A1820 14.39
     secondary #A9B0D6 on chrome 8.93, panel 8.43, card 7.40, hover 6.65,
       hairline 5.63, published ground #0F2E26 6.86
     white on the deep gradient, lightest stop #C93E96, 4.55
     published #6EE7A8 on #0F2E26 9.49, on panel 11.67, on card 10.24
     paused #F5C46B on #33280F 8.95; draft #C9CEEA on #222B55 8.74
     error #FF9B8E on panel 8.83, on #3A1820 7.76; #FFC9C2 on #3A1820 10.80
     the preview's address #4A5072 on #E3E6F0 6.28, on the bar #F4F5FA 7.19,
       on the canvas #E9ECF6 6.64
   Non-text (3:1): field borders #646EA0 on panel 3.66, card 3.21, chrome
   3.87; focus ring #2E7DF6 on chrome 4.87, panel 4.60, card 4.03, hover
   3.63; the send arrow, white on the bright gradient, 3.26 at its pink end.
   ============================================================ */

:root {
  --b-bg: #0A0E27;
  --b-panel: #10152F;
  --b-card: #182046;
  --b-hover: #1F2852;
  --b-line: #2A3363;
  --b-control: #646EA0;
  --b-text: #F2F4FF;
  --b-text-2: #A9B0D6;
  --b-focus: #2E7DF6;
  --b-canvas: #E9ECF6;
  --b-ok: #6EE7A8;
  --b-ok-bg: #0F2E26;
  --b-warn: #F5C46B;
  --b-warn-bg: #33280F;
  --b-draft: #C9CEEA;
  --b-draft-bg: #222B55;
  --b-err: #FF9B8E;
  --b-err-soft: #FFC9C2;
  --b-err-bg: #3A1820;
  --b-r-card: 12px;
  --b-r-input: 10px;
  --b-bar-h: 52px;
  --b-switch-h: 48px;
  --b-fast: .16s;
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.build {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--b-bg);
  color: var(--b-text);
  font-family: var(--font-body);
  font-size: .875rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3 { font-family: var(--font-display); margin: 0; letter-spacing: -.015em; line-height: 1.25; }
p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { display: block; }
svg { flex: none; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--b-focus); outline-offset: 2px; }
[hidden] { display: none !important; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 16px; top: 8px; z-index: 600;
  padding: 10px 16px; border-radius: var(--b-r-input);
  background: var(--b-card); color: var(--b-text); font-weight: 600; text-decoration: none;
  transform: translateY(-160%); transition: transform var(--b-fast) var(--ease);
}
.skip-link:focus-visible { transform: none; }
.bnoscript { max-width: 520px; margin: 16vh auto; padding: 32px; text-align: center; }
.bnoscript p { color: var(--b-text-2); margin-top: 8px; }

/* ---------- the working line: the bright gradient, moving ---------- */
.bshimmer, .bcomposer__shimmer {
  background: linear-gradient(90deg, var(--brand-1), var(--brand-2), var(--brand-3), var(--brand-4), var(--brand-1));
  background-size: 200% 100%;
  animation: b-flow 1.6s linear infinite;
}
@keyframes b-flow { from { background-position: 0% 0; } to { background-position: -200% 0; } }

/* ---------- boot and fail ---------- */
.bboot { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; }
.bboot__mark { width: 56px; height: 56px; filter: drop-shadow(0 10px 30px rgba(123, 63, 228, .45)); animation: b-breathe 2.4s var(--ease-in-out) infinite; }
.bboot__text { font-family: var(--font-display); font-weight: 600; color: var(--b-text-2); }
.bboot__bar { width: 160px; height: 3px; border-radius: 3px; }
@keyframes b-breathe { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(.94); opacity: .85; } }

.bfail { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; }
.bfail__card { width: min(460px, 100%); padding: 36px 32px; text-align: center; background: var(--b-panel); border: 1px solid var(--b-line); border-radius: 16px; }
.bfail__mark { width: 40px; height: 40px; margin: 0 auto 16px; }
.bfail__title { font-size: 1.375rem; font-weight: 700; }
.bfail__text { margin-top: 8px; color: var(--b-text-2); }
.bfail__actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 24px; }

/* ============================================================
   BUTTONS
   ============================================================ */
.bbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border: 1px solid transparent; border-radius: var(--b-r-input);
  font-family: var(--font-display); font-weight: 600; font-size: .875rem; line-height: 1;
  text-decoration: none; white-space: nowrap; cursor: pointer; background: transparent;
  transition: background-color var(--b-fast) var(--ease), border-color var(--b-fast) var(--ease), filter var(--b-fast) var(--ease), transform var(--b-fast) var(--ease), box-shadow var(--b-fast) var(--ease);
}
.bbtn:active { transform: translateY(1px); }
.bbtn--sm { height: 34px; padding: 0 12px; font-size: .8125rem; }
.bbtn--block { width: 100%; }
/* white on the deep gradient, 4.55:1 at its lightest stop; hover only darkens it */
.bbtn--primary { background: var(--grad-brand-deep); color: #FFFFFF; box-shadow: 0 6px 20px -8px rgba(123, 63, 228, .6), inset 0 1px 0 rgba(255, 255, 255, .16); }
.bbtn--primary:hover { filter: brightness(.92); }
.bbtn--secondary { background: var(--b-card); border-color: var(--b-line); color: var(--b-text); }
.bbtn--secondary:hover { background: var(--b-hover); border-color: var(--b-control); }
.bbtn--ghost { color: var(--b-text-2); }
.bbtn--ghost:hover { background: var(--b-card); color: var(--b-text); }
.bbtn--published { background: var(--b-ok-bg); border-color: rgba(110, 231, 168, .35); color: var(--b-ok); }
.bbtn--published:hover, .bbtn--published[aria-expanded="true"] { border-color: var(--b-ok); }
.bbtn[disabled], .bbtn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; filter: none; }

.bicon {
  display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0;
  border: 0; border-radius: var(--b-r-input); background: transparent; color: var(--b-text-2); cursor: pointer;
  transition: background-color var(--b-fast) var(--ease), color var(--b-fast) var(--ease);
}
.bicon:hover { background: var(--b-card); color: var(--b-text); }
.bicon[disabled] { opacity: .4; cursor: not-allowed; background: transparent; }

.blink { display: inline; padding: 0; border: 0; background: none; cursor: pointer; color: var(--b-text); font: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.blink:hover { text-decoration-thickness: 2px; }

/* ============================================================
   THE TOP BAR
   ============================================================ */
.bld { display: grid; grid-template-rows: var(--b-bar-h) minmax(0, 1fr); height: 100vh; height: 100dvh; }
.bbar {
  position: relative; z-index: 50;
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 12px;
  height: var(--b-bar-h); padding: 0 12px;
  background: var(--b-bg); border-bottom: 1px solid var(--b-line);
}
.bbar__left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.bbar__mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--b-r-input); flex: none; }
.bbar__mark img { width: 28px; height: 28px; filter: drop-shadow(0 4px 10px rgba(123, 63, 228, .35)); }
.bbar__mark:hover { background: var(--b-card); }
.bbar__site { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bbar__name { font-family: var(--font-display); font-weight: 600; font-size: .9375rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.bbar__saved { display: inline-flex; align-items: center; gap: 4px; font-size: .75rem; color: var(--b-text-2); white-space: nowrap; transition: opacity .6s var(--ease); }
.bbar__saved.is-saved::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--b-ok); margin-right: 2px; }
.bbar__saved.is-quiet { opacity: .7; }
.bbar__saved.is-error { color: var(--b-err); }
.bbar__saved.is-error .blink { color: var(--b-err); }
.bbar__center { display: flex; align-items: center; gap: 8px; }
.bbar__right { display: flex; align-items: center; justify-content: flex-end; gap: 4px; min-width: 0; }
.bbar__right .bpublish { margin-left: 6px; }

/* the status pill */
.bpill {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 999px; flex: none;
  font-family: var(--font-display); font-size: .6875rem; font-weight: 700; letter-spacing: .02em; line-height: 1; white-space: nowrap;
  background: var(--b-draft-bg); color: var(--b-draft);
}
.bpill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.bpill--published { background: var(--b-ok-bg); color: var(--b-ok); }
.bpill--paused { background: var(--b-warn-bg); color: var(--b-warn); }
.bpill--now { background: var(--b-card); color: var(--b-text); }
.bpill--now::before { background: var(--grad-brand); }

/* the page picker */
.bselect { position: relative; display: inline-flex; }
.bselect__input {
  appearance: none; -webkit-appearance: none; height: 34px; padding: 0 34px 0 12px; min-width: 132px; max-width: 200px;
  border: 1px solid var(--b-control); border-radius: var(--b-r-input); background: var(--b-panel); color: var(--b-text);
  font-size: .8125rem; font-weight: 500; cursor: pointer;
}
.bselect__input:hover { border-color: var(--b-text-2); }
.bselect__input:disabled { opacity: .5; cursor: not-allowed; }
.bselect__input option { background: var(--b-panel); color: var(--b-text); }
.bselect__chev { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--b-text-2); pointer-events: none; }

/* segmented controls: the device toggle */
.bseg { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--b-r-input); background: var(--b-panel); border: 1px solid var(--b-line); }
.bseg__btn {
  display: inline-grid; place-items: center; width: 34px; height: 28px; padding: 0; border: 0; border-radius: 7px;
  background: transparent; color: var(--b-text-2); cursor: pointer;
  transition: background-color var(--b-fast) var(--ease), color var(--b-fast) var(--ease);
}
.bseg__btn:hover { color: var(--b-text); }
.bseg__btn[aria-pressed="true"] { background: var(--b-card); color: var(--b-text); box-shadow: 0 1px 0 rgba(255, 255, 255, .06), 0 2px 8px -2px rgba(0, 0, 0, .5); }

/* publish and its menu */
.bpublish { position: relative; }
.bpublish__chev { transition: transform var(--b-fast) var(--ease); }
[aria-expanded="true"] > .bpublish__chev { transform: rotate(180deg); }
.bmenu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 80; min-width: 210px; padding: 6px;
  background: var(--b-panel); border: 1px solid var(--b-line); border-radius: var(--b-r-card);
  box-shadow: 0 24px 48px -16px rgba(0, 0, 0, .7);
  transition: opacity var(--b-fast) var(--ease), transform var(--b-fast) var(--ease-out);
}
@starting-style { .bmenu { opacity: 0; transform: translateY(-4px); } }
.bmenu__item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 8px 12px;
  border: 0; border-radius: 8px; background: transparent; color: var(--b-text); cursor: pointer; text-align: left; font-weight: 500;
}
.bmenu__item svg { color: var(--b-text-2); }
.bmenu__item:hover, .bmenu__item:focus-visible { background: var(--b-hover); }
.bmenu__item:focus-visible { outline-offset: -2px; }
.bmenu__item--danger, .bmenu__item--danger svg { color: var(--b-err); }

/* the phones' switch, hidden on wider screens */
.bswitch { display: none; }

/* ============================================================
   THE MAIN AREA: panel, handle, canvas
   ============================================================ */
.bmain { --panel-w: 400px; display: grid; grid-template-columns: var(--panel-w) 6px minmax(0, 1fr); min-height: 0; }
.bmain.is-resizing { cursor: col-resize; user-select: none; }
.bmain.is-resizing .bcanvas { pointer-events: none; }

.bpanel { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--b-panel); }
.bresize { position: relative; cursor: col-resize; background: var(--b-panel); touch-action: none; }
.bresize::before { content: ""; position: absolute; top: 0; bottom: 0; left: 2px; width: 1px; background: var(--b-line); transition: background-color var(--b-fast) var(--ease), width var(--b-fast) var(--ease); }
.bresize:hover::before, .bresize:focus-visible::before, .is-resizing .bresize::before { left: 1px; width: 3px; background: var(--b-focus); }
.bresize:focus-visible { outline: none; }

/* ---------- tabs ---------- */
.btabs { display: flex; gap: 4px; padding: 0 12px; height: 46px; border-bottom: 1px solid var(--b-line); flex: none; }
.btab {
  position: relative; padding: 0 12px; border: 0; background: transparent; cursor: pointer;
  color: var(--b-text-2); font-family: var(--font-display); font-weight: 600; font-size: .875rem;
  transition: color var(--b-fast) var(--ease);
}
.btab:hover { color: var(--b-text); }
.btab[aria-selected="true"] { color: var(--b-text); }
/* the active tab's line: the bright gradient, with no words on it */
.btab::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--grad-brand); transform: scaleX(0); transition: transform .28s var(--ease-out); }
.btab[aria-selected="true"]::after { transform: scaleX(1); }
.btab:focus-visible { outline-offset: -4px; border-radius: 8px; }

.btabpanel { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--b-line) transparent; }
.btabpanel:focus-visible { outline: none; }
.btabpanel[inert] { opacity: .55; }

.bsection { padding: 18px 16px; border-bottom: 1px solid var(--b-line); }
.bsection:last-child { border-bottom: 0; }
.bsection__title { font-size: .9375rem; font-weight: 700; }
.bsection__lead { margin-top: 4px; color: var(--b-text-2); font-size: .8125rem; }
.bsection__title + .bpresets, .bsection__title + .bcolors, .bsection__title + .bpairs, .bsection__lead + .bgallery,
.bsection__lead + .bbasics, .bsection__lead + .bpagelist, .bsection__title + .brange { margin-top: 12px; }
.bempty { color: var(--b-text-2); font-size: .8125rem; }

/* ---------- fields ---------- */
.blabel { display: block; font-family: var(--font-display); font-size: .8125rem; font-weight: 600; color: var(--b-text); margin-bottom: 6px; }
.binput {
  width: 100%; min-height: 40px; padding: 9px 12px;
  background: var(--b-bg); color: var(--b-text);
  border: 1px solid var(--b-control); border-radius: var(--b-r-input);
  font-size: .875rem; line-height: 1.45;
  transition: border-color var(--b-fast) var(--ease), box-shadow var(--b-fast) var(--ease);
}
.binput::placeholder { color: var(--b-text-2); opacity: 1; }
.binput:hover { border-color: var(--b-text-2); }
.binput:focus-visible { outline: 2px solid var(--b-focus); outline-offset: 1px; border-color: var(--b-focus); }
.binput[aria-invalid="true"] { border-color: var(--b-err); }
textarea.binput { resize: vertical; min-height: 76px; }
.bfieldrow + .bfieldrow { margin-top: 14px; }
.bstatus { min-height: 1.3em; font-size: .8125rem; color: var(--b-text-2); }
.bstatus:empty { min-height: 0; }
.bstatus.is-error { color: var(--b-err); font-weight: 500; }
.bstatus.is-ok { color: var(--b-ok); font-weight: 500; }

/* a switch made of a real checkbox */
.bswitch-row { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; }
.bswitch-row__text { display: grid; gap: 2px; }
.bswitch-row__label { font-family: var(--font-display); font-weight: 700; font-size: .9375rem; }
.bswitch-row__hint { color: var(--b-text-2); font-size: .8125rem; }
.bswitch-row__input { position: absolute; right: 0; top: 50%; width: 44px; height: 26px; margin: -13px 0 0; opacity: 0; cursor: pointer; }
.bswitch-row__track { position: relative; flex: none; width: 44px; height: 26px; border-radius: 999px; background: var(--b-bg); border: 1.5px solid var(--b-control); transition: background-color var(--b-fast) var(--ease), border-color var(--b-fast) var(--ease); }
.bswitch-row__track::after { content: ""; position: absolute; top: 3.5px; left: 4px; width: 16px; height: 16px; border-radius: 50%; background: var(--b-text-2); transition: transform .22s var(--ease-out), background-color var(--b-fast) var(--ease); }
.bswitch-row__input:checked + .bswitch-row__track { background: var(--b-focus); border-color: var(--b-focus); }
.bswitch-row__input:checked + .bswitch-row__track::after { transform: translateX(17px); background: #FFFFFF; }
.bswitch-row__input:focus-visible + .bswitch-row__track { outline: 2px solid var(--b-focus); outline-offset: 2px; }

/* a check box made of a real checkbox */
.bcheck { position: relative; display: flex; align-items: flex-start; gap: 10px; margin-top: 16px; padding: 12px 14px; border-radius: var(--b-r-input); background: var(--b-card); border: 1px solid var(--b-line); cursor: pointer; }
.bcheck__input { position: absolute; left: 14px; top: 13px; width: 18px; height: 18px; margin: 0; opacity: 0; cursor: pointer; }
.bcheck__box { flex: none; width: 18px; height: 18px; margin-top: 1px; border-radius: 5px; border: 1.5px solid var(--b-control); background: var(--b-bg); display: grid; place-items: center; }
.bcheck__input:checked + .bcheck__box { background: var(--b-focus); border-color: var(--b-focus); }
.bcheck__input:checked + .bcheck__box::after { content: ""; width: 9px; height: 5px; border-left: 2px solid #FFFFFF; border-bottom: 2px solid #FFFFFF; transform: translateY(-1px) rotate(-45deg); }
.bcheck__input:focus-visible + .bcheck__box { outline: 2px solid var(--b-focus); outline-offset: 2px; }
.bcheck__input:disabled ~ * { opacity: .5; }
.bcheck__text { font-weight: 500; }

/* ============================================================
   CHAT
   ============================================================ */
.bchat { display: flex; flex-direction: column; overflow: hidden; }
.bchat__log { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 20px 16px 12px; display: flex; flex-direction: column; gap: 16px; scrollbar-width: thin; scrollbar-color: var(--b-line) transparent; }

.bwelcome { margin: auto 0; padding: 12px 4px 4px; text-align: left; }
.bwelcome__orb {
  display: block; width: 44px; height: 44px; border-radius: 50%; margin-bottom: 18px;
  background: conic-gradient(from 210deg, var(--brand-1), var(--brand-2), var(--brand-3), var(--brand-4), var(--brand-1));
  box-shadow: 0 0 0 6px rgba(123, 63, 228, .14), 0 14px 40px -10px rgba(224, 53, 158, .55);
  animation: b-spin 9s linear infinite;
}
@keyframes b-spin { to { transform: rotate(360deg); } }
.bwelcome__title { font-size: 1.375rem; font-weight: 700; letter-spacing: -.02em; }
.bwelcome__text { margin-top: 6px; color: var(--b-text-2); font-size: .9375rem; }
.bwelcome__chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.bchip {
  padding: 8px 12px; border-radius: 999px; border: 1px solid var(--b-line); background: var(--b-card); color: var(--b-text);
  font-size: .8125rem; font-weight: 500; line-height: 1.3; text-align: left; cursor: pointer;
  transition: border-color var(--b-fast) var(--ease), background-color var(--b-fast) var(--ease), transform var(--b-fast) var(--ease);
}
.bchip:hover { border-color: var(--b-control); background: var(--b-hover); transform: translateY(-1px); }
.bchip:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.bmsg { max-width: 100%; animation: b-rise .32s var(--ease-out) both; }
@keyframes b-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.bmsg__text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .875rem; line-height: 1.6; }
.bmsg--user { align-self: flex-end; max-width: 88%; padding: 10px 14px; border-radius: 16px 16px 4px 16px; background: var(--b-card); border: 1px solid var(--b-line); }
.bmsg--ai { align-self: stretch; padding-left: 14px; border-left: 2px solid transparent; border-image: var(--grad-brand) 1; }
.bmsg--ai.is-error { border-image: none; border-left-color: var(--b-err); }
.bmsg--ai.is-error .bmsg__text { color: var(--b-err-soft); }

.btyping { display: inline-flex; gap: 4px; padding: 6px 0; }
.btyping i { width: 6px; height: 6px; border-radius: 50%; background: var(--b-text-2); animation: b-dot 1.2s var(--ease-in-out) infinite; }
.btyping i:nth-child(2) { animation-delay: .15s; }
.btyping i:nth-child(3) { animation-delay: .3s; }
@keyframes b-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.bmsg__chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.bchange {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--b-line); background: var(--b-card); color: var(--b-text);
  font-size: .75rem; font-weight: 600; line-height: 1.2; cursor: pointer;
  transition: border-color var(--b-fast) var(--ease), background-color var(--b-fast) var(--ease);
}
.bchange:hover { border-color: var(--b-control); background: var(--b-hover); }
.bchange__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--grad-brand); }
.bchange--more { cursor: default; color: var(--b-text-2); background: transparent; border-color: transparent; }
.bphoto {
  display: grid; gap: 2px; width: 100%; padding: 10px 12px; border-radius: var(--b-r-input); text-align: left; cursor: pointer;
  border: 1px solid transparent; color: var(--b-text);
  background: linear-gradient(var(--b-card), var(--b-card)) padding-box, var(--grad-brand) border-box;
  transition: filter var(--b-fast) var(--ease);
}
.bphoto:hover { filter: brightness(1.12); }
.bphoto__label { font-family: var(--font-display); font-weight: 700; font-size: .8125rem; }
.bphoto__what { color: var(--b-text-2); font-size: .75rem; overflow-wrap: anywhere; }
.bphoto.is-working { cursor: progress; }
.bphoto.is-done { cursor: default; background: var(--b-ok-bg); border-color: transparent; color: var(--b-ok); font-weight: 600; font-size: .8125rem; }
.bphoto:disabled:not(.is-working) { opacity: .6; cursor: not-allowed; }

/* ---------- the composer ---------- */
.bcomposer {
  position: relative; flex: none; margin: 4px 12px 12px; border-radius: 14px;
  background: var(--b-card); border: 1px solid var(--b-control);
  transition: border-color var(--b-fast) var(--ease), box-shadow var(--b-fast) var(--ease);
}
.bcomposer:focus-within { border-color: var(--b-focus); box-shadow: 0 0 0 3px rgba(46, 125, 246, .22); }
.bcomposer__shimmer { position: absolute; left: 14px; right: 14px; top: -1px; height: 2px; border-radius: 2px; opacity: 0; transition: opacity .3s var(--ease); }
.bcomposer.is-working .bcomposer__shimmer { opacity: 1; }
.bcomposer__input {
  display: block; width: 100%; min-height: 48px; max-height: 200px; padding: 13px 14px 4px;
  border: 0; background: transparent; color: var(--b-text); resize: none; font-size: .9375rem; line-height: 1.5;
}
.bcomposer__input::placeholder { color: var(--b-text-2); opacity: 1; }
.bcomposer__input:focus-visible { outline: none; }
.bcomposer__input:disabled { cursor: not-allowed; }
.bcomposer__row { display: flex; align-items: center; gap: 8px; padding: 6px 8px 8px 10px; }
.bcomposer__credits { margin-left: auto; color: var(--b-text-2); font-size: .75rem; white-space: nowrap; }
.bcomposer__note { padding: 0 14px 12px; color: var(--b-text-2); font-size: .8125rem; }

.bturbo { display: inline-flex; align-items: center; gap: 8px; padding: 4px 6px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; color: var(--b-text); }
.bturbo:hover { background: var(--b-hover); }
.bturbo:disabled { opacity: .5; cursor: not-allowed; background: transparent; }
.bturbo__track { position: relative; width: 30px; height: 18px; border-radius: 999px; border: 1.5px solid var(--b-control); background: var(--b-bg); transition: background-color var(--b-fast) var(--ease), border-color var(--b-fast) var(--ease); }
.bturbo__thumb { position: absolute; top: 2.5px; left: 3px; width: 10px; height: 10px; border-radius: 50%; background: var(--b-text-2); transition: transform .22s var(--ease-out), background-color var(--b-fast) var(--ease); }
.bturbo[aria-checked="true"] .bturbo__track { background: var(--grad-brand); border-color: transparent; }
.bturbo[aria-checked="true"] .bturbo__thumb { transform: translateX(12px); background: #FFFFFF; }
.bturbo__label { font-family: var(--font-display); font-weight: 700; font-size: .8125rem; }
.bturbo__cost { color: var(--b-text-2); font-size: .75rem; }

/* the send button: the bright gradient, an arrow and no words */
.bsend {
  display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%;
  background: var(--grad-brand); color: #FFFFFF; cursor: pointer;
  box-shadow: 0 8px 22px -8px rgba(224, 53, 158, .65);
  transition: transform var(--b-fast) var(--ease), filter var(--b-fast) var(--ease);
}
.bsend:hover { transform: translateY(-1px); filter: brightness(1.08); }
.bsend:disabled { opacity: .45; cursor: not-allowed; transform: none; filter: none; }

/* ============================================================
   EDIT
   ============================================================ */
.bfield__where { font-size: .75rem; color: var(--b-text-2); margin-bottom: 10px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.bfield__text { min-height: 96px; }
.bfield__count { margin-top: 6px; font-size: .75rem; color: var(--b-text-2); text-align: right; }
.bfield__count.is-full { color: var(--b-warn); }
.bfield__thumb { margin: 4px 0 12px; border-radius: var(--b-r-input); overflow: hidden; background: var(--b-bg); border: 1px solid var(--b-line); aspect-ratio: 16 / 10; }
.bfield__thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ============================================================
   DESIGN
   ============================================================ */
.bdesign.is-locked { pointer-events: none; }
.bpresets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.bpreset {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 10px; text-align: left; cursor: pointer;
  border-radius: var(--b-r-input); border: 1px solid var(--b-line); background: var(--b-card); color: var(--b-text);
  transition: border-color var(--b-fast) var(--ease), background-color var(--b-fast) var(--ease);
}
.bpreset:hover { border-color: var(--b-control); }
.bpreset[aria-pressed="true"] { border-color: transparent; background: linear-gradient(var(--b-card), var(--b-card)) padding-box, var(--grad-brand) border-box; }
.bpreset__dots { display: inline-flex; flex: none; }
.bpreset__dot { width: 14px; height: 14px; border-radius: 50%; background: var(--swatch, #888888); box-shadow: 0 0 0 1.5px var(--b-card); }
.bpreset__dot + .bpreset__dot { margin-left: -4px; }
.bpreset__name { font-size: .8125rem; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.bcolors { display: grid; gap: 8px; }
.bcolor { display: grid; grid-template-columns: minmax(0, 1fr) 36px 96px; align-items: center; gap: 8px; }
.bcolor__label { font-size: .8125rem; color: var(--b-text); }
.bcolor__swatch { position: relative; width: 36px; height: 36px; border-radius: var(--b-r-input); overflow: hidden; border: 1px solid var(--b-control); }
.bcolor__pick { position: absolute; inset: -8px; width: calc(100% + 16px); height: calc(100% + 16px); padding: 0; border: 0; cursor: pointer; background: transparent; }
.bcolor__swatch:focus-within { outline: 2px solid var(--b-focus); outline-offset: 2px; }
.bcolor__hex { min-height: 36px; padding: 6px 10px; font-family: var(--font-mono); font-size: .8125rem; text-transform: lowercase; }

.bpairs { display: grid; gap: 8px; }
.bpair {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; text-align: left; cursor: pointer;
  border-radius: var(--b-r-input); border: 1px solid var(--b-line); background: var(--b-card); color: var(--b-text);
  transition: border-color var(--b-fast) var(--ease);
}
.bpair:hover { border-color: var(--b-control); }
.bpair[aria-checked="true"] { border-color: transparent; background: linear-gradient(var(--b-card), var(--b-card)) padding-box, var(--grad-brand) border-box; }
.bpair__sample { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 8px; background: var(--b-bg); font-family: var(--pair-font, inherit); font-size: 1.125rem; font-weight: 700; }
.bpair__text { display: grid; gap: 1px; }
.bpair__name { font-family: var(--font-display); font-weight: 700; font-size: .875rem; }
.bpair__fonts { font-family: var(--pair-font, inherit); font-size: .8125rem; color: var(--b-text-2); }

.brange { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 12px; }
.brange .blabel { grid-column: 1 / -1; margin: 0; }
.brange__input { width: 100%; accent-color: var(--b-focus); height: 28px; cursor: pointer; }
.brange__value { min-width: 44px; text-align: right; font-variant-numeric: tabular-nums; color: var(--b-text-2); font-size: .8125rem; }

.bgallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.btpl {
  display: flex; flex-direction: column; padding: 0; overflow: hidden; text-align: left; cursor: pointer;
  border-radius: var(--b-r-card); border: 1px solid var(--b-line); background: var(--b-card); color: var(--b-text);
  transition: border-color var(--b-fast) var(--ease), transform var(--b-fast) var(--ease), box-shadow var(--b-fast) var(--ease);
}
.btpl:hover:not(:disabled) { border-color: var(--b-control); transform: translateY(-2px); box-shadow: 0 14px 30px -16px rgba(0, 0, 0, .8); }
.btpl.is-current { border-color: transparent; background: linear-gradient(var(--b-card), var(--b-card)) padding-box, var(--grad-brand) border-box; cursor: default; }
.btpl__thumb {
  display: block; aspect-ratio: 16 / 10;
  background:
    radial-gradient(120% 120% at 18% 12%, var(--thumb-m1, #5B8DEF) 0%, transparent 60%),
    radial-gradient(120% 120% at 88% 92%, var(--thumb-m2, #8B5CF6) 0%, transparent 55%),
    var(--thumb-bg, #0C1230);
}
.btpl__meta { display: grid; gap: 1px; padding: 8px 10px 10px; }
.btpl__name { font-family: var(--font-display); font-weight: 700; font-size: .8125rem; }
.btpl__cat { font-size: .6875rem; color: var(--b-text-2); }

/* ============================================================
   PAGES
   ============================================================ */
.bpagelist { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 4px; }
.bpage {
  position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%;
  min-height: 46px; padding: 10px 14px; border: 0; border-radius: var(--b-r-input); background: transparent; color: var(--b-text);
  text-align: left; cursor: pointer; transition: background-color var(--b-fast) var(--ease);
}
.bpage:hover { background: var(--b-hover); }
.bpage[aria-current="page"] { background: var(--b-card); }
.bpage[aria-current="page"]::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--grad-brand); }
.bpage__name { font-weight: 600; }
.bpage__path { font-family: var(--font-mono); font-size: .75rem; color: var(--b-text-2); }

/* ============================================================
   THE CANVAS AND THE DEVICE
   ============================================================ */
.bcanvas {
  position: relative; min-width: 0; min-height: 0; overflow: hidden;
  background-color: var(--b-canvas);
  background-image: radial-gradient(circle at center, rgba(10, 14, 39, .11) 1px, transparent 1.4px);
  background-size: 18px 18px;
}
.bstage { position: absolute; inset: 0; }
.bdevice {
  position: absolute; left: 24px; top: 24px; transform-origin: 0 0;
  display: flex; flex-direction: column; overflow: hidden;
  background: #FFFFFF; border-radius: 12px;
  box-shadow: 0 0 0 1px rgba(10, 14, 39, .08), 0 34px 80px -34px rgba(10, 14, 39, .45), 0 12px 24px -16px rgba(10, 14, 39, .25);
  transition: width .38s var(--ease-out), height .38s var(--ease-out), left .38s var(--ease-out), top .38s var(--ease-out), transform .38s var(--ease-out), border-radius .38s var(--ease-out), padding .38s var(--ease-out);
}
.bdevice__bar { display: flex; align-items: center; gap: 12px; flex: none; height: 36px; padding: 0 14px; background: #F4F5FA; border-bottom: 1px solid #E3E6F0; }
.bdevice__dots { display: inline-flex; gap: 6px; }
.bdevice__dots i { width: 10px; height: 10px; border-radius: 50%; background: #D3D7E3; }
.bdevice__address {
  flex: 0 1 420px; min-width: 0; margin: 0 auto; padding: 4px 12px; border-radius: 999px; background: #E3E6F0; color: #4A5072;
  font-size: .75rem; font-weight: 500; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bdevice__screen { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; background: #FFFFFF; }
.bdevice__frame { display: block; width: 100%; height: 100%; border: 0; background: #FFFFFF; }

.bdevice[data-device="tablet"], .bdevice[data-device="phone"] { padding: 12px; background: #0A0E27; box-shadow: 0 0 0 1px rgba(10, 14, 39, .2), 0 40px 90px -36px rgba(10, 14, 39, .6), inset 0 0 0 1px rgba(255, 255, 255, .06); }
.bdevice[data-device="tablet"] { border-radius: 30px; }
.bdevice[data-device="phone"] { border-radius: 46px; }
.bdevice[data-device="tablet"] .bdevice__bar, .bdevice[data-device="phone"] .bdevice__bar, .bdevice[data-device="fit"] .bdevice__bar { display: none; }
.bdevice[data-device="tablet"] .bdevice__screen { border-radius: 20px; }
.bdevice[data-device="phone"] .bdevice__screen { border-radius: 36px; }
.bdevice[data-device="fit"] { border-radius: 0; box-shadow: none; transition: none; }

/* while the AI works: the canvas waits, and says why */
.bworking { position: absolute; inset: 0; z-index: 5; display: grid; place-items: end center; padding-bottom: 28px; cursor: progress; }
.bworking__pill {
  display: inline-flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 999px;
  background: rgba(10, 14, 39, .92); color: #FFFFFF; font-family: var(--font-display); font-weight: 600; font-size: .8125rem;
  box-shadow: 0 16px 40px -14px rgba(10, 14, 39, .7);
  animation: b-rise .3s var(--ease-out) both;
}
.bworking__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--grad-brand); animation: b-pulse 1.2s var(--ease-in-out) infinite; }
@keyframes b-pulse { 0%, 100% { transform: scale(.8); box-shadow: 0 0 0 0 rgba(224, 53, 158, .5); } 50% { transform: scale(1); box-shadow: 0 0 0 6px rgba(224, 53, 158, 0); } }
.bcanvas.is-busy .bdevice { box-shadow: 0 0 0 2px rgba(123, 63, 228, .45), 0 34px 80px -34px rgba(10, 14, 39, .45); }

/* ============================================================
   DIALOGS AND TOASTS: portal.js's own markup, in the dark chrome
   ============================================================ */
.pdialog {
  width: min(520px, calc(100% - 32px)); max-height: min(88vh, 860px); margin: auto; padding: 0;
  border: 1px solid var(--b-line); border-radius: 16px; background: var(--b-panel); color: var(--b-text);
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .85); overflow: hidden;
}
.pdialog[open] { display: flex; flex-direction: column; animation: b-dialog .24s var(--ease-out); }
.pdialog::backdrop { background: rgba(4, 6, 20, .66); backdrop-filter: blur(2px); }
.pdialog--wide { width: min(760px, calc(100% - 32px)); }
@keyframes b-dialog { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }
.pdialog__box { display: flex; flex-direction: column; min-height: 0; max-height: inherit; flex: 1 1 auto; }
.pdialog__head { display: flex; align-items: flex-start; gap: 16px; padding: 22px 22px 14px; }
.pdialog__head > div { min-width: 0; flex: 1 1 auto; }
.pdialog__title { font-size: 1.1875rem; font-weight: 700; }
.pdialog__lead { margin-top: 6px; color: var(--b-text-2); font-size: .875rem; }
.pdialog__close { display: inline-grid; place-items: center; width: 36px; height: 36px; margin: -6px -8px 0 0; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--b-text-2); cursor: pointer; flex: none; }
.pdialog__close:hover { background: var(--b-card); color: var(--b-text); }
.pdialog__body { padding: 0 22px 22px; overflow-y: auto; min-height: 0; flex: 1 1 auto; }
.pdialog__body > * + * { margin-top: 12px; }
.pdialog__foot { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--b-line); background: var(--b-bg); }
.pdialog__foot .bstatus { margin-right: auto; }
.ptext { color: var(--b-text-2); font-size: .875rem; }
.pfield { display: grid; gap: 6px; }
.plabel { font-family: var(--font-display); font-size: .8125rem; font-weight: 600; }
.pinput { width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--b-control); border-radius: var(--b-r-input); background: var(--b-bg); color: var(--b-text); }
.pinput:focus-visible { outline: 2px solid var(--b-focus); outline-offset: 1px; }
.pbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px;
  border: 1px solid transparent; border-radius: var(--b-r-input); font-family: var(--font-display); font-weight: 600; font-size: .875rem; cursor: pointer;
  transition: background-color var(--b-fast) var(--ease), filter var(--b-fast) var(--ease);
}
.pbtn--primary { background: var(--grad-brand-deep); color: #FFFFFF; }
.pbtn--primary:hover { filter: brightness(.92); }
.pbtn--secondary { background: var(--b-card); border-color: var(--b-line); color: var(--b-text); }
.pbtn--secondary:hover { background: var(--b-hover); }
.pbtn--danger { background: #B42318; color: #FFFFFF; }
.pbtn--danger:hover { background: #961C13; }
.pbtn[disabled] { opacity: .55; cursor: not-allowed; }

.ptoasts { position: fixed; left: 50%; bottom: 24px; z-index: 700; transform: translateX(-50%); display: grid; gap: 8px; justify-items: center; width: min(480px, calc(100% - 32px)); pointer-events: none; }
.ptoast {
  display: flex; align-items: center; gap: 10px; max-width: 100%; padding: 12px 16px; border-radius: var(--b-r-input);
  background: var(--b-card); border: 1px solid var(--b-line); color: var(--b-text); box-shadow: 0 20px 40px -14px rgba(0, 0, 0, .8);
  font-size: .875rem; font-weight: 500; line-height: 1.4; overflow-wrap: anywhere; pointer-events: auto;
  transition: opacity .2s var(--ease), transform .24s var(--ease-out);
}
@starting-style { .ptoast { opacity: 0; transform: translateY(10px); } }
.ptoast.is-leaving { opacity: 0; transform: translateY(6px); }
.ptoast svg { width: 18px; height: 18px; color: var(--b-ok); }
.ptoast--error { background: var(--b-err-bg); border-color: #6B2A33; color: var(--b-err-soft); }
.ptoast--error svg { color: var(--b-err); }

/* history */
.bversions { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.bversion { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; padding: 12px 14px; border-radius: var(--b-r-input); border: 1px solid var(--b-line); background: var(--b-card); }
.bversion.is-current { background: linear-gradient(var(--b-card), var(--b-card)) padding-box, var(--grad-brand) border-box; border-color: transparent; }
.bversion__main { display: grid; gap: 2px; flex: 1 1 16rem; min-width: 0; }
.bversion__when { font-weight: 600; }
.bversion__what { overflow-wrap: anywhere; }
.bversion__who { color: var(--b-text-2); font-size: .75rem; }

/* photos */
.bmedia__bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; }
.bmedia { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr)); gap: 10px; }
.bmedia__item { position: relative; }
.bmedia__pick { display: block; width: 100%; aspect-ratio: 4 / 3; padding: 0; border-radius: var(--b-r-input); overflow: hidden; cursor: pointer; border: 1px solid var(--b-line); background: var(--b-bg); transition: transform var(--b-fast) var(--ease), border-color var(--b-fast) var(--ease); }
.bmedia__pick:hover { transform: translateY(-2px); border-color: var(--b-control); }
.bmedia__pick img { width: 100%; height: 100%; object-fit: cover; }
.bmedia__item.is-current .bmedia__pick { border-color: transparent; box-shadow: 0 0 0 2px var(--b-focus); }
.bmedia__tag { position: absolute; left: 6px; top: 6px; padding: 3px 8px; border-radius: 999px; background: rgba(10, 14, 39, .9); color: #FFFFFF; font-size: .6875rem; font-weight: 600; pointer-events: none; }

/* ============================================================
   NARROWER DESKTOPS: History and View site keep their place as icons
   ============================================================ */
@media (max-width: 1239.98px) {
  .bbar__label { display: none; }
  .bbar__wide { width: 34px; padding: 0; }
  .bselect__input { min-width: 112px; }
}
@media (max-width: 1059.98px) {
  .bbar__saved { display: none; }
}

/* ============================================================
   PHONES AND SMALL TABLETS (under 900px): one column at a time
   ============================================================ */
@media (max-width: 899.98px) {
  .bld { grid-template-rows: var(--b-bar-h) var(--b-switch-h) minmax(0, 1fr); }
  .bbar { grid-template-columns: minmax(0, 1fr) auto; gap: 6px; padding: 0 8px; }
  .bbar__center { display: none; }
  .bbar__right { gap: 2px; }
  .bbar__right .bpublish { margin-left: 4px; }
  .bswitch { display: flex; align-items: center; justify-content: center; padding: 6px 12px; background: var(--b-bg); border-bottom: 1px solid var(--b-line); }
  .bswitch { gap: 2px; }
  .bswitch__btn {
    flex: 1 1 0; max-width: 180px; height: 34px; border: 1px solid var(--b-line); background: var(--b-panel); color: var(--b-text-2);
    font-family: var(--font-display); font-weight: 600; cursor: pointer;
  }
  .bswitch__btn:first-child { border-radius: var(--b-r-input) 0 0 var(--b-r-input); }
  .bswitch__btn:last-child { border-radius: 0 var(--b-r-input) var(--b-r-input) 0; }
  .bswitch__btn[aria-pressed="true"] { background: var(--b-card); color: var(--b-text); border-color: var(--b-control); }
  .bmain { grid-template-columns: minmax(0, 1fr); }
  .bresize { display: none; }
  .bmain[data-view="panel"] .bcanvas { display: none; }
  .bmain[data-view="preview"] .bpanel { display: none; }
  .bgallery, .bpresets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 479.98px) {
  .bbar__name { display: none; }
  .bicon { width: 32px; }
  .bbar__wide { width: 32px; }
  .bbtn--sm { padding: 0 10px; }
  .bcolor { grid-template-columns: minmax(0, 1fr) 36px 88px; }
  /* the pill beside the name already says Published; the button keeps its icons and its name */
  .bpublish__word { display: none; }
}

/* ============================================================
   REDUCED MOTION: everything still, nothing slides
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important; scroll-behavior: auto !important; }
  .bshimmer, .bcomposer__shimmer { animation: none; background-position: 0 0; }
  .bwelcome__orb, .bboot__mark, .bworking__dot, .btyping i { animation: none; }
  .btyping i { opacity: .7; }
}
