/* Sepanta corrective layer — loaded last so it always wins.
   Covers: the native sort <select>, accordion visibility safety, and
   cross-resolution image / overflow behaviour on mobile, tablet and desktop. */

/* ---------- 1. Native sort select (skips the nice-select wrapper) ---------- */
.at-sort-select {
  appearance: none;
  -webkit-appearance: none;
  min-width: 160px;
  padding: 10px 38px 10px 16px;
  border: 1px solid rgba(128, 128, 128, 0.35);
  border-radius: 999px;
  background-color: transparent;
  color: inherit;
  font: inherit;
  font-size: 14px;
  line-height: 1.2;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.at-sort-select:focus-visible {
  outline: 2px solid var(--bs-primary, #ff481f);
  outline-offset: 2px;
}

.at-sort-select option {
  color: #111;
  background: #fff;
}

[dir="rtl"] .at-sort-select {
  padding: 10px 16px 10px 38px;
  background-position: 20px 50%, 15px 50%;
}

/* ---------- 2. Accordions / collapses must never stay invisible ---------- */
.accordion-collapse.show,
.accordion-collapse.show *,
.accordion-body,
.accordion-body * {
  opacity: 1 !important;
  visibility: visible !important;
  filter: none !important;
}

.accordion-collapse.show,
.accordion-body {
  transform: none !important;
  clip-path: none !important;
}

/* ---------- 3. Search overlay: lock the page behind it ---------- */
body.at-search-open {
  overflow: hidden;
}

/* ---------- 4. Cross-resolution safety ---------- */
html,
body {
  overflow-x: hidden;
  max-width: 100%;
}

img,
video,
svg,
canvas,
iframe {
  max-width: 100%;
}

img,
video {
  height: auto;
}

/* keep art-directed fills behaving like fills */
.alt-portfolio-thumb img,
.card-award-image img,
.w-100.h-100 {
  height: 100%;
  object-fit: cover;
}

/* Long words / URLs must not push a card wider than the viewport */
h1,
h2,
h3,
h4,
h5,
h6,
p,
a,
li,
span {
  overflow-wrap: break-word;
}

/* Tablet: the two-column work grid gets cramped between 768 and 991px */
@media (min-width: 768px) and (max-width: 991.98px) {
  .alt-portfolio-item .des.pr-250 {
    padding-right: 0 !important;
  }
  .card-award .card-award-title,
  .alt-portfolio-title {
    font-size: 1.05rem;
  }
}

/* Phones */
@media (max-width: 575.98px) {
  .fz-ds-1 {
    font-size: clamp(2rem, 11vw, 3rem) !important;
    line-height: 1.08 !important;
  }
  .pr-250,
  .pr-200,
  .pr-150 {
    padding-right: 0 !important;
  }
  .at-sort-select {
    width: 100%;
  }
  .filter-portfolio {
    row-gap: 8px;
  }
  .at-footer-copyright,
  .footer-2-connect-title {
    word-break: break-word;
  }
}

/* Very wide screens: stop hero type from becoming absurd */
@media (min-width: 1800px) {
  .fz-ds-1 {
    font-size: clamp(4rem, 5.2vw, 7rem) !important;
  }
}

/* ---------- 5. Reduced motion: never trap content at opacity 0 ---------- */
@media (prefers-reduced-motion: reduce) {
  .at_fade_anim,
  .scroll-move-up,
  .at-blur-in,
  .at-title-text {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }
}

/* ---------- 6. Header tool icons: keep a consistent, readable size ---------- */
.at-header-right .at-header-search-btn svg,
.at-header-right .at-menu-bar svg,
.hamburger-sticky-menu .icon svg {
  width: 24px !important;
  height: 24px !important;
  flex: 0 0 auto;
}

.at-header-right .dark-light-mode .toggle {
  width: 24px;
  height: 24px;
}

.at-header-right .dark-light-mode .icon svg {
  width: 22px !important;
  height: 22px !important;
}

.at-header-right .at-header-search-btn,
.at-header-right .at-menu-bar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  flex: 0 0 auto;
  min-width: 40px;
  min-height: 40px;
}

/* The header tools column is narrow; nothing in it may be squeezed away. */
.at-header-right {
  flex-wrap: nowrap;
}

.at-header-right > * {
  flex: 0 0 auto;
}

/* ---------- 7. Reserve image space so lazy loads never shift the page ------- */
.alt-portfolio-thumb {
  display: block;
  overflow: hidden;
}

.alt-portfolio-thumb > img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
}

/* Images that already declare intrinsic dimensions keep their own ratio */
.alt-portfolio-thumb > img[width][height] {
  aspect-ratio: auto;
}

/* ---------- 8. Selected Work rows: one stable grid, no wrapping mess ------- */
@media (min-width: 992px) {
  .card-award.style-1 .card-award-link {
    display: grid;
    grid-template-columns: 90px minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 0.9fr) 16px;
    align-items: center;
    column-gap: 28px;
    row-gap: 0;
    flex-wrap: nowrap;
  }
  .card-award.style-1 .card-award-link > * {
    flex: 0 1 auto !important;
    min-width: 0;
  }
  .card-award.style-1 .card-award-date,
  .card-award.style-1 .card-award-web-excellence,
  .card-award.style-1 .card-award-meta {
    margin-bottom: 0;
  }
  .card-award.style-1 .card-award-title {
    margin-bottom: 0;
  }
}

@media (min-width: 768px) and (max-width: 991.98px) {
  .card-award.style-1 .card-award-link {
    display: grid;
    grid-template-columns: 80px minmax(0, 1fr) 16px;
    align-items: center;
    column-gap: 20px;
    row-gap: 6px;
  }
  .card-award.style-1 .card-award-content {
    grid-column: 2;
  }
  .card-award.style-1 .card-award-web-excellence,
  .card-award.style-1 .card-award-meta {
    grid-column: 2;
  }
  .card-award.style-1 .card-award-icon {
    grid-column: 3;
    grid-row: 1;
  }
}

@media (max-width: 767.98px) {
  .card-award.style-1 {
    padding: 18px 20px;
  }
  .card-award.style-1 .card-award-link {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 16px;
    row-gap: 6px;
    column-gap: 12px;
    align-items: center;
  }
  .card-award.style-1 .card-award-date {
    grid-column: 1;
  }
  .card-award.style-1 .card-award-icon {
    grid-column: 2;
    grid-row: 1;
  }
  .card-award.style-1 .card-award-content,
  .card-award.style-1 .card-award-web-excellence,
  .card-award.style-1 .card-award-meta {
    grid-column: 1 / -1;
  }
}

.card-award.style-1 .card-award-image {
  flex: 0 0 auto;
}

/* ---------- 9. FAQ answers must stay readable once opened ----------------- */
.at-faq-collapse.show,
.at-faq-collapse.show *,
.at-faq-body,
.at-faq-body * {
  opacity: 1 !important;
  visibility: visible !important;
  filter: none !important;
}

.at-faq-collapse.show,
.at-faq-body,
.at-faq-body * {
  transform: none !important;
  clip-path: none !important;
}

/* ---------- 10. Offcanvas "Get in touch": breathing room per entry -------- */
.at-offcanvas-contact ul {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 0;
}

.at-offcanvas-contact ul > li {
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(128, 128, 128, 0.22);
  line-height: 1.6;
}

.at-offcanvas-contact ul > li:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.at-offcanvas-contact ul > li a {
  display: inline-block;
}

.at-offcanvas-contact__icon-link {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(128, 128, 128, 0.08);
  transition: transform 0.2s ease, background 0.2s ease;
}

.at-offcanvas-contact__icon-link:hover,
.at-offcanvas-contact__icon-link:focus-visible {
  transform: translateY(-2px);
  background: rgba(128, 128, 128, 0.16);
}

.at-offcanvas-contact__icon-link svg {
  display: block;
  width: 26px;
  height: 26px;
}

html[dir="rtl"] .at-offcanvas-contact__icon-link svg {
  transform: none;
}

/* ---------- 9. Footer bottom band: fluid type, safe motion, RTL-aware ---------- */
.footer-2-bottom-inner {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
}
.footer-2-bottom-main {
  flex: 1 1 min(100%, 620px);
  min-width: 0;
}
/* keep the hover text-shadow duplicate clipped (template behaviour) while
   leaving headroom above for the GSAP letter lift */
.footer-2-connect-wrap {
  overflow: hidden;
  padding-top: 0.28em;
  margin-top: -0.28em;
}
.footer-2-connect-title {
  font-size: clamp(2.6rem, 9vw, 10rem) !important;
  letter-spacing: -0.045em !important;
  line-height: 1.02 !important;
  max-width: 100%;
  overflow-wrap: break-word;
}
@media (min-width: 1400px) {
  .footer-2-connect-title {
    font-size: clamp(4rem, 8.4vw, 11rem) !important;
  }
}
.footer-2-hours {
  flex: 0 0 auto;
  text-align: end;
  white-space: nowrap;
  padding-bottom: 0.35em;
}
@media (min-width: 992px) {
  .footer-2-hours {
    margin-inline-end: 64px;
  }
}
.footer-2-hours .fz-font-md {
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Persian: no negative tracking (breaks joined glyphs), keep one clean line */
html[dir="rtl"] .footer-2-connect-title,
.at-fa-rtl.footer-2-connect-title {
  letter-spacing: 0 !important;
  font-size: clamp(2rem, 5.6vw, 6rem) !important;
  line-height: 1.35 !important;
  text-align: right;
}
html[dir="rtl"] .footer-2-bottom-inner {
  text-align: right;
}
html[dir="rtl"] .footer-2-hours {
  text-align: left;
}
html[dir="rtl"] .footer-2-hours h3,
html[dir="rtl"] .footer-2-hours span {
  white-space: nowrap;
}

@media (max-width: 767.98px) {
  .footer-2-bottom-inner {
    align-items: flex-start;
    gap: 24px;
  }
  .footer-2-hours {
    text-align: start;
  }
}

/* GSAP letter hover must never reflow the line box */
.footer-2-connect-title .at-letter-span,
.footer-2-connect-title .at-word-span {
  will-change: transform;
  transform-origin: center bottom;
}

/* Latin postal addresses inside the Persian footer keep Latin order */
html[dir="rtl"] .footer-ltr-block {
  direction: ltr !important;
  unicode-bidi: isolate !important;
  text-align: right;
}

/* Footer social + contact icons */
.at-footer-widget .at-hero-social a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.at-footer-widget .at-hero-social a svg {
  flex-shrink: 0;
}

/* Selected Work: hide project website URLs */
.card-award .card-award-url,
.card-award .card-award-meta {
   display: none !important;
}

/* Headings: never break words mid-character (split-text animations wrap chars
   in inline-block spans, which lets browsers break inside a word) */
h1, h2, h3, .fz-ds-1, .fz-ds-2, .h1, .h2 {
   overflow-wrap: normal !important;
   word-break: keep-all !important;
   hyphens: none !important;
}
h1 .word, h2 .word, h3 .word,
.fz-ds-1 .word, .fz-ds-2 .word,
.split-text .word, .text-anime-style-2 .word, .text-anime-style-3 .word {
   white-space: nowrap;
   display: inline-block;
}

/* Selected Work heading: single elegant line, smaller fluid size */
.at-section-title h2.fz-ds-1,
h2.fz-ds-1,
h1.fz-ds-1 {
   font-size: clamp(2rem, 4.2vw, 3.6rem) !important;
   line-height: 1.06 !important;
   white-space: nowrap !important;
   max-width: 100% !important;
}
@media (max-width: 575px) {
   h2.fz-ds-1,
   h1.fz-ds-1 {
      font-size: clamp(1.5rem, 8vw, 2.2rem) !important;
   }
}

/* ---------------------------------------------------------------
   Address blocks: the template hides every <br> below 991px, which
   collapsed the footer / drawer addresses into one unreadable line.
   --------------------------------------------------------------- */
.footer-ltr-block br,
.at-contact-address br,
.offcanvas-contact-address br,
footer address br {
  display: inline !important;
}

/* ---------------------------------------------------------------
   Language switch: the swap needs a full reload (GSAP split-text
   cannot be un-split in place), so give instant visual feedback
   instead of a dead-looking delay.
   --------------------------------------------------------------- */
.at-lang-switching {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 8, 8, 0.92);
  backdrop-filter: blur(6px);
  opacity: 0;
  animation: atLangFade 0.18s ease forwards;
  pointer-events: all;
}
.at-lang-switching span {
  display: block;
  width: 34px;
  height: 34px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: atLangSpin 0.7s linear infinite;
}
@keyframes atLangFade { to { opacity: 1; } }
@keyframes atLangSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .at-lang-switching span { animation-duration: 1.6s; }
}
.at-lang-toggle button { transition: opacity 0.15s ease; }
.at-lang-toggle button[aria-busy="true"] { opacity: 0.55; }
