/* ============================================================================
   zz_studio_output.css — the Post studio OUTPUT settings-group card (plan
   stage C-2; docs/design/new_content_screen.md §6.3; decisions C4 + C10 in
   docs/design/builder_v6_decisions.md; map rows A1 / A3 / B5 in
   docs/new_content/studio_control_map.md).

   Scope: :is(#new-content-shell, #editor-workspace-root) .sp-studio-card — the v6 settings-group card
   grammar (DS §5 "Karta skupiny nastavení": #101117 ground, #1B1C22 hairline,
   radius 14, mono CAPS eyebrow), first used by OUTPUT; stages C-3 (TEXT) and
   C-4 (LOOK) reuse the same classes — and the OUTPUT-specific rows under
   .sp-studio-card--output. Values come from the --bc-* chrome tokens
   (assets/new_content.css, DS-tuned in C-1b); fonts are card-local like the
   header until a --bc-* type token exists.

   Cascade: sorts after zz_new_content.css and zz_studio_chrome.css
   ("zz_studio_o" > "zz_studio_c" > "zz_n"), so equal-specificity ties go to
   these rules; !important only where the older band being overridden is
   !important (the R3 inspector density rules, the lime indicator rule).
   Nothing in styles.css / zz_new_content.css is edited.

   CSS-only mechanics (no callback, no store — the "how" behind decision C4):
   * the aspect segments are ONE Mantine SegmentedControl (:is(#display-target, #editor-display-target))
     over all 20 ratio literals; every control beyond 9:16 / 1:1 / 16:9 is
     display:none until the row is "expanded": the <details> toggle is open,
     OR the checked ratio itself is a long-tail one (:has(input:checked)), so a
     loaded 13:16 post always shows its own format;
   * the duration row hides while the mode segments read `static`
     (spec: the duration control is a video-only setting).
   Both key on the radio inputs Mantine renders inside each control
   (input[value=…]:checked) — a DOM contract of the SegmentedControl itself.

   Duration is the ORIGINAL NumberInput (1 s+, 0.5 s steps, no cap) in a DS
   label + value row — v6's 10–60 s slider was built and rejected 2026-08-29
   (a slider caps the length; the stage must not change behavior).
   ========================================================================== */

:is(#new-content-shell, #editor-workspace-root) .sp-studio-card {
  --st-ui: "Instrument Sans", "Manrope", var(--bc-body);
  --st-mono: "Space Mono", var(--bc-num);
  --st-chip-h: 32px;
  --st-seg-cols: 3;
  --st-tail: none;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  background: var(--bc-panel);
  border: 1px solid var(--bc-border-soft);
  border-radius: 14px;
  padding: 12px 12px 13px;
}

:is(#new-content-shell, #editor-workspace-root) .sp-studio-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

/* DS §5: mono CAPS section label, 10px, muted */
:is(#new-content-shell, #editor-workspace-root) .sp-studio-card-eyebrow {
  font-family: var(--st-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1;
  color: var(--bc-faint);
}

:is(#new-content-shell, #editor-workspace-root) .sp-studio-card-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

:is(#new-content-shell, #editor-workspace-root) .sp-studio-row {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

:is(#new-content-shell, #editor-workspace-root) .sp-studio-row-label {
  font-family: var(--st-ui);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--bc-text2);
}

/* ---- inline segments as value chips (DS §4 "Chip volby — inline segment") --
   The Mantine SegmentedControl keeps its radiogroup semantics and its
   `value` contract; visually each control becomes a bordered chip in a grid
   (so the aspect list can wrap when expanded) and the sliding indicator is
   retired — the lime selection paints on the active control instead. */
:is(#new-content-shell, #editor-workspace-root) .sp-studio-card .sp-studio-segments.mantine-SegmentedControl-root {
  display: grid !important;
  grid-template-columns: repeat(var(--st-seg-cols, 3), minmax(0, 1fr));
  gap: 6px;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

:is(#new-content-shell, #editor-workspace-root) .sp-studio-card .sp-studio-segments .mantine-SegmentedControl-indicator {
  display: none !important;
}

:is(#new-content-shell, #editor-workspace-root) .sp-studio-card .sp-studio-segments .mantine-SegmentedControl-control {
  min-width: 0;
  border: 0 !important;
}

:is(#new-content-shell, #editor-workspace-root) .sp-studio-card .sp-studio-segments .mantine-SegmentedControl-control::before {
  content: none !important; /* Mantine's item separators (withItemsBorders) */
}

:is(#new-content-shell, #editor-workspace-root) .sp-studio-card .sp-studio-segments .mantine-SegmentedControl-label {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: var(--st-chip-h);
  padding: 4px 8px !important;
  border: 1px solid var(--bc-border);
  border-radius: 10px;
  background: transparent;
  color: var(--bc-text2) !important;
  font-family: var(--st-ui);
  font-size: 12px !important;
  font-weight: 600 !important;
  line-height: 1.1;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

:is(#new-content-shell, #editor-workspace-root) .sp-studio-card .sp-studio-segments .mantine-SegmentedControl-label:hover {
  border-color: var(--bc-text2);
  color: var(--bc-text) !important;
}

/* selected value = lime (DS §1.3 idiom; C5) */
:is(#new-content-shell, #editor-workspace-root) .sp-studio-card .sp-studio-segments .mantine-SegmentedControl-control[data-active] .mantine-SegmentedControl-label {
  border-color: var(--bc-select);
  background: var(--bc-select-soft);
  color: var(--bc-select) !important;
}

/* disabled (cfg-animated while the dataset cannot animate — _gate_animated) */
:is(#new-content-shell, #editor-workspace-root) .sp-studio-card .sp-studio-segments[data-disabled] .mantine-SegmentedControl-label,
:is(#new-content-shell, #editor-workspace-root) .sp-studio-card .sp-studio-segments .mantine-SegmentedControl-label[data-disabled] {
  border-color: var(--bc-border-soft);
  background: transparent;
  color: var(--bc-faint) !important;
  cursor: not-allowed;
}

:is(#new-content-shell, #editor-workspace-root) .sp-studio-card .sp-studio-segments[data-disabled] .mantine-SegmentedControl-control[data-active] .mantine-SegmentedControl-label {
  border-color: color-mix(in srgb, var(--bc-select) 40%, transparent);
  color: color-mix(in srgb, var(--bc-select) 55%, var(--bc-faint)) !important;
}

:is(#new-content-shell, #editor-workspace-root) .sp-studio-card .sp-studio-segments .mantine-SegmentedControl-input:focus-visible + .mantine-SegmentedControl-label {
  outline: 2px solid var(--bc-accent);
  outline-offset: 1px;
}

/* ---- OUTPUT rows ---------------------------------------------------------- */

:is(#new-content-shell, #editor-workspace-root) .sp-output-mode {
  --st-seg-cols: 2;
}

/* Aspect ratio (C4): quick three visible, long tail collapsed. The row owns
   the two switches (--st-tail / --st-seg-cols) so the expanded state needs no
   specificity fight with the hide rule below. */
:is(#new-content-shell, #editor-workspace-root) .sp-output-aspect {
  --st-seg-cols: 3;
  --st-tail: none;
}

:is(#new-content-shell, #editor-workspace-root) .sp-output-aspect:has(> .sp-output-aspect-more[open]),
:is(#new-content-shell, #editor-workspace-root) .sp-output-aspect:has(.sp-output-aspect-segments input:checked:not([value="story"]):not([value="square"]):not([value="desktop"])) {
  --st-seg-cols: 4;
  --st-tail: block;
}

:is(#new-content-shell, #editor-workspace-root) .sp-output-aspect .sp-output-aspect-segments .mantine-SegmentedControl-control:not(:has(> input[value="story"])):not(:has(> input[value="square"])):not(:has(> input[value="desktop"])) {
  display: var(--st-tail);
}

/* the toggle: a text button, no marker */
:is(#new-content-shell, #editor-workspace-root) .sp-output-aspect-more {
  align-self: flex-start;
  margin-top: -1px;
}

:is(#new-content-shell, #editor-workspace-root) .sp-output-aspect-more-toggle {
  list-style: none;
  display: inline-flex;
  align-items: center;
  padding: 3px 0;
  cursor: pointer;
  user-select: none;
  font-family: var(--st-ui);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--bc-text2);
  transition: color 0.15s ease;
}

:is(#new-content-shell, #editor-workspace-root) .sp-output-aspect-more-toggle::-webkit-details-marker {
  display: none;
}

:is(#new-content-shell, #editor-workspace-root) .sp-output-aspect-more-toggle::marker {
  content: "";
}

:is(#new-content-shell, #editor-workspace-root) .sp-output-aspect-more-toggle:hover {
  color: var(--bc-text);
}

:is(#new-content-shell, #editor-workspace-root) .sp-output-aspect-more-toggle:focus-visible {
  outline: 2px solid var(--bc-accent);
  outline-offset: 2px;
  border-radius: 6px;
}

:is(#new-content-shell, #editor-workspace-root) .sp-output-aspect-more-open {
  display: none;
}

:is(#new-content-shell, #editor-workspace-root) .sp-output-aspect-more[open] .sp-output-aspect-more-open {
  display: inline;
}

:is(#new-content-shell, #editor-workspace-root) .sp-output-aspect-more[open] .sp-output-aspect-more-closed {
  display: none;
}

/* a long-tail ratio is the active one: the list is open FOR it, the toggle
   would be a no-op — hide it until a quick ratio is picked again */
:is(#new-content-shell, #editor-workspace-root) .sp-output-aspect:has(.sp-output-aspect-segments input:checked:not([value="story"]):not([value="square"]):not([value="desktop"])) .sp-output-aspect-more {
  display: none;
}

/* ---- Duration: label left, the number field + "s" right (DS §4 row) ------ */
:is(#new-content-shell, #editor-workspace-root) .sp-output-duration {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 32px;
}

/* video only (spec §6.3) */
:is(#new-content-shell, #editor-workspace-root) .sp-studio-card--output:has(:is(#cfg-animated, #editor-cfg-animated) input[value="static"]:checked) .sp-output-duration {
  display: none;
}

:is(#new-content-shell, #editor-workspace-root) .sp-output-duration-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

:is(#new-content-shell, #editor-workspace-root) .sp-output-duration-input.mantine-NumberInput-root,
:is(#new-content-shell, #editor-workspace-root) .sp-output-duration-input .mantine-Input-wrapper {
  width: 96px !important;
  min-width: 0 !important;
}

/* Selector weight: the R3 density rule (zz_new_content.css:4267,
   `:is(#new-content-shell, #editor-workspace-root) :is(#config-card, #editor-tools) .mantine-Input-input:not(…):not(…)`, 2 ids +
   3 classes) sets 30px on every inspector input; this chain ties it at 2 ids +
   3 classes and wins by file order (zz_studio_o > zz_n). */
:is(#new-content-shell, #editor-workspace-root) :is(#config-card, #editor-tools) .sp-studio-card--output .sp-output-duration-input .mantine-NumberInput-input,
:is(#new-content-shell, #editor-workspace-root) :is(#config-card, #editor-tools) .sp-studio-card--output .sp-output-duration-input .mantine-Input-input {
  box-sizing: border-box;
  min-height: 32px !important;
  height: 32px !important;
  padding: 0 24px 0 10px !important;
  border: 1px solid var(--bc-border) !important;
  border-radius: 10px !important;
  background: var(--bc-raised) !important;
  color: var(--bc-text) !important;
  font-family: var(--st-mono) !important;
  font-size: 12.5px !important;
  font-weight: 700 !important;
  font-variant-numeric: tabular-nums;
  text-align: right !important;
  transition: border-color 0.15s ease;
}

:is(#new-content-shell, #editor-workspace-root) .sp-output-duration-input .mantine-Input-input:focus,
:is(#new-content-shell, #editor-workspace-root) .sp-output-duration-input .mantine-Input-input:focus-visible {
  border-color: var(--bc-accent) !important;
  outline: none;
}

:is(#new-content-shell, #editor-workspace-root) .sp-output-duration-input .mantine-NumberInput-controls {
  width: 20px !important;
  right: 2px !important;
  border: 0 !important;
}

:is(#new-content-shell, #editor-workspace-root) .sp-output-duration-input .mantine-NumberInput-control {
  width: 20px !important;
  min-height: 14px !important;
  height: 14px !important;
  border: 0 !important;
  background: transparent !important;
  color: var(--bc-text2) !important;
}

:is(#new-content-shell, #editor-workspace-root) .sp-output-duration-input .mantine-NumberInput-control:hover {
  color: var(--bc-accent) !important;
  background: color-mix(in srgb, var(--bc-accent) 10%, transparent) !important;
}

:is(#new-content-shell, #editor-workspace-root) .sp-output-duration-unit {
  font-family: var(--st-mono);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  color: var(--bc-text2);
}

/* ---- mobile ≤640 (the Setup sheet; DS §3.1 touch ladder: segments 38px) -- */
@media (max-width: 640px) {
  :is(#new-content-shell, #editor-workspace-root) .sp-studio-card {
    --st-chip-h: 38px;
    padding: 12px 12px 14px;
  }

  :is(#new-content-shell, #editor-workspace-root) .sp-studio-card-body {
    gap: 14px;
  }

  :is(#new-content-shell, #editor-workspace-root) .sp-studio-row-label {
    font-size: 13px;
  }

  :is(#new-content-shell, #editor-workspace-root) .sp-studio-card .sp-studio-segments .mantine-SegmentedControl-label {
    font-size: 12.5px !important;
  }

  :is(#new-content-shell, #editor-workspace-root) .sp-output-duration-input.mantine-NumberInput-root,
  :is(#new-content-shell, #editor-workspace-root) .sp-output-duration-input .mantine-Input-wrapper {
    width: 108px !important;
  }

  /* DS §3.1 touch ladder: inputs 42–46px */
  :is(#new-content-shell, #editor-workspace-root) :is(#config-card, #editor-tools) .sp-studio-card--output .sp-output-duration-input .mantine-NumberInput-input,
  :is(#new-content-shell, #editor-workspace-root) :is(#config-card, #editor-tools) .sp-studio-card--output .sp-output-duration-input .mantine-Input-input {
    min-height: 42px !important;
    height: 42px !important;
    font-size: 14px !important;
  }

  :is(#new-content-shell, #editor-workspace-root) .sp-output-duration-input .mantine-NumberInput-control {
    min-height: 17px !important;
    height: 17px !important;
  }
}
