/* ==========================================================================
   启信网 — Enhancement Styles
   Shared layer that complements the inline brand tokens defined per page.
   Handles: scroll-reveal animations, sticky header shadow, focus states,
   multi-device tweaks, form validation feedback, FAQ accordion, etc.
   ========================================================================== */

/* ---------- Scroll-reveal animation ---------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
  will-change: opacity, transform;
}
[data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}
[data-reveal][data-reveal-delay="1"] { transition-delay: 0.08s; }
[data-reveal][data-reveal-delay="2"] { transition-delay: 0.16s; }
[data-reveal][data-reveal-delay="3"] { transition-delay: 0.24s; }
[data-reveal][data-reveal-delay="4"] { transition-delay: 0.32s; }

@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ---------- Sticky header elevation ---------- */
.site-header.is-scrolled {
  box-shadow: 0 6px 24px rgba(15, 23, 42, 0.08);
}

/* ---------- Focus ring polish ---------- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ---------- Mobile menu animation ---------- */
#mobile-menu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, padding 0.35s ease;
}
#mobile-menu.is-open {
  max-height: 720px;
}
@media (min-width: 1024px) {
  #mobile-menu { max-height: none; overflow: visible; }
}

/* ---------- Form validation states ---------- */
.form-field { position: relative; }
.form-field .field-error {
  display: none;
  color: var(--state-error);
  font-size: 0.75rem;
  margin-top: 0.375rem;
}
.form-field.has-error input,
.form-field.has-error textarea {
  border-color: var(--state-error);
  background-color: rgba(239, 68, 68, 0.04);
}
.form-field.has-error .field-error { display: block; }
.form-field.is-valid input,
.form-field.is-valid textarea {
  border-color: var(--state-success);
}

/* ---------- Toast notification ---------- */
.qxw-toast {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--neutral-900);
  color: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-float);
  transform: translateY(120%);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
  max-width: 90vw;
}
.qxw-toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}
.qxw-toast__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 9999px;
  background: var(--brand-gold);
  color: var(--brand-950);
  flex-shrink: 0;
}
.qxw-toast--success .qxw-toast__icon { background: var(--state-success); color: #fff; }
.qxw-toast--error .qxw-toast__icon { background: var(--state-error); color: #fff; }

/* ---------- FAQ accordion ---------- */
.faq-item__panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}
.faq-item.is-open .faq-item__panel { max-height: 600px; }
.faq-item.is-open .faq-item__chevron { transform: rotate(180deg); }
.faq-item__chevron { transition: transform 0.3s ease; }

/* ---------- News category filter active state ---------- */
.news-filter.is-active {
  background-color: var(--primary);
  color: #fff;
}

/* ---------- Pagination active state ---------- */
.pagination__btn.is-active {
  background-color: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ---------- Card hover lift (utility) ---------- */
.lift-on-hover {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.lift-on-hover:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

/* ---------- Image placeholder shimmer (in case assets still loading) ---------- */
.img-placeholder {
  background: linear-gradient(110deg, var(--neutral-100) 8%, var(--neutral-50) 18%, var(--neutral-100) 33%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer {
  to { background-position-x: -200%; }
}

/* ---------- Small screen tweaks ---------- */
@media (max-width: 640px) {
  .container-qxw { padding-left: 1rem; padding-right: 1rem; }
  .qxw-toast { right: 1rem; bottom: 1rem; left: 1rem; max-width: none; }
}

/* ---------- Print-friendly ---------- */
@media print {
  .site-header, .site-footer, #cta-form, .mobile-menu-btn { display: none !important; }
  body { color: #000; background: #fff; }
  a { color: #000; text-decoration: underline; }
}

/* ---------- Whole-card clickable hot zone ---------- */
.article-card { position: relative; }
.article-card .card-link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

/* ---------- Submit button overlay ---------- */
.qxw-submit-wrap { position: relative; display: block; }
.qxw-submit-mask {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0 0.75rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.94);
  color: var(--primary);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  opacity: 1;
  transition: opacity 0.28s ease;
}
.qxw-submit-mask.is-hiding { opacity: 0; }
.qxw-submit-mask[data-state="success"] {
  background: rgba(236, 253, 245, 0.97);
  color: #047857;
}
.qxw-submit-mask[data-state="error"] {
  background: rgba(254, 242, 242, 0.97);
  color: #b91c1c;
}
.qxw-submit-mask .qxw-spinner {
  flex: 0 0 auto;
  width: 1rem;
  height: 1rem;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: qxw-spin 0.6s linear infinite;
}
@keyframes qxw-spin {
  to { transform: rotate(360deg); }
}
