/* =========================================================
   Avishay's Realm: contact page
   (loads after style.css and reuses its variables)
   ========================================================= */

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.page-intro {
  margin-top: 14px;
  max-width: 36em;
  font-size: clamp(0.95rem, 1.05vw, 1.08rem);
  line-height: 1.7;
  color: var(--text);
}

/* ---------- Layout ---------- */

.contact-section {
  position: relative;
  padding: 26px 0 120px;
  overflow: hidden;
  isolation: isolate;
}

.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr);
  gap: 28px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(27, 22, 60, 0.92), rgba(15, 12, 33, 0.94));
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  padding: 26px 28px 28px;
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}
.panel-head h2 { font-size: clamp(1.35rem, 1.7vw, 1.6rem); font-weight: 400; }
.panel-icon { width: 32px; height: 32px; color: var(--accent-strong); flex: none; }

/* ---------- Form ---------- */

.botcheck { display: none; }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}
.field { position: relative; margin-bottom: 16px; }

.field-icon {
  position: absolute;
  left: 16px;
  top: 14px;
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  pointer-events: none;
  transition: color 0.2s;
}

.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form textarea {
  display: block;
  width: 100%;
  padding: 13px 16px 13px 48px;
  border: 1px solid rgba(157, 125, 245, 0.3);
  border-radius: 8px;
  background: rgba(10, 8, 24, 0.55);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 300;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.contact-form textarea { min-height: 160px; resize: vertical; line-height: 1.6; }
.contact-form ::placeholder { color: var(--text-muted); opacity: 1; }

.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(16, 12, 36, 0.75);
  box-shadow: 0 0 0 3px rgba(157, 125, 245, 0.2);
}
.field:focus-within .field-icon { color: var(--accent-strong); }

.contact-form [aria-invalid="true"] { border-color: #ff7a9a; }
.contact-form [aria-invalid="true"]:focus { box-shadow: 0 0 0 3px rgba(255, 122, 154, 0.2); }
.field-error { margin: 6px 2px 0; font-size: 0.82rem; color: #ff9db3; }
.field-error:empty { display: none; }

.form-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 20px;
  margin-top: 4px;
}
.form-status { flex: 1; font-size: 0.9rem; color: var(--text-muted); }
.form-status:empty { display: none; }
.form-status.is-error { color: #ff9db3; }

.btn--solid {
  padding: 12px 30px;
  border-color: var(--accent-strong);
  background: linear-gradient(135deg, #7552e0, #9d7df5);
  color: #fff;
  font-weight: 500;
  box-shadow: 0 0 24px var(--accent-glow);
}
.btn--solid:hover { background: linear-gradient(135deg, #8461f0, #ab8efa); box-shadow: 0 0 32px rgba(157, 125, 245, 0.55); }
.btn--solid svg { width: 19px; height: 19px; }
.btn--solid:disabled { opacity: 0.75; cursor: progress; transform: none; }
.btn--solid.is-sending svg { animation: fly 1s ease-in-out infinite; }
@keyframes fly { 50% { transform: translate(3px, -3px); } }

.form-success {
  padding: 36px 10px 20px;
  text-align: center;
  outline: none;
}
.form-success svg { width: 60px; height: 60px; margin: 0 auto 14px; color: var(--accent-strong); }
.form-success h3 { font-size: 1.5rem; font-weight: 400; margin-bottom: 8px; }
.form-success p { color: var(--text-muted); margin-bottom: 24px; }

/* ---------- Side: topic picker ---------- */

.topics { border: 0; margin: 0 0 22px; padding: 0; min-width: 0; }
.side-label {
  padding: 0;
  margin-bottom: 12px;
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.topic { display: block; margin-bottom: 12px; cursor: pointer; }
.topic-input { position: absolute; opacity: 0; pointer-events: none; }

.topic-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 22px;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(27, 22, 60, 0.9), rgba(15, 12, 33, 0.9));
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s, transform 0.2s;
}
.topic:hover .topic-card { border-color: rgba(157, 125, 245, 0.55); transform: translateX(2px); }
.topic-icon { width: 36px; height: 36px; color: var(--text); }
.topic-text { display: flex; flex-direction: column; min-width: 0; }
.topic-title { font-size: 1.05rem; font-weight: 500; }
.topic-desc { font-size: 0.85rem; color: var(--text-muted); }

.topic-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.topic-input:checked + .topic-card {
  border-color: var(--accent-strong);
  background: linear-gradient(90deg, rgba(120, 90, 230, 0.22), rgba(40, 28, 90, 0.4));
  box-shadow: 0 0 22px rgba(157, 125, 245, 0.25);
}
.topic-input:checked + .topic-card .topic-icon { color: var(--accent-strong); }
.topic-input:checked + .topic-card .topic-check {
  border-color: var(--accent-strong);
  background: radial-gradient(circle, var(--accent-strong) 0 4px, transparent 5px);
}
.topic-input:focus-visible + .topic-card { outline: 2px solid var(--accent-strong); outline-offset: 3px; }

/* ---------- Side: find me online ---------- */

.find-online { padding: 22px 24px 24px; }
.find-online .panel-head { margin-bottom: 18px; }
.find-online .panel-head h2 { font-size: 1.25rem; }
.find-online .panel-icon { width: 26px; height: 26px; }

.social-tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.social-tiles a {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(10, 8, 24, 0.45);
  color: var(--text);
  transition: border-color 0.2s, background 0.2s, color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.social-tiles a:hover {
  border-color: var(--accent-strong);
  background: rgba(157, 125, 245, 0.14);
  color: var(--accent-strong);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(60, 30, 140, 0.35);
}
.social-tiles svg { width: 42%; height: 42%; fill: currentColor; }

/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 960px) {
  /* One column: topic picker first, then the form, then the links */
  .contact-grid { grid-template-columns: 1fr; gap: 22px; }
  .contact-side { display: contents; }
  .topics { order: 1; margin: 0; }
  .form-panel { order: 2; }
  .find-online { order: 3; }

  .topics .topic { margin-bottom: 0; }
  .topics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
  .topics .side-label { grid-column: 1 / -1; }
  .topic-card { grid-template-columns: 32px minmax(0, 1fr) 18px; gap: 12px; padding: 12px 14px; height: 100%; }
  .topic-icon { width: 28px; height: 28px; }
  .topic-desc { display: none; }
  .find-online .social-tiles { max-width: 420px; }
}

@media (max-width: 640px) {
  .page-intro { font-size: 0.92rem; }
  .contact-section { padding: 18px 0 90px; }
  .panel { padding: 20px 16px 22px; border-radius: 12px; }
  .field-row { grid-template-columns: 1fr; }
  .form-foot { flex-direction: column-reverse; align-items: stretch; gap: 12px; }
  .btn--solid { justify-content: center; }
  .topics { grid-template-columns: 1fr; gap: 8px; }
  .topic-card { padding: 10px 14px; }
  .topic-title { font-size: 0.98rem; }
  .social-tiles { gap: 10px; }
}
