/* Kanon TXC — wartości z DESIGN.md brand booka (fiolet/indygo/pomarańcz/żółty,
   Titillium Web + Inter). Nie wprowadzaj tu własnych odcieni marki. */
:root {
  --brand-blue: #4C20E4;
  --brand-indigo: #450087;
  --brand-orange: #F0680C;
  --brand-yellow: #FFD300;
  --black: #000000;
  --grey-light: #F7F7F7;
  --grey: #F0F0F0;
  --line: #E2E2E2;
  --muted: #555555;
  --white: #FFFFFF;
  --system-error: #F82E47;
  --font-head: 'Titillium Web', Arial, sans-serif;
  --font-body: 'Inter', Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  background: var(--grey-light);
  color: var(--black);
  line-height: 1.55;
}

h1, h2, h3, button, .btn-link, summary, label { font-family: var(--font-head); }

.wrap { max-width: 1040px; margin: 0 auto; padding-inline: 20px; }

:focus-visible { outline: 2px solid var(--brand-blue); outline-offset: 2px; }

/* Pasek brandowy nad nagłówkiem — tylko na ekranie klucza. Po wejściu do aplikacji
   jego rolę przejmuje pasek kroków (brand book: maksymalnie jeden pasek na widok). */
.brand-bar {
  height: 8px;
  background: linear-gradient(to right,
    #FFD300 0 10%, #F0680C 10% 30%, #4C20E4 30% 60%, #450087 60% 100%);
}
body.app-open .brand-bar { display: none; }

header.site {
  background: var(--white);
  border-bottom: 1px solid var(--line);
  padding-block: 20px;
}
.head-row { display: flex; align-items: center; gap: 18px; }
.head-row img.logo { height: 40px; width: auto; display: block; }
header.site h1 { margin: 0; font-size: 1.4rem; font-weight: 700; line-height: 1.2; }
header.site .sub { margin: 2px 0 0; color: var(--muted); font-size: 0.95rem; }

main.wrap { padding-block: 28px 12px; }

/* --- ekran klucza ------------------------------------------------------------ */
.gate {
  max-width: 480px;
  margin: 48px auto;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px;
}
.gate h2 { margin: 0 0 8px; font-size: 1.5rem; }
.gate p { margin: 0 0 18px; color: var(--muted); }

/* --- pasek kroków = pasek brandowy -------------------------------------------- */
.steps { margin-bottom: 28px; scroll-margin-top: 80px; }
.steps ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 2fr 3fr 4fr; /* proporcje segmentów z brand booka */
}
.steps li { --seg: var(--brand-yellow); position: relative; min-width: 0; }
.steps li[data-step="2"] { --seg: var(--brand-orange); }
.steps li[data-step="3"] { --seg: var(--brand-blue); }
.steps li[data-step="4"] { --seg: var(--brand-indigo); }

.steps button {
  display: block;
  width: 100%;
  padding: 26px 8px 0 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
}
/* segment paska z kołem na początku (koło = wysokość paska, jak w pasek-brandowy.svg) */
.steps button::before {
  content: "";
  position: absolute;
  top: 6px;
  left: 0;
  right: 0;
  height: 12px;
  background: var(--seg);
  border-radius: 6px 0 0 6px;
  transition: opacity 0.3s;
}
.steps li:not(.reachable) button::before { opacity: 0.2; }
.steps li:not(.reachable) button { cursor: default; color: #9a9a9a; }
.steps li.current button { color: var(--black); }
.steps li.current .lbl { border-bottom: 3px solid var(--seg); padding-bottom: 2px; }
.steps li.reachable:not(.current) button:hover .lbl { text-decoration: underline; }
.steps button:disabled { cursor: default; }
.steps .node { display: none; }

.step-caption { display: none; margin: 10px 0 0; font-family: var(--font-head); font-weight: 600; }
@media (max-width: 680px) {
  .steps .lbl { display: none; }
  .steps button { padding-top: 22px; }
  .step-caption { display: block; }
}

/* --- panel kroku --------------------------------------------------------------- */
.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 32px clamp(20px, 4vw, 40px);
  margin-bottom: 40px;
}
.panel h2 { margin: 0 0 8px; font-size: clamp(1.5rem, 3vw, 2rem); line-height: 1.2; font-weight: 700; }
.panel .lead { margin: 0 0 24px; max-width: 64ch; color: #333; font-size: 1.05rem; }
.panel h3 { margin: 28px 0 4px; font-size: 1.05rem; color: var(--brand-indigo); }
.hint { color: var(--muted); font-size: 0.9rem; margin: 0 0 12px; max-width: 70ch; }

form label, .panel > label { display: block; margin: 18px 0 6px; font-weight: 600; font-size: 0.95rem; }
.req { color: var(--system-error); }
.opt { color: var(--muted); font-weight: 400; font-size: 0.85rem; font-family: var(--font-body); }

input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #CFCFCF;
  border-radius: 8px;
  font: inherit;
  font-family: var(--font-body);
  background: var(--white);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-blue); outline-offset: -1px; border-color: transparent; }
textarea { resize: vertical; }

.row { display: flex; gap: 10px; }
.row input { flex: 1; }

details.more { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
details.more summary { cursor: pointer; font-weight: 600; color: var(--brand-blue); }
.two-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 560px) { .two-cols { grid-template-columns: 1fr; } }

/* --- przyciski ------------------------------------------------------------------ */
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-top: 28px; }

button.primary, .btn-link.primary, button.secondary, button.link { font-size: 1rem; font-weight: 700; cursor: pointer; }
button.primary, .btn-link.primary {
  background: var(--brand-blue);
  color: var(--white);
  border: 2px solid var(--brand-blue);
  border-radius: 10px;
  padding: 12px 22px;
  text-decoration: none;
  display: inline-block;
}
button.primary:hover:not(:disabled), .btn-link.primary:hover { background: var(--brand-indigo); border-color: var(--brand-indigo); }
button.primary:disabled { background: #C9BEF5; border-color: #C9BEF5; cursor: not-allowed; }
button.secondary {
  background: var(--white);
  color: var(--brand-blue);
  border: 2px solid var(--brand-blue);
  border-radius: 10px;
  padding: 12px 20px;
}
button.secondary:hover:not(:disabled) { background: var(--grey-light); color: var(--brand-indigo); }
button.secondary:disabled { color: #A8A8A8; border-color: #D5D5D5; cursor: not-allowed; }
button.link {
  background: none;
  border: 0;
  padding: 12px 4px;
  color: var(--brand-blue);
  text-decoration: underline;
  text-underline-offset: 3px;
}
button.link:disabled { color: #A8A8A8; cursor: not-allowed; }

.status { margin: 14px 0 0; color: var(--brand-indigo); font-weight: 600; }
.status.error { color: var(--system-error); }

/* --- krok 1: inspiracje ------------------------------------------------------------ */
.presets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-bottom: 8px;
}
.preset {
  text-align: left;
  background: var(--grey-light);
  border: 2px solid transparent;
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  font-family: var(--font-body);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.preset strong { font-family: var(--font-head); font-size: 0.98rem; color: var(--black); }
.preset span { font-size: 0.82rem; color: var(--muted); line-height: 1.35; }
.preset:hover:not(:disabled) { border-color: #CFC3F7; }
.preset.selected { border-color: var(--brand-blue); background: #F3F0FE; }
.preset:disabled { opacity: 0.5; cursor: not-allowed; }

/* --- krok 2: szkice ------------------------------------------------------------------ */
.concepts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.concept {
  position: relative;
  padding: 0;
  border: 3px solid transparent;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  background: var(--grey);
  display: block;
}
.concept img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.concept:hover:not(:disabled) { border-color: #CFC3F7; }
.concept.selected { border-color: var(--brand-blue); }
.concept.selected::after {
  content: "Wybrany";
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--brand-blue);
  color: var(--white);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 3px 12px;
  border-radius: 999px;
}

.concept.skeleton {
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: flex-end;
  padding: 10px 12px;
  cursor: default;
  border: 0;
  background: linear-gradient(100deg, var(--grey) 30%, #E7E1FB 50%, var(--grey) 70%);
  background-size: 300% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
.concept.skeleton span { font-size: 0.85rem; color: #777; font-family: var(--font-head); }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* --- krok 3: dopracowanie ------------------------------------------------------------- */
.preview {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  background: var(--grey);
}
.preview img { width: 100%; height: 100%; object-fit: cover; display: block; }

#silhouette { display: none; position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#silhouette.show { display: block; }
#silhouette ellipse, #silhouette path { fill: rgba(69, 0, 135, 0.45); }

.badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--brand-indigo);
  color: var(--white);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 3px 12px;
  border-radius: 999px;
}

.preview-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(69, 0, 135, 0.72);
  color: var(--white);
  text-align: center;
  font-family: var(--font-head);
  backdrop-filter: blur(2px);
}
.preview-overlay strong { font-size: 1.15rem; }
.preview-overlay span:last-child { font-size: 0.9rem; opacity: 0.85; font-variant-numeric: tabular-nums; }

.check { display: inline-flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 0.92rem; font-family: var(--font-body); font-weight: 400; cursor: pointer; }
.check input { width: auto; margin: 0; }

.versions { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.version {
  flex: 0 0 150px;
  padding: 0;
  border: 3px solid transparent;
  border-radius: 10px;
  overflow: hidden;
  background: var(--grey);
  cursor: pointer;
  text-align: left;
}
.version img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.version span { display: block; padding: 4px 8px; font-size: 0.85rem; font-weight: 600; background: var(--white); }
.version.selected { border-color: var(--brand-blue); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip {
  background: var(--grey-light);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  cursor: pointer;
}
.chip:hover:not(:disabled) { border-color: var(--brand-blue); color: var(--brand-blue); }

/* --- krok 4: gotowe --------------------------------------------------------------------- */
.final { display: grid; grid-template-columns: 3fr 2fr; gap: 28px; align-items: start; }
@media (max-width: 760px) { .final { grid-template-columns: 1fr; } }
.final img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 12px; display: block; background: var(--grey); }
.final-side .btn-link.primary { font-size: 1.1rem; padding: 14px 28px; }
.final-side .hint { margin-top: 8px; }
.final-side h3 { margin-top: 20px; }
.howto-steps { margin: 8px 0 0; padding-left: 1.3em; }
.howto-steps li { margin-bottom: 8px; }

/* --- galeria zespołu ---------------------------------------------------------------------- */
.team-gallery { margin-bottom: 32px; }
.team-gallery h2 { margin: 0 0 4px; font-size: 1.25rem; }
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
}
.gallery a { display: block; border-radius: 8px; overflow: hidden; border: 2px solid transparent; }
.gallery img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.gallery a:hover { border-color: var(--brand-blue); }

footer { padding-block: 0 32px; }

/* --- stan „model pracuje” ----------------------------------------------------------------- */
.work-banner {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 50;
  background: var(--brand-indigo);
  color: var(--white);
  box-shadow: 0 4px 14px rgba(69, 0, 135, 0.25);
}
.work-row { display: flex; align-items: center; gap: 14px; padding-block: 12px; }
.work-text { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.work-text strong { font-family: var(--font-head); font-size: 1.05rem; }
.work-time { opacity: 0.85; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.work-bar { height: 5px; background: rgba(255, 255, 255, 0.18); }
#work-bar-fill { height: 100%; width: 0%; background: linear-gradient(to right, #FFD300, #F0680C); transition: width 0.5s ease; }

.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: var(--brand-yellow);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex: none;
}
.spinner.big { width: 44px; height: 44px; border-width: 4px; }
@keyframes spin { to { transform: rotate(360deg); } }

button.working, button.working:disabled {
  background: var(--brand-indigo);
  border-color: var(--brand-indigo);
  color: var(--white);
  cursor: progress;
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(76, 32, 228, 0.25); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 3s !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* --- poprawki po przeglądzie zrzutów --- */
/* główna akcja zawsze pierwsza w rzędzie przycisków */
.actions .primary { order: -1; }
/* komunikat pustej galerii na całą szerokość siatki */
.gallery > .hint { grid-column: 1 / -1; }
footer.wrap { max-width: 1040px; margin-inline: auto; }
/* telefon: inspiracje jako zwarta siatka samych nazw, żeby nie spychały formularza */
@media (max-width: 560px) {
  .presets { grid-template-columns: 1fr 1fr; }
  .preset span { display: none; }
}
