/* Web Design Studio (/website-builder). It wears Video Studio's frame and
   panels (video-studio.css): menus and Export along the top, then the page
   and screen size, then the library, the page in its frame and the settings
   in a row. On a phone the library and the settings become sheets opened
   from tabs. The page itself is the person's own design, drawn in a frame
   on a dark stage; only the editor's marks are purple and gold. */

/* ---- Start screen ---- */
.wd-new .st-new-row + .st-new-row { margin-top: 14px; }
.wd-new .st-new-row > .st-field { flex: 0 0 auto; }
.wd-new .st-new-row > .wd-new-namefield { flex: 1 1 220px; }
.wd-new .st-new-row > .wd-new-wide { flex: 1 1 100%; }
.wd-new .seg { flex-wrap: wrap; }
.wd-new-palettes, .wd-palettes { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.wd-new-pal, .wd-palette { display: flex; flex-direction: column; gap: 4px; padding: 6px; color: var(--muted); background: var(--surface-2); border: 2px solid var(--edge); font: inherit; font-size: 0.72rem; text-align: left; cursor: pointer; transition: transform 160ms var(--spring, ease), box-shadow 160ms ease, border-color 140ms ease; }
.wd-new-pal.is-active { color: var(--text); background: var(--tint); border-color: var(--accent-strong); }
.wd-palette-sw { display: flex; height: 22px; border: 1px solid var(--edge); }
.wd-palette-sw i { flex: 1 1 0; }

/* ---- The frame ---- */
.wd-work { grid-template-rows: auto auto minmax(0, 1fr); }
.wd-body { grid-template-columns: 290px minmax(0, 1fr) 310px; }
.wd-bar { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 4px 8px; background: var(--surface); border-bottom: 1px solid var(--border); }
.wd-page-sel { width: auto; min-width: 120px; max-width: 200px; flex: none; }
.wd-bp { flex: none; margin: 0; }
.wd-bp .seg-btn { display: inline-flex; align-items: center; gap: 6px; }
.wd-zoom { width: auto; flex: none; }
.wd-msg { flex: 1 1 auto; }
.wd-bar-end { display: flex; gap: 6px; flex: none; margin-left: auto; }
.wd-mode-btn { display: inline-flex; align-items: center; gap: 6px; }
.wd-mode-btn.is-on { color: var(--tint-text); background: var(--tint); border-color: var(--tint-border); }
.wd-menu { max-height: 72vh; overflow-y: auto; scrollbar-width: thin; }
.wd-menu-sep { height: 1px; margin: 4px 6px; background: var(--border); }

/* ---- The stage and the page ---- */
.wd-stage { position: relative; display: grid; place-items: start center; min-width: 0; min-height: 0; padding: 12px 16px; overflow: auto; background: #0b0914; background-image: radial-gradient(rgb(255 255 255 / .05) 1px, transparent 1px); background-size: 18px 18px; scrollbar-width: thin; }
.wd-frame-box { position: relative; flex: none; overflow: hidden; background: #fff; box-shadow: 0 0 0 2px var(--edge), 6px 6px 0 var(--edge); }
.wd-frame { position: absolute; left: 0; top: 0; display: block; border: 0; background: #fff; transform-origin: 0 0; }
.wd-preview { z-index: 2; }
.wd-app:not(.is-preview) .wd-preview { display: none; }
.wd-app.is-preview .wd-frame-box { box-shadow: 0 0 0 2px var(--gold), 6px 6px 0 var(--edge); }
.wd-code { position: absolute; inset: 0; z-index: 3; display: grid; grid-template-rows: auto minmax(0, 1fr); background: #0d0a17; }
.wd-code[hidden] { display: none; }
.wd-code-bar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--surface); border-bottom: 1px solid var(--border); }
.wd-code-bar .seg { margin: 0; }
.wd-code-name { flex: 1 1 auto; color: var(--muted); font-family: var(--mono); font-size: 0.72rem; }
.wd-code-pre { margin: 0; padding: 14px 16px 40px; overflow: auto; color: #e6e1f5; font: 12.5px/1.55 var(--mono); tab-size: 2; white-space: pre; -webkit-user-select: text; user-select: text; scrollbar-width: thin; }
.wd-k-kw { color: #c792ea; }
.wd-k-str { color: #c3e88d; }
.wd-k-com { color: #7f7a99; font-style: italic; }
.wd-k-num, .wd-k-const { color: #f78c6c; }
.wd-k-fn { color: #82aaff; }
.wd-k-type { color: #ffcb6b; }
.wd-k-tag { color: #f07178; }
.wd-k-attr { color: #ffcb6b; }
.wd-k-var { color: #89ddff; }
.wd-k-punc { color: #9a93b8; }

/* A tile being dragged onto the page. */
.wd-ghost { position: fixed; left: 0; top: 0; z-index: 1000; width: 84px; pointer-events: none; opacity: 0.92; box-shadow: var(--hard-lift, 4px 4px 0 var(--edge)); }

/* ---- Library ---- */
.wd-lib-body { padding-bottom: 28px; }
.wd-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-bottom: 4px; }
.wd-sec-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.wd-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; min-height: 64px; padding: 8px 4px 7px; color: var(--muted); background: var(--surface-2); border: 2px solid var(--edge); font: inherit; font-size: 0.7rem; line-height: 1.2; text-align: center; cursor: grab; touch-action: none; transition: transform 160ms var(--spring, ease), box-shadow 160ms ease, color 140ms ease; }
.wd-tile svg { color: var(--text); }
.wd-tile.is-section { flex-direction: row; justify-content: flex-start; min-height: 44px; padding: 8px 10px; font-size: 0.76rem; text-align: left; }
.wd-tile.is-comp { flex: 1 1 auto; flex-direction: row; justify-content: flex-start; min-height: 40px; padding: 6px 10px; }
.wd-tile.is-comp svg { color: #f472b6; }
.wd-tile:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.wd-comp-row { display: flex; align-items: center; gap: 4px; margin-bottom: 6px; }

.wd-tree { display: flex; flex-direction: column; gap: 1px; margin-bottom: 10px; }
.wd-layer { position: relative; display: flex; align-items: center; gap: 5px; padding: 4px 6px 4px calc(4px + var(--d, 0) * 14px); color: var(--muted); font-size: 0.78rem; cursor: pointer; -webkit-user-select: none; user-select: none; }
.wd-layer:hover { color: var(--text); background: rgb(255 255 255 / .04); }
.wd-layer.is-on { color: var(--text); background: var(--tint); }
.wd-layer.is-hidden .wd-layer-name { opacity: 0.5; }
.wd-layer[data-drop="before"] { box-shadow: inset 0 2px 0 var(--gold); }
.wd-layer[data-drop="after"] { box-shadow: inset 0 -2px 0 var(--gold); }
.wd-layer[data-drop="in"] { box-shadow: inset 0 0 0 2px var(--gold); }
.wd-caret, .wd-caret-gap { display: grid; place-items: center; flex: none; width: 16px; height: 16px; padding: 0; color: var(--muted); background: none; border: 0; cursor: pointer; }
.wd-caret svg { transition: transform 140ms ease; }
.wd-caret.is-open svg { transform: rotate(90deg); }
.wd-layer-icon { display: grid; place-items: center; flex: none; color: var(--accent-strong); }
.wd-layer-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wd-layer-tag { flex: none; color: var(--faint); font-family: var(--mono); font-size: 0.6rem; text-transform: uppercase; }

.wd-pages { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.wd-page-row { display: flex; align-items: center; gap: 8px; padding: 7px 6px 7px 9px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); cursor: pointer; }
.wd-page-row.is-on { color: var(--text); background: var(--tint); border-color: var(--tint-border); }
.wd-page-name { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
.wd-page-name b { overflow: hidden; color: var(--text); font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.wd-page-name small { color: var(--faint); font-family: var(--mono); font-size: 0.64rem; }
.wd-page-btns { display: flex; flex: none; }
.wd-page-btns .vs-ib { width: 24px; height: 24px; }
.wd-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.vs-chip.is-on { color: var(--tint-text); background: var(--tint); border-color: var(--tint-border); }
.wd-chips .vs-chip .vs-ib { width: 20px; height: 20px; }

.wd-hex { margin-left: auto; color: var(--faint); font-family: var(--mono); font-size: 0.7rem; }
.wd-ts { display: grid; grid-template-columns: minmax(0, 1fr) 56px 60px 58px; align-items: center; gap: 5px 6px; margin-bottom: 4px; }
.wd-ts small { color: var(--faint); font-family: var(--mono); font-size: 0.6rem; text-transform: uppercase; }
.wd-ts-name { color: var(--muted); font-size: 0.76rem; }
.wd-ts .vs-num { width: 100%; padding: 5px 6px; }
.wd-range-out { flex: none; min-width: 46px; color: var(--muted); font-family: var(--mono); font-size: 0.7rem; text-align: right; }
.wd-fav { display: flex; align-items: center; gap: 8px; }
.wd-fav img { width: 32px; height: 32px; object-fit: contain; background: #fff; border: 1px solid var(--border); }
.wd-fav > span { color: var(--faint); font-size: 0.76rem; }

.wd-media .vs-tile-pic img { width: 100%; height: 100%; object-fit: contain; background: repeating-conic-gradient(#d8d4e4 0 25%, #fff 0 50%) 0 0 / 12px 12px; }
.wd-media-tile { cursor: default; }
.wd-media-kind { color: var(--muted); font-family: var(--mono); font-size: 0.7rem; text-transform: uppercase; }
.wd-media-btns { position: absolute; top: 4px; right: 4px; display: flex; gap: 2px; }
.wd-media-btns .vs-ib { width: 24px; height: 24px; color: #fff; background: rgb(8 6 16 / .72); }

/* ---- Settings ---- */
.wd-name { width: 100%; margin: 2px 0 6px; font-weight: 600; }
.wd-bp-note { margin-top: 4px; }
.wd-in { width: 100%; min-width: 0; padding: 6px 9px; font-size: 0.8rem; }
.vs-field .wd-in { flex: 1 1 auto; }
.wd-sel { flex: 1 1 auto; min-width: 0; }
.wd-area { min-height: 0; font-size: 0.8rem; }
.wd-area.is-code { font-family: var(--mono); font-size: 0.74rem; line-height: 1.45; white-space: pre; tab-size: 2; }
.wd-seg { flex-wrap: wrap; }
.wd-seg .seg-btn { flex: 1 1 auto; padding-inline: 8px; }
.wd-sfield { position: relative; }
.wd-sfield.is-block > .seg, .wd-sfield.is-block > .wd-color { width: 100%; }
.wd-sfield .vs-field-label { display: inline-flex; align-items: center; gap: 4px; }
.wd-dot { display: inline-block; width: 7px; height: 7px; background: var(--gold); border: 1px solid var(--edge); border-radius: 50%; }
.wd-reset { display: grid; place-items: center; flex: none; width: 24px; height: 24px; padding: 0; color: var(--muted); background: none; border: 0; cursor: pointer; }
.wd-reset:hover { color: var(--edge); background: var(--gold); }
.wd-sfield.is-block .wd-reset { position: absolute; top: -2px; right: 0; }
.wd-slider-row { display: flex; align-items: center; gap: 8px; flex: 1 1 auto; min-width: 0; }
.wd-slider-row .vs-range { flex: 1 1 auto; min-width: 40px; }
.wd-check-row { gap: 8px; }
.wd-check-row input { flex: none; accent-color: var(--accent); }

.wd-color { display: flex; flex-direction: column; gap: 6px; }
.wd-color-row { display: flex; align-items: center; gap: 6px; }
.wd-color-text { flex: 1 1 auto; font-family: var(--mono); font-size: 0.74rem; }
.wd-swatches { display: flex; flex-wrap: wrap; gap: 4px; }
.wd-sw { width: 24px; height: 24px; padding: 0; background: var(--c); border: 2px solid var(--edge); cursor: pointer; transition: transform 140ms ease; }
.wd-sw.is-on { outline: 2px solid var(--accent-strong); outline-offset: 1px; }
.wd-sw.is-none { background: linear-gradient(135deg, transparent 45%, #e0606a 45% 55%, transparent 55%), var(--surface-2); }
.wd-grad { display: flex; align-items: center; gap: 6px; }
.wd-grad .wd-sel { min-width: 0; }

.wd-pic { display: grid; place-items: center; height: 92px; color: var(--faint); background: repeating-conic-gradient(#2a2340 0 25%, #221b36 0 50%) 0 0 / 14px 14px; background-size: cover; background-position: center; border: 1px solid var(--border); font-size: 0.74rem; }
.wd-pic[style*="background-image"] { background-color: #fff; background-repeat: no-repeat; }
.wd-pic.is-small { flex: none; width: 46px; height: 34px; }
.wd-picfield .vs-row-btns { margin: 6px 0 0; }
.wd-link { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.wd-slug { display: flex; align-items: center; gap: 4px; flex: 1 1 auto; min-width: 0; color: var(--faint); font-family: var(--mono); font-size: 0.74rem; }
.wd-meter { margin-top: -4px; font-family: var(--mono); font-size: 0.66rem; }
.wd-meter.is-good { color: #5ed3a1; }
.wd-meter.is-warn { color: var(--gold); }
.wd-meter.is-bad { color: var(--danger, #f87171); }
.wd-serp { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; color: #202124; background: #fff; border: 1px solid var(--edge); font-family: arial, sans-serif; }
.wd-serp-url { overflow: hidden; color: #4d5156; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.wd-serp-title { color: #1a0dab; font-size: 17px; line-height: 1.3; }
.wd-serp-desc { color: #4d5156; font-size: 13px; line-height: 1.45; }

.wd-rows { display: flex; flex-direction: column; gap: 6px; }
.wd-row { display: flex; align-items: flex-start; gap: 4px; padding: 6px; background: var(--surface-2); border: 1px solid var(--border); }
.wd-row > :first-child { flex: 1 1 auto; min-width: 0; }
.wd-row-btns { display: flex; gap: 2px; flex: none; }
.wd-row-btns .vs-ib { width: 22px; height: 20px; }
.wd-qa { display: flex; flex-direction: column; gap: 5px; }
.wd-pair { display: flex; align-items: center; gap: 8px; }
.wd-pair .wd-sel { flex: 1 1 auto; }
.wd-gal-row { display: flex; align-items: center; gap: 6px; }
.wd-rows > .btn { align-self: flex-start; display: inline-flex; align-items: center; gap: 5px; }
.wd-glyphs { display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 4px; }
.wd-glyph { display: grid; place-items: center; aspect-ratio: 1; padding: 0; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); cursor: pointer; }
.wd-glyph.is-on { color: var(--tint-text); background: var(--tint); border-color: var(--tint-border); }
.wd-four { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.wd-four-cell { display: flex; flex-direction: column; gap: 2px; }
.wd-four-cell > span { color: var(--faint); font-family: var(--mono); font-size: 0.58rem; text-transform: uppercase; }
.wd-four-cell .wd-in { padding: 5px 6px; }
.wd-css { max-height: 200px; margin: 0; padding: 8px 10px; overflow: auto; color: #e6e1f5; background: #0d0a17; border: 1px solid var(--border); font: 11.5px/1.5 var(--mono); white-space: pre; -webkit-user-select: text; user-select: text; scrollbar-width: thin; }

/* ---- Dialogs ---- */
.wd-pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; max-height: 50vh; overflow-y: auto; }
.wd-pick { display: grid; place-items: center; aspect-ratio: 4 / 3; padding: 4px; overflow: hidden; color: var(--muted); background: repeating-conic-gradient(#d8d4e4 0 25%, #fff 0 50%) 0 0 / 12px 12px; border: 2px solid var(--edge); font: inherit; font-size: 0.72rem; cursor: pointer; }
.wd-pick img { max-width: 100%; max-height: 100%; object-fit: contain; }
.wd-pick[aria-pressed="true"] { outline: 3px solid var(--accent-strong); outline-offset: -3px; }
.wd-ex-body { display: flex; flex-direction: column; gap: 10px; }
.wd-ex-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.wd-ex { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; color: var(--text); background: var(--surface-2); border: 2px solid var(--edge); box-shadow: var(--hard, 3px 3px 0 var(--edge)); font: inherit; text-align: left; cursor: pointer; transition: transform 160ms var(--spring, ease), box-shadow 160ms ease; }
.wd-ex.is-main { background: var(--tint); }
.wd-ex b { font-weight: 700; }
.wd-ex small { color: var(--muted); font-size: 0.76rem; line-height: 1.4; }
.wd-ex-head { margin: 8px 0 0; }
.wd-ex-row { display: flex; flex-wrap: wrap; gap: 12px; }
.wd-ex-row .seg { flex-wrap: wrap; }

/* ---- Gold under the pointer, a drop on press ---- */
@media (hover: hover) {
  :is(.wd-tile, .wd-new-pal, .wd-palette, .wd-ex, .wd-glyph, .wd-pick):hover { color: var(--edge); background: var(--gold); border-color: var(--edge); transform: translate(-1px, -1px); box-shadow: var(--hard-lift, 4px 4px 0 var(--edge)); }
  :is(.wd-tile, .wd-glyph):hover svg { color: var(--edge); }
  :is(.wd-ex):hover small { color: var(--edge); }
  .wd-page-row:hover:not(.is-on) { border-color: var(--gold); }
  .wd-sw:hover { transform: translateY(-2px); }
}
:is(.wd-tile, .wd-new-pal, .wd-palette, .wd-ex, .wd-glyph, .wd-pick):active { color: var(--edge); background: var(--gold); transform: translate(2px, 2px); box-shadow: none; }

/* ---- Phones ---- */
@media (max-width: 760px) {
  .wd-new .st-new-row > .st-field { flex: 1 1 100%; }
  .wd-work { grid-template-rows: auto auto minmax(0, 1fr) auto; }
  .wd-body { grid-template-columns: minmax(0, 1fr); }
  .wd-stage { height: 100%; padding: 8px; }
  .wd-bar { gap: 4px; padding: 3px 6px; overflow-x: auto; scrollbar-width: none; }
  .wd-bar::-webkit-scrollbar { display: none; }
  .wd-page-sel { min-width: 0; max-width: 110px; }
  .wd-bp .seg-btn span, .wd-mode-btn span, #wd-add-page, .wd-zoom { display: none; }
  .wd-msg { position: absolute; left: 8px; right: 8px; bottom: 64px; z-index: 25; }
  .wd-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .wd-sec-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wd-ex-grid { grid-template-columns: 1fr; }
  #wd-help { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .wd-work *, .wd-tile { transition: none !important; }
}

/* Tools: the developer and web tools in a panel over the whole studio. */
.wd-tools { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; background: var(--bg); }
.wd-tools[hidden] { display: none; }
/* Clear of the studio corner (the hat and ?), which stays on top. */
.wd-tools-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px 8px 76px; background: var(--surface); border-bottom: 2px solid var(--edge); }
.wd-tools-title { margin: 0; font-size: 1rem; font-weight: 800; }
.wd-tools-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 240px 1fr; }
.wd-tools-nav { overflow: auto; padding: 10px 8px 16px; background: var(--surface); border-right: 2px solid var(--edge); }
.wd-tools-group { margin: 14px 8px 6px; font-family: var(--mono); font-size: 0.66rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.wd-tools-group:first-child { margin-top: 4px; }
.wd-tools-item { display: block; width: 100%; padding: 7px 10px; text-align: left; color: var(--muted); background: none; border: 0; font: inherit; font-size: 0.88rem; cursor: pointer; }
.wd-tools-item.is-active { color: var(--tint-text); background: var(--tint); }
@media (hover: hover) { .wd-tools-item:hover { color: var(--edge); background: var(--gold); } }
.wd-tools-main { overflow: auto; padding: 20px 24px 40px; }
.wd-tools-main > * { max-width: 920px; margin-left: auto; margin-right: auto; }
.wd-tools-name { margin: 0 auto 14px; font-size: 1.3rem; font-weight: 900; text-transform: uppercase; }
.wd-tool-card { padding: 20px; }
@media (max-width: 760px) {
  .wd-tools-body { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .wd-tools-nav { display: flex; gap: 4px; overflow-x: auto; padding: 8px; border-right: 0; border-bottom: 2px solid var(--edge); }
  .wd-tools-group { display: none; }
  .wd-tools-item { flex: none; width: auto; white-space: nowrap; }
  .wd-tools-main { padding: 14px 12px 32px; }
}

/* A section heading in a menu (Plug-ins). */
.wd-menu-head { margin: 6px 10px 3px; color: var(--accent-strong); font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.08em; text-transform: uppercase; }
