/* =========================================================================
 * footer.css — Shafa Shahd Footer Redesign
 * "Quiet Luxury" — Trust Trilogy Layout with Traceability Portal Signature
 * ========================================================================= */

/* =========================================================================
 * 1. FOOTER ROOT & CONTAINER
 * ========================================================================= */
.footer {
  background: var(--shafa-surface-dark);
  color: var(--shafa-on-dark-surface);
  border-top: 1px solid var(--shafa-border-dark);
  padding-block: var(--s-6) var(--s-4);
  position: relative;
  clear: both;
  isolation: isolate;
}

.footer__container {
  max-width: var(--shafa-container-max);
  margin: 0 auto;
  padding-inline: var(--s-4);
}

/* Subtle ambient glow at top edge */

.footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--shafa-gold-satin), transparent);
  opacity: 0.3;
  pointer-events: none;
}

@media (prefers-reduced-transparency: reduce) {
  .footer::before {
    display: none;
  }
}

/* =========================================================================
 * 2. TRUST TRILOGY GRID (3 PILLARS)
 * ========================================================================= */
.footer__trilogy {
  display: grid;
  gap: var(--s-4);

  /* Priority 3: wider ratio — Traceability Portal has more content */
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1.1fr);
  align-items: stretch;
  margin-bottom: var(--s-4);
}

/* Pillar Base Styles */
.footer__pillar {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  min-width: 0;
}

.footer__pillar + .footer__pillar {
  border-inline-start: 1px solid var(--shafa-border-dark);
  padding-inline-start: var(--s-4);
}

/* Remove divider when pillars stack vertically */
@media (width <= 768px) {
  .footer__pillar + .footer__pillar {
    border-inline-start: none;
    padding-inline-start: 0;
  }
}

.footer__pillar-header {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.footer__pillar-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: rgb(var(--shafa-gold-satin-rgb) / 12%);
  border: 1px solid rgb(var(--shafa-gold-satin-rgb) / 25%);
  border-radius: var(--radius);
  color: var(--shafa-gold-satin);
  transition: transform var(--t-fast) var(--shafa-ease-natural),
              background var(--t-fast) var(--shafa-ease-natural),
              border-color var(--t-fast) var(--shafa-ease-natural);
}

.footer__pillar:hover .footer__pillar-icon {
  transform: scale(1.05);
  background: rgb(var(--shafa-gold-satin-rgb) / 20%);
  border-color: var(--shafa-gold-satin);
}

@media (prefers-reduced-motion: reduce) {
  .footer__pillar-icon {
    transition: none;
  }

  .footer__pillar:hover .footer__pillar-icon {
    transform: none;
  }
}

.footer__pillar-title {
  font-size: var(--fs-h3);
  font-weight: 700;
  color: var(--shafa-on-dark-surface);
  letter-spacing: var(--shafa-tracking-tight);
  margin: 0;
}

.footer__pillar-desc {
  font-size: var(--fs-sm);
  color: var(--shafa-text-tertiary);
  margin: 0;
  line-height: var(--shafa-lh-body);
}

/* =========================================================================
 * 3. PILLAR 1 — TRACEABILITY PORTAL (SIGNATURE ELEMENT)
 * ========================================================================= */
.footer__pillar--traceability {
  padding: var(--s-5);
  background: rgb(var(--shafa-surface-dark-rgb) / 75%);
  border: 1px solid rgba(197, 160, 89, 0.35);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px) saturate(180%);
  position: relative;
  overflow: hidden;
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
}

.footer__pillar--traceability::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 25% 15%, rgb(var(--shafa-gold-satin-rgb) / 14%), transparent 65%);
  pointer-events: none;
  z-index: 1;
}

.footer__pillar--traceability::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url('../../img/honeycomb-luxury.svg');
  background-repeat: repeat;
  background-size: 72px 125px;
  opacity: 0.14;
  mask-image: radial-gradient(ellipse 85% 85% at 75% 25%, black 20%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 85% 85% at 75% 25%, black 20%, transparent 80%);
  pointer-events: none;
  z-index: 1;
}

.footer__trace-portal {
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
  position: relative;
  z-index: 2;
}

/* QR Code Frame */
.footer__trace-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-4);
}

.footer__qr-frame {
  position: relative;
  width: 104px;
  height: 104px;
  border-radius: var(--radius);
  background: var(--shafa-input-bg-strong);
  border: 1px solid rgba(197, 160, 89, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-2);
  box-shadow: var(--shafa-shadow-md), 0 0 20px rgba(197, 160, 89, 0.15);
  transition: transform var(--t-base) var(--shafa-ease-natural),
              box-shadow var(--t-base) var(--shafa-ease-natural),
              border-color var(--t-base) var(--shafa-ease-natural);
}

.footer__qr-frame:hover {
  transform: scale(1.02);
  box-shadow: var(--shafa-shadow-lg), 0 0 32px rgb(var(--shafa-gold-satin-rgb) / 15%);
  border-color: rgb(var(--shafa-gold-satin-rgb) / 40%);
}

.footer__qr-code {
  width: 100%;
  height: 100%;
}

.footer__qr-caption {
  font-size: var(--fs-caption);
  color: var(--shafa-text-tertiary);
  text-align: center;
}

/* Trace Form */
.footer__trace-form {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.footer__trace-input-group {
  display: flex;
  gap: var(--s-2);
}

.footer__trace-input {
  flex: 1;
  min-width: 0;
  background: var(--shafa-surface-card);
  border: 1px solid var(--shafa-border-subtle);
  border-radius: var(--radius-sm);
  color: var(--shafa-text-primary);
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  padding: var(--s-2) var(--s-3);
  transition: border-color var(--t-fast) var(--shafa-ease-natural),
              box-shadow var(--t-fast) var(--shafa-ease-natural);
}

.footer__trace-input::placeholder {
  color: var(--shafa-text-tertiary);
}

.footer__trace-input:focus {
  outline: none;
  border-color: var(--shafa-gold-satin);
   box-shadow: 0 0 0 3px rgb(var(--shafa-gold-satin-rgb) / 20%);
}

.footer__trace-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  background: var(--shafa-gold-satin);
  color: var(--shafa-surface-dark);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: 500;
  padding: var(--s-2) var(--s-4);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--t-fast) var(--shafa-ease-natural),
              transform var(--t-fast) var(--shafa-ease-natural),
              box-shadow var(--t-fast) var(--shafa-ease-natural);
  min-height: 44px;
  touch-action: manipulation;
}

.footer__trace-submit:hover {
  background: var(--shafa-gold-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgb(var(--shafa-gold-satin-rgb) / 30%);
}

.footer__trace-submit:active {
  transform: translateY(0) scale(0.98);
}

.footer__trace-submit:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--shafa-gold-satin), 0 0 0 6px var(--shafa-surface-dark);
}

.footer__trace-submit-icon {
  flex-shrink: 0;
  transition: transform var(--t-fast) var(--shafa-ease-natural);
}

.footer__trace-submit:hover .footer__trace-submit-icon {
  transform: translateX(2px);
}

.footer__trace-hint {
  font-size: var(--fs-caption);
  color: var(--shafa-text-tertiary);
  margin: 0;
  text-align: center;
}

/* Sample Batch Codes */
.footer__trace-samples {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  padding-top: var(--s-3);
  border-top: 1px solid var(--shafa-border-dark);
}

.footer__trace-samples-label {
  font-size: var(--fs-caption);
  color: var(--shafa-text-tertiary);
  text-transform: none;
  letter-spacing: 0;
}

.footer__trace-sample-list {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--s-2);
}

.footer__trace-sample {
  background: rgb(var(--shafa-gold-satin-rgb) / 10%);
  border: 1px solid rgb(var(--shafa-gold-satin-rgb) / 20%);
  color: var(--shafa-gold-satin);
  font-family: Inter, var(--font-body);
  font-size: var(--fs-caption);
  font-weight: 500;
  font-feature-settings: "tnum";
  padding: var(--s-1) var(--s-3);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background var(--t-fast) var(--shafa-ease-natural),
    border-color var(--t-fast) var(--shafa-ease-natural),
    color var(--t-fast) var(--shafa-ease-natural),
    transform var(--t-fast) var(--shafa-ease-natural);
  min-height: 36px;
  touch-action: manipulation;
}

.footer__trace-sample:hover {
  background: var(--shafa-gold-satin);
  color: var(--shafa-surface-dark);
  border-color: var(--shafa-gold-satin);
  transform: translateY(-1px);
}

.footer__trace-sample:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgb(var(--shafa-gold-satin-rgb) / 40%);
}

@media (prefers-reduced-motion: reduce) {
  .footer__qr-frame,
  .footer__trace-input,
  .footer__trace-submit,
  .footer__trace-sample {
    transition: none;
  }

  .footer__qr-frame:hover,
  .footer__trace-submit:hover,
  .footer__trace-sample:hover {
    transform: none;
  }
}

/* =========================================================================
 * 4. PILLAR 1 — SITE NAVIGATION
 * ========================================================================= */
.footer__pillar--nav {
  /* inherits base .footer__pillar flex column */
}

.footer__nav-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-5);
}

.footer__nav-group-title {
  font-size: var(--fs-caption);
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  color: var(--shafa-gold-satin);
  margin: 0 0 var(--s-3);
  padding-bottom: var(--s-2);
  border-bottom: 1px solid var(--shafa-border-dark);
}

.footer__nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.footer__nav-link {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--fs-sm);
  color: var(--shafa-text-secondary);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
  line-height: var(--shafa-lh-body);
  transition: color var(--t-fast) var(--shafa-ease-natural),
              text-decoration-color var(--t-fast) var(--shafa-ease-natural),
              transform var(--t-fast) var(--shafa-ease-natural);
}

.footer__nav-link:hover {
  color: var(--shafa-gold-satin);
  text-decoration-color: rgb(var(--shafa-gold-satin-rgb) / 50%);
  transform: translateX(-3px); /* RTL: نزدیک‌تر به راست */
}

.footer__nav-link:focus-visible {
  outline: none;
  box-shadow: var(--shafa-focus-ring-inset);
  border-radius: var(--radius-sm);
}

/* Arrow indicator on hover */
.footer__nav-link::before {
  content: "←";
  font-size: 0.7em;
  opacity: 0;
  transform: translateX(4px);
  transition: opacity var(--t-fast) var(--shafa-ease-natural),
              transform var(--t-fast) var(--shafa-ease-natural);
  color: var(--shafa-gold-satin);
  flex-shrink: 0;
}

.footer__nav-link:hover::before {
  opacity: 1;
  transform: translateX(0);
}

@media (prefers-reduced-motion: reduce) {
  .footer__nav-link,
  .footer__nav-link::before {
    transition: none;
  }

  .footer__nav-link:hover {
    transform: none;
  }
}

@media (width <= 768px) {
  .footer__nav-grid {
    grid-template-columns: 1fr;
    gap: var(--s-4);
  }
}


/* =========================================================================
 * 5. PILLAR 2 — BRAND ESSENCE
 * ========================================================================= */
.footer__pillar--brand {
  /* Priority 1: RTL-aware alignment — start = راست in dir=rtl */
  text-align: start;
  padding: var(--s-4);
}

.footer__brand-link {
  display: inline-flex;
  align-items: center;
  gap: var(--s-4);
  text-decoration: none;
  color: inherit;
  transition: opacity var(--t-fast) var(--shafa-ease-natural);
}

.footer__brand-link:hover {
  opacity: 0.8;
}

.footer__brand-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.footer__brand-name {
  font-size: var(--fs-h2);
  font-weight: 700;
  color: var(--shafa-gold-satin);
  letter-spacing: var(--shafa-tracking-tight);
  line-height: 1;
}

.footer__brand-tagline {
  font-size: var(--fs-sm);
  color: var(--shafa-text-tertiary);
  margin: var(--s-1) 0 0;
  max-width: 40ch;

  /* Priority 1: remove centering margins — RTL start-aligned */
  line-height: var(--shafa-lh-body);
}

.footer__brand-desc {
  font-size: var(--fs-sm);
  color: var(--shafa-text-secondary);
  line-height: var(--shafa-lh-body);
  margin: var(--s-2) 0 0;
  max-width: 60ch;
}

/* Trust Badges */

/* Priority 5 (Layout): a 2×2 grid instead of a single nowrap row.
   The brand pillar is ~347px wide (~298px of content) inside the 3-column
   footer grid, so four nowrap pills (~657px) can never fit on one line.
   Fixed 2-column tracks also keep the pills the same width, which reads as
   an intentional block instead of a ragged wrapped row. */
.footer__badges {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: var(--s-2);
  margin-top: var(--s-2);
}

.footer__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-width: 0;

  /* Priority 2 (Touch): 44px min target even though the pill is decorative */
  min-height: 44px;
  padding: var(--s-2) var(--s-3);
  text-align: center;

  /* Kills the inline-SVG baseline gap that misaligns icon vs. label */
  line-height: 0;
  background: rgb(255 255 255 / 4%);
  border: 1px solid var(--shafa-border-dark);
  border-radius: var(--radius-pill);
  transition: border-color var(--t-fast) var(--shafa-ease-natural),
              background var(--t-fast) var(--shafa-ease-natural);
}

.footer__badge:hover {
  border-color: rgb(var(--shafa-gold-satin-rgb) / 40%);
  background: rgb(var(--shafa-gold-satin-rgb) / 10%);
}

.footer__badge-icon {
  flex-shrink: 0;
  display: block;
  color: var(--shafa-gold-satin);
}

.footer__badge-text {
  min-width: 0;
  font-size: var(--fs-caption);
  line-height: var(--shafa-lh-body);
  font-weight: 500;
  color: var(--shafa-text-secondary);

  /* Wrap instead of nowrap: a long label wraps to a second line inside its
     own cell and can never widen the track or push the row out of the
     column. grid-auto-rows keeps the two rows the same height. */
  white-space: normal;
  overflow-wrap: break-word;
  hyphens: auto;
}

.footer__badge:hover .footer__badge-text {
  color: var(--shafa-gold-satin);
}

/* Priority 5 (Responsive): at 320px the two tracks leave ~56px of text
   space per pill, which is tighter than the 12px label wants. Stack to a
   single column so each badge gets the full width. */
@media (width <= 380px) {
  .footer__badges {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .footer__badge {
    transition: none;
  }
}

/* Trust Marks Row — نمادهای اعتماد (اینماد + زیبال) در یک ردیف */
.footer__trust-marks {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3);
  margin-top: var(--s-3);
}

/* داخل ردیف flex، فاصلهٔ بالای تک‌تک نمادها باید صفر شود تا
   فقط فاصلهٔ grid والد اعمال گردد. */
.footer__trust-marks > .footer__enamad,
.footer__trust-marks > .footer__zibal {
  margin-top: 0;
}

/* Enamad */
.footer__enamad {
  margin-top: var(--s-3);
  display: flex;
  justify-content: flex-start;
}

.footer__enamad img {
  max-width: 120px;
  height: auto;
  opacity: 0.8;
  transition: opacity var(--t-fast) var(--shafa-ease-natural);
}

.footer__enamad img:hover {
  opacity: 1;
}

/* Zibal Trust Badge (روش HTML خالص — بدون اسکریپت) */
.footer__zibal {
  display: flex;
  justify-content: flex-start;
  align-items: center;

  /* line-height: 0 فاصلهٔ baseline تصویر inline را حذف می‌کند */
  line-height: 0;
}

.footer__zibal img {
  /* ابعاد طبیعی 2.png از زیبال ۱۰۹×۱۵۲ است؛ ارتفاع به ۱۱۰px محدود می‌شود
     تا هم‌اندازهٔ نماد اینماد دیده شود و عرض آن ~۷۹px می‌ماند. */
  height: 110px;
  width: auto;
  max-width: 100%;
  display: block;
  opacity: 0.85;
  transition: opacity var(--t-fast) var(--shafa-ease-natural);
}

.footer__zibal a:hover img,
.footer__zibal a:focus-visible img {
  opacity: 1;
}

.footer__zibal a:focus-visible {
  outline: none;
  border-radius: var(--radius-sm);
  box-shadow: var(--shafa-focus-ring-inset);
}

@media (prefers-reduced-motion: reduce) {
  .footer__zibal img {
    transition: none;
  }
}

/* =========================================================================
 * 5. PILLAR 3 — DIRECT ACCESS
 * ========================================================================= */
.footer__pillar--access {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

.footer__contact-trio {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-2);
}

.footer__contact-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  text-align: right;
  gap: var(--s-4);
  padding: var(--s-3);
  background: rgb(255 255 255 / 3%);
  border: 1px solid var(--shafa-border-dark);

  /* Priority 8: align border-radius with icon's --radius-sm (8px) for visual harmony */
  border-radius: var(--radius-sm);
  transition: transform var(--t-base) var(--shafa-ease-natural),
              border-color var(--t-base) var(--shafa-ease-natural),
              background var(--t-base) var(--shafa-ease-natural);
}

.footer__contact-item:hover {
  transform: translateY(-3px);
  border-color: rgb(var(--shafa-gold-satin-rgb) / 30%);
  background: rgb(var(--shafa-gold-satin-rgb) / 8%);
}

.footer__contact-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: rgb(var(--shafa-gold-satin-rgb) / 12%);
  border: 1px solid rgb(var(--shafa-gold-satin-rgb) / 25%);
  border-radius: var(--radius);
  color: var(--shafa-gold-satin);
  transition: transform var(--t-fast) var(--shafa-ease-natural),
              background var(--t-fast) var(--shafa-ease-natural);
}

.footer__contact-item:hover .footer__contact-icon {
  transform: scale(1.08);
  background: rgb(var(--shafa-gold-satin-rgb) / 20%);
}

.footer__contact-label {
  font-size: var(--fs-caption);
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--shafa-text-tertiary);
}

.footer__contact-value {
  font-size: var(--fs-sm);
  color: var(--shafa-on-dark-surface);
  text-decoration: none;
  line-height: 1.5;
  transition: color var(--t-fast) var(--shafa-ease-natural);
}

.footer__contact-value:hover {
  color: var(--shafa-gold-satin);
}

.footer__contact-value[dir="ltr"] {
  font-family: Inter, var(--font-body);
  font-feature-settings: "tnum";
}

/* Newsletter */
.footer__newsletter {
  padding: var(--s-4);
  background: rgb(255 255 255 / 3%);
  border: 1px solid var(--shafa-border-dark);
  border-radius: var(--radius);
}

.footer__newsletter-title {
  font-size: var(--fs-sm);
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  color: var(--shafa-gold-satin);
  margin: 0 0 var(--s-1);
}

.footer__newsletter-desc {
  font-size: var(--fs-caption);
  color: var(--shafa-text-tertiary);
  margin: 0 0 var(--s-3);
  line-height: var(--shafa-lh-body);
}

/* Social Links */
.footer__social {
  display: flex;
  justify-content: center;
  gap: var(--s-4);
  flex-wrap: nowrap;
  padding-top: var(--s-3);
  border-top: 1px solid var(--shafa-border-dark);
}

.footer__social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: rgb(255 255 255 / 5%);
  border: 1px solid var(--shafa-border-dark);
  border-radius: var(--radius-pill);
  color: var(--shafa-gold-satin);
  text-decoration: none;
  transition: transform var(--t-fast) var(--shafa-ease-natural),
              border-color var(--t-fast) var(--shafa-ease-natural),
              color var(--t-fast) var(--shafa-ease-natural),
              background var(--t-fast) var(--shafa-ease-natural);
  touch-action: manipulation;
}

.footer__social-link:hover {
  transform: scale(1.1);
  border-color: var(--shafa-gold-satin);
  color: #fff;
  background: var(--shafa-gold-satin);
}

.footer__social-link:active {
  transform: scale(0.95);
}

.footer__social-link:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgb(var(--shafa-gold-satin-rgb) / 40%);
}

@media (prefers-reduced-motion: reduce) {
  .footer__contact-item,
  .footer__contact-icon,
  .footer__social-link {
    transition: none;
  }

  .footer__contact-item:hover,
  .footer__social-link:hover {
    transform: none;
  }
}

/* =========================================================================
 * 6. FOOTER BOTTOM
 * ========================================================================= */
.footer__bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: nowrap;
  gap: var(--s-2);
  padding-top: var(--s-3);
  border-top: 1px solid var(--shafa-border-dark);
  margin-top: 0;
}

.footer__copyright {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
  align-items: flex-start;
}

/* Priority 7: visual hierarchy — copyright is primary, tagline is secondary */
.footer__copyright-text {
  font-size: var(--fs-sm);
  color: var(--shafa-on-dark-surface); /* brighter — primary info */
  font-weight: 500;
}

.footer__tagline {
  font-size: var(--fs-caption);
  color: var(--shafa-text-tertiary); /* dimmer — supporting slogan */
  font-style: normal;
  opacity: 0.85;
}

/* کریدیت توسعه‌دهنده — پایین‌تر از کپی‌رایت و تگ‌لاین در سلسله‌مراتب بصری */
.footer__credit {
  font-size: var(--fs-caption);
  color: var(--shafa-text-tertiary);
  margin-top: var(--s-1);
}

.footer__credit-link {
  color: var(--shafa-gold-satin);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 2px;
  transition: color var(--t-fast) var(--shafa-ease-natural),
              text-decoration-color var(--t-fast) var(--shafa-ease-natural);
}

.footer__credit-link:hover {
  color: var(--shafa-gold-hover);
  text-decoration-color: var(--shafa-gold-satin);
}

.footer__credit-link:focus-visible {
  color: var(--shafa-gold-hover);
  text-decoration-color: var(--shafa-gold-satin);
  outline: none;
  box-shadow: var(--shafa-focus-ring-inset);
  border-radius: var(--radius-sm);
}

.footer__legal {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--s-4);
  justify-content: flex-end;
}

/* Priority 9: smooth underline transition on legal links */
.footer__legal a {
  font-size: var(--fs-sm);
  color: var(--shafa-text-tertiary);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
  transition: color var(--t-fast) var(--shafa-ease-natural),
              text-decoration-color var(--t-fast) var(--shafa-ease-natural);
}

.footer__legal a:hover {
  color: var(--shafa-gold-satin);
  text-decoration-color: var(--shafa-gold-satin);
}

.footer__legal a:focus-visible {
  outline: none;
  box-shadow: var(--shafa-focus-ring-inset);
  border-radius: var(--radius-sm);
}

/* =========================================================================
 * 7. BACK TO TOP BUTTON
 * ========================================================================= */
.back-to-top {
  position: fixed;
  bottom: calc(var(--s-5) + env(safe-area-inset-bottom, 0px));

  /* Priority 2: logical property — correct RTL placement without hacking */
  inset-inline-start: var(--s-5);
  width: 48px;
  height: 48px;
  background: var(--shafa-gold-satin);
  color: var(--shafa-surface-dark);
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shafa-shadow-lg), 0 0 24px rgb(var(--shafa-gold-satin-rgb) / 30%);
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.9);
  transition: opacity var(--t-base) var(--shafa-ease-natural),
               visibility var(--t-base) var(--shafa-ease-natural),
               transform var(--t-base) var(--shafa-ease-natural);
  z-index: var(--shafa-z-nav);
  cursor: pointer;
  touch-action: manipulation;
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.back-to-top:hover {
  transform: translateY(0) scale(1.05);
  background: var(--shafa-gold-hover);
  box-shadow: var(--shafa-shadow-hover), 0 0 32px rgb(var(--shafa-gold-satin-rgb) / 40%);
}

.back-to-top:active {
  transform: translateY(0) scale(0.95);
}

.back-to-top:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--shafa-gold-satin), 0 0 0 6px var(--shafa-surface-dark);
}

@media (prefers-reduced-motion: reduce) {
  .back-to-top {
    transition: none;
  }

  .back-to-top:hover {
    transform: none;
  }
}

/* =========================================================================
 * 8. RESPONSIVE BREAKPOINTS
 * ========================================================================= */
@media (width <= 1024px) {
  .footer__trilogy {
    grid-template-columns: 1fr 1fr;
    gap: var(--s-5);
  }

  .footer__pillar--traceability {
    grid-column: 1 / -1;
    order: -1;
  }

  .footer__pillar--access {
    grid-column: 1 / -1;
  }

  .footer__contact-trio {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (width <= 768px) {
  .footer {
    padding-block: var(--s-6) var(--s-4);
  }

  .footer__trilogy {
    grid-template-columns: 1fr;
    gap: var(--s-5);
  }

  .footer__pillar--traceability {
    order: 0;
  }

  .footer__pillar {
    gap: var(--s-4);
  }

  .footer__pillar-header {
    align-items: center;
    text-align: center;
  }

  /* Brand pillar has no centering contract for its body (tagline, description,
     badge grid), so keep its header start-aligned with them instead of
     centering the logo and leaving everything else ragged to the right. */
  .footer__pillar--brand .footer__pillar-header {
    align-items: flex-start;
    text-align: start;
  }

  .footer__trace-input-group {
    flex-direction: column;
  }

  .footer__trace-submit {
    width: 100%;
  }

  .footer__contact-trio {
    grid-template-columns: 1fr;
    gap: var(--s-4);
  }

  .footer__contact-item {
    flex-direction: row;
    justify-content: flex-start;
    text-align: right;
    gap: var(--s-4);
  }

  .footer__bottom {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .footer__copyright {
    align-items: center;
  }

  .footer__legal {
    justify-content: center;
  }

  /* این قاعده برندهٔ نهایی است (بعد از style.css بارگذاری می‌شود).
     safe-area اضافه شد تا دکمه زیر home indicator آیفون نرود؛
     قبلاً bottom 16px ثابت بود و دکمه عملاً نیمه‌پنهان می‌شد. */
  .back-to-top {
    bottom: calc(var(--s-3) + env(safe-area-inset-bottom, 0px));
    inset-inline-start: var(--s-3);
    width: 44px;
    height: 44px;
  }
}

@media (width <= 480px) {
  .footer__container {
    padding-inline: var(--s-3);
  }

  .footer__pillar {
    padding: var(--s-4);
  }

  .footer__trace-sample-list {
    justify-content: center;
  }
}

/* =========================================================================
 * 9. SCROLL REVEAL ANIMATIONS (GSAP-compatible, follows style.css pattern)
 * ========================================================================= */

/* Default: visible. Only hide when JS motion system initializes (html.js-motion) */

/* Fallback: if GSAP initializes via data-gsap-init, disable CSS transitions */
[data-gsap-init] [data-reveal="footer-trilogy"] .footer__pillar,
[data-gsap-init] [data-reveal="footer-bottom"] {
  transition: none !important;
}

html.js-motion [data-reveal="footer-trilogy"] .footer__pillar {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--t-slow) var(--shafa-ease-natural),
    transform var(--t-slow) var(--shafa-ease-natural);
}

html.js-motion [data-reveal="footer-trilogy"].is-revealed .footer__pillar {
  opacity: 1;
  transform: translateY(0);
}

html.js-motion [data-reveal="footer-trilogy"].is-revealed .footer__pillar:nth-child(1) {
  transition-delay: 0.05s;
}

html.js-motion [data-reveal="footer-trilogy"].is-revealed .footer__pillar:nth-child(2) {
  transition-delay: 0.15s;
}

html.js-motion [data-reveal="footer-trilogy"].is-revealed .footer__pillar:nth-child(3) {
  transition-delay: 0.25s;
}

html.js-motion [data-reveal="footer-bottom"] {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity var(--t-slow) var(--shafa-ease-natural),
    transform var(--t-slow) var(--shafa-ease-natural);
  transition-delay: 0.35s;
}

html.js-motion [data-reveal="footer-bottom"].is-revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Reduced motion: always visible, no transitions */

@media (prefers-reduced-motion: reduce) {
  html.js-motion [data-reveal="footer-trilogy"] .footer__pillar,
  html.js-motion [data-reveal="footer-bottom"] {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

/* =========================================================================
 * 10. PRINT STYLES
 * ========================================================================= */
@media print {
  .footer {
    background: var(--shafa-surface-dark) !important;
    border-top: 1px solid var(--shafa-border-dark) !important;
    padding-block: var(--s-4) var(--s-3);
  }

  .footer::before {
    display: none;
  }

  .footer__trace-portal,
  .footer__social,
  .back-to-top {
    display: none !important;
  }

  .footer__pillar--traceability {
    background: none !important;
    border: none !important;
    padding: 0 !important;
  }

  .footer__trilogy {
    display: block !important;
  }

  .footer__pillar {
    page-break-inside: avoid;
    margin-bottom: var(--s-4);
  }

  .footer__bottom {
    border-top: 1px solid var(--shafa-border-dark) !important;
  }
}

/* =========================================================================
 * 11. HIGH CONTRAST MODE
 * ========================================================================= */
@media (prefers-contrast: high) {
  .footer {
    border-top-width: 2px;
  }

  .footer__trace-input,
  .footer__trace-submit,
  .footer__trace-sample,
  .footer__contact-item,
  .footer__social-link,
  .footer__badge {
    border-width: 2px;
  }

  .footer__trace-input:focus {
    box-shadow: 0 0 0 3px var(--shafa-gold-satin);
  }
}