/* ============================================================
   Cipherverse — contact.css · /contact, plus the small 404/500 styles
   Loaded via $page_styles = ['contact.css'] on contact.php, 404.php, 500.php.
   Builds on the shared .page-hero (pages.css) and tokens (style.css).
   ============================================================ */

/* ── Layout: the brief left, direct contact right ──────── */
.contact-grid {
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: var(--s-6); align-items: start;
}
.contact-k { margin-bottom: var(--s-3); }

/* ── Notices (success / form expired / fields to fix) ──── */
.cf-notice {
  position: relative; margin-bottom: var(--s-4); padding: var(--s-3) var(--s-3) var(--s-3) calc(var(--s-3) + 1.25rem);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); color: var(--grey);
}
.cf-notice::before {
  content: ''; position: absolute; left: var(--s-3); top: calc(var(--s-3) + 0.7em);
  width: 8px; height: 8px; border-radius: 50%;
}
.cf-notice--ok::before { background: var(--lime); box-shadow: 0 0 0 4px rgba(var(--lime-rgb), 0.15); }
.cf-notice--bad { border-color: var(--error); }
.cf-notice--bad::before { background: var(--error); }
.cf-notice-title {
  font-family: var(--display); font-weight: 500; font-size: var(--t-lg); line-height: 1.15;
  letter-spacing: -0.01em; color: var(--paper); margin-bottom: 0.25rem;
}

/* ── Form: large fields on a single bottom line ────────── */
.cf { display: grid; gap: var(--s-4); }
.cf-pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4) var(--s-3); }
.cf-field { display: grid; gap: 0.25rem; align-content: start; }
.cf-label { font-size: var(--t-sm); font-weight: 500; color: var(--grey); transition: color var(--fast) ease; }
.cf-field:focus-within .cf-label { color: var(--paper); }
.cf-opt {
  margin-left: 0.375rem; font-family: var(--mono); font-size: 0.6875rem; font-weight: 400;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--grey);
}
.cf-input {
  display: block; width: 100%; min-height: 56px; padding: 0.75rem 0;
  font: inherit; font-size: var(--t-md); line-height: 1.4; color: var(--paper);
  background: transparent; border: 0; border-bottom: 1px solid var(--line-2); border-radius: 0;
  -webkit-appearance: none; appearance: none;
  transition: border-color var(--fast) ease, box-shadow var(--fast) ease;
}
.cf-input:hover { border-bottom-color: var(--grey); }
/* Focus: the line turns lime and thickens (a shadow, so nothing shifts). */
.cf-input:focus, .cf-input:focus-visible {
  outline: none; border-bottom-color: var(--lime); box-shadow: 0 1px 0 0 var(--lime);
}
.cf-text { min-height: 9rem; resize: vertical; }
.cf-input:-webkit-autofill {
  -webkit-text-fill-color: var(--paper); caret-color: var(--paper);
  -webkit-box-shadow: 0 0 0 100px var(--black) inset;
}

/* Select: the native control, restyled, with a CSS chevron. */
.cf-select { position: relative; display: block; }
.cf-select::after {
  content: ''; position: absolute; right: 0.25rem; top: 50%; width: 9px; height: 9px; margin-top: -7px;
  border-right: 1.5px solid var(--grey); border-bottom: 1.5px solid var(--grey);
  transform: rotate(45deg); pointer-events: none;
}
.cf-select select { padding-right: 2rem; cursor: pointer; }
.cf-select select option { background: var(--surface-2); color: var(--paper); }

/* Errors */
.cf-field.is-bad .cf-label { color: var(--error); }
.cf-field.is-bad .cf-input { border-bottom-color: var(--error); }
.cf-field.is-bad .cf-input:focus { border-bottom-color: var(--lime); }
.cf-error { margin-top: 0.375rem; font-size: var(--t-sm); line-height: 1.4; color: var(--error); }

/* Submit */
.cf-foot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); padding-top: var(--s-1); }
.cf-submit { min-height: 64px; padding: 0 2rem; font-size: var(--t-md); }
.cf-submit svg { transition: transform var(--fast) var(--ease); }
.cf-submit:hover svg { transform: translate(2px, -2px); }
.cf-note { font-size: var(--t-sm); color: var(--grey); }

/* ── Direct: big tappable rows ─────────────────────────── */
.contact-title {
  font-family: var(--display); font-weight: 600; font-size: var(--t-h3);
  line-height: 1; letter-spacing: -0.025em; margin-bottom: var(--s-3);
}
.direct { border-top: 1px solid var(--line); }
.direct-row {
  display: flex; align-items: center; gap: var(--s-2);
  border-bottom: 1px solid var(--line);
}
.direct-main {
  flex: 1; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center;
  column-gap: var(--s-2); min-height: 84px; padding-block: var(--s-2);
}
.direct-k { grid-column: 1; color: var(--grey); margin-bottom: 0.25rem; }
.direct-v {
  grid-column: 1; font-family: var(--display); font-weight: 500; font-size: var(--t-lg);
  line-height: 1.1; letter-spacing: -0.01em; transition: color var(--fast) ease;
}
.direct-v--long { overflow-wrap: anywhere; }
.direct-v--tel { white-space: nowrap; }
.direct-go { grid-column: 2; grid-row: 1 / span 2; color: var(--grey); transition: color var(--fast) ease, transform var(--fast) var(--ease); }
.direct-main:hover .direct-v { color: var(--lime); }
.direct-main:hover .direct-go { color: var(--lime); transform: translate(2px, -2px); }

.direct-pill {
  flex: none; display: inline-flex; align-items: center; min-height: 44px; padding: 0 1.125rem;
  border: 1px solid var(--line-2); border-radius: var(--r-pill);
  font-size: var(--t-sm); font-weight: 500; color: var(--paper);
  transition: background-color var(--fast) ease, border-color var(--fast) ease, color var(--fast) ease;
}
.direct-pill:hover { background: var(--paper); border-color: var(--paper); color: var(--ink); }

/* ── What happens next ─────────────────────────────────── */
.next { margin-top: var(--s-5); }
.next-title { font-weight: 400; margin-bottom: var(--s-2); }
.next-step {
  display: grid; grid-template-columns: 3rem minmax(0, 1fr); gap: var(--s-2); align-items: baseline;
  padding-block: var(--s-2); border-top: 1px solid var(--line);
}
.next-step:last-child { border-bottom: 1px solid var(--line); }
.next-n { color: var(--grey); }

.contact-where {
  display: flex; align-items: center; gap: 0.625rem; margin-top: var(--s-4);
  font-size: var(--t-sm); color: var(--grey);
}
.contact-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; border: 1px solid var(--lime); }

/* ── 404 / 500 ─────────────────────────────────────────── */
.page-hero--error { padding-bottom: var(--s-7); }
.page-hero--error .page-foot { justify-content: flex-start; align-items: center; gap: var(--s-2) var(--s-4); }

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 1023px) {
  .contact-grid { grid-template-columns: minmax(0, 1fr); gap: var(--s-6); }
  .contact-aside { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: var(--s-5); }
  .contact-aside > .contact-k, .contact-aside > .contact-title { grid-column: 1 / -1; }
  .contact-aside .next { margin-top: 0; }
  .contact-where { grid-column: 1 / -1; }
}

@media (max-width: 767px) {
  .contact-aside { display: block; }
  .contact-aside .next { margin-top: var(--s-5); }
  .cf { gap: var(--s-3); }
  .cf-pair { grid-template-columns: minmax(0, 1fr); gap: var(--s-3); }
  .cf-input { font-size: 1rem; min-height: 52px; }   /* 16px: no iOS zoom on focus */
  .cf-submit { width: 100%; }
  .cf-foot { gap: var(--s-2); }
  .direct-main { min-height: 76px; }
  .direct-v--tel { font-size: var(--t-md); }
  .page-hero--error { padding-bottom: var(--s-6); }
  .page-hero--error .page-actions { width: 100%; }
  .page-hero--error .page-actions .btn { flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .cf-input, .cf-label, .cf-submit svg, .direct-v, .direct-go, .direct-pill { transition: none; }
}
