/* ==========================================================================
   GRAFMEN BRIEF STEPPER & FORMS STYLING
   Spójny z systemem wizualnym Grafmen (Outfit + Inter, #09090b, #ff6400)
   Dostępny z klawiatury, zoptymalizowany pod kątem ekranów mobilnych i dotykowych.
   ========================================================================== */

.brief-page-wrap {
  padding-block: clamp(40px, 6vw, 80px) clamp(64px, 12vh, 120px);
}

.brief-container {
  max-width: 860px;
  width: 100%;
  margin-inline: auto;
}

/* --- ISOLATED INTRO BLOCK (Pionowy układ, brak kolizji z header z site-base.css) --- */
.brief-intro-block {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  text-align: left !important;
  width: 100% !important;
  height: auto !important;
  margin: 0 0 clamp(28px, 4vw, 36px) 0 !important;
  padding: 0 !important;
  grid-template-columns: none !important;
}

.brief-intro-kicker {
  font-family: var(--font-body, 'Inter', sans-serif);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  color: #71717a;
  margin: 0 0 12px;
}

.brief-intro-title {
  font-family: var(--font-heading, 'Outfit', sans-serif);
  font-size: clamp(32px, 4.5vw, 48px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 700;
  color: var(--ink, #09090b);
  margin: 0 0 14px;
  max-width: 100%;
  word-break: normal;
}

.brief-intro-lead {
  font-size: clamp(16px, 1.8vw, 18px);
  line-height: 1.55;
  color: #62626b;
  max-width: 680px;
  margin: 0;
}

/* --- STEPPER PROGRESS BAR --- */
.brief-stepper {
  background: #ffffff;
  border: 1px solid #e4e4e7;
  border-radius: 16px;
  padding: 20px clamp(20px, 3.5vw, 32px);
  margin-bottom: 24px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.stepper-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}

.stepper-step-indicator {
  font-size: 14px;
  font-weight: 600;
  color: var(--orange, #ff6400);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stepper-step-title {
  font-family: var(--font-heading, 'Outfit', sans-serif);
  font-size: 18px;
  font-weight: 600;
  color: var(--ink, #09090b);
}

.stepper-progress-track {
  height: 6px;
  background: #f0f0f2;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.stepper-progress-bar {
  height: 100%;
  background: var(--orange, #ff6400);
  border-radius: 999px;
  transition: width 0.35s cubic-bezier(0.25, 1, 0.5, 1);
}

/* --- CARD FORM WRAPPER (Białe tło, jedno delikatne obramowanie) --- */
.brief-card-box {
  background: #ffffff;
  border: 1px solid #e4e4e7;
  border-radius: 16px;
  padding: clamp(24px, 4vw, 44px);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.02);
}

/* Semantyczny fieldset bez obramowania wewnątrz */
fieldset.brief-step {
  border: none !important;
  margin: 0 !important;
  padding: 0 !important;
  min-inline-size: 0 !important;
  display: none;
}

fieldset.brief-step.is-active {
  display: block;
}

form.has-stepped fieldset.brief-step.is-active {
  animation: briefStepFadeInDesktop 1000ms cubic-bezier(0.22, 0.61, 0.36, 1) backwards;
  will-change: opacity, transform;
}

@keyframes briefStepFadeInDesktop {
  from {
    opacity: 0;
    transform: translateY(38px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 768px) {
  form.has-stepped fieldset.brief-step.is-active {
    animation-name: briefStepFadeInMobile;
  }

  @keyframes briefStepFadeInMobile {
    from {
      opacity: 0;
      transform: translateY(26px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  form.has-stepped fieldset.brief-step.is-active {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

legend.step-legend {
  display: block;
  width: 100%;
  padding: 0;
  margin: 0 0 6px;
  font-family: var(--font-heading, 'Outfit', sans-serif);
  font-size: clamp(20px, 2.4vw, 26px);
  font-weight: 700;
  line-height: 1.25;
  color: var(--ink, #09090b);
  border: none;
}

.step-desc {
  font-size: 15px;
  line-height: 1.5;
  color: #62626b;
  margin: 0 0 26px;
}

/* --- FORM FIELDS & GROUPS --- */
.brief-group {
  margin-bottom: 26px;
}

.brief-group:last-child {
  margin-bottom: 0;
}

.brief-label {
  display: block;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink, #09090b);
  line-height: 1.4;
  margin-bottom: 8px;
}

.brief-label .req {
  color: var(--orange, #ff6400);
  margin-left: 2px;
}

.brief-hint {
  font-size: 13.5px;
  color: #71717a;
  margin-top: -4px;
  margin-bottom: 10px;
  line-height: 1.45;
}

.brief-input,
.brief-textarea {
  box-sizing: border-box;
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid #d4d4d8;
  border-radius: 10px;
  background: #ffffff;
  color: var(--ink, #09090b);
  font-family: var(--font-body, 'Inter', sans-serif);
  font-size: 16px;
  line-height: 1.5;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.brief-textarea {
  min-height: 96px;
  resize: vertical;
}

.brief-input:focus-visible,
.brief-textarea:focus-visible {
  outline: none;
  border-color: var(--orange, #ff6400);
  box-shadow: 0 0 0 3px rgba(255, 100, 0, 0.18);
}

.brief-input.is-invalid,
.brief-textarea.is-invalid {
  border-color: #ef4444 !important;
  background-color: #fffaf0;
}

/* --- SELECTION TILES (SIATKA 2 × 2 NA DESKTOPIE, 1 KOLUMNA NA MOBILE) --- */
.tiles-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.tiles-grid.is-invalid {
  border: 1.5px solid #ef4444;
  border-radius: 12px;
  padding: 8px;
  background: rgba(239, 68, 68, 0.03);
}

.tile-choice {
  position: relative;
  display: flex;
  cursor: pointer;
  user-select: none;
  width: 100%;
}

.tile-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.tile-body {
  flex: 1;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: #ffffff;
  border: 1.5px solid #d4d4d8;
  border-radius: 12px;
  transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
  min-height: 100%;
  box-sizing: border-box;
}

.tile-choice:hover .tile-body {
  border-color: #71717a;
  background-color: #fafafa;
}

.tile-input:focus-visible + .tile-body {
  border-color: var(--orange, #ff6400);
  box-shadow: 0 0 0 3px rgba(255, 100, 0, 0.22);
}

.tile-input:checked + .tile-body {
  border-color: var(--orange, #ff6400);
  background-color: rgba(255, 100, 0, 0.05);
}

.tile-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  flex-shrink: 0;
  border: 1.5px solid #a1a1aa;
  border-radius: 50%;
  background: #ffffff;
  transition: border-color 0.18s ease, background-color 0.18s ease;
}

.tile-choice.is-checkbox .tile-indicator {
  border-radius: 5px;
}

.tile-input:checked + .tile-body .tile-indicator {
  border-color: var(--orange, #ff6400);
  background-color: var(--orange, #ff6400);
  color: #ffffff;
}

/* Radio button dot */
.tile-choice:not(.is-checkbox) .tile-indicator::after {
  content: "";
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffffff;
  transform: scale(0);
  transition: transform 0.15s ease-in-out;
}

.tile-choice:not(.is-checkbox) .tile-input:checked + .tile-body .tile-indicator::after {
  transform: scale(1);
}

/* Checkbox icon */
.tile-check-icon {
  width: 12px;
  height: 12px;
  opacity: 0;
  stroke: #ffffff;
  stroke-width: 3;
}

.tile-input:checked + .tile-body .tile-check-icon {
  opacity: 1;
}

.tile-label-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.tile-title {
  font-size: 15.5px;
  font-weight: 600;
  color: var(--ink, #09090b);
  line-height: 1.35;
}

.tile-desc {
  font-size: 13.5px;
  color: #62626b;
  line-height: 1.4;
}

/* Trzy opcje: trzecia rozciągnięta w drugim rzędzie dla symetrii */
.tiles-grid.is-3 .tile-choice:last-child {
  grid-column: span 2;
}

/* --- OPTIONAL PHONE TOGGLE --- */
.phone-toggle-wrap {
  margin-top: 14px;
}

.phone-toggle-btn {
  background: none;
  border: none;
  color: var(--orange, #ff6400);
  font: inherit;
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.15s;
}

.phone-toggle-btn:hover {
  color: #d14d00;
  text-decoration: underline;
}

.phone-field-box {
  margin-top: 12px;
  animation: briefFadeIn 0.25s ease;
}

.phone-field-box[hidden] {
  display: none;
}

/* --- SUMMARY STEP (STEP 4) --- */
.summary-container {
  display: grid;
  gap: 16px;
}

.summary-card {
  background: #ffffff;
  border: 1px solid #e4e4e7;
  border-radius: 12px;
  padding: 18px 22px;
}

.summary-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #f0f0f2;
  padding-bottom: 10px;
  margin-bottom: 12px;
}

.summary-card-title {
  font-family: var(--font-heading, 'Outfit', sans-serif);
  font-size: 16px;
  font-weight: 600;
  color: var(--ink, #09090b);
  margin: 0;
}

.summary-edit-btn {
  background: none;
  border: none;
  color: var(--orange, #ff6400);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background-color 0.15s, color 0.15s;
}

.summary-edit-btn:hover {
  background: rgba(255, 100, 0, 0.08);
  color: #d14d00;
}

.summary-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.summary-item {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) 2fr;
  gap: 12px;
  font-size: 14.5px;
  line-height: 1.5;
}

.summary-key {
  color: #71717a;
  font-weight: 500;
}

.summary-val {
  color: var(--ink, #09090b);
  word-break: break-word;
}

/* --- BUTTONS & ACTIONS BAR --- */
.brief-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid #e4e4e7;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 52px;
  min-height: 52px;
  padding: 0 22px;
  border: 1px solid #d4d8de;
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink, #09090b);
  font-family: var(--font-body, 'Inter', sans-serif);
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.2s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.2s cubic-bezier(0.22, 1, 0.36, 1), color 0.2s cubic-bezier(0.22, 1, 0.36, 1);
  text-decoration: none;
  white-space: nowrap;
}

.btn-secondary span[aria-hidden="true"] {
  display: inline-block;
  font-size: 15px;
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.btn-secondary:not(.f3-link):hover:not(:disabled),
.btn-secondary:not(.f3-link):focus-visible:not(:disabled) {
  border-color: #09090b;
  background: #f4f4f5;
  color: var(--orange, #ff6400);
}

.btn-secondary:not(.f3-link):hover:not(:disabled) span[aria-hidden="true"],
.btn-secondary:not(.f3-link):focus-visible:not(:disabled) span[aria-hidden="true"] {
  transform: translateX(-4px);
}

.btn-secondary:focus-visible {
  outline: 2px solid var(--orange, #ff6400);
  outline-offset: 2px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  height: 52px;
  min-height: 52px;
  padding: 0 24px;
  border: none;
  border-radius: 8px;
  background: #09090b;
  color: #ffffff;
  font-family: var(--font-body, 'Inter', sans-serif);
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.2s cubic-bezier(0.22, 1, 0.36, 1), color 0.2s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s;
  margin-left: auto;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary span[aria-hidden="true"] {
  display: inline-block;
  font-size: 16px;
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.btn-primary:not(.f3-link):hover:not(:disabled),
.btn-primary:not(.f3-link):focus-visible:not(:disabled) {
  background: #1a1a1f;
  color: var(--orange, #ff6400);
}

.btn-primary:not(.f3-link):hover:not(:disabled) span[aria-hidden="true"],
.btn-primary:not(.f3-link):focus-visible:not(:disabled) span[aria-hidden="true"] {
  transform: translateX(4px);
}

.btn-primary:focus-visible {
  outline: 2px solid var(--orange, #ff6400);
  outline-offset: 2px;
}

.btn-primary:disabled,
.btn-secondary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary.is-submitting {
  position: relative;
  pointer-events: none;
}

.btn-primary.is-submitting::after {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #ffffff;
  border-top-color: transparent;
  border-radius: 50%;
  animation: briefSpin 0.7s linear infinite;
  margin-left: 8px;
}

@keyframes briefSpin {
  to { transform: rotate(360deg); }
}

/* --- FEEDBACK STATUS NOTICES --- */
.brief-status-box {
  margin-top: 20px;
  padding: 16px 20px;
  border-radius: 10px;
  font-size: 15px;
  line-height: 1.5;
}

.brief-status-box[hidden] {
  display: none;
}

.brief-status-box.is-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.brief-status-box.is-error a {
  color: #991b1b;
  font-weight: 600;
  text-decoration: underline;
}

.brief-status-box.is-success {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}

/* Ekran sukcesu */
.brief-success-screen {
  text-align: center;
  padding: clamp(32px, 6vw, 64px) 24px;
}

.brief-success-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border-radius: 50%;
  margin-bottom: 24px;
}

.brief-success-screen h2 {
  font-family: var(--font-heading, 'Outfit', sans-serif);
  font-size: clamp(24px, 3.5vw, 36px);
  color: var(--ink, #09090b);
  margin: 0 0 16px;
}

.brief-success-screen p {
  font-size: 16px;
  color: #62626b;
  line-height: 1.6;
  max-width: 520px;
  margin: 0 auto 32px;
}

/* Honeypot field */
.botcheck-field {
  display: none !important;
  visibility: hidden !important;
  position: absolute !important;
  left: -9999px !important;
}

/* --- CALLOUT POD PAKIETAMI (SEKCJA ZAPROSZENIA DO BRIEFU) --- */
.packages-brief-callout {
  margin-top: clamp(48px, 6vw, 64px);
  background: #ffffff;
  border: 1px solid #e4e4e7;
  border-radius: 16px;
  padding: clamp(28px, 3.5vw, 36px) clamp(24px, 4vw, 40px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.02);
  text-align: left;
}

.packages-brief-callout-content {
  max-width: 620px;
}

.packages-brief-callout-title {
  font-family: var(--font-heading, 'Outfit', sans-serif);
  font-size: clamp(22px, 2.5vw, 26px);
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--ink, #09090b);
  margin: 0 0 8px;
}

.packages-brief-callout-desc {
  font-size: 15.5px;
  line-height: 1.5;
  color: #62626b;
  margin: 0;
}

.packages-brief-callout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  gap: 18px;
  height: 52px;
  min-height: 52px;
  padding: 0 24px;
  background: #0b0b0d;
  color: #ffffff;
  font-family: var(--font-body, 'Inter', sans-serif);
  font-size: 15px;
  font-weight: 600;
  border-radius: 8px;
  text-decoration: none;
  border: 0;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.packages-brief-callout-btn:hover,
.packages-brief-callout-btn:focus-visible {
  background: #1a1a1f;
  color: #ffffff;
}

.packages-brief-callout-btn:focus-visible {
  outline: 2px solid var(--orange, #ff6400);
  outline-offset: 2px;
}

/* --- RESPONSIVENESS & SAFE MARGINS --- */
@media (max-width: 768px) {
  .packages-brief-callout {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
    padding: 24px 20px;
  }
  .packages-brief-callout-btn {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .tiles-grid {
    grid-template-columns: 1fr;
  }
  .tiles-grid.is-3 .tile-choice:last-child {
    grid-column: auto;
  }
  .summary-item {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .brief-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }
  .btn-primary,
  .btn-secondary {
    width: 100%;
    justify-content: center;
  }
  .brief-page-wrap {
    padding-bottom: 96px;
  }
}
