/* ============================================================
   Contact Modal — Periyasamy Industriess
   Theme-compatible (dark default / light via data-theme).
   Uses ONLY theme.css color tokens for colors.
   ============================================================ */

/* ---- Overlay / backdrop ---- */
.cmodal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 4vw, 2rem);
  background: rgba(4, 8, 16, 0.62);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.32s var(--ease), visibility 0s linear 0.32s;
  overflow-y: auto;
}
.cmodal.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.32s var(--ease);
}

/* ---- Card ---- */
.cmodal__card {
  position: relative;
  width: 100%;
  max-width: 520px;
  margin: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(1.5rem, 4vw, 2.4rem);
  transform: translateY(24px) scale(0.97);
  opacity: 0;
  transition: transform 0.36s var(--ease), opacity 0.36s var(--ease);
}
.cmodal.is-open .cmodal__card {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* Accent top edge */
.cmodal__card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--grad-accent);
}

/* ---- Close button ---- */
.cmodal__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, transform 0.2s var(--ease);
}
.cmodal__close:hover {
  color: var(--text);
  border-color: var(--accent);
  transform: rotate(90deg);
}
.cmodal__close svg { width: 18px; height: 18px; }

/* ---- Header ---- */
.cmodal__eyebrow {
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin: 0 0 0.5rem;
}
.cmodal__title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 1.9rem);
  line-height: 1.1;
  color: var(--text);
  margin: 0 0 0.5rem;
}
.cmodal__sub {
  color: var(--muted);
  font-size: 0.96rem;
  margin: 0 0 1.6rem;
  line-height: 1.5;
}

/* ---- Form ---- */
.cmodal__form { display: grid; gap: 1.05rem; }

/* Floating-label field (replicates style.css .field) */
.cmodal .field { position: relative; }
.cmodal .field input,
.cmodal .field textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 1.1rem 1rem 0.5rem;
  color: var(--text);
  font: inherit;
  font-size: 0.98rem;
  resize: vertical;
  transition: border-color 0.25s, box-shadow 0.25s;
}
.cmodal .field textarea { padding-top: 1.4rem; min-height: 96px; }
.cmodal .field label {
  position: absolute;
  left: 1rem;
  top: 0.95rem;
  color: var(--muted-2);
  pointer-events: none;
  font-size: 0.98rem;
  transition: transform 0.2s var(--ease), color 0.2s, font-size 0.2s;
  transform-origin: left;
}
.cmodal .field input:focus,
.cmodal .field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}
.cmodal .field input:focus + label,
.cmodal .field input:not(:placeholder-shown) + label,
.cmodal .field textarea:focus + label,
.cmodal .field textarea:not(:placeholder-shown) + label {
  transform: translateY(-0.7rem) scale(0.78);
  color: var(--accent-2);
}
.cmodal .field textarea:focus + label,
.cmodal .field textarea:not(:placeholder-shown) + label {
  transform: translateY(-0.55rem) scale(0.78);
}
.cmodal .field .req { color: var(--accent); }

/* Invalid state */
.cmodal .field input.is-invalid,
.cmodal .field textarea.is-invalid {
  border-color: #e5484d;
  box-shadow: 0 0 0 3px rgba(229, 72, 77, 0.15);
}

/* ---- Honeypot (visually hidden) ---- */
.cmodal__hp {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Inline error message ---- */
.cmodal__error {
  display: none;
  background: rgba(229, 72, 77, 0.12);
  border: 1px solid rgba(229, 72, 77, 0.4);
  color: #e5484d;
  border-radius: var(--radius-sm);
  padding: 0.8rem 1rem;
  font-size: 0.9rem;
  line-height: 1.45;
}
.cmodal__error.is-shown { display: block; }
.cmodal__error a { color: inherit; font-weight: 600; text-decoration: underline; }

/* Light theme: error text needs slightly darker for contrast */
:root[data-theme="light"] .cmodal__error { color: #c0272d; }
:root[data-theme="light"] .cmodal__error a { color: #c0272d; }

/* ---- Success screen ---- */
.cmodal__success {
  text-align: center;
  padding: 0.5rem 0 0.5rem;
}
.cmodal__check {
  width: 84px;
  height: 84px;
  margin: 0 auto 1.4rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(46, 204, 113, 0.14);
  border: 2px solid #2ecc71;
  animation: cmodal-pop 0.45s var(--ease) both;
}
.cmodal__check svg {
  width: 42px; height: 42px;
  stroke: #2ecc71;
  stroke-width: 3;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.cmodal__check svg path {
  stroke-dasharray: 36;
  stroke-dashoffset: 36;
  animation: cmodal-draw 0.5s 0.18s var(--ease) forwards;
}
.cmodal__success h3 {
  font-family: var(--font-display);
  font-size: 1.7rem;
  color: var(--text);
  margin: 0 0 0.6rem;
}
.cmodal__success p {
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.55;
  margin: 0 auto 1.6rem;
  max-width: 380px;
}

@keyframes cmodal-pop {
  0%   { transform: scale(0.4); opacity: 0; }
  60%  { transform: scale(1.08); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes cmodal-draw {
  to { stroke-dashoffset: 0; }
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  .cmodal, .cmodal__card, .cmodal__check, .cmodal__check svg path {
    transition: none !important;
    animation: none !important;
    stroke-dashoffset: 0;
  }
}

/* ============================================================
   Contact section — Google Map container (index.html)
   ============================================================ */
.contact__map {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  min-height: 420px;
  height: 100%;
  background: var(--surface-2);
}
.contact__map iframe {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 420px;
  border: 0;
}
.contact__info .contact__cta { margin-top: 1.8rem; }

@media (max-width: 720px) {
  .contact__map,
  .contact__map iframe { min-height: 300px; }
}
