/* Kreator (#start), studio-onboarding.js: one question per screen in a full-window focus mode, like a setup assistant.
   The window is white; choices and list rows are grey tiles, and what sits on a tile is white.
   Tokens come from studio.css; wizard-only values are --ob-*. */
:root {
  --ob-width: 720px;
  --ob-wide: 920px;
  --ob-gutter: clamp(16px, 4vw, 40px);
  --ob-move: 24px;
  --ob-time: .25s;
  --ob-title: clamp(26px, 1.2vw + 20px, 34px);
}

.onboarding-banner a { font-weight: 600; }

/* Focus mode: the wizard covers the studio; the side menu and the Agent panel are inert (studio-onboarding.js). */
body.onboarding-open { overflow: hidden; }
body.onboarding-open #view-onboarding { position: fixed; inset: 0; z-index: 60; overflow-y: auto; overscroll-behavior: contain; background: var(--color-bg); }
#onboarding-body { min-height: 100%; }
.ob-loading { margin: 0; padding: 48px var(--ob-gutter) 12px; }
.form-error.ob-loading { margin: 48px var(--ob-gutter) 12px; padding: 12px var(--space-4); }
#onboarding-body > .button-secondary, #onboarding-body > .button-text { margin: 0 0 0 var(--ob-gutter); }

/* The frame: a thin progress line, a top bar, the question, a foot with the position and the arrows. */
.ob-shell { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.ob-progress { position: fixed; top: 0; left: 0; right: 0; z-index: 3; height: 4px; background: var(--color-fill); }
.ob-progress span { display: block; width: 0; height: 100%; border-radius: 0 var(--radius-pill) var(--radius-pill) 0; background: var(--color-accent); transition: width var(--ob-time) var(--ease-out); }
.ob-top { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: var(--space-2) var(--space-4); padding: var(--space-4) var(--ob-gutter) 10px;
  background: var(--material-bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); }
.ob-brand { min-width: 0; margin: 0 auto 0 0; color: var(--color-text); font-size: var(--text-body); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ob-agent { display: flex; align-items: center; gap: var(--space-2); flex-shrink: 0; margin: 0; padding: 6px 12px; border-radius: var(--radius-control); background: var(--color-tile); color: var(--color-text-2); font-size: var(--text-footnote); font-weight: 500; }
.ob-agent.is-running::before, .ob-status::before { content: ""; flex: 0 0 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--color-accent); animation: ob-pulse 1.4s ease-in-out infinite; }
.ob-leave { flex-shrink: 0; color: var(--color-text-2); }
.ob-leave:hover:not(:disabled) { background: var(--color-fill-soft); color: var(--color-text); }

/* The question: a small kicker, a very large title, a calm line of help. */
.ob-stage { flex: 1; display: grid; align-items: center; justify-items: center; padding: var(--space-8) var(--ob-gutter) var(--space-12); }
.ob-stage > .ob-q { grid-area: 1 / 1; width: min(var(--ob-width), 100%); min-width: 0; }
.ob-stage > .ob-q-wide { width: min(var(--ob-wide), 100%); }
.ob-kicker { display: flex; align-items: center; gap: var(--space-2); margin: 0 0 14px; color: var(--color-text-3); font-size: var(--text-body); font-weight: 600; }
.ob-number { color: var(--color-accent-text); font-variant-numeric: tabular-nums; }
.ob-title { color: var(--color-text); font-size: var(--ob-title); font-weight: 700; line-height: 1.1; letter-spacing: -.028em; outline: none; overflow-wrap: anywhere; text-wrap: balance; }
.ob-help { max-width: 60ch; margin: 14px 0 0; color: var(--color-text-3); font-size: clamp(15px, .5vw + 13px, 17px); line-height: 1.45; letter-spacing: -.01em; }
.ob-note { width: fit-content; max-width: 62ch; margin: var(--space-4) 0 0; padding: 10px 14px; border-radius: var(--radius-md); background: var(--color-warning-soft); color: var(--color-warning); font-size: var(--text-body); }
.ob-control { margin-top: var(--space-8); }
.ob-error { width: fit-content; max-width: 62ch; margin: var(--space-4) 0 0; padding: 10px 14px; border-radius: var(--radius-md); background: var(--color-danger-soft); color: var(--color-danger); font-size: var(--text-body); font-weight: 500; }

/* Fields: the one big answer, and the fields in lists. The white input with its border comes from studio.css. */
.ob-input, .ob-field { min-height: 52px; padding: 13px var(--space-4); border-radius: var(--radius-md); font-size: 17px; line-height: 1.4; }
textarea.ob-input { resize: vertical; }

.ob-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-4); margin-top: var(--space-8); }
.ob-actions > button { min-height: 50px; font-size: 17px; }
.ob-ok { padding: 0 28px; }
.ob-shell.is-busy .ob-ok { cursor: progress; }
.ob-hint { margin: 0; color: var(--color-text-3); font-size: var(--text-footnote); }
.ob-hint-below { margin-top: 14px; }
.ob-hint kbd { padding: 2px 7px; border-radius: 6px; background: var(--color-fill-soft); color: var(--color-text-2); font: inherit; font-size: var(--text-caption); font-weight: 600; }
@media (hover: none) and (pointer: coarse) { .ob-hint { display: none; } }

/* Choices: a grey tile with a letter, a label and a tick; the chosen one turns accent-soft with the accent ring. */
.ob-options { display: flex; flex-direction: column; gap: 10px; max-width: 620px; }
.ob-option { display: flex; align-items: center; justify-content: flex-start; gap: 14px; width: 100%; min-height: 60px; padding: 12px 18px 12px 14px; border: 0; border-radius: var(--radius-row);
  background: var(--color-tile); color: var(--color-text); font-size: 17px; font-weight: 500; text-align: left; }
.ob-option:hover:not(:disabled) { background: var(--color-tile-hover); }
.ob-option.is-on, .ob-option.is-on:hover:not(:disabled) { background: var(--color-accent-soft); box-shadow: inset 0 0 0 1.5px var(--color-accent); }
.ob-key { display: grid; place-items: center; flex: 0 0 28px; height: 28px; border-radius: 8px; background: var(--color-surface); box-shadow: var(--shadow-card);
  color: var(--color-text-2); font-size: var(--text-caption); font-weight: 700; }
.ob-option.is-on .ob-key { background: var(--color-accent); box-shadow: none; color: var(--color-on-accent); }
.ob-option-copy { display: flex; flex: 1; flex-direction: column; gap: 2px; min-width: 0; }
.ob-option-copy strong { font-weight: 600; line-height: 1.3; }
.ob-option-copy span { color: var(--color-text-2); font-size: var(--text-body); font-weight: 400; line-height: 1.4; }
.ob-tick { visibility: hidden; color: var(--color-accent-text); font-size: 17px; font-weight: 700; }
.ob-option.is-on .ob-tick { visibility: visible; }

/* Choices with a picture (logo and icon from the website): the picture sits on white. */
.ob-options-pictures { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); max-width: none; }
.ob-options-pictures .ob-option { position: relative; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: var(--space-3); padding: 50px 12px 14px; border-radius: var(--radius-lg); }
.ob-options-pictures .ob-key { position: absolute; top: 12px; left: 12px; }
.ob-options-pictures .ob-tick { position: absolute; top: 14px; right: 16px; }
.ob-picture { display: grid; place-items: center; height: 120px; padding: var(--space-3); border-radius: var(--radius-md); background: var(--color-surface); box-shadow: var(--shadow-card); }
.ob-picture img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; }
.ob-picture-icon img { width: 64px; height: 64px; }
.ob-status { display: flex; align-items: center; gap: 10px; margin: 0; color: var(--color-text-2); font-size: var(--text-body); }
.ob-quiet { margin: 0; color: var(--color-text-3); font-size: var(--text-body); }

/* Lists: calls to action, rules, facts, products. A fact is a grey tile; "Zgadza się" is a white capsule on it. */
.ob-stack { display: flex; flex-direction: column; align-items: stretch; gap: var(--space-4); }
.ob-stack > button { align-self: flex-start; }
.ob-rows { display: flex; flex-direction: column; gap: 10px; }
.ob-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-2); align-items: center; }
.ob-row-tagged { grid-template-columns: minmax(0, 1fr) auto auto; }
.ob-fact { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: var(--space-4) 18px; border-radius: var(--radius-row); background: var(--color-tile); transition: opacity var(--duration-fast); }
.ob-fact p { margin: 0 0 2px; color: var(--color-text); font-size: 16px; line-height: 1.45; }
.ob-fact a { overflow-wrap: anywhere; }
.ob-product { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 2fr); gap: var(--space-2) 10px; align-items: center; }
.ob-fact.is-off, .ob-product.is-off { opacity: .55; }
.ob-fact input[type="checkbox"], .ob-product input[type="checkbox"], .ob-check input { width: 20px; min-height: 20px; height: 20px; margin: 2px 0 0; flex: none; }
.ob-check { display: flex; align-items: center; gap: var(--space-2); min-height: 36px; margin: 0; padding: 0 14px 0 10px; border-radius: var(--radius-pill); background: var(--color-surface); box-shadow: var(--shadow-card);
  font-size: var(--text-footnote); font-weight: 600; white-space: nowrap; cursor: pointer; }
.ob-fact .ob-check input { margin: 0; }
.ob-fact > .brand-tag { margin-top: 2px; }
.ob-fact span.small-note { display: block; }

/* A brand book pasted or read from a file (the form comes from studio-brandbook.js). */
.brandbook-embed { display: flex; flex-direction: column; gap: 10px; }
.brandbook-embed .brandbook-text { min-height: 220px; padding: 14px var(--space-4); border-radius: var(--radius-md); font-size: 16px; line-height: 1.5; }
.brandbook-embed .brandbook-file-note { margin: 0; }

/* The look: files and colours. */
.ob-thumbs { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.ob-thumbs:empty { display: none; }
.ob-thumb { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 0; padding: 10px 10px 6px; border-radius: var(--radius-lg); background: var(--color-tile); }
.ob-thumb .ob-picture { width: 132px; height: 132px; }
.ob-remove { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px var(--space-2); }
.ob-colors { display: grid; gap: 10px; max-width: 500px; }
.ob-color { display: grid; grid-template-columns: 52px minmax(0, 1fr) 132px; gap: 14px; align-items: center; padding: 10px; border-radius: var(--radius-row); background: var(--color-tile); }
.ob-color label { margin: 0; font-size: 17px; font-weight: 500; }
.ob-color input[type="color"] { width: 52px; height: 52px; min-height: 52px; padding: 4px; border: 0; border-radius: var(--radius-md); background: var(--color-surface); box-shadow: var(--shadow-card); cursor: pointer; }
.ob-color input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.ob-color input[type="color"]::-webkit-color-swatch { border: 0; border-radius: var(--radius-md); }
.ob-color input[type="color"]::-moz-color-swatch { border: 0; border-radius: var(--radius-md); }

/* The review before finishing: a grey tile per group, its answers as lines in one white card. */
.ob-review { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.ob-review-group { padding: var(--space-5); border-radius: var(--radius-xl); background: var(--color-tile); }
.ob-review-group h3 { margin: 0 2px var(--space-3); font-size: var(--text-headline); }
.ob-review dl { margin: 0; padding: 2px var(--space-4); border-radius: var(--radius-row); background: var(--color-surface); box-shadow: var(--shadow-card); }
.ob-review-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 10px; padding: 11px 0; border-top: 1px solid var(--color-separator); font-size: var(--text-body); line-height: 1.4; }
.ob-review-row:first-child { border-top: 0; }
.ob-review dt { color: var(--color-text-3); }
.ob-review dd { display: flex; align-items: flex-start; gap: 6px; min-width: 0; margin: 0; color: var(--color-text); overflow-wrap: anywhere; }
.ob-review dd > span:first-child { flex: 1; min-width: 0; }
.ob-review dd.is-empty > span { color: var(--color-text-3); font-style: italic; }
.ob-review dd .button-text { flex: none; min-height: 28px; margin: -4px -8px -4px auto; padding: 0 10px; font-size: var(--text-footnote); }
.ob-review dd .ob-swatch:last-of-type { margin-right: auto; }
.ob-swatch { display: inline-block; flex: none; width: 20px; height: 20px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .14); }

.ob-foot { position: sticky; bottom: 0; z-index: 2; display: flex; align-items: center; gap: var(--space-3); padding: 10px var(--ob-gutter) max(12px, env(safe-area-inset-bottom));
  background: var(--material-bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); }
.ob-position { margin: 0; color: var(--color-text-3); font-size: var(--text-footnote); font-weight: 600; font-variant-numeric: tabular-nums; }
.ob-saved { margin: 0 auto 0 0; color: var(--color-success); font-size: var(--text-footnote); font-weight: 500; }
.ob-nav { display: flex; gap: 6px; }
.ob-nav .button-square { font-size: 18px; }
.ob-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Moving between questions: about 250 ms, off for people who ask for less motion. */
.ob-out-up, .ob-out-down { pointer-events: none; }
.ob-in-up { animation: ob-in-up var(--ob-time) ease-out both; }
.ob-in-down { animation: ob-in-down var(--ob-time) ease-out both; }
.ob-out-up { animation: ob-out-up var(--ob-time) ease-in both; }
.ob-out-down { animation: ob-out-down var(--ob-time) ease-in both; }
@keyframes ob-in-up { from { opacity: 0; transform: translateY(var(--ob-move)); } }
@keyframes ob-in-down { from { opacity: 0; transform: translateY(calc(-1 * var(--ob-move))); } }
@keyframes ob-out-up { to { opacity: 0; transform: translateY(calc(-1 * var(--ob-move))); } }
@keyframes ob-out-down { to { opacity: 0; transform: translateY(var(--ob-move)); } }
@keyframes ob-pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) {
  .ob-in-up, .ob-in-down, .ob-out-up, .ob-out-down, .ob-agent.is-running::before, .ob-status::before { animation: none; }
  .ob-progress span { transition: none; }
}

@media (max-width: 760px) {
  .ob-stage { align-items: start; padding: var(--space-4) var(--space-4) var(--space-6); }
  .ob-top { padding: 14px var(--space-4) 6px; }
  .ob-agent { display: none; }
  .ob-control { margin-top: var(--space-6); }
  .ob-actions { margin-top: var(--space-6); }
  .ob-ok { flex: 1 1 100%; }  /* The way on is a full-width capsule; "Pomiń" and the rest sit under it. */
  .ob-foot { position: static; padding: var(--space-2) var(--space-4) max(12px, env(safe-area-inset-bottom)); }
  .ob-product { grid-template-columns: auto minmax(0, 1fr); }
  .ob-product > input:last-child { grid-column: 2; }
  .ob-fact { grid-template-columns: auto minmax(0, 1fr); gap: 10px 12px; padding: 14px; }
  .ob-fact > .ob-check, .ob-fact > .brand-tag { grid-column: 2; justify-self: start; }
  .ob-row-tagged { grid-template-columns: minmax(0, 1fr) auto; }
  .ob-row-tagged > .brand-tag { grid-row: 2; justify-self: start; }
  .brandbook-embed .brandbook-text { min-height: 180px; }
  .brandbook-embed .brandbook-file { flex-direction: column; align-items: flex-start; }  /* Materiały does this by its container. */
  .ob-review { grid-template-columns: minmax(0, 1fr); }
  .ob-review-group { padding: var(--space-4); border-radius: var(--radius-lg); }
  .ob-options-pictures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ob-picture { height: 96px; }
  .ob-thumb .ob-picture { width: 120px; height: 120px; }
  .ob-color { grid-template-columns: 48px minmax(0, 1fr) 118px; gap: var(--space-3); }
  .ob-color label { font-size: var(--text-body); }
  .ob-color input[type="color"] { width: 48px; height: 48px; min-height: 48px; }
}
