/* Stud Building — Guided quote C · premium craft (Linear/Stripe feel) */
:root {
  --sq-bg: #f7f5f0;
  --sq-surface: #ffffff;
  --sq-ink: #1a1916;
  --sq-muted: #6b6760;
  --sq-line: rgba(26, 25, 22, 0.1);
  --sq-line-strong: rgba(26, 25, 22, 0.16);
  --sq-accent: #1f4ed8;
  --sq-accent-hover: #1639a8;
  --sq-warn: #9a3412;
  --sq-ok: #166534;
  --sq-shadow: 0 24px 64px -16px rgba(26, 25, 22, 0.28), 0 8px 24px -8px rgba(26, 25, 22, 0.12);
  --sq-radius: 16px;
  --sq-radius-sm: 10px;
  --sq-z: 95;
  --sq-ease: cubic-bezier(0.32, 0.72, 0, 1);
  --sq-font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --sq-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

.sq-scrim {
  position: fixed;
  inset: 0;
  background: rgba(26, 25, 22, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: var(--sq-z);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s var(--sq-ease);
}
.sq-scrim.is-on {
  opacity: 1;
  pointer-events: auto;
}

.sq-sheet {
  position: fixed;
  z-index: calc(var(--sq-z) + 1);
  left: 50%;
  top: 50%;
  width: min(440px, calc(100vw - 32px));
  max-height: min(720px, calc(100vh - 48px));
  background: var(--sq-surface);
  border: 1px solid var(--sq-line-strong);
  border-radius: var(--sq-radius);
  box-shadow: var(--sq-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--sq-font);
  color: var(--sq-ink);
  -webkit-font-smoothing: antialiased;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, calc(-50% + 12px)) scale(0.98);
  transition:
    opacity 0.28s var(--sq-ease),
    transform 0.32s var(--sq-ease),
    visibility 0.32s;
}
.sq-sheet.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.sq-handle {
  display: none;
  width: 36px;
  height: 4px;
  border-radius: 99px;
  background: var(--sq-line-strong);
  margin: 10px auto 0;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .sq-sheet {
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    width: 100%;
    max-height: min(92vh, calc(100vh - env(safe-area-inset-top, 0px) - 24px));
    border-radius: 20px 20px 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    transform: translateY(110%);
  }
  .sq-sheet.is-open {
    transform: translateY(0);
  }
  .sq-handle { display: block; }
}

.sq-hd {
  padding: 20px 24px 12px;
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.sq-eyebrow {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sq-accent);
  margin-bottom: 6px;
}
.sq-title {
  font-weight: 650;
  font-size: 1.375rem;
  letter-spacing: -0.03em;
  line-height: 1.2;
}
.sq-sub {
  margin-top: 6px;
  font-size: 0.875rem;
  color: var(--sq-muted);
  line-height: 1.45;
  max-width: 36ch;
}
.sq-close {
  background: var(--sq-bg);
  border: 1px solid var(--sq-line);
  width: 44px;
  height: 44px;
  border-radius: 12px;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  color: var(--sq-ink);
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}
.sq-close:hover,
.sq-close:focus-visible {
  background: var(--sq-ink);
  color: #fff;
  border-color: var(--sq-ink);
  outline: none;
}
.sq-close:active { transform: scale(0.96); }

.sq-steps {
  display: flex;
  gap: 6px;
  padding: 8px 24px 0;
  flex-shrink: 0;
}
.sq-step {
  flex: 1;
  height: 3px;
  background: var(--sq-line);
  border-radius: 99px;
  transition: background 0.25s ease, transform 0.25s ease;
}
.sq-step.on { background: var(--sq-ink); }
.sq-step.done { background: var(--sq-accent); }

.sq-body {
  padding: 20px 24px 8px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}

.sq-field { margin-bottom: 16px; }
.sq-field label,
.sq-lab {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--sq-muted);
  margin-bottom: 8px;
}
.sq-field input,
.sq-field textarea {
  width: 100%;
  background: var(--sq-bg);
  border: 1px solid var(--sq-line-strong);
  border-radius: var(--sq-radius-sm);
  padding: 14px 16px;
  font-family: var(--sq-font);
  font-size: 1rem;
  color: var(--sq-ink);
  min-height: 48px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  box-sizing: border-box;
}
.sq-field textarea { min-height: 96px; resize: vertical; }
.sq-field input:focus,
.sq-field textarea:focus {
  outline: none;
  border-color: var(--sq-accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(31, 78, 216, 0.18);
}

.sq-suburb-known {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--sq-bg);
  border: 1px solid var(--sq-line);
  border-radius: var(--sq-radius-sm);
  padding: 12px 14px;
  margin-bottom: 8px;
}
.sq-suburb-known strong {
  flex: 1;
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.sq-change {
  background: transparent;
  border: 0;
  color: var(--sq-accent);
  font-family: var(--sq-font);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 4px;
  min-height: 44px;
}
.sq-change:hover { text-decoration: underline; }
.sq-field.is-editing .sq-suburb-known { display: none; }
.sq-field:not(.is-editing) .sq-suburb-edit { display: none; }

.sq-hint {
  margin-top: 8px;
  font-size: 0.8125rem;
  color: var(--sq-muted);
  line-height: 1.45;
}
.sq-hint.ok { color: var(--sq-ok); }
.sq-hint.warn { color: var(--sq-warn); font-weight: 500; }

.sq-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.sq-chip {
  font-family: var(--sq-font);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--sq-ink);
  background: var(--sq-bg);
  border: 1px solid var(--sq-line-strong);
  padding: 12px 16px;
  min-height: 44px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}
.sq-chip:hover,
.sq-chip:focus-visible {
  border-color: var(--sq-ink);
  outline: none;
}
.sq-chip:active { transform: scale(0.97); }
.sq-chip.sel {
  background: var(--sq-ink);
  color: #fff;
  border-color: var(--sq-ink);
}

.sq-photo-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.sq-file {
  font-family: var(--sq-font);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--sq-ink);
  background: var(--sq-bg);
  border: 1.5px dashed var(--sq-line-strong);
  border-radius: var(--sq-radius-sm);
  padding: 28px 16px;
  text-align: center;
  cursor: pointer;
  min-height: 44px;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}
.sq-file input { display: none; }
.sq-file:hover {
  border-color: var(--sq-accent);
  color: var(--sq-accent);
  background: rgba(31, 78, 216, 0.04);
}
.sq-file-list {
  font-size: 0.8125rem;
  color: var(--sq-muted);
  line-height: 1.45;
}
.sq-check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 0.9375rem;
  line-height: 1.4;
  cursor: pointer;
  padding: 12px;
  border-radius: var(--sq-radius-sm);
  border: 1px solid var(--sq-line);
  background: var(--sq-bg);
  min-height: 44px;
}
.sq-check input {
  margin-top: 2px;
  width: 18px;
  height: 18px;
  accent-color: var(--sq-accent);
  flex-shrink: 0;
}

.sq-facts {
  margin-top: 8px;
  border: 1px solid var(--sq-line);
  border-radius: var(--sq-radius-sm);
  background: var(--sq-bg);
  overflow: hidden;
}
.sq-facts div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--sq-line);
  font-size: 0.8125rem;
}
.sq-facts div:last-child { border-bottom: 0; }
.sq-facts span:first-child { color: var(--sq-muted); }
.sq-facts span:last-child { color: var(--sq-ink); font-weight: 550; text-align: right; }

.sq-ft {
  padding: 16px 24px 20px;
  border-top: 1px solid var(--sq-line);
  flex-shrink: 0;
  background: var(--sq-surface);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sq-ft-row {
  display: flex;
  gap: 8px;
}
.sq-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  font-family: var(--sq-font);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  padding: 14px 18px;
  min-height: 48px;
  border: 1px solid var(--sq-accent);
  background: var(--sq-accent);
  color: #fff;
  cursor: pointer;
  border-radius: 12px;
  text-decoration: none;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease, opacity 0.2s ease;
}
.sq-btn:hover:not(:disabled),
.sq-btn:focus-visible:not(:disabled) {
  background: var(--sq-accent-hover);
  border-color: var(--sq-accent-hover);
  outline: none;
}
.sq-btn:active:not(:disabled) { transform: scale(0.985); }
.sq-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.sq-btn.ghost {
  background: transparent;
  color: var(--sq-ink);
  border-color: var(--sq-line-strong);
  flex: 0 0 auto;
  min-width: 88px;
}
.sq-btn.ghost:hover:not(:disabled) {
  background: var(--sq-bg);
  border-color: var(--sq-ink);
  color: var(--sq-ink);
}
.sq-btn.is-loading {
  position: relative;
  color: transparent !important;
}
.sq-btn.is-loading::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: sq-spin 0.7s linear infinite;
}
@keyframes sq-spin { to { transform: rotate(360deg); } }

.sq-alt {
  text-align: center;
  margin-top: 4px;
  font-size: 0.8125rem;
  color: var(--sq-muted);
}
.sq-alt a {
  color: var(--sq-ink);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid rgba(31, 78, 216, 0.45);
}
.sq-alt a:hover { border-bottom-color: var(--sq-accent); }

.sq-success {
  text-align: left;
  padding: 8px 0 16px;
}
.sq-success h3 {
  font-size: 1.25rem;
  letter-spacing: -0.025em;
  margin: 0 0 10px;
  font-weight: 650;
}
.sq-success p {
  color: var(--sq-muted);
  font-size: 0.9375rem;
  line-height: 1.5;
  margin: 0 0 16px;
}
.sq-status {
  font-size: 0.8125rem;
  padding: 12px 14px;
  border-radius: var(--sq-radius-sm);
  border: 1px solid var(--sq-line);
  background: var(--sq-bg);
  margin-bottom: 8px;
  line-height: 1.45;
}
.sq-status.pending { color: var(--sq-muted); }
.sq-status.ok { color: var(--sq-ok); border-color: rgba(22, 101, 52, 0.25); background: rgba(22, 101, 52, 0.06); }

@media (prefers-reduced-motion: reduce) {
  .sq-scrim, .sq-sheet, .sq-btn, .sq-chip, .sq-close, .sq-step {
    transition: none !important;
    animation: none !important;
  }
}

html.sq-open { overflow: hidden; }

/* Suburb Melb typeahead inside quote sheet — match homepage .sa-suggest */
.sq-suburb-edit .sa-suggest-wrap {
  position: relative;
  display: block;
  width: 100%;
}
.sq-suburb-edit .sa-suggest {
  z-index: 40;
  background: #fff;
}
.sq-field.is-editing {
  position: relative;
  z-index: 5;
  overflow: visible;
}
/* Let the suggest panel paint below the input without being clipped by the panel body */
.sq-sheet.is-open:has(.sq-field.is-editing) .sq-body {
  overflow: visible;
}
