/* =========================================
   NAVIGATION
   ========================================= */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: var(--space-4) 0;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.nav--solid {
  background-color: var(--color-teal);
  box-shadow: var(--shadow-md);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav__logo-svg {
  height: 36px;
  width: 112.5px;
  display: block;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.nav--solid .nav__logo-svg {
  opacity: 1;
  transform: translateY(0);
}

.nav__links {
  display: none;
  gap: var(--space-6);
}

.nav__link {
  color: var(--color-white);
  font-size: var(--text-sm);
  font-weight: 500;
  padding: var(--space-2) var(--space-1);
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  border-bottom: 2px solid transparent;
  transition: border-color 0.3s ease;
}

.nav__link:hover,
.nav__link.active {
  border-bottom-color: var(--color-orange);
}

.nav__lang {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.lang-btn {
  color: rgba(255,255,255,0.6);
  font-family: var(--font-heading-en);
  font-size: var(--text-sm);
  font-weight: 600;
  min-width: 48px;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.3s ease;
}

.lang-btn.active {
  color: var(--color-white);
}

.lang-btn:hover {
  color: var(--color-orange);
}

.nav__lang-sep {
  color: rgba(255,255,255,0.3);
}

/* Hamburger */
.nav__hamburger {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: var(--space-2);
}

.nav__hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background-color: var(--color-white);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.nav__hamburger.open span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.nav__hamburger.open span:nth-child(2) {
  opacity: 0;
}

.nav__hamburger.open span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile overlay nav */
.nav__links.open {
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--color-teal-dark);
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
  z-index: 99;
}

.nav__links.open .nav__link {
  font-size: var(--text-2xl);
}

@media (min-width: 1024px) {
  .nav__links {
    display: flex;
  }

  .nav__hamburger {
    display: none;
  }
}

/* =========================================
   HERO
   ========================================= */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: var(--color-teal);
  position: relative;
  overflow: hidden;
  padding: var(--space-16) var(--space-4);
  padding-bottom: 120px;
}

/* Hero Background Paths */
.hero__paths {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.hero__paths--left {
  transform: scaleX(1);
}

.hero__paths--right {
  transform: scaleX(-1);
}

.hero__paths-svg {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 140%;
  height: 140%;
  min-width: 1400px;
  color: white;
}

@media (min-width: 768px) {
  .hero__paths-svg {
    width: 160%;
    height: 160%;
    min-width: 1800px;
  }
}

/* Continuous flowing path animation (replicating framer-motion pathOffset: [0, 1, 0]) */
@keyframes pathFlow {
  0% {
    stroke-dashoffset: 0;
  }
  50% {
    stroke-dashoffset: var(--path-length, 2000);
  }
  100% {
    stroke-dashoffset: 0;
  }
}

/* Opacity loop matching framer-motion opacity: [0.3, 0.6, 0.3] */
@keyframes pathOpacity {
  0%, 100% {
    opacity: 0.3;
  }
  50% {
    opacity: 0.6;
  }
}

.hero__content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 900px;
  overflow: visible;
  width: 100%;
}

.hero__logo-wrap {
  margin-bottom: var(--space-8);
}

/* AREC text logo */
.hero__logo-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.04em;
  background-color: var(--color-navy);
  padding: 0.3em 0.55em;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  border: 2px solid rgba(255, 255, 255, 0.15);
  direction: ltr; /* Prevent RTL reversal of letters */
}

.hero__logo-letter {
  font-family: 'Outfit', 'Arial Black', sans-serif;
  font-size: 3.5rem;
  font-weight: 800;
  color: white;
  letter-spacing: 0.1em;
  line-height: 1;
  text-transform: uppercase;
}

@media (min-width: 768px) {
  .hero__logo-letter {
    font-size: 5rem;
  }
  
  .hero__logo-text {
    border-radius: 16px;
  }
}

@media (min-width: 1024px) {
  .hero__logo-letter {
    font-size: 6rem;
  }
}

/* Word grouping for title animation */
.hero__word {
  display: inline-block;
  margin-inline-end: 0.25em;
}

.hero__word:last-child {
  margin-inline-end: 0;
}

/* Letter-by-letter spring animation */
.hero__letter {
  display: inline-block;
  opacity: 0;
  transform: translateY(40px);
  animation: letterReveal 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes letterReveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero__title {
  color: var(--color-white);
  font-size: var(--text-4xl);
  margin-bottom: var(--space-4);
  overflow: visible;
}

@media (min-width: 768px) {
  .hero__title {
    font-size: var(--text-5xl);
  }
}

@media (min-width: 1024px) {
  .hero__title {
    font-size: var(--text-6xl);
  }
}

.hero__subtitle {
  color: rgba(255,255,255,0.85);
  font-size: var(--text-xl);
  margin-bottom: var(--space-10);
  line-height: var(--leading-relaxed);
}

.hero__pillars {
  display: flex;
  justify-content: center;
  gap: var(--space-10);
  margin-bottom: var(--space-10);
  flex-wrap: wrap;
}

.hero__pillar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  color: var(--color-white);
  font-size: var(--text-sm);
  font-weight: 500;
}

.hero__pillar-icon {
  color: rgba(255,255,255,0.9);
}

/* Frosted-glass CTA (Amendment 2) */
.hero__cta-wrap {
  display: inline-block;
  background: linear-gradient(135deg, rgba(232,151,44,0.6), rgba(43,122,132,0.4));
  border-radius: var(--border-radius-md);
  padding: 1px;
}

.hero__cta {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--color-white);
  padding: var(--space-3) var(--space-8);
  border-radius: var(--border-radius-md);
  font-weight: 600;
  font-size: var(--text-lg);
  transition: background-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
  min-height: 48px;
}

.hero__cta:hover {
  background: rgba(255,255,255,0.18);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.hero__cta-arrow {
  display: inline-block;
  transition: transform 0.3s ease;
}

.hero__cta:hover .hero__cta-arrow {
  transform: translateX(-4px);
}

[dir="ltr"] .hero__cta:hover .hero__cta-arrow {
  transform: translateX(4px);
}

.hero__scroll-indicator {
  position: absolute;
  bottom: var(--space-8);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  color: rgba(255,255,255,0.6);
  font-size: var(--text-sm);
  animation: bounceDown 2s ease-in-out infinite;
}

@keyframes bounceDown {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(8px); }
}

/* Hero entrance animations */
.hero-anim {
  opacity: 0;
  transform: translateY(20px);
  animation: heroFadeIn 0.8s ease forwards;
}

.hero-anim--logo  { animation-delay: 0s; }
.hero-anim--title { animation-delay: 0.15s; }
.hero-anim--subtitle { animation-delay: 0.3s; }
.hero-anim--pillars { animation-delay: 0.5s; }
.hero-anim--cta   { animation-delay: 0.7s; }

@keyframes heroFadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =========================================
   ABOUT
   ========================================= */
.about {
  background-color: var(--color-white);
}

.about__layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--grid-gap);
  align-items: center;
}

.about__body {
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
  color: var(--color-gray-700);
  margin-bottom: var(--space-6);
}

.about__deco {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 250px;
}

.about__year {
  font-family: var(--font-mono);
  font-size: 8rem;
  font-weight: 700;
  color: var(--color-teal);
  opacity: 0.08;
  position: absolute;
}

.about__geometric {
  position: relative;
  width: 150px;
  height: 150px;
}

.about__geo-square {
  position: absolute;
  border: 2px solid var(--color-teal);
  opacity: 0.2;
}

.about__geo-square--1 {
  width: 100px;
  height: 100px;
  top: 20%;
  left: 20%;
  transform: rotate(15deg);
}

.about__geo-square--2 {
  width: 80px;
  height: 80px;
  top: 35%;
  left: 35%;
  transform: rotate(30deg);
  border-color: var(--color-orange);
  opacity: 0.15;
}

.about__geo-square--3 {
  width: 60px;
  height: 60px;
  top: 45%;
  left: 45%;
  transform: rotate(45deg);
}

@media (min-width: 1024px) {
  .about__layout {
    grid-template-columns: 60% 40%;
  }
}

/* =========================================
   VISION & MISSION
   ========================================= */
.vision {
  background-color: var(--color-gray-100);
}

.vision__cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--grid-gap);
}

.vision__card {
  background-color: var(--color-white);
  padding: var(--space-8);
  box-shadow: var(--shadow-sm);
  border-radius: var(--border-radius-md);
  text-align: center;
}

.vision__icon {
  margin-bottom: var(--space-4);
  margin-inline: auto;
}

.vision__card h3 {
  font-size: var(--text-2xl);
  color: var(--color-teal);
  margin-bottom: var(--space-4);
}

.vision__card p {
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
  color: var(--color-gray-700);
}

@media (min-width: 768px) {
  .vision__cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* =========================================
   SERVICES
   ========================================= */
.services {
  background-color: var(--color-white);
}

.services__grid {
  margin-top: var(--space-8);
}

.service-card {
  background-color: var(--color-white);
  padding: var(--space-6);
  position: relative;
  border-inline-start: 3px solid var(--color-teal);
  transition: box-shadow 0.3s ease;
}

.service-card:hover {
  box-shadow: var(--shadow-sm);
}

.service-card__num {
  font-family: var(--font-mono);
  font-size: var(--text-5xl);
  font-weight: 700;
  color: var(--color-teal);
  opacity: 0.12;
  position: absolute;
  top: var(--space-2);
  inset-inline-end: var(--space-4);
  line-height: 1;
}

.service-card__icon {
  margin-bottom: var(--space-4);
}

.service-card h3 {
  font-size: var(--text-xl);
  margin-bottom: var(--space-3);
  color: var(--color-navy);
}

.service-card p {
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--color-gray-700);
}

/* =========================================
   PORTFOLIO
   ========================================= */
.portfolio {
  background-color: var(--color-gray-100);
}

.portfolio__tabs {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-8);
  flex-wrap: wrap;
}

.portfolio__tab {
  padding: var(--space-3) var(--space-6);
  border-radius: var(--border-radius-sm);
  font-weight: 500;
  font-size: var(--text-sm);
  color: var(--color-teal);
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.portfolio__tab.active {
  background-color: var(--color-teal);
  color: var(--color-white);
}

.portfolio__tab:hover:not(.active) {
  background-color: rgba(43, 122, 132, 0.1);
}

/* Mobile: horizontal scroll-snap (Amendment 1) */
.portfolio__grid {
  display: flex;
  gap: var(--space-4);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: var(--space-4);
}

.portfolio__grid::-webkit-scrollbar {
  height: 4px;
}

.portfolio__grid::-webkit-scrollbar-thumb {
  background: var(--color-teal-light);
  border-radius: 2px;
}

.portfolio__item {
  flex: 0 0 85%;
  scroll-snap-align: start;
  overflow: hidden;
  border-radius: var(--border-radius-md);
}

@media (min-width: 768px) {
  .portfolio__grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    overflow-x: visible;
    scroll-snap-type: none;
  }

  .portfolio__item {
    flex: none;
  }
}

@media (min-width: 1024px) {
  .portfolio__grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.portfolio__img-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.portfolio__img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.portfolio__overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(26, 58, 74, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.portfolio__overlay span {
  color: var(--color-white);
  font-size: var(--text-base);
  text-align: center;
  font-weight: 500;
}

.portfolio__img-wrap:hover .portfolio__overlay {
  opacity: 1;
}

/* =========================================
   FEATURED PROJECT
   ========================================= */
.featured {
  background-color: var(--color-navy);
  color: var(--color-white);
}

.section-title--light {
  color: var(--color-white);
}

.section-title--light::before {
  background-color: var(--color-orange);
}

.featured__desc {
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
  opacity: 0.85;
  max-width: 700px;
  margin-bottom: var(--space-12);
}

.featured__counters {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-8);
  text-align: center;
}

.featured__counter-num {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-5xl);
  font-weight: 700;
  color: var(--color-orange);
  margin-bottom: var(--space-2);
}

.featured__counter-label {
  font-size: var(--text-sm);
  opacity: 0.8;
}

@media (min-width: 768px) {
  .featured__counters {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* =========================================
   CLIENTS — Marquee
   ========================================= */
.clients {
  background-color: var(--color-white);
  overflow: hidden;
}

.clients__strip {
  margin-bottom: var(--space-8);
}

.clients__category {
  font-size: var(--text-lg);
  color: var(--color-teal);
  text-align: center;
  margin-bottom: var(--space-4);
  padding-inline: var(--space-4);
}

/* Marquee container */
.clients__marquee {
  overflow: hidden;
  position: relative;
  width: 100%;
  mask-image: linear-gradient(to right, transparent 0%, black 8%, black 92%, transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 8%, black 92%, transparent 100%);
}

/* Track — flex row, duplicated by JS */
.clients__track {
  display: flex;
  align-items: center;
  width: max-content;
  will-change: transform;
}

/* Default animation: left */
.clients__marquee[data-direction="left"] .clients__track {
  animation: marqueeLeft var(--marquee-duration, 30s) linear infinite;
}

.clients__marquee[data-direction="right"] .clients__track {
  animation: marqueeRight var(--marquee-duration, 25s) linear infinite;
}

/* Pause animation on hover instead of reversing, so user can actually see the logo clearly */
.clients__marquee:hover .clients__track {
  animation-play-state: paused;
}

@keyframes marqueeLeft {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

@keyframes marqueeRight {
  0% { transform: translateX(-50%); }
  100% { transform: translateX(0); }
}

/* Individual logo */
.client-logo {
  flex-shrink: 0;
  width: 120px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-white);
  border: 1px solid var(--color-gray-200);
  border-radius: var(--border-radius-sm);
  padding: var(--space-3);
  margin-inline-end: var(--space-8);
  transition: transform 0.3s ease;
}

.client-logo:hover {
  transform: scale(1.05);
}

.client-logo img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
}

.client-logo:hover {
  filter: grayscale(0);
  opacity: 1;
  transform: scale(1.15);
  box-shadow: var(--shadow-md);
  z-index: 2;
  position: relative;
}

/* ---- Mobile: wrap into grid ---- */
@media (max-width: 767px) {
  .clients__marquee {
    mask-image: none;
    -webkit-mask-image: none;
    overflow: visible;
  }

  .clients__track {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-3);
    width: 100%;
    padding-inline: var(--space-4);
    animation: none !important;
  }

  .client-logo {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    opacity: 0.8;
    filter: grayscale(0);
  }
}

/* =========================================
   SAFETY
   ========================================= */
.safety {
  background-color: var(--color-gray-100);
  text-align: center;
}

.safety__header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.safety__header .section-title::before {
  inset-inline-start: 50%;
  transform: translateX(-50%);
}

.safety__text {
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
  color: var(--color-gray-700);
  margin-bottom: var(--space-8);
}

.safety__icons {
  display: flex;
  justify-content: center;
  gap: var(--space-8);
}

/* =========================================
   CONTACT
   ========================================= */
.contact {
  background-color: var(--color-white);
}

.contact__intro {
  font-size: var(--text-lg);
  color: var(--color-gray-700);
  margin-bottom: var(--space-8);
  line-height: var(--leading-relaxed);
}

.contact__layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--grid-gap);
}

.contact__info-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  color: var(--color-gray-700);
}

.contact__info-item svg {
  flex-shrink: 0;
  color: var(--color-teal);
}

.contact__info-item a {
  color: var(--color-teal);
}

.contact__map-placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  background-color: var(--color-gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius-md);
  color: var(--color-gray-400);
  margin-top: var(--space-4);
}

.contact__field {
  margin-bottom: var(--space-4);
}

.contact__field label {
  display: block;
  margin-bottom: var(--space-2);
  font-weight: 500;
  font-size: var(--text-sm);
  color: var(--color-navy);
}

.contact__field input,
.contact__field textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-gray-200);
  border-radius: var(--border-radius-sm);
  background-color: var(--color-white);
  font-size: var(--text-base);
  transition: border-color 0.3s ease;
}

.contact__field input:focus,
.contact__field textarea:focus {
  outline: none;
  border-color: var(--color-teal);
  box-shadow: 0 0 0 3px rgba(43, 122, 132, 0.15);
}

.contact__submit {
  width: 100%;
  padding: var(--space-3) var(--space-8);
  background-color: var(--color-orange);
  color: var(--color-white);
  border-radius: var(--border-radius-sm);
  font-weight: 600;
  font-size: var(--text-lg);
  transition: background-color 0.3s ease;
  cursor: pointer;
  border: none;
}

.contact__submit:hover {
  background-color: var(--color-orange-dark);
}

@media (min-width: 1024px) {
  .contact__layout {
    grid-template-columns: 40% 60%;
  }
}

/* =========================================
   FOOTER
   ========================================= */
.footer {
  background-color: var(--color-dark);
  color: var(--color-white);
  padding-block: var(--space-12);
}

.footer__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--grid-gap);
  margin-bottom: var(--space-8);
}

.footer__logo {
  margin-bottom: var(--space-3);
}

.footer__logo-svg {
  height: 60px;
  width: 187.5px;
  display: block;
}

.footer__tagline {
  color: var(--color-gray-400);
  font-size: var(--text-sm);
}

.footer__links h4,
.footer__contact h4 {
  font-size: var(--text-lg);
  margin-bottom: var(--space-4);
  color: var(--color-white);
}

.footer__links ul {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.footer__links a {
  color: var(--color-gray-400);
  font-size: var(--text-sm);
  transition: color 0.3s ease;
}

.footer__links a:hover {
  color: var(--color-orange);
}

.footer__contact p {
  color: var(--color-gray-400);
  font-size: var(--text-sm);
  margin-bottom: var(--space-2);
}

.footer__contact a {
  color: var(--color-gray-400);
  transition: color 0.3s ease;
}

.footer__contact a:hover {
  color: var(--color-orange);
}

.footer__bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: var(--space-6);
  text-align: center;
}

.footer__bottom p {
  font-size: var(--text-sm);
  color: var(--color-gray-400);
}

@media (min-width: 768px) {
  .footer__grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* =========================================
   BACK TO TOP
   ========================================= */
.back-to-top {
  position: fixed;
  bottom: var(--space-6);
  z-index: 90;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: var(--color-orange);
  color: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  transition: background-color 0.3s ease, transform 0.3s ease;
  cursor: pointer;
  border: none;
}

.back-to-top:hover {
  background-color: var(--color-orange-dark);
  transform: translateY(-2px);
}

.back-to-top:focus-visible {
  outline: 2px solid var(--color-white);
  outline-offset: 2px;
}
