/* =========================================================
   GOparts.mn — Холбоо барих (contact.html)
   Хамааралтай: style.css, pages.css
   ========================================================= */

.contact-hero { padding-bottom: clamp(24px, 3vw, 36px); }

/* ---------- Газрын зураг ---------- */
.map {
  position: relative; overflow: hidden;
  border-radius: var(--radius); background: var(--gray-100);
  border: 1px solid var(--line);
}
.map-view { position: relative; height: clamp(360px, 46vw, 540px); }
.map-frame, .map-fallback { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.map-frame { z-index: 1; background: var(--gray-100); }
.map-fallback img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(.85) contrast(1.02) brightness(1.04); }
.map-pin {
  position: absolute; left: 50%; top: 50%; z-index: 1;
  display: flex; flex-direction: column; align-items: center;
  transform: translate(-50%, -100%);
  color: var(--yellow); filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .3));
}
.map-pin svg { width: 52px; height: 52px; animation: pinDrop .7s var(--ease) .3s both; }
.map-pin-label {
  order: -1; margin-bottom: 4px; padding: 4px 10px; border-radius: 4px;
  background: var(--black); color: var(--white);
  font-family: var(--font-display); font-weight: 700; font-size: 15px; letter-spacing: .5px;
}
/* Байршлын долгио */
.map-pin::after {
  content: ""; position: absolute; left: 50%; bottom: 2px; width: 18px; height: 8px; margin-left: -9px;
  border-radius: 50%; background: rgba(23, 21, 15, .35);
}
@keyframes pinDrop { from { opacity: 0; transform: translateY(-24px); } to { opacity: 1; transform: none; } }
.map-attr {
  position: absolute; right: 0; bottom: 0; z-index: 1; padding: 2px 8px;
  background: rgba(255, 255, 255, .85); font-size: 11px; color: var(--gray-700);
}
.map-attr a { text-decoration: underline; }

/* Мэдээллийн карт газрын зураг дээр */
.map-card {
  position: absolute; left: 24px; bottom: 24px; z-index: 2;
  display: flex; flex-direction: column; gap: 10px;
  width: min(340px, calc(100% - 48px)); padding: 22px 22px 20px;
  background: var(--white); border-radius: var(--radius);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .18);
}
.map-card img { width: 120px; height: auto; }
.map-card-addr { font-size: 14px; line-height: 1.55; color: var(--gray-700); }
.map-card-status { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--gray-600); }
.map-card-status .dot { width: 8px; height: 8px; border-radius: 50%; background: #C2402B; flex: none; }
.map-card-status.is-open { color: #1E7A3D; }
.map-card-status.is-open .dot { background: #2BA155; box-shadow: 0 0 0 0 rgba(43, 161, 85, .5); animation: livePulse 2s infinite; }
@keyframes livePulse { 70% { box-shadow: 0 0 0 7px rgba(43, 161, 85, 0); } 100% { box-shadow: 0 0 0 0 rgba(43, 161, 85, 0); } }
.map-card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }

/* ---------- Мэдээллийн картууд ---------- */
.info-sec { padding-top: clamp(28px, 4vw, 40px); }
.info-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
.info-card {
  display: flex; flex-direction: column; gap: 8px;
  padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white);
  transition: border-color .3s var(--ease), box-shadow .3s var(--ease);
}
.info-card h3 { font-family: var(--font-display); font-weight: 700; font-size: 20px; text-transform: uppercase; letter-spacing: .3px; }
.info-card p { font-size: 15px; line-height: 1.55; color: var(--gray-700); }
.info-icon { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 6px; border-radius: 50%; background: var(--yellow-soft); color: var(--black); }
.info-icon svg { width: 22px; height: 22px; color: var(--yellow-dark); }
.info-big { font-family: var(--font-display); font-weight: 700; font-size: 30px; line-height: 1.1; color: var(--black); letter-spacing: .3px; transition: color .2s var(--ease); }
.info-mail { font-size: 24px; overflow-wrap: anywhere; }
.info-big:hover { color: var(--yellow-dark); }
.info-sub { font-size: 13px !important; color: var(--gray-600) !important; }
.info-link {
  align-self: flex-start; margin-top: auto; padding: 6px 0;
  font-size: 13px; font-weight: 600; color: var(--black);
  text-decoration: underline; text-decoration-color: var(--yellow); text-underline-offset: 4px; text-decoration-thickness: 2px;
}
.info-link:hover { color: var(--yellow-dark); }
@media (hover: hover) and (pointer: fine) {
  .info-card:hover { border-color: transparent; box-shadow: var(--shadow-hover); }
}
.hours { display: grid; gap: 4px; margin-top: 2px; }
.hours > div { display: flex; justify-content: space-between; gap: 8px; padding: 6px 8px; margin-inline: -8px; border-radius: 4px; font-size: 13.5px; }
.hours dt { color: var(--gray-700); white-space: nowrap; }
.hours dd { font-weight: 600; white-space: nowrap; }
.hours > div.is-today { background: var(--yellow-soft); box-shadow: inset 3px 0 0 var(--yellow); }
.hours > div.is-today dt { color: var(--black); font-weight: 600; }

/* ---------- Маягт ---------- */
.form-sec { padding-block: var(--section-y); }
.form-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: clamp(32px, 5vw, 64px); align-items: start; }
.form-col .section-note { margin-bottom: 24px; }
.cform { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field--full { grid-column: 1 / -1; }
.field label { font-size: 14px; font-weight: 600; }
.req { color: var(--yellow-dark); }
.field input, .field select, .field textarea {
  width: 100%; min-height: 48px; padding: 12px 14px;
  border: 1px solid var(--gray-200); border-radius: var(--radius); background: var(--white);
  font: inherit; font-size: 15px; color: var(--black);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.field textarea { resize: vertical; min-height: 130px; line-height: 1.55; }
.field input::placeholder, .field textarea::placeholder { color: var(--gray-400); }
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--gray-400); }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--black); box-shadow: 0 0 0 3px rgba(255, 194, 14, .45); }
.select { position: relative; }
.select select { appearance: none; padding-right: 40px; cursor: pointer; }
.select::after {
  content: ""; position: absolute; right: 16px; top: 50%; width: 8px; height: 8px; margin-top: -6px;
  border-right: 2px solid var(--gray-600); border-bottom: 2px solid var(--gray-600); transform: rotate(45deg); pointer-events: none;
}
.err { min-height: 0; font-size: 13px; color: #B3261E; }
.err:empty { display: none; }
.field.has-error input, .field.has-error textarea { border-color: #B3261E; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: 4px; }
.form-note { font-size: 13px; color: var(--gray-600); }
.form-err { flex-basis: 100%; font-size: 14px; font-weight: 600; color: #B3261E; }
.form-err:empty { display: none; }
.form-demo[hidden] { display: none; }
.btn.is-loading { pointer-events: none; opacity: .7; }
.btn.is-loading svg { animation: nudge .6s var(--ease) infinite alternate; }
@keyframes nudge { to { transform: translateX(5px); } }

.form-done {
  display: flex; flex-direction: column; align-items: flex-start; gap: 12px;
  padding: clamp(24px, 4vw, 40px); border-radius: var(--radius); background: var(--gray-100);
  outline: none; animation: newsDone .5s var(--ease) both;
}
.form-done[hidden] { display: none; }
@keyframes newsDone { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.done-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--yellow); }
.done-icon svg { width: 26px; height: 26px; }
.form-done h3 { font-family: var(--font-display); font-weight: 800; font-size: 28px; text-transform: uppercase; }
.form-done p { color: var(--gray-700); line-height: 1.6; max-width: 56ch; }
.form-done a { font-weight: 600; text-decoration: underline; text-decoration-color: var(--yellow); text-underline-offset: 3px; }
.form-demo { font-size: 13px; color: var(--gray-600) !important; padding: 8px 12px; border-left: 3px solid var(--yellow); background: var(--white); }

/* ---------- Хажуу багана ---------- */
.side-col { display: flex; flex-direction: column; gap: 28px; }
.side-title { font-family: var(--font-display); font-weight: 800; font-size: 22px; text-transform: uppercase; letter-spacing: .3px; margin-bottom: 12px; }
/* Сошиал: 4 icon ижил хэлбэртэй (брэндийн өнгөт дугуй, цагаан тэмдэг).
   Hover үед 50% томорч сайтын шар өнгөтэй болно */
.social-list { display: flex; flex-wrap: wrap; gap: 26px; }
.social-list a {
  display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%;
  background: var(--brand, var(--black)); color: var(--white);
  transition: transform .35s cubic-bezier(.34, 1.56, .64, 1), background .25s var(--ease), color .25s var(--ease), box-shadow .25s var(--ease);
}
.social-list svg { width: 28px; height: 28px; }
.social-list a:hover, .social-list a:focus-visible { background: var(--yellow); color: var(--black); transform: scale(1.5); box-shadow: 0 8px 18px rgba(255, 194, 14, .45); }
.side-cta { position: relative; display: block; overflow: hidden; border-radius: var(--radius); aspect-ratio: 1 / 1; background: var(--black); }
.side-cta img { width: 100%; height: 100%; object-fit: cover; opacity: .7; transition: transform .7s var(--ease), opacity .4s var(--ease); }
.side-cta-body { position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; gap: 2px; padding: 18px; color: var(--white); background: linear-gradient(180deg, transparent, rgba(0, 0, 0, .7)); }
.side-cta-body strong { font-family: var(--font-display); font-weight: 800; font-size: 22px; text-transform: uppercase; color: var(--yellow); }
.side-cta-body span { font-size: 14px; }
@media (hover: hover) and (pointer: fine) {
  .side-cta:hover img { transform: scale(1.05); opacity: .85; }
}


/* =========================================================
   Хөдөлгөөн (prefers-reduced-motion үед унтарна)
   ========================================================= */
@media (prefers-reduced-motion: no-preference) {
  /* Газрын зураг: аажмаар ойртоно */
  html.js .map[data-animate] .map-fallback img { transform: scale(1.12); transition: transform 2.2s cubic-bezier(.16, 1, .3, 1) .1s; }
  html.js .map[data-animate].is-visible .map-fallback img { transform: none; }
  html.js .map[data-animate] .map-pin svg { animation: none; opacity: 0; }
  html.js .map[data-animate].is-visible .map-pin svg { animation: pinDrop .8s cubic-bezier(.34, 1.56, .64, 1) .5s both; }
  html.js .map[data-animate] .map-pin-label { opacity: 0; transform: translateY(6px); transition: opacity .4s var(--ease) 1.1s, transform .4s var(--ease) 1.1s; }
  html.js .map[data-animate].is-visible .map-pin-label { opacity: 1; transform: none; }

  /* Пингийн долгио */
  .map-pin::before {
    content: ""; position: absolute; left: 50%; bottom: -4px; width: 20px; height: 20px; margin-left: -10px;
    border-radius: 50%; border: 2px solid var(--yellow); opacity: 0;
    animation: pinRing 2.4s ease-out 1.4s infinite;
  }
  @keyframes pinRing {
    0% { transform: scale(.4); opacity: .9; }
    100% { transform: scale(4.2); opacity: 0; }
  }

  /* Мэдээллийн картын icon "үсэрч" гарна, hover үед хөдөлнө */
  html.js .info-card[data-animate] .info-icon { transform: scale(.4) rotate(-20deg); opacity: 0; transition: transform .6s cubic-bezier(.34, 1.56, .64, 1) calc(var(--delay, 0ms) + 250ms), opacity .4s var(--ease) calc(var(--delay, 0ms) + 250ms); }
  html.js .info-card[data-animate].is-visible .info-icon { transform: none; opacity: 1; }
  .info-card:hover .info-icon { animation: iconWiggle .6s var(--ease); }
  .info-card:hover .info-icon svg { color: var(--black); }
  .info-icon { transition: background .3s var(--ease); }
  .info-card:hover .info-icon { background: var(--yellow); }
  @keyframes iconWiggle { 0%, 100% { rotate: 0deg; } 25% { rotate: -12deg; } 50% { rotate: 10deg; } 75% { rotate: -5deg; } }

  /* Ажлын цагийн мөрүүд ар араасаа */
  html.js .info-card[data-animate] .hours > div { opacity: 0; transform: translateX(-10px); transition: opacity .4s var(--ease), transform .4s var(--ease); }
  html.js .info-card[data-animate].is-visible .hours > div { opacity: 1; transform: none; }
  html.js .info-card.is-visible .hours > div:nth-child(1) { transition-delay: .45s; }
  html.js .info-card.is-visible .hours > div:nth-child(2) { transition-delay: .55s; }
  html.js .info-card.is-visible .hours > div:nth-child(3) { transition-delay: .65s; }
  .hours > div.is-today { background-size: 200% 100%; background-image: linear-gradient(90deg, var(--yellow-soft) 45%, #FFE79A 50%, var(--yellow-soft) 55%); animation: todayShine 3.5s ease-in-out 1.2s infinite; }
  @keyframes todayShine { 0% { background-position: 100% 0; } 60%, 100% { background-position: -100% 0; } }

  /* Маягтын талбарууд ар араасаа гарна */
  html.js .form-col[data-animate] .cform > * { opacity: 0; transform: translateY(14px); transition: opacity .5s var(--ease), transform .5s var(--ease); }
  html.js .form-col[data-animate].is-visible .cform > * { opacity: 1; transform: none; }
  html.js .form-col.is-visible .cform > :nth-child(2) { transition-delay: .10s; }
  html.js .form-col.is-visible .cform > :nth-child(3) { transition-delay: .16s; }
  html.js .form-col.is-visible .cform > :nth-child(4) { transition-delay: .22s; }
  html.js .form-col.is-visible .cform > :nth-child(5) { transition-delay: .28s; }
  html.js .form-col.is-visible .cform > :nth-child(6) { transition-delay: .34s; }
  html.js .form-col.is-visible .cform > :nth-child(7) { transition-delay: .40s; }
  html.js .form-col.is-visible .cform > :nth-child(8) { transition-delay: .46s; }
  html.js .form-col.is-visible .cform > :nth-child(9) { transition-delay: .52s; }

  /* Идэвхтэй талбарын шошго, доор нь шар зураас сунана */
  .field { position: relative; }
  .field label { transition: color .2s var(--ease), transform .2s var(--ease); transform-origin: left; }
  .field:focus-within label { color: var(--yellow-dark); transform: translateX(3px); }
  .field input, .field select, .field textarea { background-image: linear-gradient(var(--yellow), var(--yellow)); background-repeat: no-repeat; background-position: left bottom; background-size: 0 3px; transition: border-color .2s var(--ease), box-shadow .2s var(--ease), background-size .35s var(--ease); }
  .field input:focus, .field select:focus, .field textarea:focus { background-size: 100% 3px; }
  .field.has-error input, .field.has-error textarea { animation: shake .4s var(--ease); }
  @keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
  .err:not(:empty) { animation: errIn .3s var(--ease); }
  @keyframes errIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

  /* Амжилттай илгээгдсэний тэмдэг зурагдана */
  .done-icon { animation: donePop .55s cubic-bezier(.34, 1.56, .64, 1) .1s both; }
  .done-icon path { stroke-dasharray: 24; stroke-dashoffset: 24; animation: drawCheck .45s var(--ease) .5s forwards; }
  @keyframes donePop { from { transform: scale(0); } to { transform: none; } }
  @keyframes drawCheck { to { stroke-dashoffset: 0; } }

  /* Сошиал холбоос */
  html.js .social[data-animate] .social-list li { opacity: 0; transform: scale(.9); transition: opacity .4s var(--ease), transform .4s var(--ease); }
  html.js .social[data-animate].is-visible .social-list li { opacity: 1; transform: none; }
  html.js .social.is-visible .social-list li:nth-child(2) { transition-delay: .08s; }
  html.js .social.is-visible .social-list li:nth-child(3) { transition-delay: .16s; }
  html.js .social.is-visible .social-list li:nth-child(4) { transition-delay: .24s; }

  /* Утасны дугаар hover үед "дуугарна" */
  .info-card:hover .info-big[href^="tel"] { animation: ring .5s var(--ease); display: inline-block; }
  @keyframes ring { 0%, 100% { transform: none; } 20% { transform: rotate(-3deg); } 40% { transform: rotate(3deg); } 60% { transform: rotate(-2deg); } 80% { transform: rotate(1deg); } }
}

/* ---------- Responsive ---------- */
@media (max-width: 1199px) {
  .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 991px) {
  .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-layout { grid-template-columns: minmax(0, 1fr); }
  .side-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 32px; }
}
@media (max-width: 600px) {
  .map-sec .container { padding-inline: 0; }
  .map { border-radius: 0; border-inline: 0; }
  .map-view { height: 320px; }
  .map-card { position: static; width: auto; box-shadow: none; border-radius: 0; padding: 20px var(--gutter); }
  .info-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .cform { grid-template-columns: minmax(0, 1fr); }
  .side-col { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .map-pin svg, .form-done, .map-card-status.is-open .dot { animation: none; }
}

/* Газрын зургийн карт: GOparts барилгын гадна зураг логоны дээр (№56) */
.map-card .map-card-photo { display: block; align-self: stretch; width: auto; max-width: none; height: 150px; margin: -22px -22px 4px; object-fit: cover; object-position: center 35%; border-radius: inherit; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
@media (max-width: 991px) {
  .map-card .map-card-photo { margin: -20px calc(var(--gutter) * -1) 4px; height: 180px; border-radius: 0; }
}
