/* ── Contact + footer — ONE shared photo card, not two separate backgrounds ── */
.contact-footer-merged {
  position: relative;
  margin: 3rem;
  border-radius: 22px;
  background-color: var(--charcoal);
  background-image:
    linear-gradient(to bottom, rgba(44, 40, 36, 0.3) 0%, rgba(44, 40, 36, 0.4) 25%, rgba(44, 40, 36, 0.58) 50%, rgba(44, 40, 36, 0.72) 75%, rgba(44, 40, 36, 0.85) 100%),
    url("/images/uploads/contact-footer-full.webp");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  box-shadow: 0 26px 50px -22px rgba(44, 40, 36, 0.4);
  aspect-ratio: 1448 / 1086;
  display: flex;
  flex-direction: column;
}

#contact {
  background: transparent;
  position: relative;
  flex: 3 1 0;
  display: flex;
  align-items: center;
}

#footer.footer-merged-half {
  background: transparent;
  position: relative;
  z-index: 1;
  border-top: 1px solid rgba(253, 250, 247, 0.18);
  flex: 2 1 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.footer-merged-half .footer-inner { padding: 2rem 2rem 1.5rem; width: 100%; }
.footer-merged-half .footer-bottom { padding: 1rem 2rem; }

/* Past 1440px the aspect ratio makes the card taller than the screen (1848px at 2560px):
   let height follow content (at least one screen) and keep the footer strip at its natural height. */
@media (min-width: 1441px) {
  .contact-footer-merged { aspect-ratio: auto; min-height: min(100svh, 75vw); }
  #footer.footer-merged-half { flex: 0 0 auto; }
}

/* ── Decorative background SVGs ── */
.contact-decor {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}


.cd-dots {
  position: absolute;
  right: 3%;
  bottom: 6%;
  width: 192px;
  height: 192px;
  opacity: 0.25;
}

.cd-cross {
  position: absolute;
  right: 28%;
  top: 7%;
  width: 100px;
  height: 100px;
  opacity: 0.2;
}

#contact .section-inner {
  position: relative;
  z-index: 1;
  padding-top: 2.5rem;
  padding-bottom: 2.5rem;
  width: 100%;
}

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1.8fr;
  gap: 5rem;
  align-items: center;
}

/* ── Left — info column ── */
.contact-info h1,
.contact-info h2 {
  margin-bottom: 1.25rem;
  font-size: clamp(2rem, 4vw, 3rem);
  color: var(--cream);
}
.contact-info > p {
  color: var(--stone);
  margin-bottom: 2.75rem;
  line-height: 1.85;
  max-width: 30ch;
}

.contact-details {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.contact-details li,
.contact-details a {
  font-size: 1.05rem;
  color: var(--cream);
  letter-spacing: 0.03em;
}
.contact-details a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: color 0.2s, gap 0.2s;
}
.contact-details a::before {
  content: '—';
  font-size: 0.7rem;
  color: var(--warm);
  letter-spacing: 0;
  transition: margin-right 0.2s;
}
/* Plain-text row (location): invisible dash spacer so its text lines up with the linked rows */
.contact-location {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.contact-location::before {
  content: '—';
  font-size: 0.7rem;
  letter-spacing: 0;
  visibility: hidden;
}
.contact-details a:hover {
  color: var(--warm);
  gap: 0.75rem;
}

/* ── Floating card ── */
.contact-form {
  background: var(--white);
  border-radius: 14px;
  padding: 3.25rem 3rem 3rem;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  box-shadow:
    0 2px 6px  rgba(44, 40, 36, 0.04),
    0 12px 40px rgba(44, 40, 36, 0.10),
    0 40px 88px rgba(44, 40, 36, 0.08);
}

/* Warm accent line at the top of the card */
.contact-form::before {
  content: '';
  position: absolute;
  top: 0;
  left: 2.5rem;
  right: 2.5rem;
  height: 2px;
  background: linear-gradient(90deg, var(--warm), transparent);
}

/* ── Form layout ── */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row-fieldsets { align-items: start; }

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  position: relative;
}

.form-group label {
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--warm);
  font-family: var(--font-body);
}

/* Line-only inputs — refined, airy */
.form-group input,
.form-group select,
.form-group textarea {
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(196, 181, 165, 0.7);
  padding: 0.75rem 0;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--charcoal);
  outline: none;
  border-radius: 0;
  -webkit-appearance: none;
  transition: border-color 0.3s ease;
  width: 100%;
}

.form-group input::placeholder,
.form-group select::placeholder,
.form-group textarea::placeholder {
  color: var(--stone);
  font-size: 0.95rem;
}

/* Animated underline on focus */
.form-group {
  isolation: isolate;
}
.form-group::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--warm);
  transition: width 0.35s ease;
}
.form-group:has(input:focus)::after,
.form-group:has(select:focus)::after,
.form-group:has(textarea:focus)::after {
  width: 100%;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-bottom-color: transparent;
}

.form-group input.error,
.form-group textarea.error {
  border-bottom-color: #c0392b;
}

.form-group textarea {
  resize: none;
  height: 120px;
}

/* ── Checkbox group ── */
.form-checkboxes {
  border: none;
  padding: 0;
  margin: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.form-checkboxes legend {
  padding: 0;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--warm);
  font-family: var(--font-body);
}
.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.1rem;
}
.checkbox-group-1col { flex-direction: column; }
.checkbox-group-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
/* Too narrow for two columns without "Celý dům/byt" / "Dětský pokojík" breaking onto two lines:
   phones, 769–829px (form stacked but its two fieldsets side by side), and 1025–1279px (form in a
   narrow column beside the contact info) */
@media (max-width: 480px), (min-width: 769px) and (max-width: 829px), (min-width: 1025px) and (max-width: 1279px) {
  .checkbox-group-2col { grid-template-columns: 1fr; }
}
.checkbox-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  color: var(--charcoal);
  cursor: pointer;
  user-select: none;  /* quick repeated taps shouldn't select the label text */
}
.checkbox-item input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border: 1px solid var(--stone);
  border-radius: 3px;
  position: relative;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.checkbox-item input[type="checkbox"]:checked {
  background: var(--warm);
  border-color: var(--warm);
}
.checkbox-item input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 1px;
  width: 6px;
  height: 11px;
  border: solid var(--white);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.checkbox-item input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--warm);
  outline-offset: 2px;
}
.checkbox-item input[type="checkbox"].error {
  border-color: #c0392b;
}

/* ── Option row with info tooltip ── */
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.info-tip {
  position: relative;
  width: 17px;
  height: 17px;
  padding: 0;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid var(--stone);
  background: transparent;
  color: var(--warm);
  font-family: var(--font-heading);
  font-style: italic;
  font-size: 0.8rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: help;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.info-tip:hover,
.info-tip:focus-visible,
.info-tip.is-shown {
  background: var(--warm);
  border-color: var(--warm);
  color: var(--white);
  outline: none;
}
.info-tip::after {
  content: attr(data-tip);
  position: absolute;
  left: -8px;
  bottom: calc(100% + 8px);
  width: max-content;
  max-width: 240px;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  background: var(--charcoal);
  color: var(--cream);
  font-family: var(--font-body);
  font-style: normal;
  font-weight: 300;
  font-size: 0.8rem;
  line-height: 1.5;
  text-align: left;
  white-space: normal;
  box-shadow: 0 10px 24px -8px rgba(44, 40, 36, 0.4);
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
  pointer-events: none;
  z-index: 5;
}
.info-tip:hover::after,
.info-tip:focus-visible::after,
.info-tip.is-shown::after {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* ── Validation messages (contact-form.js reports every missing field at once) ── */
.field-error {
  margin-top: 0.4rem;
  font-size: 0.8rem;
  line-height: 1.4;
  color: #b3261e;
}
.form-group.has-error input,
.form-group.has-error textarea { border-bottom-color: #b3261e; }
.form-checkboxes.has-error legend { color: #b3261e; }
.form-checkboxes.has-error .checkbox-item input[type="checkbox"] { border-color: #b3261e; }
.form-checkboxes.has-error .choice-toggle { border-bottom-color: #b3261e; }

.form-errors {
  padding: 0.9rem 1.1rem;
  border-left: 3px solid #b3261e;
  border-radius: 4px;
  background: #fbeeec;
  color: var(--charcoal);
  font-size: 0.9rem;
}
.form-errors-title { font-weight: 500; margin-bottom: 0.35rem; }
.form-errors ul { list-style: none; display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; }
.form-errors button {
  padding: 0;
  background: none;
  border: none;
  font: inherit;
  color: #b3261e;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* ── Dictation (microphone in the message box; shown only where the browser supports it) ── */
.message-wrap { position: relative; }
.message-wrap textarea { width: 100%; padding-right: 2.75rem; }
.dictate-btn {
  position: absolute;
  right: 0;
  bottom: 0.6rem;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--stone);
  border-radius: 50%;
  background: var(--white);
  color: var(--warm);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.dictate-btn[hidden] { display: none; }
.dictate-btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}
.dictate-btn:hover,
.dictate-btn:focus-visible { border-color: var(--warm); outline: none; }
.dictate-btn.is-listening {
  background: var(--warm);
  border-color: var(--warm);
  color: var(--white);
  animation: dictate-pulse 1.4s ease-in-out infinite;
}
@keyframes dictate-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(139, 111, 94, 0.45); }
  50%      { box-shadow: 0 0 0 7px rgba(139, 111, 94, 0); }
}
@media (prefers-reduced-motion: reduce) { .dictate-btn.is-listening { animation: none; } }
.dictate-status { font-size: 0.8rem; color: var(--warm); min-height: 0; }
.dictate-status:empty { display: none; }

/* ── Submit button ── */
.contact-form .btn-primary {
  width: 100%;
  text-align: center;
  padding: 1.1rem;
  letter-spacing: 0.18em;
  margin-top: 0.25rem;
  font-size: 0.88rem;
  border-radius: 999px;
}

/* ── Form footer ── */
.form-note {
  font-size: 0.82rem;
  color: var(--stone);
  letter-spacing: 0.04em;
  text-align: center;
  margin-top: -0.5rem;
}

.form-privacy {
  font-size: 0.78rem;
  color: #6b635c;
  text-align: center;
  line-height: 1.5;
}
.form-privacy a { text-decoration: underline; color: inherit; }

.form-success {
  color: var(--warm);
  font-style: italic;
  font-family: var(--font-heading);
  font-size: 1.15rem;
  text-align: center;
  padding: 1rem 0;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .contact-grid { grid-template-columns: 1fr; gap: 3.5rem; }
}
@media (max-width: 768px) {
  .contact-footer-merged { margin: 1.5rem 1.25rem; border-radius: 16px; }
  #contact .section-inner { padding-top: 2.5rem; padding-bottom: 2.5rem; }
  .contact-form { margin-inline: 0.75rem; padding: 2.25rem 1.75rem 2rem; }
  .contact-form::before { left: 1.75rem; right: 1.75rem; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; gap: 1.25rem; }
  .contact-info > p { max-width: none; }
  /* Anchor tooltips to the whole option row so the 240px bubble can't run past the screen edge
     (it did even while hidden, giving the page a sideways scroll on phones). */
  .checkbox-row { position: relative; }
  .info-tip { position: static; }
  .info-tip::after { left: 0; max-width: min(100%, 240px); }
}
/* Phones: shorter form — options flow side by side (each kept on one line) instead of one per row,
   tighter vertical rhythm, shorter message box. Text sizes stay as they are. */
@media (max-width: 600px) {
  .contact-form { gap: 1.35rem; padding-top: 2rem; padding-bottom: 1.75rem; }
  .form-row, .form-row-3 { gap: 1rem; }
  .form-group input { padding: 0.55rem 0; }
  .form-group textarea { height: 96px; }
  .form-row-fieldsets { gap: 1.35rem; }
  .checkbox-group,
  .checkbox-group-1col,
  .checkbox-group-2col { display: flex; flex-direction: row; flex-wrap: wrap; gap: 0.7rem 1.25rem; }
  .checkbox-item,
  .checkbox-row { white-space: nowrap; }
  .checkbox-item { line-height: 1.35; }
  .form-checkboxes legend { letter-spacing: 0.12em; }
}

/* ── Collapsible choice groups (phones) ──
   Each checkbox group hides behind a toggle styled like the text fields; the toggle's label
   lists the ticked options. Needs contact-form.js (.has-choice-toggles), else lists stay open. */
.choice-toggle { display: none; }
@media (max-width: 600px) {
  .has-choice-toggles .choice-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    padding: 0.55rem 0;
    background: none;
    border: none;
    border-bottom: 1px solid rgba(196, 181, 165, 0.7);
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 300;
    color: var(--stone);
    text-align: left;
    cursor: pointer;
  }
  .has-choice-toggles .choice-toggle.has-value { color: var(--charcoal); }
  .choice-summary { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .choice-toggle::after {
    content: '';
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    margin-right: 4px;
    border-right: 1.5px solid var(--warm);
    border-bottom: 1.5px solid var(--warm);
    transform: translateY(-3px) rotate(45deg);
    transition: transform 0.2s ease;
  }
  .form-checkboxes.is-open > .choice-toggle::after { transform: translateY(2px) rotate(-135deg); }
  .choice-toggle:focus-visible { outline: 2px solid var(--warm); outline-offset: 3px; }
  .has-choice-toggles .form-checkboxes:not(.is-open) > .checkbox-group { display: none; }
  .has-choice-toggles .form-checkboxes.is-open > .checkbox-group { padding-top: 0.6rem; }
}

/* Smallest phones: slightly less inset so "Technické výkresy" stays on one line */
@media (max-width: 380px) {
  .contact-form { margin-inline: 0.25rem; padding-inline: 1.5rem; }
  .contact-form::before { left: 1.5rem; right: 1.5rem; }
}
