/* project-settings.css — Studio's Project settings forms, which project-settings.js
   builds: Name, Root feature, Splash screen, Navigation, Theme, Authentication,
   Devices, Orientation, Minimum versions, Geos and languages, Device permissions,
   Capability preflight and Archive project. (The Links form is links.css's.)

   Every colour, type size and control size is a role `styles.css` declares on
   `:root` and again under `[data-theme="dark"]`, so there is no dark block here.
   The one literal is the dialog's backdrop, because a custom property does not
   reach `::backdrop` in every browser this page supports. Spacing follows
   Studio's scale (4, 8, 12, 16, 24). A form takes Studio's wide width, 560 points
   (`StudioFormWidth.wide`), and Geos and languages the extra-wide 720.

   Nothing here is written from script. The shell's CSP (`style-src 'self'`)
   refuses style attributes, so state arrives as a class, `hidden`, `disabled`,
   `checked` or `aria-pressed`, and these rules draw it. Headings in eyebrow type
   are written in Studio's own case, so nothing here transforms text. */

/* `styles.css` already hides `[hidden]`; repeated for the elements below that set
   a display of their own, so this file does not lean on another's rule. */
.pset-dialog [hidden] { display: none !important; }

/* ---------------------------------------------------------------- the card */

/* A native modal `<dialog>` in the top layer: a card on the panel surface with a
   hairline and Studio's 12-point radius, cross-faded in over a 40% black scrim,
   with no blur and no shadow. The header and footer stay put; the body scrolls. */
.pset-dialog {
  width: min(560px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}
.pset-dialog.wide { width: min(720px, calc(100vw - 32px)); }
.pset-dialog[open] { display: flex; animation: pset-dialog-in .3s ease-in-out; }
.pset-dialog::backdrop { background: rgba(0, 0, 0, .4); }
@keyframes pset-dialog-in { from { opacity: 0; } }
.pset-frame { flex: 1 1 auto; min-width: 0; min-height: 0; display: flex; flex-direction: column; }

/* `StudioFormView`'s header: the title, the "Working" indicator while the form
   saves, and the close button, which waits while it does. The row is as tall as
   the close button with or without the indicator, so saving never resizes the card. */
.pset-head { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; padding: 24px 24px 0; }
.pset-title { flex: 1 1 auto; min-width: 0; margin: 0; font: var(--type-h1); overflow-wrap: anywhere; }
.pset-close { width: var(--icon-button); height: var(--icon-button); flex: 0 0 var(--icon-button); display: grid; place-items: center; padding: 0; color: var(--ink); background: transparent; border: 0; border-radius: var(--radius-icon); font-size: 17px; line-height: 1; cursor: pointer; }
.pset-close:hover:not(:disabled) { background: var(--hover); }
.pset-close:disabled { color: var(--muted); cursor: progress; }

/* Studio's small loading indicator. Neutral, as Studio's is: orange is kept for a
   chat turn at work. */
.pset-spinner { width: 12px; height: 12px; flex: 0 0 12px; display: inline-block; border: 1.5px solid var(--line-strong); border-top-color: var(--loading); border-radius: 50%; animation: pset-spin .8s linear infinite; }
@keyframes pset-spin { to { transform: rotate(360deg); } }

.pset-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 16px; padding: 16px 24px; }
.pset-intro { margin: 0; color: var(--ink-soft); font: var(--type-body); }

/* ------------------------------------------------------------ shared pieces */

.pset-eyebrow { margin: 0; color: var(--muted); font: var(--type-eyebrow); letter-spacing: var(--eyebrow-tracking); }
.pset-caption { margin: 0; color: var(--muted); font: var(--type-caption); }
.pset-small { margin: 0; color: var(--ink-soft); font: var(--type-small); }
.pset-warning { margin: 0; color: var(--warn-ink); font: var(--type-caption); }
.pset-headline { margin: 0; color: var(--ink); font: var(--type-h3); overflow-wrap: anywhere; }
.pset-none { margin: 0; padding: 12px; color: var(--muted); font: var(--type-small); }
.pset-count { flex: 0 0 auto; color: var(--muted); font: var(--type-caption); }
.pset-group { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.pset-group > * { max-width: 100%; }

/* Studio's status badge: "Saved changes · next version" in the warning family, and
   "Permission setup complete" in the success family. */
.pset-badge { align-self: flex-start; margin: 0; padding: 4px 8px; color: var(--warn-ink); background: var(--warn-bg); border-radius: var(--radius-badge); font: var(--type-caption-strong); }
.pset-badge.ok { color: var(--ok-ink); background: var(--ok-bg); }

/* `StudioLabeledFieldView`: the title in eyebrow type over the field. */
.pset-field { align-self: stretch; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.pset-input, .pset-select { width: 100%; height: var(--control-height); padding: 0 12px; color: var(--ink); background: var(--raised); border: 1px solid var(--line); border-radius: var(--radius-button); font: var(--type-body); }
.pset-input:focus, .pset-select:focus { border-color: var(--selected-line-strong); }
.pset-input::placeholder { color: var(--muted); }
.pset-input:disabled, .pset-select:disabled { color: var(--muted); background: var(--chip); cursor: progress; }

/* Studio's Secondary button with its `studioLabel`, and the quiet one (Remove), which
   has no fill until hovered. Disabled, both are muted ink on the chip. */
.pset-action { flex: 0 0 auto; height: var(--control-height); padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink); background-color: var(--selected-fill); border: 1px solid var(--selected-line); border-radius: var(--radius-button); font: var(--type-caption-strong); white-space: nowrap; cursor: pointer; }
.pset-action:hover:not(:disabled) { background-image: linear-gradient(var(--hover), var(--hover)); }
.pset-action:active:not(:disabled) { background-image: linear-gradient(var(--pressed), var(--pressed)); }
.pset-action.quiet { background-color: transparent; border-color: transparent; }
.pset-action:disabled { color: var(--muted); background-color: var(--chip); border-color: transparent; cursor: not-allowed; }

/* ------------------------------------------------------------ setting choices */

/* `StudioSettingChoiceRowView`: unchosen, the muted surface with no edge; chosen,
   Studio's raised neutral fill, a neutral edge and primary ink, with the mark filled
   and ticked so the state is not carried by the edge alone. The mark is a circle for
   one choice and a square for several. The note on a chosen row takes `--ink-soft`,
   because `--muted` falls under 4.5:1 there (TechPlan.md § The design system is
   Studio's). A choice that cannot be taken yet — Required and Deferred before the
   authentication gate exists — is dimmed. */
.pset-choices { align-self: stretch; margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.pset-choice { width: 100%; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 12px; color: var(--ink); text-align: left; background: var(--panel-muted); border: 1px solid transparent; border-radius: var(--radius-button); cursor: pointer; }
.pset-choice:hover:not(:disabled) { background-image: linear-gradient(var(--hover), var(--hover)); }
.pset-choice.selected { background: var(--selected-fill); border-color: var(--selected-line-strong); }
.pset-choice:disabled { cursor: not-allowed; opacity: .48; }
.pset-choice-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.pset-choice-title { color: var(--ink); font: var(--type-label); overflow-wrap: anywhere; }
.pset-choice.selected .pset-choice-title { color: var(--selected-ink); }
.pset-choice-note { color: var(--ink-soft); font: var(--type-small); overflow-wrap: anywhere; }
.pset-mark { width: 16px; height: 16px; flex: 0 0 16px; display: grid; place-items: center; box-sizing: border-box; border: 1.5px solid var(--muted); border-radius: 50%; }
.pset-mark.multiple { border-radius: 4px; }
.pset-choice.selected .pset-mark { background: var(--selected-ink); border-color: var(--selected-ink); }
.pset-choice.selected .pset-mark::after { content: "✓"; color: var(--selected-fill); font: var(--type-caption-strong); line-height: 1; }

/* Authentication: ACCESS and, 16 points beneath it, the API credential or the method. */
.pset-authentication { min-width: 0; display: flex; flex-direction: column; gap: 16px; }

/* ----------------------------------------------------------- minimum versions */

/* The iOS floors side by side, then the app's, 12 points apart. */
.pset-versions { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.pset-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: 12px; }

/* --------------------------------------------------------- geos and languages */

/* Two checklists side by side, each a heading with its count, a search field, and a
   box of Studio's 160 points that scrolls (`marketChoiceListHeight`). */
.pset-markets { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.pset-market-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: 16px; }
.pset-market { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.pset-list-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.pset-market-list { height: 160px; overflow-y: auto; overscroll-behavior: contain; background: var(--inset); border: 1px solid var(--line); border-radius: var(--radius-button); }
.pset-market-rows { margin: 0; padding: 8px 0; list-style: none; display: flex; flex-direction: column; }
.pset-check { display: flex; align-items: center; gap: 8px; padding: 4px 12px; color: var(--ink); font: var(--type-body); cursor: pointer; }
.pset-check:hover { background: var(--hover); }
.pset-checkbox { width: 14px; height: 14px; flex: 0 0 14px; margin: 0; accent-color: var(--primary); }
.pset-check-name { min-width: 0; overflow-wrap: anywhere; }
.pset-select { width: auto; max-width: 100%; }

/* ---------------------------------------------------------- device permissions */

/* A section per group, 24 points apart; inside a section each permission, 16 apart:
   its name beside the On/Off control, its reason and what else it needs beneath, and
   a soft hairline under each. */
.pset-permissions { min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.pset-permission-group { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.pset-permission { min-width: 0; display: flex; flex-direction: column; gap: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line-soft); }
.pset-permission-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pset-permission-name { min-width: 0; color: var(--ink); font: var(--type-label); overflow-wrap: anywhere; }

/* Studio's segmented control: a bordered chip-coloured group with the chosen segment
   raised. */
.pset-segmented { flex: 0 0 auto; display: flex; gap: 4px; padding: 4px; background: var(--chip); border-radius: var(--radius-button); box-shadow: inset 0 0 0 1px var(--line); }
.pset-segment { min-height: 20px; padding: 0 12px; color: var(--ink-soft); background: transparent; border: 0; border-radius: 3px; font: var(--type-body); white-space: nowrap; cursor: pointer; }
.pset-segment:hover:not(:disabled) { background: var(--hover); }
.pset-segment[aria-pressed="true"] { color: var(--selected-ink); background: var(--selected-fill); box-shadow: inset 0 0 0 1px var(--selected-line-strong); }
.pset-segment:disabled { cursor: not-allowed; opacity: .48; }

/* A saved value outside the current catalog, with Remove on the trailing edge. */
.pset-unknown { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pset-unknown .pset-small { min-width: 0; color: var(--muted); overflow-wrap: anywhere; }

/* ------------------------------------------------------- capability preflight */

.pset-preflight { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.pset-preflight .pset-warning { font: var(--type-small); }
.pset-preflight-group { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.pset-detail-rows { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; }
/* `StudioDetailRowView`: the title on the leading edge, its value on the trailing. */
.pset-detail-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.pset-detail-title { min-width: 0; color: var(--muted); font: var(--type-small); }
.pset-detail-value { flex: 0 0 auto; color: var(--ink); font: var(--type-small-strong); text-align: right; user-select: text; }

/* ------------------------------------------------------------- the footer */

/* Messages sit directly above the actions they are about and scroll within Studio's
   180 points (`formMessageMaximumHeight`), so the actions never leave. */
.pset-foot { flex: 0 0 auto; display: flex; flex-direction: column; gap: 12px; padding: 0 24px 24px; }
.pset-messages { max-height: 180px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.pset-problem { margin: 0; color: var(--warn-ink); font: var(--type-small); }
/* `StudioFormErrorView`: the danger family's muted fill under its own ink. */
.pset-error { margin: 0; padding: 12px; color: var(--bad-ink); background: var(--bad-bg); border-radius: var(--radius-button); font: var(--type-small); }

/* Studio's dialog buttons: equal shares of the row, 28 points, body type — the
   dismissal in the Cancel role and the answer in the primary orange. Archive project
   is the Secondary button in the danger family: red, and never the default. */
.pset-actions { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; }
.pset-button { height: var(--control-height); min-width: 0; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; overflow: hidden; border: 1px solid transparent; border-radius: var(--radius-button); font: var(--type-body); white-space: nowrap; text-overflow: ellipsis; cursor: pointer; transition: background-color .16s ease, border-color .16s ease, color .16s ease; }
.pset-button.cancel { color: var(--ink); background-color: var(--panel-muted); border-color: var(--line); }
.pset-button.cancel:hover:not(:disabled) { background-image: linear-gradient(var(--hover), var(--hover)); }
.pset-button.primary { color: var(--on-primary); background: var(--primary); }
.pset-button.primary:hover:not(:disabled) { background: var(--primary-hover); }
.pset-button.primary:active:not(:disabled) { background: var(--primary-pressed); }
.pset-button.danger { color: var(--bad-ink); background-color: var(--bad-bg); border-color: var(--bad-line); }
.pset-button.danger:hover:not(:disabled) { background-image: linear-gradient(var(--hover), var(--hover)); }
.pset-button.danger:active:not(:disabled) { background-image: linear-gradient(var(--pressed), var(--pressed)); }
.pset-button:disabled { color: var(--muted); background: var(--chip); background-image: none; border-color: transparent; cursor: not-allowed; }

/* Keyboard focus is `styles.css`'s ring on every button, input and select; the search
   field and the default-language menu also take the selection edge while focused. */

@media (prefers-reduced-motion: reduce) {
  .pset-dialog[open] { animation: none; }
  .pset-spinner { animation: none; border-top-color: var(--loading); }
}

@media (max-width: 600px) {
  .pset-head { padding: 20px 16px 0; }
  .pset-body { padding: 12px 16px; }
  .pset-foot { padding: 0 16px 20px; }
  .pset-market-columns { grid-template-columns: minmax(0, 1fr); }
}
