/* ==========================================================================
   Style category (P7, decision D-8; artboards D8Style1, D8Custom). Markup: pages/new_content/editor_style_panel.py;
   behaviour: assets/editor_style_panel.js. Scoped to `.sp-style`, so the ranking block that shares the Background
   panel (assets/zzzzzzzzzzzz_ranking_in_editor.css) keeps its look.
   ========================================================================== */
#editor-workspace-root .sp-style { display: block; }
#editor-workspace-root .sp-style-view[hidden] { display: none !important; }
#editor-workspace-root .sp-style-view { display: flex; flex-direction: column; gap: 0; }

/* Titles: "Style" and "< Customize" (the shell's sheet name is not shown on the phone). */
#editor-workspace-root .sp-style-title { display: block; font: 700 17px/22px var(--sp-font-display); color: var(--sp-text); }
#editor-workspace-root .sp-style-view[data-view="style"] > .sp-style-title { display: flex; align-items: center; height: 44px; }
#editor-workspace-root .sp-style-head { display: flex; align-items: center; height: 44px; margin: 0 -6px; }
#editor-workspace-root .sp-style-head .sp-style-title { flex: 1; }
#editor-workspace-root .sp-style-back { flex: none; display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border: 0; background: transparent; color: var(--sp-text); cursor: pointer; }
#editor-workspace-root .sp-style-back .sp-sheet-icon { width: 20px; height: 20px; }

/* Section labels: LAYOUT, LOOK. */
#editor-workspace-root .sp-style-label { display: flex; align-items: baseline; justify-content: space-between; margin: 3px 0 8px; font: 700 10.5px var(--sp-font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--sp-text-2); }
#editor-workspace-root .sp-style-status { font: 500 10.5px/15px var(--sp-font-ui); letter-spacing: 0; text-transform: none; }
#editor-workspace-root .sp-style-layout[hidden] { display: none; }

/* Card rows: one line, scrolled sideways, with the right-edge fade of D8Style1. */
#editor-workspace-root .sp-style-layout + .sp-style-label { margin-top: 0; }
#editor-workspace-root .sp-style-row { position: relative; display: flex; gap: 8px; margin: 0 -14px 10px; padding: 0 14px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; mask-image: linear-gradient(90deg, #000 calc(100% - 30px), transparent); -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 30px), transparent); }
#editor-workspace-root .sp-style-row::-webkit-scrollbar { display: none; }
#editor-workspace-root .sp-style-card { flex: none; width: 92px; padding: 0; border: 0; background: transparent; color: var(--sp-text); text-align: left; cursor: pointer; font: inherit; }
#editor-workspace-root .sp-style-preview { position: relative; display: block; box-sizing: border-box; height: 60px; border: 1px solid var(--sp-border-strong); border-radius: 10px; overflow: hidden; background: var(--sp-bg); }
#editor-workspace-root .sp-style-card[aria-pressed="true"] .sp-style-preview { outline: 2px solid var(--sp-accent); outline-offset: 1px; }
#editor-workspace-root .sp-style-card-label { display: block; height: 28px; margin-top: 6px; font: 500 11.5px/1.2 var(--sp-font-ui); color: #D6D2CA; }

/* Layout thumbnails (rows of label stub s, picture u, bar b). */
#editor-workspace-root .sp-style-mini-row { display: flex; align-items: center; gap: 3px; height: 9px; margin: 5px 7px 0; }
#editor-workspace-root .sp-style-mini-row:first-child { margin-top: 9px; }
#editor-workspace-root .sp-style-mini-row s { display: block; flex: none; width: 14px; height: 4px; border-radius: 2px; background: #8A867E; text-decoration: none; }
#editor-workspace-root .sp-style-mini-row b { display: block; flex: none; position: relative; height: 8px; border-radius: 2px; background: #E8734A; }
#editor-workspace-root .sp-style-mini-row u { display: block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: #38BDF8; text-decoration: none; }
#editor-workspace-root .sp-style-mini-row b u { position: absolute; right: -3px; top: 0; }
/* bar race layouts (2026-11): a rank tile, and the name over a thin bar */
#editor-workspace-root .sp-style-mini-row em { display: block; flex: none; width: 5px; height: 5px; background: #8A867E; }
#editor-workspace-root .sp-style-mini-row em.is-first { background: #E8734A; }
#editor-workspace-root .sp-style-mini-row i { display: flex; flex: none; flex-direction: column; justify-content: center; gap: 1px; height: 9px; }
#editor-workspace-root .sp-style-mini-row i s { height: 3px; }
#editor-workspace-root .sp-style-mini-row i b { height: 4px; }

/* Look thumbnails: the Look's own background, a title stub and its two first palette colours. */
#editor-workspace-root .sp-style-look { display: block; box-sizing: border-box; width: 100%; height: 100%; padding: 8px 8px 0; }
#editor-workspace-root .sp-style-look i { display: block; width: 44%; height: 4px; margin-bottom: 5px; border-radius: 2px; }
#editor-workspace-root .sp-style-lines { display: block; width: 100%; height: 30px; }

/* Customize entry. */
#editor-workspace-root .sp-style-customize { display: flex; align-items: center; justify-content: space-between; box-sizing: border-box; width: 100%; height: 44px; padding: 0 12px; border: 1px solid var(--sp-border-strong); border-radius: 10px; background: var(--sp-surface); color: var(--sp-text); text-align: left; cursor: pointer; font: 500 14px/18px var(--sp-font-ui); }
#editor-workspace-root .sp-style-customize-text { display: block; }
#editor-workspace-root .sp-style-customize small { display: block; font: 400 12px/15px var(--sp-font-ui); color: var(--sp-text-2); }
#editor-workspace-root .sp-style-customize .sp-sheet-icon { width: 20px; height: 20px; color: var(--sp-text-2); }

/* ---- Customize rows ---- */
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-style-view[data-view="customize"] { gap: 6px; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-style-view[data-view="customize"] .sp-editor-section-title { margin: 2px 0 0; font: 700 10.5px var(--sp-font-mono); letter-spacing: .1em; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-style-head + .sp-editor-section-title { margin-top: 1px; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-style-view .sp-editor-row { min-height: 40px; gap: 12px; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-style-view .sp-editor-row > .sp-editor-row-label { flex: 0 0 62px; min-width: 0; font: 500 13px/16px var(--sp-font-ui); color: var(--sp-text-2) !important; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-style-view .sp-editor-row--head > .sp-editor-row-label { flex: 1 1 auto; font: 500 14px/18px var(--sp-font-ui); color: var(--sp-text) !important; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-style-view .sp-editor-row--head .mantine-Switch-track { width: 44px; min-width: 44px; height: 26px; border-radius: 13px; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-style-view .sp-editor-row--head .mantine-Switch-thumb { width: 20px; height: 20px; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-style-view .sp-editor-row :is(.mantine-InputWrapper-label, .mantine-InputWrapper-description) { display: none; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-style-view .sp-editor-row:is(.sp-editor-row--segments, .sp-editor-row--delegate) > :last-child { flex: 1 1 0; max-width: none; min-width: 0; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-style-view .sp-editor-row--size > :last-child { flex: 1 1 0; max-width: none; min-width: 0; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-style-view .sp-editor-row--size .sp-slider-field .mantine-NumberInput-root { width: 48px !important; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-style-view .sp-editor-caption.sp-style-hint { margin: 0 4px 0 74px; font: 500 12.5px/15px var(--sp-font-ui); color: var(--sp-text-2); }
/* Segments: the Flat | Gradient | Image delegate and the Mantine Colors control look the same. */
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-style-view .sp-style-seg, #editor-workspace-root #editor-tools.sp-editor-sheet .sp-style-view .mantine-SegmentedControl-root { display: flex; box-sizing: border-box; width: 100%; height: 38px; padding: 3px; gap: 0; border-radius: 10px; border: 1px solid var(--sp-border-strong); background: var(--sp-surface); }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-style-view .mantine-SegmentedControl-indicator { border-radius: 8px !important; background: var(--sp-chip) !important; box-shadow: none !important; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-style-view .mantine-SegmentedControl-label { height: 30px !important; padding: 0 6px !important; display: flex; align-items: center; justify-content: center; border-radius: 8px !important; font: 500 12.5px/30px var(--sp-font-ui) !important; color: var(--sp-text-2) !important; white-space: nowrap; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-style-view .mantine-SegmentedControl-control[data-active] .mantine-SegmentedControl-label { color: var(--sp-text) !important; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-style-view .sp-style-seg-option { flex: 1 1 0; min-width: 0; height: 30px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--sp-text-2); font: 500 12.5px/30px var(--sp-font-ui); white-space: nowrap; cursor: pointer; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-style-view .sp-style-seg-option[aria-pressed="true"] { background: var(--sp-chip); color: var(--sp-text); }

/* The Background mode decides which rows apply: Flat shows the colour and the hint, Gradient its colours, Image the upload. */
#editor-workspace-root .sp-style[data-bg-mode="gradient"] .sp-style-hint, #editor-workspace-root .sp-style[data-bg-mode="image"] .sp-style-hint { display: none; }
#editor-workspace-root .sp-style[data-bg-mode="flat"] .sp-style-hint-off { display: none; }
#editor-workspace-root .sp-style[data-bg-mode="image"] :is(.sp-style-bgcolor, #style-gradient-colors-wrap, #style-gradient-end-wrap) { display: none; }
#editor-workspace-root .sp-style-image { display: flex; flex-direction: column; gap: 6px; margin-left: 74px; }
#editor-workspace-root .sp-style-image[hidden] { display: none; }
#editor-workspace-root .sp-style-image-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
#editor-workspace-root .sp-style-image #editor-background-upload-feedback { font: 500 12.5px/15px var(--sp-font-ui); color: var(--sp-text-2); }

/* Background colour row (D8Custom): the hex chip shows its value, then the four quick swatches and "+". */
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-style-bgcolor .sp-color-field { gap: 12px; height: 40px; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-style-bgcolor .sp-color-trigger { height: 34px; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-style-bgcolor .sp-color-chip { height: 34px; gap: 8px; padding: 0 10px 0 5px; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-style-bgcolor .sp-color-chip .sp-color-dot { width: 22px; height: 22px; border-width: 1.5px; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-style-bgcolor .sp-color-trigger .sp-color-value { display: inline; font: 700 12px/16px var(--sp-font-mono); letter-spacing: 0; text-transform: uppercase; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-style-bgcolor .sp-color-trigger .sp-sheet-icon { display: none; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-style-bgcolor .sp-color-quick { gap: 12px; flex: 0 0 auto; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-style-bgcolor .sp-color-quick .sp-color-swatch { flex: 0 0 26px; width: 26px; min-width: 26px; max-width: 26px; height: 34px; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-style-bgcolor .sp-color-quick .sp-color-swatch::before { width: 26px; height: 26px; aspect-ratio: auto; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-style-bgcolor .sp-color-quick .sp-color-more { flex: 0 0 26px; width: 26px; }

/* Desktop: the shell's sheet name already says "Style", so the panel's own title shows only in Customize (with its back arrow);
   the 290 px inspector gets smaller swatches so the colour row fits. */
@media (min-width: 768px), (min-width: 600px) and (min-aspect-ratio: 10/13) {
  #editor-workspace-root .sp-style-view[data-view="style"] > .sp-style-title { display: none; }
  /* A mouse cannot scroll the card row sideways (its scrollbar is hidden for touch), so every card past the third
     was out of reach. In the inspector the cards wrap into three columns instead; nothing is hidden. */
  #editor-workspace-root .sp-style-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 8px; margin: 0 0 10px; padding: 0; overflow: visible; mask-image: none; -webkit-mask-image: none; }
  #editor-workspace-root .sp-style-card { width: auto; min-width: 0; }
  #editor-workspace-root #editor-tools.sp-editor-sheet .sp-style-bgcolor .sp-color-field { gap: 8px; }
  #editor-workspace-root #editor-tools.sp-editor-sheet .sp-style-bgcolor .sp-color-quick { gap: 4px; }
  #editor-workspace-root #editor-tools.sp-editor-sheet .sp-style-bgcolor .sp-color-quick .sp-color-swatch,
  #editor-workspace-root #editor-tools.sp-editor-sheet .sp-style-bgcolor .sp-color-quick .sp-color-more { flex-basis: 20px; width: 20px; min-width: 20px; max-width: 20px; }
  #editor-workspace-root #editor-tools.sp-editor-sheet .sp-style-bgcolor .sp-color-quick .sp-color-swatch::before { width: 20px; height: 20px; }
}
