/* Contact page: contact.php — project brief form + live "system blueprint" panel */

/* ---------- Page keyframes ---------- */
@media (prefers-reduced-motion: no-preference) {
  @keyframes contactQ { from { opacity: 0; transform: translateY(40px); filter: blur(8px); } to { opacity: 1; transform: none; filter: blur(0); } }
  @keyframes contactPulse { 0% { box-shadow: 0 0 0 0 rgba(241, 43, 43, .6); } 100% { box-shadow: 0 0 0 18px rgba(241, 43, 43, 0); } }
  @keyframes contactCaret { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
  @keyframes contactPop { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.06); } 100% { transform: scale(1); opacity: 1; } }
  @keyframes contactShake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
  @keyframes contactStamp { 0% { transform: rotate(-14deg) scale(2); opacity: 0; } 100% { transform: rotate(-8deg) scale(1); opacity: 1; } }
  @keyframes contactBreath { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
  @keyframes contactBlink { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
}

/* ---------- Dark page shell ---------- */
body:has(> .contact-page) { background: var(--ink); }
.contact-page { background: var(--ink); color: var(--white); }

/* ---------- Stage (form + blueprint panel) ---------- */
.contact-stage {
  position: relative;
  isolation: isolate;
  min-height: calc(100vh - 76px);
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  border-bottom: 1px solid #1F1F1D;
}

.contact-stage__grid {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 64px 64px;
}

.contact-stage__main {
  order: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(24px, 4vw, 56px) clamp(18px, 4vw, 64px);
  min-width: 0;
}

.contact-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted-dark);
}
.contact-progress-head__label { display: flex; align-items: center; gap: 10px; }

.contact-progress {
  position: relative;
  margin-top: 14px;
  height: 2px;
  background: #1F1F1D;
}
.contact-progress__bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: calc(var(--pct, 0) * 1%);
  background: var(--red);
  transition: width .6s var(--ease-out);
}

/* ---------- Form ---------- */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: clamp(22px, 2.6vw, 34px);
  padding-top: clamp(28px, 4vw, 52px);
  animation: contactQ .7s var(--ease-out) both;
}

.contact-form__intro { display: flex; flex-direction: column; gap: 12px; }

.contact-title {
  font-weight: 500;
  font-size: clamp(42px, 4.6vw, 76px);
  line-height: 0.96;
  letter-spacing: -0.05em;
  text-wrap: balance;
}
.contact-title--form { max-width: 15ch; }
.contact-title--done { max-width: 14ch; }

.contact-form__lead {
  font-size: clamp(15px, 1.2vw, 18px);
  line-height: 1.5;
  color: var(--muted-2);
  max-width: 46ch;
}

.contact-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px 28px;
}

.contact-field { display: flex; flex-direction: column; gap: 6px; }

.contact-label {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--muted-dark);
}
.contact-check { color: var(--red); opacity: 0; transition: opacity .3s; }
.contact-field.is-ok .contact-check,
.contact-pains.is-ok .contact-check { opacity: 1; }
.contact-field.is-bad .contact-label,
.contact-pains.is-bad .contact-label { color: #FF7A7A; }

.contact-field__input {
  width: 100%;
  padding: 8px 0 10px;
  background: transparent;
  border: 0;
  border-bottom: 2px solid #3A3A37;
  color: var(--white);
  font-size: clamp(22px, 2vw, 30px);
  letter-spacing: -0.03em;
  font-weight: 500;
  outline: none;
  transition: border-color .25s;
}
.contact-field__input::placeholder { color: #3F3F3C; }
.contact-field.is-ok .contact-field__input { border-bottom-color: #5F5E5A; }
.contact-field.is-bad .contact-field__input { border-bottom-color: #FF7A7A; }
.contact-field .contact-field__input:focus { border-bottom-color: var(--red); }

/* Pain-point toggles */
.contact-pains { display: flex; flex-direction: column; gap: 10px; }
.contact-pains__list { display: flex; flex-wrap: wrap; gap: 8px; }

.contact-pain {
  appearance: none;
  border-radius: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  margin: 0;
  padding: 12px 16px;
  border: 1px solid #2A2A28;
  background: rgba(17, 17, 16, 0.8);
  color: var(--on-dark-2);
  font-size: 15px;
  line-height: normal;
  text-align: left;
  transition: all .2s;
}
.contact-pains.is-bad .contact-pain { border-color: #7A2B2B; }
.contact-pains .contact-pain[aria-pressed="true"] { border-color: var(--red); background: var(--red-deep); color: var(--white); }
.contact-pains .contact-pain:hover { border-color: var(--red); }

.contact-pain__box {
  flex: none;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #5F5E5A;
  background: transparent;
  font-size: 10px;
  color: var(--white);
  transition: all .2s;
}
.contact-pain[aria-pressed="true"] .contact-pain__box { border-color: var(--red); background: var(--red); }
.contact-pain[aria-pressed="true"] .contact-pain__box::before { content: "✓"; }

/* Optional message */
.contact-msg { display: flex; flex-direction: column; gap: 8px; }
.contact-msg__input {
  padding: 14px;
  background: rgba(17, 17, 16, 0.8);
  border: 1px solid #2A2A28;
  color: var(--white);
  font-size: 16px;
  line-height: 1.5;
  resize: vertical;
  outline: none;
}
.contact-msg__input:focus { border-color: var(--red); }

.contact-error {
  font-size: 15px;
  color: #FF7A7A;
  animation: contactShake .35s ease both;
}

.contact-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px 24px;
}

.contact-submit {
  appearance: none;
  border-radius: 0;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 18px 28px;
  border: 0;
  background: var(--white);
  color: var(--ink);
  font-size: 16px;
  font-weight: 500;
  line-height: normal;
  transition: background .2s, color .2s;
}
.contact-submit.is-ready {
  background: var(--red);
  color: var(--white);
  animation: contactPulse 1.8s ease-out infinite;
}
.contact-submit:hover { background: var(--red); color: var(--white); }

.contact-actions__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: #5F5E5A;
}

/* ---------- Sent state ---------- */
.contact-done {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding-top: clamp(28px, 4vw, 52px);
  animation: contactQ .7s var(--ease-out) both;
}
.contact-done__code {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--red);
}
.contact-done__name {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  color: var(--red);
}
.contact-done__lead {
  font-size: 16px;
  line-height: 1.55;
  color: var(--muted-2);
  max-width: 46ch;
}
.contact-done__buttons { display: flex; flex-wrap: wrap; gap: 10px; }
.contact-done__mail {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 26px;
  background: var(--red);
  color: var(--white);
  font-size: 16px;
  font-weight: 500;
  animation: contactPulse 1.8s ease-out infinite;
}
.contact-done__mail:hover { background: var(--white); color: var(--ink); }
.contact-done__copy {
  appearance: none;
  border-radius: 0;
  margin: 0;
  padding: 18px 22px;
  border: 1px solid #3A3A37;
  background: transparent;
  color: var(--white);
  font-size: 15px;
  line-height: normal;
}
.contact-done__copy:hover { border-color: var(--red); }
.contact-done__links { display: flex; flex-wrap: wrap; gap: 20px; font-size: 14px; }
.contact-done__alt { border-bottom: 1px solid #555550; padding-bottom: 3px; }
.contact-done__alt:hover { color: var(--red); border-color: var(--red); }
.contact-done__edit {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted-dark);
  font-size: inherit;
  line-height: normal;
}
.contact-done__edit:hover { color: var(--white); }

/* ---------- Blueprint panel ---------- */
.contact-panel {
  order: 2;
  position: sticky;
  top: 76px;
  height: calc(100vh - 76px);
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #111110;
  border-left: 1px solid #1F1F1D;
}

.contact-panel__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 14px clamp(16px, 2vw, 24px);
  border-bottom: 1px solid var(--line-dark);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
}
.contact-panel__title { display: flex; align-items: center; gap: 8px; color: var(--white); }
.contact-panel__live {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #1F9D55;
  animation: contactBlink 1.4s ease-in-out infinite;
}
.contact-stage.is-sent .contact-panel__live { background: var(--red); }
.contact-panel__code { color: var(--muted-dark); }

/* Map with canvas mesh, capability nodes and the central hub */
.contact-map {
  position: relative;
  flex: 1;
  min-height: 320px;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 50%, rgba(241, 43, 43, 0.08), transparent 60%);
}
.contact-map__canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.contact-node {
  position: absolute;
  transform: translate(-50%, -50%) scale(.94);
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 9px 12px;
  border: 1px solid #2A2A28;
  background: #141413;
  color: #5F5E5A;
  font-size: 13px;
  white-space: nowrap;
  box-shadow: none;
  animation: contactBreath 3s ease-in-out infinite;
  transition: all .5s var(--ease-out);
}
.contact-node--1 { left: 50%; top: 18%; animation-delay: 0s; }
.contact-node--2 { left: 79.4449%; top: 34%; animation-delay: .3s; }
.contact-node--3 { left: 79.4449%; top: 66%; animation-delay: .6s; }
.contact-node--4 { left: 50%; top: 82%; animation-delay: .9s; }
.contact-node--5 { left: 20.5551%; top: 66%; animation-delay: 1.2s; }
.contact-node--6 { left: 20.5551%; top: 34%; animation-delay: 1.5s; }

.contact-node.is-scanning { border-color: #5F5E5A; color: var(--on-dark-2); }
.contact-node.is-on {
  transform: translate(-50%, -50%) scale(1.06);
  border-color: var(--red);
  background: var(--red-deep);
  color: var(--white);
  box-shadow: 0 0 0 1px rgba(241, 43, 43, 0.25), 0 12px 30px -10px rgba(241, 43, 43, 0.45);
  animation: none;
}

.contact-node__top { display: flex; align-items: center; gap: 7px; }
.contact-node__num { font-family: var(--mono); font-size: 9px; color: #3F3F3C; }
.contact-node.is-on .contact-node__num { color: var(--red); }

.contact-node__rel {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.06em;
  color: #5F5E5A;
}
.contact-node.is-on .contact-node__rel { color: var(--white); }
.contact-node__track {
  position: relative;
  width: 34px;
  height: 2px;
  overflow: hidden;
  background: #2A2A28;
}
.contact-node__fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: calc(var(--rel, 0) * 1%);
  background: var(--red);
  transition: width .8s var(--ease-out);
}

.contact-hub {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 72px;
  height: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: var(--red-deep);
  border: 1px solid var(--red);
  color: var(--white);
  transition: background .5s;
}
.contact-hub.is-pulsing { animation: contactPulse 1.8s ease-out infinite; }
.contact-stage.is-sent .contact-hub { background: var(--red); }
.contact-hub__initial { font-size: 26px; font-weight: 600; letter-spacing: -0.04em; line-height: 1; }
.contact-hub__pct { font-family: var(--mono); font-size: 8px; letter-spacing: 0.08em; color: var(--white); }

.contact-hub-label {
  position: absolute;
  left: 50%;
  top: calc(50% - 66px);
  transform: translate(-50%, -100%);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--muted-dark);
  white-space: nowrap;
  animation: contactBreath 1.6s ease-in-out infinite;
}
.contact-hub-label.is-active { color: var(--red); }

.contact-stamp {
  display: none;
  position: absolute;
  right: 18px;
  top: 16px;
  padding: 6px 10px;
  border: 2px solid var(--red);
  color: var(--red);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  animation: contactStamp .5s var(--ease-out) both;
}
.contact-stage.is-sent .contact-stamp { display: block; }

/* AI insight line */
.contact-insight {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px clamp(16px, 2vw, 24px);
  background: #0E0E0D;
  border-top: 1px solid var(--line-dark);
}
.contact-insight__tag {
  flex: none;
  padding: 3px 6px;
  background: var(--red);
  color: var(--white);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
}
.contact-insight__text {
  min-height: 1.5em;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.5;
  color: #D8D7D1;
}
.contact-insight__caret {
  display: inline-block;
  width: 6px;
  height: 12px;
  margin-left: 2px;
  vertical-align: -2px;
  background: var(--red);
  animation: contactCaret 1s steps(1) infinite;
}

/* Recommendation + summary rows */
.contact-panel__detail {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line-dark);
}
.contact-rec {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px clamp(16px, 2vw, 24px);
  border-bottom: 1px solid var(--line-dark);
}
.contact-rec__eyebrow { font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; color: var(--red); }
.contact-rec__title {
  font-size: 20px;
  letter-spacing: -0.025em;
  font-weight: 500;
  line-height: 1.15;
  color: #5F5E5A;
}
.contact-rec__title.is-set { color: var(--white); }
.contact-rec__title.is-popping { animation: contactPop .45s ease both; }
.contact-rec__desc { font-size: 13px; line-height: 1.5; color: var(--muted-2); }

.contact-rows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.contact-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 12px clamp(16px, 2vw, 24px);
  border-bottom: 1px solid #1C1C1A;
  border-right: 1px solid #1C1C1A;
}
.contact-row dt { font-family: var(--mono); font-size: 9px; letter-spacing: 0.08em; color: #5F5E5A; }
.contact-row dd {
  font-size: 14px;
  color: #3F3F3C;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color .3s;
}
.contact-row dd.is-set { color: var(--white); }

/* Short desktop viewports: the panel scrolls with the page */
@media (max-height: 759.98px) {
  .contact-panel { position: relative; top: auto; height: auto; }
}

/* ---------- FAQ ---------- */
.contact-faq { background: var(--paper); color: var(--ink); }
.contact-faq__inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(64px, 8vw, 120px) var(--gutter);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr));
  gap: clamp(36px, 5vw, 80px);
  align-items: start;
}
.contact-faq__intro { display: flex; flex-direction: column; gap: 20px; }
.contact-faq__title {
  font-size: clamp(30px, 3.8vw, 58px);
  line-height: 1;
  letter-spacing: -0.045em;
  font-weight: 500;
  text-wrap: balance;
}
/* Honeypot field for bots (send-brief.php), off-screen for people */
.contact-hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.contact-submit.is-sending { opacity: 0.6; cursor: progress; }

.contact-faq__text { font-size: 17px; line-height: 1.7; color: var(--text); max-width: 52ch; }
.contact-faq__nap { display: flex; flex-direction: column; gap: 4px; max-width: 40ch; font-style: normal; font-size: 15px; line-height: 1.6; color: var(--text); }
.contact-faq__nap-name { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.contact-faq__nap a:hover { color: var(--red); }
.contact-faq__link {
  align-self: flex-start;
  font-size: 15px;
  font-weight: 500;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 3px;
}
.contact-faq__link:hover { color: var(--red); border-color: var(--red); }

.contact-faq__list { display: flex; flex-direction: column; }
.contact-faq__label { margin-bottom: 12px; }
.contact-faq__item { border-top: 1px solid var(--rule-strong); }
.contact-faq__item summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 20px 0;
  cursor: pointer;
  font-size: clamp(17px, 1.4vw, 20px);
  font-weight: 500;
  letter-spacing: -0.015em;
}
.contact-faq__plus { flex: none; font-family: var(--mono); font-size: 16px; color: var(--red); }
.contact-faq__item p {
  margin: 0 0 20px;
  font-size: 16px;
  line-height: 1.65;
  color: #4A4945;
  max-width: 60ch;
}
.contact-faq__end { border-top: 1px solid var(--rule-strong); }

/* ---------- Narrow (< 1024px): panel on top, single column ---------- */
@media (max-width: 1023.98px) {
  .contact-stage { min-height: auto; grid-template-columns: minmax(0, 1fr); }
  .contact-stage__main { order: 2; }
  .contact-panel {
    order: 1;
    position: relative;
    top: auto;
    height: auto;
    border-left: 0;
    border-bottom: 1px solid #1F1F1D;
  }
  .contact-map { flex: none; min-height: 440px; }
  .contact-stage:not(.is-sent) .contact-panel__detail { display: none; }
}

/* ---------- Mobile (< 640px) ---------- */
@media (max-width: 639.98px) {
  .contact-title { font-size: 38px; }
  .contact-field__input { font-size: 22px; }
  .contact-fields { grid-template-columns: minmax(0, 1fr); }
  .contact-submit { flex: 1 1 100%; }

  .contact-map { min-height: 360px; }
  .contact-node { padding: 6px 8px; font-size: 11px; }
  .contact-node__rel { display: none; }
  .contact-node--1 { left: 50%; top: 16%; }
  .contact-node--2 { left: 81.1769%; top: 33%; }
  .contact-node--3 { left: 81.1769%; top: 67%; }
  .contact-node--4 { left: 50%; top: 84%; }
  .contact-node--5 { left: 18.8231%; top: 67%; }
  .contact-node--6 { left: 18.8231%; top: 33%; }

  .contact-hub { width: 54px; height: 54px; }
  .contact-hub__initial { font-size: 20px; }
  .contact-hub-label { top: calc(50% - 52px); }
}
